5#ifndef DUNE_ALBERTA_DOFVECTOR_HH
6#define DUNE_ALBERTA_DOFVECTOR_HH
44 return ALBERTA get_dof_int_vec( name.c_str(), dofSpace );
49 ALBERTA free_dof_int_vec( dofVector );
54 return ALBERTA read_dof_int_vec_xdr( filename.c_str(), mesh, dofSpace );
57 static bool write (
const DofVector *dofVector,
const std::string &filename )
59 int success =
ALBERTA write_dof_int_vec_xdr( dofVector, filename.c_str() );
60 return (success == 0);
71 return ALBERTA get_dof_schar_vec( name.c_str(), dofSpace );
76 ALBERTA free_dof_schar_vec( dofVector );
81 return ALBERTA read_dof_schar_vec_xdr( filename.c_str(), mesh, dofSpace );
84 static bool write (
const DofVector *dofVector,
const std::string &filename )
86 int success =
ALBERTA write_dof_schar_vec_xdr( dofVector, filename.c_str() );
87 return (success == 0);
98 return ALBERTA get_dof_uchar_vec( name.c_str(), dofSpace );
103 ALBERTA free_dof_uchar_vec( dofVector );
108 return ALBERTA read_dof_uchar_vec_xdr( filename.c_str(), mesh, dofSpace );
113 int success =
ALBERTA write_dof_uchar_vec_xdr( dofVector, filename.c_str() );
114 return (success == 0);
125 return ALBERTA get_dof_real_vec( name.c_str(), dofSpace );
130 ALBERTA free_dof_real_vec( dofVector );
135 return ALBERTA read_dof_real_vec_xdr( filename.c_str(), mesh, dofSpace );
140 int success =
ALBERTA write_dof_real_vec_xdr( dofVector, filename.c_str() );
141 return (success == 0);
152 return ALBERTA get_dof_real_d_vec( name.c_str(), dofSpace );
157 ALBERTA free_dof_real_d_vec( dofVector );
162 return ALBERTA read_dof_real_d_vec_xdr( filename.c_str(), mesh, dofSpace );
167 int success =
ALBERTA write_dof_real_d_vec_xdr( dofVector, filename.c_str() );
168 return (success == 0);
177 template<
class Dof >
185 typedef typename DofVectorProvider::DofVector
DofVector;
198 const std::string &
name =
"" )
203 : dofVector_( dofVector )
206 explicit operator bool ()
const
208 return (
bool)dofVector_;
216 operator Dof * ()
const
219 GET_DOF_VEC( ptr, dofVector_ );
225 return dofVector_->fe_space;
231 return dofVector_->name;
233 return std::string();
246 dofVector_ = DofVectorProvider::read( filename, meshPointer, NULL );
249 bool write (
const std::string &filename )
const
251 return DofVectorProvider::write( dofVector_, filename );
258 DofVectorProvider::free( dofVector_ );
263 template<
class Functor >
266 Dof *array = (Dof *)(*
this);
267 FOR_ALL_DOFS(
dofSpace()->admin, functor( array[ dof ] ) );
272 Dof *array = (Dof *)(*
this);
273 FOR_ALL_DOFS(
dofSpace()->admin, array[ dof ] = value );
276 template<
class AdaptationData >
279 assert( dofVector_ );
280 assert( dofVector_->user_data );
281 return static_cast< AdaptationData *
>( dofVector_->user_data );
284 template<
class AdaptationData >
287 assert( dofVector_ );
288 dofVector_->user_data = adaptationData;
291 template<
class Interpolation >
294 assert( dofVector_ );
295 dofVector_->refine_interpol = &refineInterpolate< Interpolation >;
298 template<
class Restriction >
301 assert( dofVector_ );
302 dofVector_->coarse_restrict = &coarsenRestrict< Restriction >;
306 template<
class Interpolation >
307 static void refineInterpolate (
DofVector *dofVector, RC_LIST_EL *list,
int n )
309 const This dofVectorPointer( dofVector );
310 typename Interpolation::Patch patch( list, n );
311 Interpolation::interpolateVector( dofVectorPointer, patch );
314 template<
class Restriction >
315 static void coarsenRestrict (
DofVector *dofVector, RC_LIST_EL *list,
int n )
317 const This dofVectorPointer( dofVector );
318 typename Restriction::Patch patch( list, n );
319 Restriction::restrictVector( dofVectorPointer, patch );
330 assert( !dofVector ==
false );
331 int *array = (
int *)dofVector;
332 FOR_ALL_DOFS( dofVector.
dofSpace()->admin,
333 array[ dof ] =
std::abs( array[ dof ] ) );
339 assert( !dofVector ==
false );
340 int *array = (
int *)dofVector;
342 FOR_ALL_DOFS( dofVector.
dofSpace()->admin,
343 result =
std::max( result, array[ dof ] ) );
350 assert( !dofVector ==
false );
351 int *array = (
int *)dofVector;
353 FOR_ALL_DOFS( dofVector.
dofSpace()->admin,
354 result =
std::min( result, array[ dof ] ) );
provides a wrapper for ALBERTA's refinement patches and the corners for geometryInFather
provides a wrapper for ALBERTA's el_info structure
#define ALBERTA
Definition: albertaheader.hh:29
Include standard header files.
Definition: agrid.hh:60
ALBERTA MESH Mesh
Definition: misc.hh:53
void abs(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:328
ALBERTA REAL Real
Definition: misc.hh:48
ALBERTA FE_SPACE DofSpace
Definition: misc.hh:65
int min(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:348
int max(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:337
ALBERTA REAL_D GlobalVector
Definition: misc.hh:50
Definition: meshpointer.hh:40
Definition: dofvector.hh:35
static DofVector * get(const DofSpace *dofSpace, const std::string &name)
Definition: dofvector.hh:42
ALBERTA DOF_INT_VEC DofVector
Definition: dofvector.hh:40
static bool write(const DofVector *dofVector, const std::string &filename)
Definition: dofvector.hh:57
static void free(DofVector *dofVector)
Definition: dofvector.hh:47
static DofVector * read(const std::string &filename, Mesh *mesh, DofSpace *dofSpace)
Definition: dofvector.hh:52
static bool write(const DofVector *dofVector, const std::string &filename)
Definition: dofvector.hh:84
static void free(DofVector *dofVector)
Definition: dofvector.hh:74
static DofVector * get(const DofSpace *dofSpace, const std::string &name)
Definition: dofvector.hh:69
static DofVector * read(const std::string &filename, Mesh *mesh, DofSpace *dofSpace)
Definition: dofvector.hh:79
ALBERTA DOF_SCHAR_VEC DofVector
Definition: dofvector.hh:67
static void free(DofVector *dofVector)
Definition: dofvector.hh:101
ALBERTA DOF_UCHAR_VEC DofVector
Definition: dofvector.hh:94
static DofVector * read(const std::string &filename, Mesh *mesh, DofSpace *dofSpace)
Definition: dofvector.hh:106
static DofVector * get(const DofSpace *dofSpace, const std::string &name)
Definition: dofvector.hh:96
static bool write(const DofVector *dofVector, const std::string &filename)
Definition: dofvector.hh:111
static DofVector * get(const DofSpace *dofSpace, const std::string &name)
Definition: dofvector.hh:123
static DofVector * read(const std::string &filename, Mesh *mesh, DofSpace *dofSpace)
Definition: dofvector.hh:133
static void free(DofVector *dofVector)
Definition: dofvector.hh:128
static bool write(const DofVector *dofVector, const std::string &filename)
Definition: dofvector.hh:138
ALBERTA DOF_REAL_VEC DofVector
Definition: dofvector.hh:121
ALBERTA DOF_REAL_D_VEC DofVector
Definition: dofvector.hh:148
static void free(DofVector *dofVector)
Definition: dofvector.hh:155
static bool write(const DofVector *dofVector, const std::string &filename)
Definition: dofvector.hh:165
static DofVector * read(const std::string &filename, Mesh *mesh, DofSpace *dofSpace)
Definition: dofvector.hh:160
static DofVector * get(const DofSpace *dofSpace, const std::string &name)
Definition: dofvector.hh:150
Definition: dofvector.hh:179
DofVectorProvider::DofVector DofVector
Definition: dofvector.hh:185
void setupInterpolation()
Definition: dofvector.hh:292
void initialize(const Dof &value)
Definition: dofvector.hh:270
void read(const std::string &filename, const MeshPointer< dim > &meshPointer)
Definition: dofvector.hh:243
void create(const DofSpace *dofSpace, const std::string &name="")
Definition: dofvector.hh:236
void release()
Definition: dofvector.hh:254
AdaptationData * getAdaptationData() const
Definition: dofvector.hh:277
void setupRestriction()
Definition: dofvector.hh:299
DofVectorPointer()
Definition: dofvector.hh:193
void setAdaptationData(AdaptationData *adaptationData)
Definition: dofvector.hh:285
bool write(const std::string &filename) const
Definition: dofvector.hh:249
DofVectorPointer(DofVector *dofVector)
Definition: dofvector.hh:202
const DofSpace * dofSpace() const
Definition: dofvector.hh:223
static const bool supportsAdaptationData
Definition: dofvector.hh:187
std::string name() const
Definition: dofvector.hh:228
void forEach(Functor &functor) const
Definition: dofvector.hh:264
DofVectorPointer(const DofSpace *dofSpace, const std::string &name="")
Definition: dofvector.hh:197