Skip to content
Snippets Groups Projects
Commit 53170dae authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

Some changes in resize methods for new adaptation strategy.

[[Imported from SVN: r1878]]
parent 88e9ec32
Branches
Tags
No related merge requests found
......@@ -231,7 +231,7 @@ namespace Dune {
return ;
}
int nMemSize = (int) (nsize * 0.02);
int nMemSize = (int) (nsize * 0.1);
nMemSize += nsize;
vec_ = AllocatorType :: realloc (vec_,size_,nMemSize);
......@@ -267,6 +267,7 @@ namespace Dune {
{
int len = size_;
xdr_int( xdrs, &len );
//std::cout << len << " len|size "<< size_ << "\n";
assert(size_ <= len);
xdr_vector(xdrs,(char *) vec_,size_, sizeof(T) ,(xdrproc_t)xdr_double);
......@@ -502,6 +503,8 @@ namespace Dune {
typedef LocalInterface<typename GridType::template codim<0>::Entity> LocalIndexSetObjectsType;
mutable LocalIndexSetObjectsType indexSets_;
int maxIndex_;
public:
template <class MapperType , class DofStorageType >
struct Traits
......@@ -510,7 +513,7 @@ namespace Dune {
};
//! Constructor
DofManager (const GridType & grid) : grid_(grid) {}
DofManager (const GridType & grid) : grid_(grid) , maxIndex_(0) {}
//! Desctructor, removes all MemObjects and IndexSetObjects
~DofManager ()
......@@ -649,9 +652,30 @@ namespace Dune {
ListIteratorType it = memList_.begin();
ListIteratorType endit = memList_.end();
maxIndex_ = 0;
for( ; it != endit ; ++it)
{
(*it)->realloc ( (*it)->size() + (*it)->additionalSizeEstimate() );
maxIndex_ = std::max( (*it)->size() , maxIndex_ );
}
}
void resizeChunk (int index, int chunkSize)
{
//std::cout << "index = " << index << " |m=" << maxIndex_ << "\n";
if(index >= maxIndex_)
{
ListIteratorType it = memList_.begin();
ListIteratorType endit = memList_.end();
maxIndex_ = 0;
for( ; it != endit ; ++it)
{
(*it)->realloc ( (*it)->size() + chunkSize );
//std::cout << "Resized with new size = " << (*it)->size() << "\n";
maxIndex_ = std::max( (*it)->size() , maxIndex_ );
//std::cout << "index = " << index << " |m=" << maxIndex_ << "\n";
}
}
}
......@@ -660,9 +684,11 @@ namespace Dune {
ListIteratorType it = memList_.begin();
ListIteratorType endit = memList_.end();
maxIndex_ = 0;
for( ; it != endit ; ++it)
{
(*it)->realloc ( (*it)->size() + nsize );
maxIndex_ = std::max( (*it)->size() , maxIndex_ );
}
}
......@@ -684,10 +710,12 @@ namespace Dune {
ListIteratorType it = memList_.begin();
ListIteratorType endit = memList_.end();
maxIndex_ = 0;
for( ; it != endit ; ++it)
{
int nSize = (*it)->newSize();
(*it)->realloc ( nSize );
maxIndex_ = std::max( (*it)->size() , maxIndex_ );
}
}
......@@ -709,11 +737,13 @@ namespace Dune {
ListIteratorType it = memList_.begin();
ListIteratorType endit = memList_.end();
maxIndex_ = 0;
for( ; it != endit ; ++it)
{
// if correponding index was not compressed yet, yhis is called in
// the MemObject dofCompress, if index has not changes, nothing happens
(*it)->dofCompress () ;
maxIndex_ = std::max( (*it)->size() , maxIndex_ );
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment