12#ifndef BELFEM_CL_TENSORMESHCONFIG_HPP
13#define BELFEM_CL_TENSORMESHCONFIG_HPP
28 const uint mDimension ;
38 const uint mNumNodes ;
39 const uint mNumElements ;
40 const uint mNumControlPoints ;
65 return mNumNodesPerDim ;
70 return mNumElementsPerDim ;
93 case 0 :
return mNumElementsPerDim( 0 ) ;
94 case 1 :
return mNumElementsPerDim( 1 ) ;
97 BELFEM_ERROR( mDimension == 3,
"Invalid dimension : %u", (
unsigned int ) aDimension );
98 return mNumElementsPerDim( 2 ) ;
100 default :
return mNumElements ;
107 switch ( aDimension )
109 case 0 :
return mNumNodesPerDim( 0 ) ;
110 case 1 :
return mNumNodesPerDim( 1 ) ;
114 "Invalid dimension : %u", (
unsigned int ) aDimension );
115 return mNumNodesPerDim( 2 ) ;
117 default :
return mNumNodes ;
123 return mElementType ;
129 switch ( aDimension )
131 case 0 :
return mNumControlPointsPerDim( 0 ) ;
132 case 1 :
return mNumControlPointsPerDim( 1 ) ;
136 "Invalid dimension : %u", (
unsigned int ) aDimension );
137 return mNumControlPointsPerDim( 2 ) ;
139 default :
return mNumControlPoints ;
146 BELFEM_ASSERT( aDimension < mDimension,
"Invalid dimension : %u", (
unsigned int ) aDimension );
147 return mOrigin( aDimension );
153 BELFEM_ASSERT( aDimension < mDimension,
"Invalid dimension : %u", (
unsigned int ) aDimension );
154 return mLimit( aDimension );
160 BELFEM_ASSERT( mDimension == 2,
"Invalid dimension : %u", (
unsigned int ) mDimension );
162 BELFEM_ASSERT( i < mNumNodesPerDim( 0 ),
"Invalid i : %u", (
unsigned int ) i );
163 BELFEM_ASSERT( j < mNumNodesPerDim( 1 ),
"Invalid j : %u", (
unsigned int ) j );
164 return mNumNodesPerDim( 1 ) * i + j ;
170 BELFEM_ASSERT( mDimension == 3,
"Invalid dimension : %u", (
unsigned int ) mDimension );
171 BELFEM_ASSERT( i < mNumNodesPerDim( 0 ),
"Invalid i : %u", (
unsigned int ) i );
172 BELFEM_ASSERT( j < mNumNodesPerDim( 1 ),
"Invalid j : %u", (
unsigned int ) j );
173 BELFEM_ASSERT( k < mNumNodesPerDim( 2 ),
"Invalid k : %u", (
unsigned int ) k );
174 return mNumNodesPerDim( 2 ) * ( mNumNodesPerDim( 1 )*i + j ) + k ;
180 BELFEM_ASSERT( mDimension == 2,
"Invalid dimension : %u", (
unsigned int ) mDimension );
181 BELFEM_ASSERT( i < mNumElementsPerDim( 0 ),
"Invalid i : %u", (
unsigned int ) i );
182 BELFEM_ASSERT( j < mNumElementsPerDim( 1 ),
"Invalid j : %u", (
unsigned int ) j );
183 return mNumElementsPerDim( 1 ) * i + j ;
189 BELFEM_ASSERT( mDimension == 3,
"Invalid dimension : %u", (
unsigned int ) mDimension );
190 BELFEM_ASSERT( i < mNumElementsPerDim( 0 ),
"Invalid i : %u", (
unsigned int ) i );
191 BELFEM_ASSERT( j < mNumElementsPerDim( 1 ),
"Invalid j : %u", (
unsigned int ) j );
192 BELFEM_ASSERT( k < mNumElementsPerDim( 2 ),
"Invalid k : %u", (
unsigned int ) k );
193 return mNumElementsPerDim( 2 ) * ( mNumElementsPerDim( 1 ) * i + j ) + k ;
199 BELFEM_ASSERT( aDimension < mDimension,
"Invalid dimension : %u", (
unsigned int ) aDimension );
200 return mElementSteps( aDimension );
206 BELFEM_ASSERT( aDimension < mDimension,
"Invalid dimension : %u", (
unsigned int ) aDimension );
207 return mInvElementSteps( aDimension );
213 BELFEM_ASSERT( i < mDimension,
"Invalid dimension : %u", (
unsigned int ) i );
220 const real tS = std::floor( ( x - mOrigin( i ) ) * mInvElementSteps( i ) );
221 if ( ! ( tS > 0.0 ) )
225 return (
index_t ) std::min( tS, (
real ) ( mNumElementsPerDim( i ) - 1 ) );
230 compute_num_elements_per_dim()
const ;
233 compute_num_control_points_per_dim()
const ;
236 compute_limit()
const ;
239 compute_num_nodes()
const ;
242 compute_num_elements()
const ;
245 compute_num_control_point()
const ;
248 determine_element_type()
const ;
251 compute_element_steps()
const ;
254 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:121
real element_step(const uint aDimension) const
Definition cl_TensorMeshConfig.hpp:197
uint num_control_points(const uint aDimension=BELFEM_UINT_MAX) const
Definition cl_TensorMeshConfig.hpp:127
const Vector< index_t > & num_elements_vector() const
Definition cl_TensorMeshConfig.hpp:68
index_t node_index(const index_t i, const index_t j) const
Definition cl_TensorMeshConfig.hpp:158
real inv_element_step(const uint aDimension) const
Definition cl_TensorMeshConfig.hpp:204
real min(const uint aDimension) const
Definition cl_TensorMeshConfig.hpp:144
uint num_elements(const uint aDimension=BELFEM_UINT_MAX) const
Definition cl_TensorMeshConfig.hpp:89
real max(const uint aDimension) const
Definition cl_TensorMeshConfig.hpp:151
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:53
const Vector< real > & origin() const
Definition cl_TensorMeshConfig.hpp:78
const Vector< index_t > & num_nodes_vector() const
Definition cl_TensorMeshConfig.hpp:63
index_t element_ijk(const index_t i, const real x)
Definition cl_TensorMeshConfig.hpp:211
index_t element_index(const index_t i, const index_t j, const index_t k) const
Definition cl_TensorMeshConfig.hpp:187
index_t node_index(const index_t i, const index_t j, const index_t k) const
Definition cl_TensorMeshConfig.hpp:168
uint num_nodes(const uint aDimension=BELFEM_UINT_MAX) const
Definition cl_TensorMeshConfig.hpp:105
const Vector< real > & step() const
Definition cl_TensorMeshConfig.hpp:73
const Vector< real > & limit() const
Definition cl_TensorMeshConfig.hpp:83
index_t element_index(const index_t i, const index_t j) const
Definition cl_TensorMeshConfig.hpp:178
uint dimension() const
Definition cl_TensorMeshConfig.hpp:58
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:79