12#ifndef BELFEM_CL_MESH_BASIS_HPP
13#define BELFEM_CL_MESH_BASIS_HPP
38 uint16_t mNumberOfSources = 0 ;
39 Basis ** mSources = nullptr ;
40 real * mWeights = nullptr ;
48 uint8_t mNumberOfDofs = 0 ;
268 return mNumberOfSources > 0 ;
276 return mNumberOfSources ;
287 BELFEM_ERROR( mNumberOfDofs < std::numeric_limits<
decltype( mNumberOfDofs ) >
::max(),
288 "Dof counter of basis %lu is full ( max %lu )",
289 (
long unsigned int ) this->
id(),
290 (
long unsigned int ) std::numeric_limits<
decltype( mNumberOfDofs ) >
::max() );
300 if( mNumberOfDofs > 0 )
306 BELFEM_ERROR( mDofs !=
nullptr,
"Failed to allocate the dof container of basis %lu",
307 (
long unsigned int ) this->
id() );
308 std::fill( mDofs, mDofs + mNumberOfDofs,
nullptr );
330 BELFEM_ERROR( mNumberOfDofs < std::numeric_limits<
decltype( mNumberOfDofs ) >
::max(),
331 "Dof counter of basis %lu is full ( max %lu )",
332 (
long unsigned int ) this->
id(),
333 (
long unsigned int ) std::numeric_limits<
decltype( mNumberOfDofs ) >
::max() );
335 mDofs[ mNumberOfDofs++ ] = aDof ;
343 return mNumberOfDofs ;
351 BELFEM_ASSERT( aIndex < (
uint ) mNumberOfDofs,
"Index %u out of bounds for basis %lu (expect < %u).",
352 (
unsigned int ) aIndex,
353 (
long unsigned int ) this->
id(),
354 (
unsigned int ) mNumberOfDofs );
356 return mDofs[ aIndex ];
364 if ( mDofs !=
nullptr )
366 for (
uint k = 0; k < mNumberOfDofs; ++k )
368 if ( mDofs[ k ] == aDof )
382 return mDofs != nullptr ;
390 BELFEM_ASSERT( aIndex < (
uint ) mNumberOfSources,
"Index %u out of bounds for basis %lu (must be < %u).",
391 (
unsigned int ) aIndex,
392 (
long unsigned int ) this->
id(),
393 (
unsigned int ) mNumberOfSources );
395 return mSources[ aIndex ];
403 BELFEM_ASSERT( aIndex < (
uint ) mNumberOfSources,
"Index %u out of bounds for basis %lu (must be < %u).",
404 (
unsigned int ) aIndex,
405 (
long unsigned int ) this->
id(),
406 (
unsigned int ) mNumberOfSources );
408 return mSources[ aIndex ];
416 BELFEM_ASSERT( aIndex < mNumberOfSources,
"Index %u out of bounds for basis %lu (must be < %u).",
417 (
unsigned int ) aIndex,
418 (
long unsigned int ) this->
id(),
419 (
unsigned int ) mNumberOfSources );
421 return mWeights[ aIndex ];
429 BELFEM_ASSERT( aIndex < (
uint ) mNumberOfSources,
"Index %u out of bounds for basis %lu (must be < %u).",
430 (
unsigned int ) aIndex,
431 (
long unsigned int ) this->
id(),
432 (
unsigned int ) mNumberOfSources );
434 mWeights[ aIndex ] = aValue ;
#define BELFEM_ERROR(aCheck,...)
Definition assert.hpp:264
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
A bounds-checked wrapper around std::vector.
Definition cl_Cell.hpp:45
Graph node with an adjacency list; the vertex type the graph algorithms operate on.
Definition cl_Graph_Vertex.hpp:32
Definition cl_Mesh_Basis.hpp:33
Basis & operator=(const Basis &)=delete
virtual Edge * edge(const uint aIndex)
Definition cl_Mesh_Basis.cpp:121
virtual uint number_of_nodes() const
Definition cl_Mesh_Basis.cpp:73
graph::Vertex * dof(const uint aIndex)
Definition cl_Mesh_Basis.hpp:349
void set_weight(const uint aIndex, const real aValue)
Definition cl_Mesh_Basis.hpp:427
bool is_hanging() const
Definition cl_Mesh_Basis.hpp:266
void insert_dof(graph::Vertex *aDof)
Definition cl_Mesh_Basis.hpp:328
void reset_source_container()
Definition cl_Mesh_Basis.cpp:277
void flag_sources()
Definition cl_Mesh_Basis.cpp:380
void add_source(Basis *aSource, const real aWeight=1.0)
Definition cl_Mesh_Basis.cpp:318
bool has_dof_container() const
true while a container is allocated, whatever its count
Definition cl_Mesh_Basis.hpp:380
Basis(const Basis &)=delete
uint number_of_dofs() const
Definition cl_Mesh_Basis.hpp:341
uint number_of_sources() const
Definition cl_Mesh_Basis.hpp:274
void set_sources(Cell< Basis * > &aSources, const Vector< real > &aCoefficients)
Stores borrowed pointers to the sources and copies the weights.
Definition cl_Mesh_Basis.cpp:189
virtual Face * face(const uint aIndex=0)
Definition cl_Mesh_Basis.cpp:143
virtual EntityType entity_type() const
returns the type of this vertex
Definition cl_Mesh_Basis.cpp:64
Basis()
Definition cl_Mesh_Basis.cpp:21
void allocate_source_container(uint aNumSources)
Definition cl_Mesh_Basis.cpp:295
virtual Node * node(const uint aIndex)
Definition cl_Mesh_Basis.cpp:100
Basis & operator=(Basis &&)=delete
Node * source_node(const uint aIndex)
Definition cl_Mesh_Basis.cpp:163
virtual uint number_of_elements() const
Definition cl_Mesh_Basis.cpp:46
void reset_dof_container()
Definition cl_Mesh_Basis.hpp:316
virtual uint number_of_edges() const
Definition cl_Mesh_Basis.cpp:82
bool holds_dof(const graph::Vertex *aDof) const
Definition cl_Mesh_Basis.hpp:362
real weight(const uint aIndex) const
Definition cl_Mesh_Basis.hpp:414
virtual uint number_of_faces() const
Definition cl_Mesh_Basis.cpp:91
Basis * source(const uint aIndex)
Definition cl_Mesh_Basis.hpp:388
virtual Element * element(const uint aIndex)
Definition cl_Mesh_Basis.cpp:55
void increment_dof_counter()
Definition cl_Mesh_Basis.hpp:283
void allocate_dof_container()
Definition cl_Mesh_Basis.hpp:298
Special Edge class for NEDELEC-Type elements.
Definition cl_Edge.hpp:30
Lagrange Element baseclass.
Definition cl_Element.hpp:35
Definition cl_Face.hpp:29
Definition cl_Node.hpp:30
Definition cl_EF_EdgeFunction.hpp:24
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
T max(const Vector< T > &aVector)
Definition fn_AR_max.hpp:24
EntityType
Definition Mesh_Enums.hpp:116
double real
Definition typedefs.hpp:36