15 #if !defined(KRATOS_GEOMETRY_SHAPE_FUNCTION_CONTAINER_H_INCLUDED )
16 #define KRATOS_GEOMETRY_SHAPE_FUNCTION_CONTAINER_H_INCLUDED
58 template<
typename TIntegrationMethodType>
106 : mDefaultMethod(ThisDefaultMethod)
107 , mIntegrationPoints(ThisIntegrationPoints)
108 , mShapeFunctionsValues( ThisShapeFunctionsValues )
109 , mShapeFunctionsLocalGradients( ThisShapeFunctionsLocalGradients )
117 const Matrix& ThisShapeFunctionsValues,
118 const Matrix& ThisShapeFunctionsGradients)
119 : mDefaultMethod(ThisDefaultMethod)
122 ips[0] = ThisIntegrationPoint;
123 mIntegrationPoints[
static_cast<int>(ThisDefaultMethod)] = ips;
125 mShapeFunctionsValues[
static_cast<int>(ThisDefaultMethod)] = ThisShapeFunctionsValues;
128 DN_De_array[0] = ThisShapeFunctionsGradients;
129 mShapeFunctionsLocalGradients[
static_cast<int>(ThisDefaultMethod)] = DN_De_array;
136 const Matrix& ThisShapeFunctionsValues,
138 : mDefaultMethod(ThisDefaultMethod)
141 ips[0] = ThisIntegrationPoint;
142 mIntegrationPoints[
static_cast<int>(ThisDefaultMethod)] = ips;
144 mShapeFunctionsValues[
static_cast<int>(ThisDefaultMethod)] = ThisShapeFunctionsValues;
146 if (ThisShapeFunctionsDerivatives.size() > 0)
149 DN_De_array[0] = ThisShapeFunctionsDerivatives[0];
150 mShapeFunctionsLocalGradients[
static_cast<int>(ThisDefaultMethod)] = DN_De_array;
152 if (ThisShapeFunctionsDerivatives.size() > 1)
155 for (
IndexType i = 1;
i < ThisShapeFunctionsDerivatives.size(); ++
i)
158 DN_De_i_array[0] = ThisShapeFunctionsDerivatives[
i];
159 derivatives_array[
i - 1] = DN_De_i_array;
161 mShapeFunctionsDerivatives[
static_cast<int>(ThisDefaultMethod)] = derivatives_array;
167 : mIntegrationPoints({})
168 , mShapeFunctionsValues({})
169 , mShapeFunctionsLocalGradients({})
170 , mShapeFunctionsDerivatives({})
176 : mDefaultMethod(rOther.mDefaultMethod)
177 , mIntegrationPoints(rOther.mIntegrationPoints)
178 , mShapeFunctionsValues( rOther.mShapeFunctionsValues )
179 , mShapeFunctionsLocalGradients( rOther.mShapeFunctionsLocalGradients )
180 , mShapeFunctionsDerivatives( rOther.mShapeFunctionsDerivatives )
194 mDefaultMethod = rOther.mDefaultMethod;
195 mIntegrationPoints = rOther.mIntegrationPoints;
196 mShapeFunctionsValues = rOther.mShapeFunctionsValues;
197 mShapeFunctionsLocalGradients = rOther.mShapeFunctionsLocalGradients;
198 mShapeFunctionsDerivatives = rOther.mShapeFunctionsDerivatives;
209 return mDefaultMethod;
214 return (!mIntegrationPoints[
static_cast<int>(ThisMethod)].empty());
223 return mIntegrationPoints[
static_cast<int>(mDefaultMethod)].size();
228 return mIntegrationPoints[
static_cast<int>(ThisMethod)].size();
233 return mIntegrationPoints[
static_cast<int>(mDefaultMethod)];
238 return mIntegrationPoints[
static_cast<int>(ThisMethod)];
247 return mShapeFunctionsValues[
static_cast<int>(mDefaultMethod)];
253 return mShapeFunctionsValues[
static_cast<int>(ThisMethod)];
261 KRATOS_DEBUG_ERROR_IF(mShapeFunctionsValues[
static_cast<int>(ThisMethod)].size1() <= IntegrationPointIndex )
262 <<
"No existing integration point" << std::endl;
264 KRATOS_DEBUG_ERROR_IF(mShapeFunctionsValues[
static_cast<int>(ThisMethod)].size2() <= ShapeFunctionIndex )
265 <<
"No existing shape function value" << std::endl;
267 return mShapeFunctionsValues[
static_cast<int>(ThisMethod)]( IntegrationPointIndex, ShapeFunctionIndex );
272 return mShapeFunctionsValues[
static_cast<int>(mDefaultMethod)](IntegrationPointIndex, ShapeFunctionIndex);
277 return mShapeFunctionsLocalGradients[
static_cast<int>(mDefaultMethod)];
283 return mShapeFunctionsLocalGradients[
static_cast<int>(ThisMethod)];
296 KRATOS_DEBUG_ERROR_IF(mShapeFunctionsLocalGradients[
static_cast<int>(ThisMethod)].size() <= IntegrationPointIndex )
297 <<
"No existing integration point" << std::endl;
299 return mShapeFunctionsLocalGradients[
static_cast<int>(ThisMethod)][IntegrationPointIndex];
307 KRATOS_DEBUG_ERROR_IF(mShapeFunctionsLocalGradients[
static_cast<int>(ThisMethod)].size() <= IntegrationPointIndex )
308 <<
"No existing integration point" << std::endl;
310 return mShapeFunctionsLocalGradients[
static_cast<int>(ThisMethod)][IntegrationPointIndex];
339 <<
"Shape functions cannot be accessed through ShapeFunctionDerivatives()" << std::endl;
341 if (DerivativeOrderIndex == 1)
343 return mShapeFunctionsLocalGradients[
static_cast<int>(ThisMethod)][IntegrationPointIndex];
346 KRATOS_DEBUG_ERROR_IF(mShapeFunctionsDerivatives[
static_cast<int>(ThisMethod)][DerivativeOrderIndex - 2].size() < IntegrationPointIndex)
347 <<
"Not enough integration points within geometry_shape_function_container. Geometry_shape_function_container has "
348 << mShapeFunctionsDerivatives[
static_cast<int>(ThisMethod)][DerivativeOrderIndex - 2].size()
349 <<
" integration points. Called integration point index: " << IntegrationPointIndex << std::endl;
351 return mShapeFunctionsDerivatives[
static_cast<int>(ThisMethod)][DerivativeOrderIndex - 2][IntegrationPointIndex];
379 if (DerivativeOrderIndex == 0)
380 return mShapeFunctionsValues[
static_cast<int>(ThisMethod)](IntegrationPointIndex, ShapeFunctionIndex);
381 if (DerivativeOrderIndex == 1)
382 return mShapeFunctionsLocalGradients[
static_cast<int>(ThisMethod)][IntegrationPointIndex](ShapeFunctionIndex, DerivativeOrderRowIndex);
384 return mShapeFunctionsDerivatives[
static_cast<int>(ThisMethod)][DerivativeOrderIndex - 2][IntegrationPointIndex](ShapeFunctionIndex, DerivativeOrderRowIndex);
392 virtual std::string
Info()
const
394 return "shape function container";
400 rOStream <<
"shape function container";
430 virtual void save(
Serializer& rSerializer )
const
432 rSerializer.
save(
"IntegrationPoints", mIntegrationPoints);
433 rSerializer.
save(
"ShapeFunctionsValues", mShapeFunctionsValues);
434 rSerializer.
save(
"ShapeFunctionsLocalGradients", mShapeFunctionsLocalGradients);
435 rSerializer.
save(
"ShapeFunctionsDerivatives", mShapeFunctionsDerivatives);
440 KRATOS_ERROR <<
"load function for geometry_shape_function_container not yet implemented." << std::endl;
441 rSerializer.
load(
"IntegrationPoints", mIntegrationPoints);
442 rSerializer.
load(
"ShapeFunctionsValues", mShapeFunctionsValues);
443 rSerializer.
load(
"ShapeFunctionsLocalGradients", mShapeFunctionsLocalGradients);
444 rSerializer.
load(
"ShapeFunctionsDerivatives", mShapeFunctionsDerivatives);
456 template<
typename TIntegrationMethodType>
461 template<
typename TIntegrationMethodType>
466 rOStream << std::endl;
IntegrationMethod
Definition: geometry_data.h:76
@ NumberOfIntegrationMethods
Definition: geometry_shape_function_container.h:60
const Matrix & ShapeFunctionsValues() const
Definition: geometry_shape_function_container.h:245
IntegrationPoint< 3 > IntegrationPointType
Integration points.
Definition: geometry_shape_function_container.h:77
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry_shape_function_container.h:231
DenseVector< ShapeFunctionsDerivativesType > ShapeFunctionsDerivativesIntegrationPointArrayType
Definition: geometry_shape_function_container.h:92
DenseVector< Matrix > ShapeFunctionsGradientsType
First derivatives/ gradients.
Definition: geometry_shape_function_container.h:85
double ShapeFunctionValue(IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex) const
Definition: geometry_shape_function_container.h:270
GeometryShapeFunctionContainer & operator=(const GeometryShapeFunctionContainer &rOther)
Definition: geometry_shape_function_container.h:191
const ShapeFunctionsGradientsType & ShapeFunctionsLocalGradients(IntegrationMethod ThisMethod) const
Definition: geometry_shape_function_container.h:280
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: geometry_shape_function_container.h:398
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry_shape_function_container.h:78
const ShapeFunctionsGradientsType & ShapeFunctionsLocalGradients() const
Definition: geometry_shape_function_container.h:275
KRATOS_CLASS_POINTER_DEFINITION(GeometryShapeFunctionContainer)
Pointer definition of GeometryShapeFunctionContainer.
const Matrix & ShapeFunctionLocalGradient(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
Definition: geometry_shape_function_container.h:292
SizeType IntegrationPointsNumber(IntegrationMethod ThisMethod) const
Definition: geometry_shape_function_container.h:226
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: geometry_shape_function_container.h:404
virtual std::string Info() const
Turn back information as a string.
Definition: geometry_shape_function_container.h:392
GeometryShapeFunctionContainer(IntegrationMethod ThisDefaultMethod, const IntegrationPointsContainerType &ThisIntegrationPoints, const ShapeFunctionsValuesContainerType &ThisShapeFunctionsValues, const ShapeFunctionsLocalGradientsContainerType &ThisShapeFunctionsLocalGradients)
Constructor for single integration point having the full containers.
Definition: geometry_shape_function_container.h:101
const Matrix & ShapeFunctionsValues(IntegrationMethod ThisMethod) const
Definition: geometry_shape_function_container.h:250
DenseVector< Matrix > ShapeFunctionsDerivativesType
Higher order derivatives.
Definition: geometry_shape_function_container.h:90
GeometryShapeFunctionContainer(IntegrationMethod ThisDefaultMethod, const IntegrationPointType &ThisIntegrationPoint, const Matrix &ThisShapeFunctionsValues, const DenseVector< Matrix > &ThisShapeFunctionsDerivatives)
Constructor ONLY for single integration point with multiple derivatives.
Definition: geometry_shape_function_container.h:133
std::array< Matrix, static_cast< int >IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsValuesContainerType
Shape functions.
Definition: geometry_shape_function_container.h:82
SizeType IntegrationPointsNumber() const
Definition: geometry_shape_function_container.h:221
std::array< IntegrationPointsArrayType, static_cast< int >IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType
Definition: geometry_shape_function_container.h:79
std::array< ShapeFunctionsDerivativesIntegrationPointArrayType, static_cast< int >IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsDerivativesContainerType
Definition: geometry_shape_function_container.h:94
double & ShapeFunctionDerivativeValue(IndexType IntegrationPointIndex, IndexType DerivativeOrderIndex, IndexType DerivativeOrderRowIndex, IndexType ShapeFunctionIndex, IntegrationMethod ThisMethod)
Definition: geometry_shape_function_container.h:372
std::size_t IndexType
Size types.
Definition: geometry_shape_function_container.h:73
TIntegrationMethodType IntegrationMethod
Defining enum of integration method.
Definition: geometry_shape_function_container.h:70
std::size_t SizeType
Definition: geometry_shape_function_container.h:74
bool HasIntegrationMethod(IntegrationMethod ThisMethod) const
Definition: geometry_shape_function_container.h:212
std::array< DenseVector< Matrix >, static_cast< int >IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsLocalGradientsContainerType
Definition: geometry_shape_function_container.h:86
const IntegrationPointsArrayType & IntegrationPoints(IntegrationMethod ThisMethod) const
Definition: geometry_shape_function_container.h:236
double ShapeFunctionValue(IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex, IntegrationMethod ThisMethod) const
Definition: geometry_shape_function_container.h:256
GeometryShapeFunctionContainer(IntegrationMethod ThisDefaultMethod, const IntegrationPointType &ThisIntegrationPoint, const Matrix &ThisShapeFunctionsValues, const Matrix &ThisShapeFunctionsGradients)
Constructor ONLY for single integration point with first derivatives.
Definition: geometry_shape_function_container.h:114
const Matrix & ShapeFunctionLocalGradient(IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex, IntegrationMethod ThisMethod) const
Definition: geometry_shape_function_container.h:302
virtual ~GeometryShapeFunctionContainer()
Destructor. Do nothing!!!
Definition: geometry_shape_function_container.h:185
IntegrationMethod DefaultIntegrationMethod() const
Definition: geometry_shape_function_container.h:207
GeometryShapeFunctionContainer()
Default Constructor.
Definition: geometry_shape_function_container.h:166
const Matrix & ShapeFunctionLocalGradient(IndexType IntegrationPointIndex) const
Definition: geometry_shape_function_container.h:286
const Matrix & ShapeFunctionDerivatives(IndexType DerivativeOrderIndex, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
Definition: geometry_shape_function_container.h:330
GeometryShapeFunctionContainer(const GeometryShapeFunctionContainer &rOther)
Copy constructor.
Definition: geometry_shape_function_container.h:175
Short class definition.
Definition: integration_point.h:52
Definition: amatrix_interface.h:41
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_DEBUG_ERROR_IF(conditional)
Definition: exception.h:171
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307
integer i
Definition: TensorModule.f:17