From 806ba8b3310a60fd6cde0bb9e3fe7bf25bf4e397 Mon Sep 17 00:00:00 2001 From: hartmann Date: Tue, 19 Mar 2002 14:11:07 +0000 Subject: [PATCH] To make it compile revert changes due to Sun Forte compiler. git-svn-id: https://svn.dealii.org/trunk@5589 0785d39b-7218-0410-832d-ea1e28bc413d --- .../base/include/base/memory_consumption.h | 217 ++++++++++++++++++ deal.II/base/source/memory_consumption.cc | 185 --------------- 2 files changed, 217 insertions(+), 185 deletions(-) diff --git a/deal.II/base/include/base/memory_consumption.h b/deal.II/base/include/base/memory_consumption.h index 5b7d646814..40b2e9c949 100644 --- a/deal.II/base/include/base/memory_consumption.h +++ b/deal.II/base/include/base/memory_consumption.h @@ -362,4 +362,221 @@ namespace MemoryConsumption +// now comes the implementation of these functions + +namespace MemoryConsumption +{ + inline + unsigned int memory_consumption (const bool) + { + return sizeof(bool); + }; + + + + inline + unsigned int memory_consumption (const char) + { + return sizeof(char); + }; + + + + inline + unsigned int memory_consumption (const short int) + { + return sizeof(short int); + }; + + + + inline + unsigned int memory_consumption (const short unsigned int) + { + return sizeof(short unsigned int); + }; + + + + inline + unsigned int memory_consumption (const int) + { + return sizeof(int); + }; + + + + inline + unsigned int memory_consumption (const unsigned int) + { + return sizeof(unsigned int); + }; + + + + inline + unsigned int memory_consumption (const float) + { + return sizeof(float); + }; + + + + inline + unsigned int memory_consumption (const double) + { + return sizeof(double); + }; + + + + inline + unsigned int memory_consumption (const std::string &s) + { + return sizeof(s) + s.length(); + }; + + +// if necessary try to work around a bug in the IBM xlC compiler +#ifdef XLC_WORK_AROUND_STD_BUG + using namespace std; +#endif + + template + unsigned int memory_consumption (const typename std::vector &v) + { + unsigned int mem = sizeof(std::vector); + const unsigned int n = v.size(); + for (unsigned int i=0; i + unsigned int memory_consumption (const T (&v)[N]) + { + unsigned int mem = 0; + for (unsigned int i=0; i &v) + { + return v.capacity() / 8 + sizeof(v); + }; + + + + inline + unsigned int memory_consumption (const std::vector &v) + { + return (v.capacity() * sizeof(int) + + sizeof(v)); + }; + + + + inline + unsigned int memory_consumption (const std::vector &v) + { + return (v.capacity() * sizeof(double) + + sizeof(v)); + }; + + + + inline + unsigned int memory_consumption (const std::vector &v) + { + return (v.capacity() * sizeof(float) + + sizeof(v)); + }; + + + + inline + unsigned int memory_consumption (const std::vector &v) + { + return (v.capacity() * sizeof(char) + + sizeof(v)); + }; + + + + inline + unsigned int memory_consumption (const std::vector &v) + { + return (v.capacity() * sizeof(unsigned char) + + sizeof(v)); + }; + + + + template + inline + unsigned int memory_consumption (const typename std::vector &v) + { + return (v.capacity() * sizeof(T *) + + sizeof(v)); + }; + + + + template + inline + unsigned int memory_consumption (const typename std::pair &p) + { + return (memory_consumption(p.first) + + memory_consumption(p.second)); + }; + + + + template + inline + unsigned int + memory_consumption (const T * const) + { + return sizeof(T*); + }; + + + + template + inline + unsigned int + memory_consumption (T * const) + { + return sizeof(T*); + }; + + + + inline + unsigned int + memory_consumption (void * const) + { + return sizeof(void*); + }; + + + + template + inline + unsigned int + memory_consumption (const T &t) + { + return t.memory_consumption(); + }; +} + + + #endif diff --git a/deal.II/base/source/memory_consumption.cc b/deal.II/base/source/memory_consumption.cc index 421198f784..33e5bbbb3b 100644 --- a/deal.II/base/source/memory_consumption.cc +++ b/deal.II/base/source/memory_consumption.cc @@ -26,189 +26,4 @@ namespace MemoryConsumption }; - - unsigned int memory_consumption (const bool) - { - return sizeof(bool); - }; - - - - unsigned int memory_consumption (const char) - { - return sizeof(char); - }; - - - - unsigned int memory_consumption (const short int) - { - return sizeof(short int); - }; - - - - unsigned int memory_consumption (const short unsigned int) - { - return sizeof(short unsigned int); - }; - - - - unsigned int memory_consumption (const int) - { - return sizeof(int); - }; - - - - unsigned int memory_consumption (const unsigned int) - { - return sizeof(unsigned int); - }; - - - - unsigned int memory_consumption (const float) - { - return sizeof(float); - }; - - - - unsigned int memory_consumption (const double) - { - return sizeof(double); - }; - - - - unsigned int memory_consumption (const std::string &s) - { - return sizeof(s) + s.length(); - }; - - - - template - unsigned int memory_consumption (const typename std::vector &v) - { - unsigned int mem = sizeof(std::vector); - const unsigned int n = v.size(); - for (unsigned int i=0; i - unsigned int memory_consumption (const T (&v)[N]) - { - unsigned int mem = 0; - for (unsigned int i=0; i &v) - { - return v.capacity() / 8 + sizeof(v); - }; - - - - unsigned int memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(int) + - sizeof(v)); - }; - - - - unsigned int memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(double) + - sizeof(v)); - }; - - - - unsigned int memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(float) + - sizeof(v)); - }; - - - - unsigned int memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(char) + - sizeof(v)); - }; - - - - unsigned int memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(unsigned char) + - sizeof(v)); - }; - - - - template - unsigned int memory_consumption (const typename std::vector &v) - { - return (v.capacity() * sizeof(T *) + - sizeof(v)); - }; - - - - template - unsigned int memory_consumption (const typename std::pair &p) - { - return (memory_consumption(p.first) + - memory_consumption(p.second)); - }; - - - - template - unsigned int - memory_consumption (const T * const) - { - return sizeof(T*); - }; - - - - template - unsigned int - memory_consumption (T * const) - { - return sizeof(T*); - }; - - - - unsigned int - memory_consumption (void * const) - { - return sizeof(void*); - }; - - - - template - unsigned int - memory_consumption (const T &t) - { - return t.memory_consumption(); - }; }; -- 2.39.5