v0.13.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MoFEM::OpBaseDerivativesNext< 1 > Struct Reference

Specialisation for calculate directives for scalar base functions. More...

#include <src/finite_elements/BaseDerivativesDataOperators.hpp>

Inheritance diagram for MoFEM::OpBaseDerivativesNext< 1 >:
[legend]
Collaboration diagram for MoFEM::OpBaseDerivativesNext< 1 >:
[legend]

Public Member Functions

 OpBaseDerivativesNext (int derivative, boost::shared_ptr< MatrixDouble > base_mass_ptr, boost::shared_ptr< EntitiesFieldData > data_l2, const FieldApproximationBase b, const FieldSpace s, int verb=QUIET, Sev sev=Sev::verbose)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
- Public Member Functions inherited from MoFEM::OpBaseDerivativesBase
 OpBaseDerivativesBase (boost::shared_ptr< MatrixDouble > base_mass_ptr, boost::shared_ptr< EntitiesFieldData > data_l2, const FieldApproximationBase b, const FieldSpace s, int verb=QUIET, Sev sev=Sev::verbose)
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, const bool symm=true)
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
int getFEDim () const
 Get dimension of finite element. More...
 
EntityType getFEType () const
 Get dimension of finite element. More...
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
std::string getFEName () const
 Get name of the element. More...
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User call this function to loop over elements on the side of face. This function calls finite element with is operator to do calculations. More...
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User call this function to loop over parent elements. This function calls finite element with is operator to do calculations. More...
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User call this function to loop over parent elements. This function calls finite element with is operator to do calculations. More...
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User call this function to loop over parent elements. This function calls finite element with is operator to do calculations. More...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Protected Member Functions

template<int BASE_DIM>
MoFEMErrorCode doWorkImpl (int side, EntityType type, EntitiesFieldData::EntData &data)
 
template<int BASE_DIM, int SPACE_DIM>
MoFEMErrorCode setBaseImpl (EntitiesFieldData::EntData &data, EntitiesFieldData::EntData &ent_data)
 
- Protected Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
virtual MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 

Protected Attributes

int calcBaseDerivative
 
MatrixDouble nF
 
- Protected Attributes inherited from MoFEM::OpBaseDerivativesBase
FieldApproximationBase base
 
int verbosity
 
Sev severityLevel
 
boost::shared_ptr< MatrixDoublebaseMassPtr
 
boost::shared_ptr< EntitiesFieldDatadataL2
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType {
  OPROW = 1 << 0 , OPCOL = 1 << 1 , OPROWCOL = 1 << 2 , OPSPACE = 1 << 3 ,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity. More...
 
booldoVertices
 \deprectaed If false skip vertices More...
 
booldoEdges
 \deprectaed If false skip edges More...
 
booldoQuads
 \deprectaed More...
 
booldoTris
 \deprectaed More...
 
booldoTets
 \deprectaed More...
 
booldoPrisms
 \deprectaed More...
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 

Detailed Description

Specialisation for calculate directives for scalar base functions.

Template Parameters
<br>

Definition at line 69 of file BaseDerivativesDataOperators.hpp.

Constructor & Destructor Documentation

◆ OpBaseDerivativesNext()

MoFEM::OpBaseDerivativesNext< 1 >::OpBaseDerivativesNext ( int  derivative,
boost::shared_ptr< MatrixDouble base_mass_ptr,
boost::shared_ptr< EntitiesFieldData data_l2,
const FieldApproximationBase  b,
const FieldSpace  s,
int  verb = QUIET,
Sev  sev = Sev::verbose 
)

Definition at line 134 of file BaseDerivativesDataOperators.cpp.

138 : OpBaseDerivativesBase(base_mass_ptr, data_l2, b, s, verb, sev),
139 calcBaseDerivative(derivative) {
140 if (s != H1)
141 doEntities[MBVERTEX] = false;
142}
@ H1
continuous field
Definition: definitions.h:85
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.
OpBaseDerivativesBase(boost::shared_ptr< MatrixDouble > base_mass_ptr, boost::shared_ptr< EntitiesFieldData > data_l2, const FieldApproximationBase b, const FieldSpace s, int verb=QUIET, Sev sev=Sev::verbose)

Member Function Documentation

◆ doWork()

MoFEMErrorCode MoFEM::OpBaseDerivativesNext< 1 >::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
virtual

Operator for linear form, usually to calculate values on right hand side.

Reimplemented from MoFEM::DataOperator.

Reimplemented in MoFEM::OpBaseDerivativesNext< 3 >.

Definition at line 284 of file BaseDerivativesDataOperators.cpp.

285 {
286 return doWorkImpl<1>(side, type, data);
287}

◆ doWorkImpl()

template<int BASE_DIM>
MoFEMErrorCode MoFEM::OpBaseDerivativesNext< 1 >::doWorkImpl ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
protected

Definition at line 194 of file BaseDerivativesDataOperators.cpp.

195 {
197
198 auto &approx_base = data.getN(base);
199 const auto nb_approx_bases = approx_base.size2() / BASE_DIM;
200
201 if (nb_approx_bases) {
202
203 const auto fe_type = getFEType();
204 const auto nb_integration_pts = approx_base.size1();
205
206 const auto space_dim =
207 data.getDiffN(base).size2() / (BASE_DIM * nb_approx_bases);
208 auto &diff_approx_base = *(data.getNSharedPtr(
209 base, static_cast<BaseDerivatives>(calcBaseDerivative - 1)));
210 int nb_derivatives = BASE_DIM * pow(space_dim, calcBaseDerivative - 1);
211
212 auto &ent_data = dataL2->dataOnEntities[fe_type][0];
213 const int nb_prj_bases = ent_data.getN().size2();
214
215#ifndef NDEBUG
216 if (!baseMassPtr)
217 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
218 "Mass matrix is null pointer");
219#endif
220 auto &nN = *baseMassPtr;
221
222#ifndef NDEBUG
223 if (diff_approx_base.size2() != nb_approx_bases * nb_derivatives) {
224 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
225 "Number of derivatives and basses do not match");
226 }
227 if (ent_data.getN().size1() != nb_integration_pts) {
228 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
229 "Number of integration points is not consistent");
230 }
231 if (nN.size2() != nb_prj_bases) {
232 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
233 "Number of base functions and size of mass matrix does not math");
234 }
235#endif
236
237 nF.resize(nb_approx_bases * nb_derivatives, nb_prj_bases, false);
238 nF.clear();
239
240 auto t_w = getFTensor0IntegrationWeight();
241 // get base function gradient on rows
242
243 auto diff_base_ptr = &*diff_approx_base.data().begin();
244 // loop over integration points
245 for (int gg = 0; gg != nb_integration_pts; ++gg) {
246 // take into account Jacobian
247 const double alpha = t_w;
248
249 for (int r = 0; r != nb_approx_bases * nb_derivatives; ++r) {
250
251 // Rows are base functions
252 auto t_base = ent_data.getFTensor0N(base, gg, 0);
253 for (int rr = 0; rr != nb_prj_bases; ++rr) {
254 nF(r, rr) += alpha * (t_base * (*diff_base_ptr));
255 ++t_base;
256 }
257
258 ++diff_base_ptr;
259 }
260
261 ++t_w; // move to another integration weight
262 }
263
264 for (auto r = 0; r != nb_approx_bases * nb_derivatives; ++r) {
265 ublas::matrix_row<MatrixDouble> mc(nF, r);
266 cholesky_solve(nN, mc, ublas::lower());
267 }
268
269 if (space_dim == 3)
270 CHKERR setBaseImpl<BASE_DIM, 3>(data, ent_data);
271 else if (space_dim == 2)
272 CHKERR setBaseImpl<BASE_DIM, 2>(data, ent_data);
273 // else if (space_dim == 1)
274 // CHKERR setBaseImpl<BASE_DIM, 1>(data, ent_data);
275 else
276 SETERRQ1(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE,
277 "Space dim can be only 1,2,3 but is %d", space_dim);
278 }
279
281}
void cholesky_solve(const TRIA &L, VEC &x, ublas::lower)
solve system L L^T x = b inplace
Definition: cholesky.hpp:221
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_IMPOSSIBLE_CASE
Definition: definitions.h:35
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
constexpr int BASE_DIM
EntitiesFieldData::EntData::BaseDerivatives BaseDerivatives
int r
Definition: sdf.py:5
EntityType getFEType() const
Get dimension of finite element.
auto getFTensor0IntegrationWeight()
Get integration weights.
boost::shared_ptr< EntitiesFieldData > dataL2
boost::shared_ptr< MatrixDouble > baseMassPtr

