11 : sEnse(0), oRder(0), bAse(
NOBASE), entDataBitRefLevel(),
12 N(baseFunctionsAndBaseDerivatives[ZeroDerivative]),
13 diffN(baseFunctionsAndBaseDerivatives[FirstDerivative]) {
14 if (allocate_base_matrices) {
17 for (
int b = 0; b !=
LASTBASE; ++b) {
33boost::shared_ptr<MatrixDouble> &
36 return baseFunctionsAndBaseDerivatives[derivative][base];
39boost::shared_ptr<MatrixDouble> &
53 auto set_default = [&]() {
54 std::array<size_t, MBMAXTYPE> count;
55 std::fill(count.begin(), count.end(), 0);
56 const int dim_type = moab::CN::Dimension(
type);
58 if (
type != MBVERTEX) {
59 for (
auto dd = dim_type; dd > 0; --dd) {
60 int nb_ents = moab::CN::NumSubEntities(
type, dd);
61 for (
int ii = 0; ii != nb_ents; ++ii) {
62 auto sub_ent_type = moab::CN::SubEntityType(
type, dd, ii);
63 count[sub_ent_type] = nb_ents;
65 for (
auto tt = moab::CN::TypeDimensionMap[dd].first;
66 tt <= moab::CN::TypeDimensionMap[dd].second; ++tt) {
94 const boost::shared_ptr<EntitiesFieldData> &data_ptr) {
99 for (
int tt = MBVERTEX; tt != MBMAXTYPE; ++tt) {
100 auto &ent_data = data_ptr->dataOnEntities[tt];
102 for (
auto c = derived_ent_data.size();
c < ent_data.size(); ++
c) {
103 boost::shared_ptr<EntData> ent_data_ptr(data_ptr, &ent_data[
c]);
104 derived_ent_data.push_back(
new DerivedEntData(ent_data_ptr));
106 derived_ent_data.resize(ent_data.size());
111 const boost::shared_ptr<EntitiesFieldData> &data_ptr)
129 dOfs.resize(0,
false);
136 for (EntityType
t = MBVERTEX;
t != MBMAXTYPE;
t++)
138 CHKERR e.resetFieldDependentData();
146 auto make_swap = [](boost::shared_ptr<MatrixDouble> &ptr,
147 boost::shared_ptr<MatrixDouble> &ptrBB,
148 boost::shared_ptr<MatrixDouble> &swap_ptr) {
157 make_swap(getNSharedPtr(base), getBBNSharedPtr(
field_name), swapBaseNPtr);
158 make_swap(getDiffNSharedPtr(base), getBBDiffNSharedPtr(
field_name),
167 for (
int tt = MBVERTEX; tt != MBENTITYSET; ++tt) {
169 for (
auto &side_data : ent_data)
178 auto make_swap = [](boost::shared_ptr<MatrixDouble> &ptr,
179 boost::shared_ptr<MatrixDouble> &ptrBB,
180 boost::shared_ptr<MatrixDouble> &swap_ptr) {
189 make_swap(getDerivedNSharedPtr(base), getBBNSharedPtr(
field_name),
191 make_swap(getDerivedDiffNSharedPtr(base), getBBDiffNSharedPtr(
field_name),
197 const boost::shared_ptr<EntitiesFieldData::EntData> &ent_data_ptr)
204boost::shared_ptr<MatrixDouble> &
207 if (baseFunctionsAndBaseDerivatives[derivative][base])
208 return baseFunctionsAndBaseDerivatives[derivative][base];
210 return entDataPtr->getNSharedPtr(base, derivative);
213boost::shared_ptr<MatrixDouble> &
219 return entDataPtr->getNSharedPtr(base);
222boost::shared_ptr<MatrixDouble> &
228 return entDataPtr->getDiffNSharedPtr(base);
230const boost::shared_ptr<MatrixDouble> &
236 return entDataPtr->getNSharedPtr(base);
238const boost::shared_ptr<MatrixDouble> &
244 return entDataPtr->getDiffNSharedPtr(base);
249 os <<
"sEnse: " << e.
getSense() << std::endl
250 <<
"oRder: " << e.
getOrder() << std::endl
251 <<
"global indices: " << e.
getIndices() << std::endl
254 os <<
"fieldData: " << std::fixed << std::setprecision(2) << e.
getFieldData()
259 const double eps = 1e-6;
260 for (
unsigned int ii = 0; ii != base.size1(); ii++) {
261 for (
unsigned int jj = 0; jj != base.size2(); jj++) {
262 if (fabs(base(ii, jj)) <
eps)
266 for (
unsigned int ii = 0; ii != diff_base.size1(); ii++) {
267 for (
unsigned int jj = 0; jj != diff_base.size2(); jj++) {
268 if (fabs(diff_base(ii, jj)) <
eps)
269 diff_base(ii, jj) = 0;
272 os <<
"N: " << std::fixed << base << std::endl
273 <<
"diffN: " << std::fixed << diff_base;
278 for (EntityType
t = MBVERTEX;
t != MBMAXTYPE; ++
t) {
280 os <<
"dataOnEntities[" << moab::CN::EntityTypeName(
t) <<
"][" << nn
294template <
int Tensor_Dim0,
int Tensor_Dim1>
296 Tensor_Dim0, Tensor_Dim1>
299 s <<
"Template for tensor dimension " << Tensor_Dim0 <<
"x" << Tensor_Dim1
300 <<
" not implemented";
305template <
int Tensor_Dim0,
int Tensor_Dim1>
307 Tensor_Dim0, Tensor_Dim1>
309 const int gg,
const int bb) {
311 s <<
"Template for tensor dimension " << Tensor_Dim0 <<
"x" << Tensor_Dim1
312 <<
" not implemented";
319EntitiesFieldData::EntData::getFTensor2DiffN<3, 3>(
321 double *t_diff_n_ptr = &*getDiffN(base).
data().begin();
331 const int gg,
const int bb) {
332 double *t_diff_n_ptr = &getDiffN(base)(gg, 9 * bb);
341EntitiesFieldData::EntData::getFTensor2DiffN<3, 2>(
343 double *t_diff_n_ptr = &*getDiffN(base).data().begin();
352 const int gg,
const int bb) {
353 double *t_diff_n_ptr = &getDiffN(base)(gg, 6 * bb);
362 double *ptr = &(getN(base, BaseDerivatives::SecondDerivative))(0, 0);
377template <
int Tensor_Dim0,
int Tensor_Dim1,
int Tensor_Dim2>
380 Tensor_Dim0, Tensor_Dim1, Tensor_Dim2>
383 s <<
"Template for tensor dimension " << Tensor_Dim0 <<
"x" << Tensor_Dim1
384 <<
"x" << Tensor_Dim2 <<
" not implemented";
389template <
int Tensor_Dim0,
int Tensor_Dim1,
int Tensor_Dim2>
391 Tensor_Dim0, Tensor_Dim1, Tensor_Dim2>
393 const int gg,
const int bb) {
395 s <<
"Template for tensor dimension " << Tensor_Dim0 <<
"x" << Tensor_Dim1
396 <<
" not implemented";
404 double *ptr = &*getDiffN(base).
data().begin();
411 const int gg,
const int bb) {
412 double *ptr = &getDiffN(base)(gg, 27 * bb);
422boost::shared_ptr<MatrixInt> &
428boost::shared_ptr<MatrixDouble> &
436const boost::shared_ptr<MatrixDouble> &
445boost::shared_ptr<MatrixDouble> &
453const boost::shared_ptr<MatrixDouble> &
459std::map<std::string, boost::shared_ptr<MatrixInt>> &
461 return bbAlphaIndices;
464std::map<std::string, boost::shared_ptr<MatrixDouble>> &
469std::map<std::string, boost::shared_ptr<MatrixDouble>> &
474boost::shared_ptr<MatrixInt> &
476 return bbAlphaIndicesByOrder[o];
479boost::shared_ptr<MatrixDouble> &
481 return bbNByOrder[o];
484boost::shared_ptr<MatrixDouble> &
486 return bbDiffNByOrder[o];
489std::array<boost::shared_ptr<MatrixInt>,
492 return bbAlphaIndicesByOrder;
495std::array<boost::shared_ptr<MatrixDouble>,
501std::array<boost::shared_ptr<MatrixDouble>,
504 return bbDiffNByOrder;
507boost::shared_ptr<MatrixInt> &
510 return entDataPtr->getBBAlphaIndicesSharedPtr(
field_name);
513boost::shared_ptr<MatrixDouble> &
516 return entDataPtr->getBBNSharedPtr(
field_name);
519const boost::shared_ptr<MatrixDouble> &
522 return entDataPtr->getBBNSharedPtr(
field_name);
528boost::shared_ptr<MatrixDouble> &
531 return entDataPtr->getBBDiffNSharedPtr(
field_name);
537const boost::shared_ptr<MatrixDouble> &
540 return entDataPtr->getBBDiffNSharedPtr(
field_name);
546 return entDataBitRefLevel;
549std::vector<BitRefLevel> &
551 return entDataPtr->getEntDataBitRefLevel();
T data[Tensor_Dim0][Tensor_Dim1]
T data[Tensor_Dim0][Tensor_Dim1][Tensor_Dim2]
FieldApproximationBase
approximation base
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
const double c
speed of light (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
implementation of Data Operators for Forces and Sources
static void constructor_derived_data(DerivedEntitiesFieldData *derived_data, const boost::shared_ptr< EntitiesFieldData > &data_ptr)
static void constructor_data(EntitiesFieldData *data, const EntityType type)
FTensor::Tensor3< FTensor::PackPtr< double *, 27 >, 3, 3, 3 > getFTensor3FromPtr< 3, 3, 3 >(double *ptr)
constexpr double t
plate stiffness
constexpr auto field_name
Derived data on single entity (This is passed as argument to DataOperator::doWork)
boost::shared_ptr< MatrixDouble > & getBBNSharedPtr(const std::string &field_name)
MoFEMErrorCode baseSwap(const std::string &field_name, const FieldApproximationBase base)
Used by Bernstein base to keep temporary pointer.
std::vector< BitRefLevel > & getEntDataBitRefLevel()
Get entity bit reference level.
int getSense() const
Get entity sense for conforming approximation fields.
boost::shared_ptr< MatrixInt > & getBBAlphaIndicesSharedPtr(const std::string &field_name)
boost::shared_ptr< MatrixDouble > & getBBDiffNSharedPtr(const std::string &field_name)
boost::shared_ptr< MatrixDouble > & getDiffNSharedPtr(const FieldApproximationBase base)
Get shared pointer to derivatives of base functions.
DerivedEntData(const boost::shared_ptr< EntitiesFieldData::EntData > &ent_data_ptr)
boost::shared_ptr< MatrixDouble > & getNSharedPtr(const FieldApproximationBase base, const BaseDerivatives derivative)
Get shared pointer to base functions with derivatives.
this class derives data from other data structure
MoFEMErrorCode setElementType(const EntityType type)
Set element type for derived data.
const boost::shared_ptr< EntitiesFieldData > dataPtr
DerivedEntitiesFieldData(const boost::shared_ptr< EntitiesFieldData > &data_ptr)
Construct DerivedEntitiesFieldData from existing EntitiesFieldData.
Data on single entity (This is passed as argument to DataOperator::doWork)
virtual std::array< boost::shared_ptr< MatrixDouble >, MaxBernsteinBezierOrder > & getBBDiffNByOrderArray()
FieldSpace sPace
Entity space.
virtual std::array< boost::shared_ptr< MatrixDouble >, MaxBernsteinBezierOrder > & getBBNByOrderArray()
VectorDouble fieldData
Field data on entity.
ApproximationOrder getOrder() const
Get approximation order.
VectorInt localIndices
Local indices on entity.
virtual std::array< boost::shared_ptr< MatrixInt >, MaxBernsteinBezierOrder > & getBBAlphaIndicesByOrderArray()
virtual std::map< std::string, boost::shared_ptr< MatrixInt > > & getBBAlphaIndicesMap()
static constexpr size_t MaxBernsteinBezierOrder
VectorInt iNdices
Global indices on entity.
virtual boost::shared_ptr< MatrixDouble > & getNSharedPtr(const FieldApproximationBase base, const BaseDerivatives derivative)
Get shared pointer to base functions with derivatives.
virtual boost::shared_ptr< MatrixInt > & getBBAlphaIndicesSharedPtr(const std::string &field_name)
const VectorDouble & getFieldData() const
Get DOF values on entity.
virtual boost::shared_ptr< MatrixDouble > & getBBDiffNByOrderSharedPtr(const size_t o)
get BB base derivative by order
virtual std::map< std::string, boost::shared_ptr< MatrixDouble > > & getBBNMap()
get hash map of base function for BB base, key is a field name
virtual MoFEMErrorCode baseSwap(const std::string &field_name, const FieldApproximationBase base)
Swap bases functions.
const VectorInt & getLocalIndices() const
Get local indices of degrees of freedom on entity.
FTensor::Tensor3< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 *Tensor_Dim2 >, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2 > getFTensor3DiffN()
Get derivatives of base functions for tonsorial Hdiv space.
virtual std::map< std::string, boost::shared_ptr< MatrixDouble > > & getBBDiffNMap()
get hash map of derivatives base function for BB base, key is a field name
virtual std::vector< BitRefLevel > & getEntDataBitRefLevel()
Get entity bit reference level.
virtual int getSense() const
Get entity sense for conforming approximation fields.
VectorFieldEntities fieldEntities
Field entities.
virtual boost::shared_ptr< MatrixInt > & getBBAlphaIndicesByOrderSharedPtr(const size_t o)
get ALpha indices for BB base by order
MoFEMErrorCode resetFieldDependentData()
FTensor::Tensor3< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 *Tensor_Dim2 >, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2 > getFTensor3Diff2N()
Get second derivatives of base functions for Hvec space.
virtual boost::shared_ptr< MatrixDouble > & getBBNSharedPtr(const std::string &field_name)
std::array< std::array< boost::shared_ptr< MatrixDouble >, LASTBASE >, LastDerivative > baseFunctionsAndBaseDerivatives
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2DiffN()
Get derivatives of base functions for Hdiv space.
VectorDofs dOfs
DoFs on entity.
virtual boost::shared_ptr< MatrixDouble > & getDiffNSharedPtr(const FieldApproximationBase base)
Get shared pointer to derivatives of base functions.
virtual boost::shared_ptr< MatrixDouble > & getBBNByOrderSharedPtr(const size_t o)
get BB base by order
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.
EntData(const bool allocate_base_matrices=true)
Construct EntData object.
FieldApproximationBase bAse
Field approximation base.
virtual boost::shared_ptr< MatrixDouble > & getBBDiffNSharedPtr(const std::string &field_name)
data structure for finite element entity
friend std::ostream & operator<<(std::ostream &os, const EntitiesFieldData &e)
MoFEMErrorCode resetFieldDependentData()
Reset data associated with particular field name.
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
virtual MoFEMErrorCode baseSwap(const std::string &field_name, const FieldApproximationBase base)
Swap approximation base.
virtual MoFEMErrorCode setElementType(const EntityType type)
Set element type and initialize data structures.