Skip to content
Snippets Groups Projects
Commit 6d9e0143 authored by Adrian Burri's avatar Adrian Burri
Browse files

Bugfix in init: use a flag to signal that the local function hasn't been initialised so far

[[Imported from SVN: r1596]]
parent b3d01571
No related branches found
No related tags found
No related merge requests found
......@@ -266,6 +266,9 @@ namespace Dune {
//! do we have the same base function set for all elements
bool uniform_;
//! is it initialised?
mutable bool init_;
}; // end LocalFunctionAdapt
......
......@@ -269,6 +269,9 @@ namespace Dune {
//! do we have the same base function set for all elements
bool uniform_;
//! is it initialised?
mutable bool init_;
}; // end LocalFunctionArray
......
......@@ -383,7 +383,7 @@ namespace Dune
LocalFunctionAdapt( const DiscreteFunctionSpaceType &f ,
DofArrayType & dofVec )
: fSpace_ ( f ), dofVec_ ( dofVec )
, uniform_(true) {}
, uniform_(true), init_(false) {}
template<class DiscreteFunctionSpaceType >
inline LocalFunctionAdapt < DiscreteFunctionSpaceType >::~LocalFunctionAdapt()
......@@ -496,7 +496,7 @@ namespace Dune
inline bool LocalFunctionAdapt < DiscreteFunctionSpaceType >::
init (EntityType &en ) const
{
if(!uniform_)
if(!uniform_ || !init_)
{
numOfDof_ =
fSpace_.getBaseFunctionSet(en).getNumberOfBaseFunctions();
......@@ -505,6 +505,8 @@ namespace Dune
if(numOfDof_ > this->values_.size())
this->values_.resize( numOfDof_ );
init_ = true;
}
for(int i=0; i<numOfDof_; i++)
......
......@@ -418,7 +418,7 @@ namespace Dune
LocalFunctionArray( const DiscreteFunctionSpaceType &f ,
Array < RangeFieldType > & dofVec )
: fSpace_ ( f ), dofVec_ ( dofVec ) , next_ (0)
, uniform_(true) {}
, uniform_(true), init_(false) {}
template<class DiscreteFunctionSpaceType >
inline LocalFunctionArray < DiscreteFunctionSpaceType >::~LocalFunctionArray()
......@@ -520,7 +520,7 @@ namespace Dune
inline bool LocalFunctionArray < DiscreteFunctionSpaceType >::
init (EntityType &en ) const
{
if(!uniform_)
if(!uniform_ || !init_)
{
numOfDof_ =
fSpace_.getBaseFunctionSet(en).getNumberOfBaseFunctions();
......@@ -529,6 +529,8 @@ namespace Dune
if(numOfDof_ > values_.size())
values_.resize( numOfDof_ );
init_ = true;
}
for(int i=0; i<numOfDof_; i++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment