|
| v0.14.0
|
Atom test verifying forces and sources operator on H1 approx. space.
More...
Go to the source code of this file.
Atom test verifying forces and sources operator on H1 approx. space.
Definition in file forces_and_sources_getting_mult_H1_H1_atom_test.cpp.
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 25 of file forces_and_sources_getting_mult_H1_H1_atom_test.cpp.
34 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
36 PetscBool flg = PETSC_TRUE;
38 #if PETSC_VERSION_GE(3, 6, 4)
45 if (flg != PETSC_TRUE) {
46 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
62 CHKERR moab.create_meshset(MESHSET_SET, meshset_level0);
135 typedef tee_device<std::ostream, std::ofstream>
TeeDevice;
145 : ofs(
"forces_and_sources_getting_mult_H1_H1_atom_test.txt"),
146 my_tee(
std::cout, ofs), my_split(my_tee){};
148 ~my_mult_H1_H1() { my_split.close(); }
150 ublas::matrix<FieldData> NN;
152 MoFEMErrorCode doWork(
int row_side,
int col_side, EntityType row_type,
160 int nb_row_dofs = row_data.
getN().size2();
161 int nb_col_dofs = col_data.
getN().size2();
163 my_split << row_side <<
" " << col_side <<
" " << row_type <<
" "
164 << col_type << std::endl;
165 my_split <<
"nb_row_dofs " << nb_row_dofs <<
" nb_col_dofs "
166 << nb_col_dofs << std::endl;
167 NN.resize(nb_row_dofs, nb_col_dofs);
172 my_split << std::setprecision(3);
173 my_split << std::fixed;
174 my_split << row_data.
getN() << std::endl;
175 my_split << col_data.
getN() << std::endl;
177 for (
unsigned int gg = 0; gg < row_data.
getN().size1(); gg++) {
179 bzero(&*NN.data().begin(),
180 nb_row_dofs * nb_col_dofs *
sizeof(
FieldData));
182 cblas_dger(CblasRowMajor, nb_row_dofs, nb_col_dofs, 1,
183 &row_data.
getN()(gg, 0), 1, &col_data.
getN()(gg, 0), 1,
184 &*NN.data().begin(), nb_col_dofs);
186 my_split <<
"gg " << gg <<
" : ";
187 my_split << std::setprecision(3);
188 my_split << std::fixed;
191 NN - outer_prod(row_data.
getN(gg), col_data.
getN(gg));
194 my_split << difference << std::endl;
195 if (row_type != MBVERTEX) {
196 my_split << row_data.
getDiffN(gg) << std::endl;
199 if (row_type == MBVERTEX) {
200 my_split << row_data.
getDiffN() << std::endl;
202 typedef ublas::array_adaptor<FieldData> storage_t;
203 storage_t st(nb_row_dofs * 3, &row_data.
getDiffN()(gg, 0));
204 ublas::matrix<FieldData, ublas::row_major, storage_t>
205 digNatGaussPt(nb_row_dofs, 3, st);
206 my_split << std::endl << digNatGaussPt << std::endl;
210 my_split << std::endl;
234 CHKERR getEntitySense<MBEDGE>(data_row);
235 CHKERR getEntitySense<MBTRI>(data_row);
236 CHKERR getEntitySense<MBEDGE>(data_col);
237 CHKERR getEntitySense<MBTRI>(data_col);
239 CHKERR getEntityDataOrder<MBEDGE>(data_row,
H1);
240 CHKERR getEntityDataOrder<MBEDGE>(data_col,
H1);
241 CHKERR getEntityDataOrder<MBTRI>(data_row,
H1);
242 CHKERR getEntityDataOrder<MBTRI>(data_col,
H1);
243 CHKERR getEntityDataOrder<MBTET>(data_row,
H1);
244 CHKERR getEntityDataOrder<MBTET>(data_col,
H1);
248 const auto bn1 = mField.get_field_bit_number(
"FIELD1");
249 const auto bn2 = mField.get_field_bit_number(
"FIELD2");
263 for (
int gg = 0; gg < 4; gg++) {
278 CHKERR op.opLhs(data_row, data_col);
290 ForcesAndSourcesCore_TestFE fe1(m_field);
◆ zero_entries()
template<typename T >
void zero_entries |
( |
T & |
t | ) |
|
◆ eps
◆ help
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MoFEMErrorCode getEntityRowIndices(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
Data on single entity (This is passed as argument to DataOperator::doWork)
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
base operator to do operations at Gauss Pt. level
Problem manager is used to build and partition problems.
Class used to pass element data to calculate base functions on tet,triangle,edge.
MoFEMErrorCode getFaceNodes(EntitiesFieldData &data) const
Get nodes on faces.
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
MatrixDouble & getDiffN(const FieldApproximationBase base)
get derivatives of base functions
virtual MoFEMErrorCode preProcess()
function is run at the beginning of loop
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
Deprecated interface functions.
MoFEMErrorCode getEntityFieldData(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
DeprecatedCoreInterface Interface
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
#define CHKERR
Inline error check.
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string name_row)=0
set field col which finite element use
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
MoFEMErrorCode getColNodesIndices(EntitiesFieldData &data, const int bit_number) const
get col node indices from FENumeredDofEntity_multiIndex
FieldApproximationBase & getBase()
Get approximation base.
MoFEMErrorCode getEntityColIndices(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
virtual MoFEMErrorCode operator()()
function is run for every finite element
constexpr double t
plate stiffness
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
MoFEMErrorCode partitionFiniteElements(const std::string name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=VERBOSE)
partition finite elements
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
MoFEMErrorCode getSpacesAndBaseOnEntities(EntitiesFieldData &data) const
Get field approximation space and base on entities.
MoFEMErrorCode getRowNodesIndices(EntitiesFieldData &data, const int bit_number) const
get row node indices from FENumeredDofEntity_multiIndex
structure to get information form mofem into EntitiesFieldData
const double v
phase velocity of light in medium (cm/ns)
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define CATCH_ERRORS
Catch errors.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
MoFEMErrorCode partitionSimpleProblem(const std::string name, int verb=VERBOSE)
partition problem dofs
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
data structure for finite element entity
virtual MoFEMErrorCode postProcess()
function is run at the end of loop
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
@ CONTINUOUS
Regular field.
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
virtual MoFEMErrorCode add_field(const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Calculate base functions on tetrahedral.