12#ifndef BELFEM_CL_TENSORMESHCONFIG_HPP
13#define BELFEM_CL_TENSORMESHCONFIG_HPP
25 const uint mDimension ;
35 const uint mNumNodes ;
36 const uint mNumElements ;
37 const uint mNumControlPoints ;
62 return mNumNodesPerDim ;
67 return mNumElementsPerDim ;
90 case 0 :
return mNumElementsPerDim( 0 ) ;
91 case 1 :
return mNumElementsPerDim( 1 ) ;
94 BELFEM_ERROR( mDimension == 3,
"Invalid dimension : %u", (
unsigned int ) aDimension );
95 return mNumElementsPerDim( 2 ) ;
97 default :
return mNumElements ;
104 switch ( aDimension )
106 case 0 :
return mNumNodesPerDim( 0 ) ;
107 case 1 :
return mNumNodesPerDim( 1 ) ;
111 "Invalid dimension : %u", (
unsigned int ) aDimension );
112 return mNumNodesPerDim( 2 ) ;
114 default :
return mNumNodes ;
120 return mElementType ;
126 switch ( aDimension )
128 case 0 :
return mNumControlPointsPerDim( 0 ) ;
129 case 1 :
return mNumControlPointsPerDim( 1 ) ;
133 "Invalid dimension : %u", (
unsigned int ) aDimension );
134 return mNumControlPointsPerDim( 2 ) ;
136 default :
return mNumControlPoints ;
143 BELFEM_ASSERT( aDimension < mDimension,
"Invalid dimension : %u", (
unsigned int ) aDimension );
144 return mOrigin( aDimension );
150 BELFEM_ASSERT( aDimension < mDimension,
"Invalid dimension : %u", (
unsigned int ) aDimension );
151 return mLimit( aDimension );
157 BELFEM_ASSERT( mDimension == 2,
"Invalid dimension : %u", (
unsigned int ) mDimension );
159 BELFEM_ASSERT( i < mNumNodesPerDim( 0 ),
"Invalid i : %u", (
unsigned int ) i );
160 BELFEM_ASSERT( j < mNumNodesPerDim( 1 ),
"Invalid j : %u", (
unsigned int ) j );
161 return mNumNodesPerDim( 1 ) * i + j ;
167 BELFEM_ASSERT( mDimension == 3,
"Invalid dimension : %u", (
unsigned int ) mDimension );
168 BELFEM_ASSERT( i < mNumNodesPerDim( 0 ),
"Invalid i : %u", (
unsigned int ) i );
169 BELFEM_ASSERT( j < mNumNodesPerDim( 1 ),
"Invalid j : %u", (
unsigned int ) j );
170 BELFEM_ASSERT( k < mNumNodesPerDim( 2 ),
"Invalid k : %u", (
unsigned int ) k );
171 return mNumNodesPerDim( 2 ) * ( mNumNodesPerDim( 1 )*i + j ) + k ;
177 BELFEM_ASSERT( mDimension == 2,
"Invalid dimension : %u", (
unsigned int ) mDimension );
178 BELFEM_ASSERT( i < mNumElementsPerDim( 0 ),
"Invalid i : %u", (
unsigned int ) i );
179 BELFEM_ASSERT( j < mNumElementsPerDim( 1 ),
"Invalid j : %u", (
unsigned int ) j );
180 return mNumElementsPerDim( 1 ) * i + j ;
186 BELFEM_ASSERT( mDimension == 3,
"Invalid dimension : %u", (
unsigned int ) mDimension );
187 BELFEM_ASSERT( i < mNumElementsPerDim( 0 ),
"Invalid i : %u", (
unsigned int ) i );
188 BELFEM_ASSERT( j < mNumElementsPerDim( 1 ),
"Invalid j : %u", (
unsigned int ) j );
189 BELFEM_ASSERT( k < mNumElementsPerDim( 2 ),
"Invalid k : %u", (
unsigned int ) k );
190 return mNumElementsPerDim( 2 ) * ( mNumElementsPerDim( 1 ) * i + j ) + k ;
196 BELFEM_ASSERT( aDimension < mDimension,
"Invalid dimension : %u", (
unsigned int ) aDimension );
197 return mElementSteps( aDimension );
203 BELFEM_ASSERT( aDimension < mDimension,
"Invalid dimension : %u", (
unsigned int ) aDimension );
204 return mInvElementSteps( aDimension );
210 BELFEM_ASSERT( i < mDimension,
"Invalid dimension : %u", (
unsigned int ) i );
212 return std::clamp( (
index_t ) ( ( x - mOrigin( i ) ) * mInvElementSteps( i ) ),
213 (
index_t ) 0, mNumElementsPerDim( i ) -1);
218 compute_num_elements_per_dim()
const ;
221 compute_num_control_points_per_dim()
const ;
224 compute_limit()
const ;
227 compute_num_nodes()
const ;
230 compute_num_elements()
const ;
233 compute_num_control_point()
const ;
236 determine_element_type()
const ;
239 compute_element_steps()
const ;
242 compute_inv_element_steps()
const ;
#define BELFEM_ERROR(aCheck,...)
Definition assert.hpp:264
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
~TensorMeshConfig()=default
ElementType element_type() const
Definition cl_TensorMeshConfig.hpp:118
real element_step(const uint aDimension) const
Definition cl_TensorMeshConfig.hpp:194
uint num_control_points(const uint aDimension=BELFEM_UINT_MAX) const
Definition cl_TensorMeshConfig.hpp:124
const Vector< index_t > & num_elements_vector() const
Definition cl_TensorMeshConfig.hpp:65
index_t node_index(const index_t i, const index_t j) const
Definition cl_TensorMeshConfig.hpp:155
real inv_element_step(const uint aDimension) const
Definition cl_TensorMeshConfig.hpp:201
real min(const uint aDimension) const
Definition cl_TensorMeshConfig.hpp:141
uint num_elements(const uint aDimension=BELFEM_UINT_MAX) const
Definition cl_TensorMeshConfig.hpp:86
real max(const uint aDimension) const
Definition cl_TensorMeshConfig.hpp:148
TensorMeshConfig(const uint aOrder, const Vector< index_t > &aNumNodes, const Vector< real > &aStep, const Vector< real > aOrigin={})
Definition cl_TensorMeshConfig.cpp:17
uint order() const
Definition cl_TensorMeshConfig.hpp:50
const Vector< real > & origin() const
Definition cl_TensorMeshConfig.hpp:75
const Vector< index_t > & num_nodes_vector() const
Definition cl_TensorMeshConfig.hpp:60
index_t element_ijk(const index_t i, const real x)
Definition cl_TensorMeshConfig.hpp:208
index_t element_index(const index_t i, const index_t j, const index_t k) const
Definition cl_TensorMeshConfig.hpp:184
index_t node_index(const index_t i, const index_t j, const index_t k) const
Definition cl_TensorMeshConfig.hpp:165
uint num_nodes(const uint aDimension=BELFEM_UINT_MAX) const
Definition cl_TensorMeshConfig.hpp:102
const Vector< real > & step() const
Definition cl_TensorMeshConfig.hpp:70
const Vector< real > & limit() const
Definition cl_TensorMeshConfig.hpp:80
index_t element_index(const index_t i, const index_t j) const
Definition cl_TensorMeshConfig.hpp:175
uint dimension() const
Definition cl_TensorMeshConfig.hpp:55
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
ElementType
Element types.
Definition Mesh_Enums.hpp:27
uint32_t index_t
Definition typedefs.hpp:52
double real
Definition typedefs.hpp:36
#define BELFEM_UINT_MAX
Definition typedefs.hpp:80