1#ifndef ESHELBIAN_L2_ROTATION_HPP
2#define ESHELBIAN_L2_ROTATION_HPP
13 using DL = DataLayoutTraits<DataLayout::GaussByCoeffs>;
17 SmartPetscObj<Vec> vector = {})
18 :
OpBase(field,
std::move(total), vector, MBTET),
27 auto a = MatrixSizeHelper<GetFTensor1FromMatType<3, -1,
DL>,
DL>
::size(
29 auto q = MatrixSizeHelper<GetFTensor1FromMatType<3, -1,
DL>,
DL>
::size(
33 const int dofs =
data.getFieldData().size();
36 if (dofs < 3 || dofs % 3)
38 "L2 rotation requires a complete constant vector block");
44 auto coefficients = getFTensor1FromPtr<3>(&dotVector[0]);
45 c0(
i) = coefficients(
i);
47 auto coefficients =
data.getFTensor1FieldData<3>();
48 c0(
i) = coefficients(
i);
50 const double phi0 =
data.getN()(0, 0);
52 if (!std::isfinite(phi0) || phi0 == 0.)
54 "Invalid constant L2 rotation basis");
55 for (
int gg = 0; gg != points; ++gg)
56 if (std::abs(
data.getN()(gg, 0) - phi0) > 1.e-13)
58 "First L2 rotation basis must be constant");
60 auto total = MatrixSizeHelper<GetFTensor1FromMatType<3, -1,
DL>,
DL>::get(
62 for (
int gg = 0; gg != points; ++gg) {
64 q(
i) = total(
i) -
a(
i);
80template <AssemblyType Assembly>
82 : FormsIntegrators<VolUserDataOperator>::template Assembly<
84 using OpBase =
typename FormsIntegrators<
86 using DL = DataLayoutTraits<DataLayout::GaussByCoeffs>;
94 using View = GetFTensor1FromMatType<3, -1,
DL>;
95 auto values = std::array{MatrixSizeHelper<View, DL>::get(
97 MatrixSizeHelper<View, DL>::get(
100 auto weight = OpBase::getFTensor0IntegrationWeight();
102 const double alpha = weight * OpBase::getMeasure();
103 auto f = OpBase::template getNf<3>();
106 f(
i) += (alpha * basis) *
values[rr ? 1 : 0](
i);
boost::shared_ptr< DataAtIntegrationPts > data
SmartPetscObj< Vec > values
#define FTENSOR_INDEX(DIM, I)
#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 ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
boost::shared_ptr< MatrixDouble > MatrixPtr
typename FormsIntegrators< VolUserDataOperator >::template Assembly< Assembly >::OpBase OpBase
OpAssembleL2RotationLoad(const std::string &field, MatrixPtr constant, MatrixPtr higher)
MoFEMErrorCode iNtegrate(EntData &row_data) override
DataLayoutTraits< DataLayout::GaussByCoeffs > DL
OpCalculateL2RotationValues(const std::string &field, MatrixPtr total, MatrixPtr constant, MatrixPtr higher, SmartPetscObj< Vec > vector={})
MoFEMErrorCode doWork(int side, EntityType type, EntData &data) override
Operator for linear form, usually to calculate values on right hand side.
DataLayoutTraits< DataLayout::GaussByCoeffs > DL
Data on single entity (This is passed as argument to DataOperator::doWork)
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
int nbRows
number of dofs on rows
int nbIntegrationPts
number of integration points
int nbRowBaseFunctions
number or row base functions
Calculate field values for tensor field rank 1, i.e. vector field.
boost::shared_ptr< MatrixDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of vector field at integration points