22 template <
class TMEM,
class TFather = TPZMaterial>
43 virtual std::string
Name()
override {
44 return "TPZMatWithMem< >";
48 virtual void PrintMem(std::ostream &out = std::cout,
const int memory = 0);
51 virtual void Print(std::ostream &out)
override;
53 virtual TMEM &
MemItem(
const int i)
const;
64 std::shared_ptr<TPZAdmChunkVector<TMEM>> &
GetMemory();
73 virtual int PushMemItem(
int sourceIndex = -1)
override;
85 int nmem =
fMemory->NElements();
86 for (
unsigned int im = 0; im < nmem; im++) {
109 std::shared_ptr<TPZAdmChunkVector<TMEM>>
fMemory;
118 template <
class TMEM,
class TFather>
125 template <
class TMEM,
class TFather>
132 template <
class TMEM,
class TFather>
140 template <
class TMEM,
class TFather>
144 template <
class TMEM,
class TFather>
146 out << __PRETTY_FUNCTION__ << std::endl;
151 int size =
fMemory->NElements();
152 out <<
"\nfMemory with " << size <<
" elements";
153 for (
int i = 0; i < size; i++) {
154 out <<
"\nfMemory element : " << i << std::endl;
160 template <
class TMEM,
class TFather>
162 int size =
fMemory->NElements();
163 if (memory >= 0 && memory < size) {
164 out <<
"fMemory element : " << memory << std::endl;
165 this->
MemItem(memory).Print(out);
167 out <<
"Memory index out of range : memory " << memory <<
" no elements " << size << std::endl;
171 template <
class TMEM,
class TFather>
173 return fMemory.get()->operator [](i);
176 template <
class TMEM,
class TFather>
178 return Hash(
"TPZMatWithMem") ^ TFather::ClassId() << 1 ^ TMEM().ClassId() << 2;
181 template <
class TMEM,
class TFather>
183 TFather::Write(buf, withclassid);
185 buf.
Write(&updatemem);
190 template <
class TMEM,
class TFather>
192 TFather::Read(buf, context);
194 buf.
Read(&updatemem);
205 template <
class TMEM,
class TFather>
210 template <
class TMEM,
class TFather>
215 template <
class TMEM,
class TFather>
217 int index =
fMemory->AllocateNewElement();
218 if (sourceIndex < 0) {
226 template <
class TMEM,
class TFather>
231 template <
class TMEM,
class TFather>
236 template <
class TMEM,
class TFather>
241 template <
class TMEM,
class TFather>
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
virtual TMEM & GetDefaultMemory()
Access the default memory settings for initislization.
void SetMemory(std::shared_ptr< TPZAdmChunkVector< TMEM >> &memory)
virtual std::string Name() override
Returns the name of the material.
Declarates the TPZBlock<REAL>class which implements block matrices.
void ResetMemItem(int index)
int ClassId() const override
Unique identifier for serialization purposes.
void Write(TPZStream &buf, int withclassid) const override
virtual void SetDefaultMem(TMEM &defaultMem)
Sets the default memory settings for initialization.
Implements a chunk vector with free store administration. Utility.
Implements an abstract class implementing the memory features.
virtual void FreeMemItem(int index) override
Frees an entry in the material with memory internal history storage.
std::shared_ptr< TPZAdmChunkVector< TMEM > > & GetMemory()
bool fUpdateMem
Flag to indicate whether the memory data are to be updated in an assemble loop.
void ResetMemory()
Reset all memory items.
virtual void Write(const bool val)
virtual void SetUpdateMem(bool update=1)
Sets/Unsets the internal memory data to be updated in the next assemble/contribute call...
virtual int PushMemItem(int sourceIndex=-1) override
Pushes a new entry in the context of materials with memory.
TPZMatWithMem()
Default constructor.
void Read(TPZStream &buf, void *context) override
static std::shared_ptr< TPZSavable > GetSharedPointer(const int64_t &objId)
int32_t Hash(std::string str)
TMEM fDefaultMem
Default memory settings.
Defines the interface for saving and reading data. Persistency.
virtual void PrintMem(std::ostream &out=std::cout, const int memory=0)
Prints out the data associated with the material.
virtual TMEM & MemItem(const int i) const
virtual bool GetUpdateMem()
Gets the internal memory data to be updated in the next assemble/contribute call. ...
static void WritePointer(const TPZSavable *obj, TPZStream *stream)
std::shared_ptr< TPZAdmChunkVector< TMEM > > fMemory
Shared pointer to material memory.
virtual void Read(bool &val)