◆ setBaseImpl()

template<int BASE_DIM, int SPACE_DIM>
MoFEMErrorCode MoFEM::OpBaseDerivativesNext< 1 >::setBaseImpl ( EntitiesFieldData::EntData data,
EntitiesFieldData::EntData ent_data 
)
protected

Definition at line 146 of file BaseDerivativesDataOperators.cpp.

147 {
149
150 const int nb_gauss_pts = data.getN(base).size1();
151 const int nb_approx_bases = data.getN(base).size2() / BASE_DIM;
152 const int nb_derivatives =
153 BASE_DIM * std::pow(SPACE_DIM, calcBaseDerivative - 1);
154
155 const int nb_prj_bases = ent_data.getN().size2();
156
157 auto &n_diff_shared_ptr = data.getNSharedPtr(
159 if (!n_diff_shared_ptr)
160 n_diff_shared_ptr = boost::make_shared<MatrixDouble>();
161
162 auto &nex_diff_base = *(n_diff_shared_ptr);
163 const int next_nb_derivatives = BASE_DIM * pow(SPACE_DIM, calcBaseDerivative);
164 nex_diff_base.resize(nb_gauss_pts, nb_approx_bases * next_nb_derivatives,
165 false);
166 nex_diff_base.clear();
167
169 auto next_diffs_ptr = &*nex_diff_base.data().begin();
170 auto t_next_diff = getFTensor1FromPtr<SPACE_DIM>(next_diffs_ptr);
171
172 for (int gg = 0; gg != nb_gauss_pts; ++gg) {
173
174 auto ptr = &*nF.data().begin();
175
176 for (auto r = 0; r != nb_approx_bases * nb_derivatives; ++r) {
177
178 auto l2_diff_base = ent_data.getFTensor1DiffN<SPACE_DIM>(base, gg, 0);
179 for (int rr = 0; rr != nb_prj_bases; ++rr) {
180 t_next_diff(i) += l2_diff_base(i) * (*ptr);
181 ++l2_diff_base;
182 ++ptr;
183 }
184
185 ++t_next_diff;
186 }
187 }
188
190}
constexpr int SPACE_DIM
FTensor::Index< 'i', SPACE_DIM > i

Member Data Documentation

◆ calcBaseDerivative

int MoFEM::OpBaseDerivativesNext< 1 >::calcBaseDerivative
protected

Definition at line 81 of file BaseDerivativesDataOperators.hpp.

◆ nF

Definition at line 82 of file BaseDerivativesDataOperators.hpp.


The documentation for this struct was generated from the following files: