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

Added insert Indices to DataCollector during loadBalance.

Also minor faceliftings.

[[Imported from SVN: r2311]]
parent b0d728a1
Branches
Tags
No related merge requests found
......@@ -349,7 +349,7 @@ namespace Dune {
template <class EntityType>
void prolongLocal ( EntityType &father, EntityType &son, bool initialize ) const
{
assert( son.state() == REFINED );
//assert( son.state() == REFINED );
df_.localFunction( father, vati_ );
df_.localFunction( son , sohn_ );
......
......@@ -512,6 +512,13 @@ namespace Dune {
{
ParamType p( &str , &en );
if(!read_)
dm_.removeOldIndex( en );
else
{
dm_.insertNewIndex( en );
dm_.resizeMem ( mxlvl * 10 );
}
ldc_.apply( p );
{
typedef typename EntityType::HierarchicIterator HierItType;
......@@ -519,11 +526,18 @@ namespace Dune {
for(HierItType it = en.hbegin(mxlvl);
it != endit; ++it )
{
//if((*it).isLeaf())
if(!read_)
{
p.second = it.operator -> ();
ldc_.apply( p );
dm_.removeOldIndex( *it );
}
else
{
dm_.insertNewIndex( *it );
dm_.checkMemorySize();
}
p.second = it.operator -> ();
ldc_.apply( p );
}
}
}
......@@ -575,13 +589,12 @@ namespace Dune {
: df_ (df) , lf_ (df.newLocalFunction() ) , leaf_(leaf) {}
//! store data to stream
//template <class ObjectStreamType, class EntityType>
void apply ( ParamType & p ) const
{
assert( p.first && p.second );
EntityType & en = const_cast<EntityType &> (*(p.second));
if(leaf_) if(!en.isLeaf()) return;
if(leaf_ && (!en.isLeaf())) return;
df_.localFunction( en , lf_ );
for(int l=0; l<lf_.numberOfDofs(); l++)
......@@ -599,22 +612,6 @@ namespace Dune {
};
/*
template <class ObjectStreamType , class LocalFunctionType>
struct GatherScatterCopy
{
static void gather ( ObjectStreamType & os, LocalFunctionType & lf )
{
std::cout << "Gather data \n";
for(int l=0; l<lf.numberOfDofs(); l++)
{
os.readObject( lf[l] );
}
}
};
*/
template <class DiscreteFunctionType>
class DataXtractor :
public LocalInlinePlus < DataXtractor< DiscreteFunctionType > ,
......@@ -638,40 +635,25 @@ namespace Dune {
typedef typename DiscreteFunctionType::RangeFieldType RangeFieldType;
typedef typename DiscreteFunctionType::DomainType DomainType;
//typedef void GatherFunctionType( ObjectStreamType & , LocalFunctionType & );
//typedef void ScatterFunctionType( ObjectStreamType & , LocalFunctionType & );
public:
DataXtractor ( DiscreteFunctionType & df , bool leaf = true)
: df_ (df) , lf_ (df.newLocalFunction() ) , leaf_(leaf) {}
//! store data to stream
//template <class ObjectStreamType, class EntityType>
void apply ( ParamType & p ) const
{
assert( p.first && p.second );
EntityType & en = const_cast<EntityType &> (*(p.second));
if(leaf_) if(!en.isLeaf()) return;
if(leaf_ && (!en.isLeaf())) return;
df_.localFunction( en , lf_ );
//assert( gatherFunc_ );
//gatherFunc_( (*(p.first)) , lf_ ) ;
for(int l=0; l<lf_.numberOfDofs(); l++)
{
(*(p.first)).readObject( lf_[l] );
}
}
/*
template <template <class,class> class GatherScatterType>
void setGatherScatter ()
{
gatherFunc_ = GatherScatterType<ObjectStreamType,LocalFunctionType>::gather;
std::cout << "Set gather Function " << gatherFunc_ << "\n";
}
*/
private:
mutable DiscreteFunctionType & df_;
mutable LocalFunctionType lf_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment