1 #ifndef DUNE_FEM_DOFMANAGER_HH 2 #define DUNE_FEM_DOFMANAGER_HH 8 #include <dune/common/exceptions.hh> 9 #include <dune/common/stdstreams.hh> 10 #include <dune/common/version.hh> 12 #include <dune/grid/alugrid/common/interfaces.hh> 29 #include <dune/grid/common/datahandleif.hh> 31 #include <dune/alugrid/common/ldbhandleif.hh> 46 template <
class Gr
idType>
class DofManager;
53 template<
class ArrayType>
60 static size_t used(
const ArrayType & array)
73 const int oldStartIdx,
const int newStartIdx)
76 int newIdx = newStartIdx + length - 1;
78 for(
int oldIdx = oldStartIdx+length-1; oldIdx >= oldStartIdx; --oldIdx, --newIdx )
81 array[newIdx] = array[oldIdx];
88 const int oldStartIdx,
const int newStartIdx)
90 const int upperBound = oldStartIdx + length;
92 int newIdx = newStartIdx;
93 for(
int oldIdx = oldStartIdx; oldIdx<upperBound; ++oldIdx, ++newIdx )
96 array[newIdx] = array[oldIdx];
102 void assign( ArrayType& array,
const int newIndex,
const int oldIndex )
104 array[ newIndex ] = array[ oldIndex ];
129 template<
class IndexSet >
131 : setPtr_( getIdentifier( iset ) ),
132 referenceCounter_( 1 )
140 virtual void resize () = 0;
142 virtual bool compress () = 0;
145 virtual void backup()
const = 0;
147 virtual void restore() = 0;
163 return (--referenceCounter_ == 0);
166 template<
class IndexSet >
169 return (getIdentifier( iset ) == setPtr_);
173 template<
class IndexSet >
174 IdentifierType getIdentifier (
const IndexSet &iset )
const 176 return static_cast< IdentifierType
>( &iset );
183 template <
class IndexSetType,
class EntityType>
186 public LocalInlinePlus < ManagedIndexSet<IndexSetType,EntityType> , EntityType >
207 LocalIndexSetObjectsType & indexSetList,
208 LocalIndexSetObjectsType & insertList,
209 LocalIndexSetObjectsType & removeList )
211 , indexSet_ (const_cast<IndexSetType &> (iset))
212 , insertIdxObj_(indexSet_), removeIdxObj_(indexSet_)
213 , indexSetList_(indexSetList)
214 , insertList_(insertList)
215 , removeList_(removeList)
217 this->setPtr_ = (
void *) &indexSet_;
219 indexSetList_ += *
this;
220 if( indexSet_.consecutive() )
222 insertList_ += insertIdxObj_;
223 removeList_ += removeIdxObj_;
230 indexSetList_.
remove( *
this );
231 if( indexSet_.consecutive() )
233 insertList_.
remove( insertIdxObj_ );
234 removeList_.
remove( removeIdxObj_ );
247 return indexSet_.compress();
296 virtual const std::string& name ()
const = 0;
299 virtual int size ()
const = 0;
317 virtual void resize () = 0;
319 virtual void reserve (
int newSize) = 0;
321 virtual void dofCompress () = 0;
323 virtual size_t usedMemorySize()
const = 0;
341 template <
class Gr
idImp,
class MapperType ,
class DofArrayType>
377 const MapperType& mapper,
378 const std::string& name,
379 DofArrayType& array )
380 : dm_( DofManagerType :: instance( grid ) ),
381 mapper_ ( const_cast<MapperType& >(mapper)),
384 resizeMemObj_(*this),
385 reserveMemObj_(*this),
386 dataCompressionEnabled_(false)
410 const std::string&
name ()
const {
return name_; }
413 int size ()
const {
return array_.size(); }
419 const int oldSize = array_.size();
422 const int nSize = mapper().size();
425 if( nSize == oldSize ) return ;
428 array_.resize( nSize );
431 if( ! dataCompressionEnabled_ ) return ;
434 const int numBlocks = mapper().numBlocks();
437 int upperBound = oldSize ;
440 assert( mapper().offSet( 0 ) == 0 );
441 assert( mapper().oldOffSet( 0 ) == 0 );
444 for(
int block = numBlocks-1; block >= 1; --block )
447 const int newOffSet = mapper().offSet( block );
448 const int oldOffSet = mapper().oldOffSet( block );
451 assert( newOffSet >= oldOffSet );
454 if( newOffSet > oldOffSet )
457 const int blockSize = upperBound - oldOffSet;
463 upperBound = oldOffSet;
472 if( mapper().consecutive() )
474 const int nSize = size() + (needed * mapper().maxNumDofs());
475 array_.reserve( nSize );
481 assert( ! mapper().consecutive() );
491 const int nSize = mapper().size();
494 if( dataCompressionEnabled_ )
497 const int oldSize = array_.size();
505 const int numBlocks = mapper().numBlocks();
506 for(
int block = 0; block < numBlocks; ++block )
509 moveToFront( oldSize, block );
512 if( mapper().consecutive () )
515 const int holes = mapper().numberOfHoles( block );
516 for(
int i = 0; i < holes; ++i )
518 const int oldIndex = mapper().oldIndex( i, block );
519 const int newIndex = mapper().newIndex( i, block );
521 assert( newIndex < nSize );
530 array_.resize( nSize );
542 dataCompressionEnabled_ =
true;
563 const int oldOffSet = mapper().oldOffSet( block );
566 const int newOffSet = mapper().offSet( block );
569 assert( newOffSet <= oldOffSet );
572 if( newOffSet < oldOffSet )
575 const int numBlocks = mapper().numBlocks();
579 = (block == numBlocks - 1) ? oldSize : mapper().oldOffSet( block + 1 );
580 const int blockSize = upperBound - oldOffSet;
590 template <
class Gr
idImp,
class MapperType ,
class DofArrayType>
599 const MapperType& mapper,
600 const std::string& name )
601 : BaseType( grid, mapper, name, myArray_ ),
602 myArray_( mapper.size() )
608 template<
class DofStorageType,
class Gr
idType,
class MapperType >
609 static inline std::pair< DofStorageInterface* , DofStorageType* >
611 const MapperType& mapper,
612 const std::string& name,
613 const DofStorageType * = 0 )
617 DofStorageType > ManagedDofStorageType;
619 ManagedDofStorageType* mds =
620 new ManagedDofStorageType( grid, mapper, name );
624 return std::pair< DofStorageInterface* , DofStorageType* >
625 ( mds , & mds->getArray () );
636 template <
class IndexSetType,
class EntityType>
638 :
public LocalInlinePlus < RemoveIndicesFromSet<IndexSetType,EntityType> , EntityType >
642 IndexSetType & indexSet_;
649 inline void apply ( EntityType & entity )
651 indexSet_.removeEntity( entity );
655 template <
class IndexSetType,
class EntityType>
657 :
public LocalInlinePlus < InsertIndicesToSet< IndexSetType, EntityType > , EntityType >
661 IndexSetType & indexSet_;
668 inline void apply ( EntityType & entity )
670 indexSet_.insertEntity( entity );
674 template <
class MemObjectType>
676 :
public LocalInlinePlus < ResizeMemoryObjects < MemObjectType > , int >
680 MemObjectType & memobj_;
686 : memobj_(org.memobj_)
697 template <
class MemObjectType>
699 :
public LocalInlinePlus < ReserveMemoryObjects < MemObjectType > , int >
703 MemObjectType & memobj_;
710 inline void apply (
int & chunkSize )
712 memobj_.reserve( chunkSize );
720 template <
class DofManagerType ,
class RestrictPro
longIndexSetType,
bool doResize >
723 RestrictProlongTraits<
724 IndexSetRestrictProlong<DofManagerType,RestrictProlongIndexSetType,doResize>, double > >
726 DofManagerType & dm_;
728 RestrictProlongIndexSetType & insert_;
729 RestrictProlongIndexSetType & remove_;
733 : dm_(dm) , insert_( is ), remove_( rm ) {}
736 template <
class EntityType>
737 inline void restrictLocal (
const EntityType & father,
const EntityType & son ,
bool initialize )
const 740 insert_.apply( father );
742 remove_.apply( son );
752 template <
class EntityType>
753 inline void prolongLocal (
const EntityType & father,
const EntityType & son ,
bool initialize )
const 756 remove_.apply( father );
758 insert_.apply( son );
775 template <
class EntityType>
776 inline void restrictLocal ( EntityType & father, EntityType & son ,
bool initialize )
const {}
778 template <
class EntityType>
779 inline void prolongLocal ( EntityType & father, EntityType & son ,
bool initialize )
const {}
801 template<
class Gr
id >
803 #if HAVE_DUNE_ALUGRID 804 public LoadBalanceHandleWithReserveAndCompress,
807 public CommDataHandleIF< DofManager< Grid >, char >
829 typedef typename GridType :: template Codim< 0 > :: Entity
ElementType ;
832 typedef std::list< ManagedDofStorageInterface* > ListType;
833 typedef typename ListType::iterator ListIteratorType;
834 typedef typename ListType::const_iterator ConstListIteratorType;
838 typedef std::list< ManagedIndexSetInterface * > IndexListType;
839 typedef typename IndexListType::iterator IndexListIteratorType;
840 typedef typename IndexListType::const_iterator ConstIndexListIteratorType;
846 IndexListType indexList_;
849 const GridType &grid_;
852 mutable DataInlinerType dataInliner_;
853 mutable DataXtractorType dataXtractor_;
857 typedef const ElementType ConstElementType;
860 mutable LocalIndexSetObjectsType indexSets_;
862 mutable LocalIndexSetObjectsType insertIndices_;
863 mutable LocalIndexSetObjectsType removeIndices_;
867 mutable MemObjectCheckType resizeMemObjs_;
868 mutable MemObjectCheckType reserveMemObjs_;
871 const int defaultChunkSize_;
895 IndexSetRestrictProlongType indexRPop_;
898 double memoryFactor_;
902 inline explicit DofManager (
const GridType *grid )
904 defaultChunkSize_( 128 ),
906 indexSetRestrictProlong_( *this, insertIndices_ , removeIndices_ ),
907 indexSetRestrictProlongNoResize_( *this, insertIndices_ , removeIndices_ ),
909 memoryFactor_(
Parameter :: getValidValue(
"fem.dofmanager.memoryfactor", double( 1.1 ),
910 [] ( double value ) {
return value >= 1.0; } ) )
913 if(
std::abs( memoryFactor_ - 1.1 ) > 1e-12 )
917 std::cout <<
"Created DofManager with memory factor " 918 << memoryFactor_ <<
"." << std::endl;
926 std::cerr <<
"DofManager(const DofManager &) not allowed!" << std :: endl;
955 template <
class IndexSetType>
956 inline void addIndexSet (
const IndexSetType &iset );
965 template <
class IndexSetType>
966 inline void removeIndexSet (
const IndexSetType &iset );
978 template <
class ManagedDofStorageImp>
979 void addDofStorage(ManagedDofStorageImp& dofStorage);
985 template <
class ManagedDofStorageImp>
986 void removeDofStorage(ManagedDofStorageImp& dofStorage);
995 return indexSetRestrictProlong_;
1003 return indexSetRestrictProlongNoResize_;
1009 return ! insertIndices_.
empty();
1016 ConstListIteratorType endit = memList_.end();
1017 for(ConstListIteratorType it = memList_.begin(); it != endit ; ++it)
1019 used += (*it)->usedMemorySize();
1036 int localChunkSize =
std::max(nsize, defaultChunkSize_ );
1037 assert( localChunkSize > 0 );
1040 reserveMemObjs_.
apply ( localChunkSize );
1057 IndexListIteratorType endit = indexList_.end();
1058 for(IndexListIteratorType it = indexList_.begin(); it != endit; ++it)
1069 insertIndices_.
apply( element );
1078 removeIndices_.
apply( element );
1086 resizeMemObjs_.
apply ( dummy );
1099 assert( sequence_ == grid_.comm().max( sequence_ ) );
1109 incrementSequenceNumber ();
1113 IndexListIteratorType endit = indexList_.end();
1114 for(IndexListIteratorType it = indexList_.begin(); it != endit; ++it)
1123 ListIteratorType endit = memList_.end();
1124 for(ListIteratorType it = memList_.begin(); it != endit ; ++it)
1131 (*it)->dofCompress () ;
1140 int wasChangedCounter = int( wasChanged );
1141 return bool( grid_.comm().max( wasChangedCounter ) );
1145 template <
class DataCollType>
1154 dataInliner_.
clear();
1158 template <
class DataCollType>
1167 dataXtractor_.
clear();
1177 return ( codim == 0 );
1187 template <
class Entity>
1190 DUNE_THROW(NotImplemented,
"DofManager::size should not be called!");
1195 void gather( InlineStreamType& str, ConstElementType& element )
const 1197 dataInliner_.
apply(str, element);
1200 template <
class MessageBuffer,
class Entity>
1201 void gather( MessageBuffer& str,
const Entity& entity )
const 1203 DUNE_THROW(NotImplemented,
"DofManager::gather( entity ) with codim > 0 not implemented");
1207 void scatter ( XtractStreamType& str, ConstElementType& element,
size_t )
1211 dataXtractor_.
apply(str, element);
1215 template <
class MessageBuffer,
class Entity>
1216 void scatter ( MessageBuffer & str,
const Entity& entity,
size_t )
1218 DUNE_THROW(NotImplemented,
"DofManager::scatter( entity ) with codim > 0 not implemented");
1226 void inlineData( InlineStreamImplType& str, ConstElementType& element )
const 1228 InlineStreamType buffer( str );
1229 dataInliner_.
apply( buffer, element);
1233 void xtractData( XtractStreamImplType& str, ConstElementType& element,
size_t newElements )
1236 reserveMemory( newElements );
1238 XtractStreamType buffer( str );
1241 dataXtractor_.
apply( buffer, element);
1253 ConstIndexListIteratorType endit = indexList_.end();
1254 for(ConstIndexListIteratorType it = indexList_.begin(); it != endit; ++it)
1264 IndexListIteratorType endit = indexList_.end();
1265 for(IndexListIteratorType it = indexList_.begin(); it != endit; ++it)
1285 template <
class OutStream >
1288 ConstIndexListIteratorType endit = indexList_.end();
1289 for(ConstIndexListIteratorType it = indexList_.begin(); it != endit; ++it)
1291 (*it)->write( out );
1299 template <
class InStream >
1302 IndexListIteratorType endit = indexList_.end();
1303 for(IndexListIteratorType it = indexList_.begin(); it != endit; ++it)
1319 static inline ThisType&
instance(
const GridType& grid )
1322 return DofManagerFactoryType :: instance( grid );
1332 template <
class Gr
idType>
1335 if(memList_.size() > 0)
1337 while( memList_.rbegin() != memList_.rend())
1340 memList_.pop_back();
1343 dverb <<
"Removing '" << mobj->
name() <<
"' from DofManager!\n";
1347 if(indexList_.size() > 0)
1349 std::cerr <<
"ERROR: Not all index sets have been removed from DofManager yet!" << std::endl;
1350 while ( indexList_.rbegin() != indexList_.rend())
1353 indexList_.pop_back();
1354 if(iobj)
delete iobj;
1359 template <
class Gr
idType>
1360 template <
class IndexSetType>
1368 typedef typename IndexListType::reverse_iterator IndexListIteratorType;
1370 ManagedIndexSetType * indexSet = 0;
1373 IndexListIteratorType endit = indexList_.rend();
1374 for( IndexListIteratorType it = indexList_.rbegin(); it != endit; ++it )
1377 if( set->equals( iset ) )
1381 indexSet =
static_cast< ManagedIndexSetType *
>( set );
1388 indexSet =
new ManagedIndexSetType ( iset, indexSets_ , insertIndices_ , removeIndices_ );
1389 indexList_.push_back( static_cast< ManagedIndexSetInterface * >( indexSet ) );
1393 template <
class Gr
idType>
1394 template <
class IndexSetType>
1399 typedef typename IndexListType::reverse_iterator IndexListIteratorType;
1402 IndexListIteratorType endit = indexList_.rend();
1403 for( IndexListIteratorType it = indexList_.rbegin(); it != endit; ++it )
1406 if( set->equals( iset ) )
1408 if( set->removeReference() )
1413 typename IndexListType::iterator fit = it.base();
1414 indexList_.erase( --fit );
1423 DUNE_THROW(InvalidStateException,
"Could not remove index from DofManager set!");
1426 template <
class Gr
idType>
1427 template <
class ManagedDofStorageImp>
1432 dverb <<
"Adding '" << dofStorage.name() <<
"' to DofManager! \n";
1438 memList_.push_front( obj );
1441 resizeMemObjs_ += dofStorage.resizeMemoryObject();
1444 reserveMemObjs_ += dofStorage.reserveMemoryObject();
1448 template <
class Gr
idType>
1449 template <
class ManagedDofStorageImp>
1458 ListIteratorType endit = memList_.end();
1459 for( ListIteratorType it = memList_.begin();
1465 memList_.erase( it );
1467 dvverb <<
"Remove '" << dofStorage.
name() <<
"' from DofManager!\n";
1470 resizeMemObjs_.
remove( dofStorage.resizeMemoryObject() );
1471 reserveMemObjs_.
remove( dofStorage.reserveMemoryObject() );
1488 template<
class DofManagerImp >
1498 typedef const GridType *KeyType;
1512 inline static DofManagerType &
instance (
const GridType &grid )
1514 DofManagerType *dm = getDmFromList( grid );
1516 return DMProviderType :: getObject( &grid );
1523 const std :: string &filename,
1526 DofManagerType *dm = getDmFromList( grid );
1537 const std :: string &filename,
1540 DofManagerType *dm = getDmFromList( grid );
1552 DMProviderType :: removeObject( &dm );
1557 inline static DofManagerType *getDmFromList(
const GridType &grid )
1559 return (DMProviderType :: getObjFromList( &grid )).first;
1567 #endif // #ifndef DUNE_FEM_DOFMANAGER_HH Definition: datacollector.hh:47
Definition: dofmanager.hh:342
void removeEntity(ConstElementType &element)
Removes entity from all index sets added to dof manager.
Definition: dofmanager.hh:1076
void clearDataXtractors()
clear data xtractor list
Definition: dofmanager.hh:1165
MapperType & mapper() const
Definition: dofmanager.hh:549
static void memMoveForward(ArrayType &array, const int length, const int oldStartIdx, const int newStartIdx)
move memory blocks forward
Definition: dofmanager.hh:87
void backup() const
:: backup
Definition: dofmanager.hh:1250
virtual void read(XDRFileInStream &in)
new write method
Definition: dofmanager.hh:263
void restrictLocal(const EntityType &father, const EntityType &son, bool initialize) const
restrict data to father and resize memory if doResize is true
Definition: dofmanager.hh:737
ManagedIndexSet(const IndexSetType &iset, LocalIndexSetObjectsType &indexSetList, LocalIndexSetObjectsType &insertList, LocalIndexSetObjectsType &removeList)
Constructor of MemObject, only to call from DofManager.
Definition: dofmanager.hh:206
Definition: dofmanager.hh:180
ResizeMemoryObjects(MemObjectType &mo)
Definition: dofmanager.hh:684
DofManagerType & dm_
Definition: dofmanager.hh:353
void reserveMemory(int nsize, bool dummy=false)
reserve memory for at least nsize elements, dummy is needed for dune-grid ALUGrid version ...
Definition: dofmanager.hh:1034
GridObjectStreamTraits< GridType >::InStreamType XtractStreamImplType
Definition: dofmanager.hh:818
void removeIndexSet(const IndexSetType &iset)
removed index set from dof manager's list of index sets
Definition: dofmanager.hh:1396
virtual const std::string & name() const =0
returns name of dof storage
input stream reading from a given std::istream
Definition: standardstreams.hh:194
interface documentation for (grid part) index sets
Definition: common/indexset.hh:25
Definition: dofmanager.hh:118
double memoryFactor() const
return factor to over estimate new memory allocation
Definition: dofmanager.hh:935
void apply(EntityType &entity)
apply wraps the removeEntity Method of the index set
Definition: dofmanager.hh:649
Container for User Specified Parameters.
Definition: io/parameter.hh:187
void insertEntity(ConstElementType &element)
Inserts entity to all index sets added to dof manager.
Definition: dofmanager.hh:1066
IndexSetRestrictProlong< ThisType, LocalIndexSetObjectsType, false > IndexSetRestrictProlongNoResizeType
Definition: dofmanager.hh:880
~ManagedIndexSet()
desctructor
Definition: dofmanager.hh:228
DofManager< GridImp > DofManagerType
Definition: dofmanager.hh:350
bool compress()
wrap compress of index set
Definition: dofmanager.hh:245
bool empty() const
Definition: datacollector.hh:224
DofArrayType & getArray()
return reference to array for DiscreteFunction
Definition: dofmanager.hh:546
virtual ~ManagedDofStorageInterface()
destructor
Definition: dofmanager.hh:314
void addReference()
increase reference counter
Definition: dofmanager.hh:158
static constexpr T max(T a)
Definition: utility.hh:65
void addDataXtractor(DataCollType &d)
add data handler for data xtracting to dof manager
Definition: dofmanager.hh:1159
void gather(MessageBuffer &str, const Entity &entity) const
Definition: dofmanager.hh:1201
Singleton list for key/object pairs.
Definition: singletonlist.hh:49
Definition: dofmanager.hh:591
void prolongLocal(const EntityType &father, const EntityType &son, bool initialize) const
prolong data to children and resize memory if doResize is true
Definition: dofmanager.hh:753
void compress()
Compress all data that is hold by this dofmanager.
Definition: dofmanager.hh:1106
void addDataInliner(DataCollType &d)
add data handler for data inlining to dof manager
Definition: dofmanager.hh:1146
Grid GridType
type of Grid this DofManager belongs to
Definition: dofmanager.hh:816
static size_t used(const ArrayType &array)
return used memory size of Array
Definition: dofmanager.hh:60
virtual void read(StandardInStream &in)
new write method
Definition: dofmanager.hh:269
static void deleteDofManager(DofManagerType &dm)
delete the dof manager that belong to the given grid
Definition: dofmanager.hh:1550
DofManagerType::GridType GridType
Definition: dofmanager.hh:1495
InsertIndicesToSet< IndexSetType, EntityType > insertIdxObj_
Definition: dofmanager.hh:194
virtual void write(XDRFileOutStream &out) const
new write method
Definition: dofmanager.hh:266
Definition: datacollector.hh:45
static std::pair< DofStorageInterface *, DofStorageType * > allocateManagedDofStorage(const GridType &grid, const MapperType &mapper, const std::string &name, const DofStorageType *=0)
default implementation for creating a managed dof storage
Definition: dofmanager.hh:610
XDR output stream reading from a file.
Definition: xdrstreams.hh:319
bool removeReference()
decrease reference counter and return true if zero reached
Definition: dofmanager.hh:161
void resizeForRestrict()
resize memory before data restriction during grid adaptation is done.
Definition: dofmanager.hh:1027
virtual void restore()
:: restore
Definition: dofmanager.hh:257
void addIndexSet(const IndexSetType &iset)
add index set to dof manager's list of index sets
Definition: dofmanager.hh:1362
void incrementSequenceNumber()
increase the DofManagers internal sequence number
Definition: dofmanager.hh:1093
DofArrayType myArray_
Definition: dofmanager.hh:595
ResizeMemoryObjects< ThisType > ResizeMemoryObjectType
Definition: dofmanager.hh:364
bool hasIndexSets() const
if dofmanagers list is not empty return true
Definition: dofmanager.hh:1007
void write(OutStream &out) const
write all index sets to a given stream
Definition: dofmanager.hh:1286
DataCollectorInterface< GridType, XtractStreamType > DataXtractorType
Definition: dofmanager.hh:826
size_t referenceCounter_
Definition: dofmanager.hh:127
EmptyIndexSetRestrictProlong IndexSetRestrictProlongType
Definition: dofmanager.hh:883
void scatter(MessageBuffer &str, const Entity &entity, size_t)
unpacks all data of this entity from message buffer
Definition: dofmanager.hh:1216
SpecialArrayFeatures is a wrapper class to extend some array classes with some special features neede...
Definition: arrays.hh:39
DofStorageInterface()
do not allow to create explicit instances
Definition: dofmanager.hh:286
size_t usedMemorySize() const
return used memory size
Definition: dofmanager.hh:534
EmptyIndexSetRestrictProlong()
Definition: dofmanager.hh:773
~ManagedDofStorageImplementation()
destructor deleting MemObject from resize and reserve List
Definition: dofmanager.hh:396
void reserve(const int needed)
reserve memory for what is comming
Definition: dofmanager.hh:469
ResizeMemoryObjectType resizeMemObj_
Definition: dofmanager.hh:366
Double abs(const Double &a)
Definition: double.hh:860
size_t size(const Entity &) const
for convenience
Definition: dofmanager.hh:1188
Definition: dofmanager.hh:184
virtual ~ManagedIndexSetInterface()
Definition: dofmanager.hh:137
void dofCompress()
copy the dof from the rear section of the vector to the holes
Definition: dofmanager.hh:488
void scatter(XtractStreamType &str, ConstElementType &element, size_t)
unpacks all data attached of this entity from message buffer
Definition: dofmanager.hh:1207
void read(InStream &in)
read all index sets from a given stream
Definition: dofmanager.hh:1300
static void assign(ArrayType &array, const int newIndex, const int oldIndex)
implements array[ newIndex ] = array[ oldIndex ]
Definition: dofmanager.hh:102
void resizeMemory()
resize the MemObject if necessary
Definition: dofmanager.hh:1082
void restore()
:: restore
Definition: dofmanager.hh:1261
Interface class defining the local behaviour of the restrict/prolong operation (using BN) ...
Definition: restrictprolonginterface.hh:38
IdentifierType setPtr_
Definition: dofmanager.hh:125
Definition: dofmanager.hh:328
LocalIndexSetObjectsType & insertList_
Definition: dofmanager.hh:198
int sequence() const
return number of sequence, if dofmanagers memory was changed by calling some method like resize...
Definition: dofmanager.hh:1047
output stream writing into a given std::ostream
Definition: standardstreams.hh:59
MapperType & mapper_
Definition: dofmanager.hh:356
ManagedIndexSetInterface(const IndexSet &iset)
Definition: dofmanager.hh:130
Definition: coordinate.hh:4
ManagedIndexSetInterface BaseType
type of base class
Definition: dofmanager.hh:203
void gather(InlineStreamType &str, ConstElementType &element) const
packs all data attached to this entity
Definition: dofmanager.hh:1195
ReserveMemoryObjectType & reserveMemoryObject()
return object that calls reserve of this memory object
Definition: dofmanager.hh:407
Interface class for a dof storage object to be stored in discrete functions.
Definition: dofmanager.hh:282
DataCollectorInterface< GridType, InlineStreamType > DataInlinerType
Definition: dofmanager.hh:827
void resizeAndMoveToRear()
Definition: dofmanager.hh:555
Definition: dofmanager.hh:721
ResizeMemoryObjects(const ResizeMemoryObjects &org)
Definition: dofmanager.hh:685
static bool readDofManagerNew(const GridType &grid, const std::string &filename, int timestep)
reads DofManager of corresponding grid, when DofManager exists
Definition: dofmanager.hh:1536
static void memMoveBackward(ArrayType &array, const int length, const int oldStartIdx, const int newStartIdx)
move memory blocks backwards
Definition: dofmanager.hh:72
void resize()
Resize index sets and memory due to what the mapper has as new size.
Definition: dofmanager.hh:1053
virtual void apply(ObjectStreamType &str, const EntityType &entity) const
Definition: datacollector.hh:289
virtual void clear()
clear object list
Definition: datacollector.hh:379
void resize()
wrap resize of index set
Definition: dofmanager.hh:239
void moveToFront(const int oldSize, const int block)
move block to front again
Definition: dofmanager.hh:560
void prolongLocal(EntityType &father, EntityType &son, bool initialize) const
prolong data to children and resize memory if doResize is true
Definition: dofmanager.hh:779
bool contains(const int dim, const int codim) const
the dof manager only transfers element data during load balancing
Definition: dofmanager.hh:1175
Definition: dofmanager.hh:327
std::string name_
Definition: dofmanager.hh:362
IndexSetRestrictProlong(DofManagerType &dm, RestrictProlongIndexSetType &is, RestrictProlongIndexSetType &rm)
Definition: dofmanager.hh:732
void apply(int &chunkSize)
Definition: dofmanager.hh:710
void resize()
resize the memory with the new size
Definition: dofmanager.hh:416
IndexSetRestrictProlong< ThisType, LocalIndexSetObjectsType, true > NewIndexSetRestrictProlongType
Definition: dofmanager.hh:878
DofManagerImp DofManagerType
Definition: dofmanager.hh:1494
Interface class for a dof storage object that can be managed (resized and compressed) by the DofManag...
Definition: dofmanager.hh:306
void restrictLocal(EntityType &father, EntityType &son, bool initialize) const
restrict data to father and resize memory if doResize is true
Definition: dofmanager.hh:776
IndexSetRestrictProlongNoResizeType & indexSetRestrictProlongNoResize()
returns the index set restriction and prolongation operator
Definition: dofmanager.hh:999
void apply(int &)
Definition: dofmanager.hh:690
size_t usedMemorySize() const
return used memory size of all MemObjects in bytes.
Definition: dofmanager.hh:1013
virtual ~DofStorageInterface()
destructor
Definition: dofmanager.hh:290
Definition: gridobjectstreams.hh:17
Definition: dofmanager.hh:181
Definition: dofmanager.hh:783
DofArrayType & array_
Definition: dofmanager.hh:359
static bool verbose()
obtain the cached value for fem.verbose
Definition: io/parameter.hh:444
static DofManagerType & instance(const GridType &grid)
obtain a reference to the DofManager for a given grid
Definition: dofmanager.hh:1512
void apply(ParamType &p) const
for all pointer to local operators call the func pointer
Definition: datacollector.hh:163
ArrayType::value_type ValueType
value type of array, i.e. double
Definition: dofmanager.hh:57
ManagedDofStorageImplementation< GridImp, MapperType, DofArrayType > ThisType
Definition: dofmanager.hh:348
bool notifyGlobalChange(const bool wasChanged) const
communicate new sequence number
Definition: dofmanager.hh:1137
Definition: dofmanager.hh:769
ManagedDofStorage(const GridImp &grid, const MapperType &mapper, const std::string &name)
Constructor of ManagedDofStorage.
Definition: dofmanager.hh:598
int size() const
return size of underlying array
Definition: dofmanager.hh:413
void clearDataInliners()
clear data inliner list
Definition: dofmanager.hh:1152
bool fixedsize(const int dim, const int codim) const
fixed size is false
Definition: dofmanager.hh:1181
ReserveMemoryObjects(MemObjectType &mo)
Definition: dofmanager.hh:707
ReserveMemoryObjects< ThisType > ReserveMemoryObjectType
Definition: dofmanager.hh:365
ResizeMemoryObjectType & resizeMemoryObject()
return object that calls resize of this memory object
Definition: dofmanager.hh:404
MessageBufferIF< InlineStreamImplType > InlineStreamType
Definition: dofmanager.hh:823
InsertIndicesToSet(IndexSetType &iset)
Definition: dofmanager.hh:665
void enableDofCompression()
enable dof compression for this MemObject
Definition: dofmanager.hh:540
virtual void backup() const
:: backup
Definition: dofmanager.hh:251
void removeDofStorage(ManagedDofStorageImp &dofStorage)
remove a managed dof storage from the dof manager.
Definition: dofmanager.hh:1452
MessageBufferIF< XtractStreamImplType > XtractStreamType
Definition: dofmanager.hh:822
virtual void write(StandardOutStream &out) const
new write method
Definition: dofmanager.hh:272
ManagedDofStorageInterface()
do not allow to create explicit instances
Definition: dofmanager.hh:310
RemoveIndicesFromSet< IndexSetType, EntityType > removeIdxObj_
Definition: dofmanager.hh:195
virtual void enableDofCompression()
enable dof compression for dof storage (default is empty)
Definition: dofmanager.hh:293
RemoveIndicesFromSet(IndexSetType &iset)
Definition: dofmanager.hh:646
static bool singleThreadMode()
returns true if program is operating on one thread currently
Definition: threadmanager.hh:217
bool dataCompressionEnabled_
Definition: dofmanager.hh:370
ManagedDofStorageImplementation(const GridImp &grid, const MapperType &mapper, const std::string &name, DofArrayType &array)
Constructor of ManagedDofStorageImplementation, only to call from derived classes.
Definition: dofmanager.hh:376
LocalIndexSetObjectsType & indexSetList_
Definition: dofmanager.hh:197
Singleton provider for the DofManager.
Definition: dofmanager.hh:47
static void setMemoryFactor(ArrayType &array, const double memFactor)
set memory overestimate factor, here does nothing
Definition: dofmanager.hh:66
const void * IdentifierType
Definition: dofmanager.hh:123
NewIndexSetRestrictProlongType & indexSetRestrictProlong()
returns the index set restriction and prolongation operator
Definition: dofmanager.hh:989
void remove(const OpType &op)
Definition: datacollector.hh:203
static ThisType & instance(const GridType &grid)
obtain a reference to the DofManager for a given grid
Definition: dofmanager.hh:1319
XDR output stream writing into a file.
Definition: xdrstreams.hh:267
static bool writeDofManagerNew(const GridType &grid, const std::string &filename, int timestep)
writes DofManager of corresponding grid, when DofManager exists
Definition: dofmanager.hh:1522
GridType::template Codim< 0 >::Entity ElementType
Definition: dofmanager.hh:829
void addDofStorage(ManagedDofStorageImp &dofStorage)
add a managed dof storage to the dof manager.
Definition: dofmanager.hh:1430
GridObjectStreamTraits< GridType >::OutStreamType InlineStreamImplType
Definition: dofmanager.hh:819
void apply(EntityType &entity)
apply wraps the insertEntity method of the index set
Definition: dofmanager.hh:668
const std::string & name() const
returns name of this vector
Definition: dofmanager.hh:410
bool equals(const IndexSet &iset) const
Definition: dofmanager.hh:167
Definition: singletonlist.hh:21
ReserveMemoryObjectType reserveMemObj_
Definition: dofmanager.hh:367
LocalIndexSetObjectsType & removeList_
Definition: dofmanager.hh:199
IndexSetType & indexSet_
Definition: dofmanager.hh:191