Skip to content
Snippets Groups Projects
Commit b916289e authored by Oliver Sander's avatar Oliver Sander
Browse files

assignment on a given level

[[Imported from SVN: r778]]
parent 234f1718
No related branches found
No related tags found
No related merge requests found
......@@ -61,34 +61,45 @@ namespace Dune
}
// assign
// assign on maxlevel
template<class DiscreteFunctionSpaceType, class DofIteratorImp,
template <class,class> class LocalFunctionIteratorImp, class DiscreteFunctionImp >
inline Vector< typename DiscreteFunctionSpaceType::RangeField > &
DiscreteFunctionDefault<DiscreteFunctionSpaceType ,
DofIteratorImp , LocalFunctionIteratorImp, DiscreteFunctionImp >::
assign( const Vector< typename DiscreteFunctionSpaceType::RangeField > & g )
{
int level = this->getFunctionSpace().getGrid().maxlevel();
assign(g, level);
return *this;
}
// assign on a given level
template<class DiscreteFunctionSpaceType, class DofIteratorImp,
template <class,class> class LocalFunctionIteratorImp, class DiscreteFunctionImp >
inline Vector< typename DiscreteFunctionSpaceType::RangeField > &
DiscreteFunctionDefault<DiscreteFunctionSpaceType ,
DofIteratorImp , LocalFunctionIteratorImp, DiscreteFunctionImp >::
assign( const Vector< typename DiscreteFunctionSpaceType::RangeField > & g, int level )
{
typedef DiscreteFunctionDefault<DiscreteFunctionSpaceType ,
DofIteratorImp , LocalFunctionIteratorImp, DiscreteFunctionImp > DiscreteFunctionDefaultType;
DiscreteFunctionDefaultType &gc =
const_cast<DiscreteFunctionDefaultType &>( static_cast<const DiscreteFunctionDefaultType &> ( g ));
// we would need const_iterators.....
int level = this->getFunctionSpace().getGrid().maxlevel();
/** \todo we would need const_iterators..... */
DofIteratorImp it = this->dbegin( level );
DofIteratorImp endit = this->dend ( level );
DofIteratorImp git = gc.dbegin ( level );
for(DofIteratorImp it = this->dbegin( level ); it != endit; ++it)
{
for(; it != endit; ++it, ++git)
*it = *git;
++git;
}
return *this;
}
// operator =
template<class DiscreteFunctionSpaceType, class DofIteratorImp,
template <class,class> class LocalFunctionIteratorImp, class DiscreteFunctionImp >
......
......@@ -23,6 +23,8 @@ namespace Dune {
typedef std::basic_string <char> StringType;
/** \brief ???
* \todo Please doc me! */
template <typename T>
StringType typeIdentifier ()
{
......@@ -204,10 +206,14 @@ namespace Dune {
RangeFieldType scalarProductDofs( const DiscreteFunctionDefault &g,
int level) const;
//! Assignment
//! Assignment on maxlevel
Vector<RangeFieldType> &
assign(const Vector<RangeFieldType> &g);
//! Assignment on a given level
Vector<RangeFieldType> &
assign(const Vector<RangeFieldType> &g, int level);
//! Assignment operator
Vector<RangeFieldType> & operator = (const Vector<RangeFieldType> &g);
......
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