25 {
26
28
29 try {
30
31 moab::Core mb_instance;
32 moab::Interface &moab = mb_instance;
33 int rank;
34 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
35
36 PetscBool flg = PETSC_TRUE;
38#if PETSC_VERSION_GE(3, 6, 4)
40 255, &flg);
41#else
44#endif
45 if (flg != PETSC_TRUE) {
46 SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
47 }
48
49
52
53 const char *option;
54 option = "";
55 ;
57
58
60 bit_level0.set(0);
62 CHKERR moab.create_meshset(MESHSET_SET, meshset_level0);
65 0, 3, bit_level0);
66
67
70
71
73
74
79
80
82
83
85
87
88
90
93
95 "TEST_FE");
96
97
98
99
109
110
111
112
114
116
118
119
122
124
125
126
127
130
132
134
135 typedef tee_device<std::ostream, std::ofstream>
TeeDevice;
137
139
140 std::ofstream ofs;
143
144 my_mult_H1_H1()
145 : ofs("forces_and_sources_getting_mult_H1_H1_atom_test.txt"),
146 my_tee(
std::cout, ofs), my_split(my_tee){};
147
148 ~my_mult_H1_H1() { my_split.close(); }
149
150 ublas::matrix<FieldData> NN;
151
157
160 int nb_row_dofs = row_data.
getN().size2();
161 int nb_col_dofs = col_data.
getN().size2();
162
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);
168
171
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;
176
177 for (
unsigned int gg = 0; gg < row_data.
getN().size1(); gg++) {
178
179 bzero(&*NN.data().begin(),
180 nb_row_dofs * nb_col_dofs *
sizeof(
FieldData));
181
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);
185
186 my_split << "gg " << gg << " : ";
187 my_split << std::setprecision(3);
188 my_split << std::fixed;
189
191 NN - outer_prod(row_data.
getN(gg), col_data.
getN(gg));
193
194 my_split << difference << std::endl;
195 if (row_type != MBVERTEX) {
196 my_split << row_data.
getDiffN(gg) << std::endl;
197 }
198
199 if (row_type == MBVERTEX) {
200 my_split << row_data.
getDiffN() << std::endl;
201 } else {
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;
207 }
208 }
209
210 my_split << std::endl;
211
213 }
214 };
215
216 my_mult_H1_H1 op;
217
220
224 }
225
227
230
233
234 CHKERR getEntitySense<MBEDGE>(data_row);
235 CHKERR getEntitySense<MBTRI>(data_row);
236 CHKERR getEntitySense<MBEDGE>(data_col);
237 CHKERR getEntitySense<MBTRI>(data_col);
238
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);
247
248 const auto bn1 = mField.get_field_bit_number("FIELD1");
249 const auto bn2 = mField.get_field_bit_number("FIELD2");
250
261
263 for (int gg = 0; gg < 4; gg++) {
268 }
270 gauss_pts,
274 gauss_pts,
277
278 CHKERR op.opLhs(data_row, data_col);
279
281 }
282
285
287 }
288 };
289
290 ForcesAndSourcesCore_TestFE fe1(m_field);
292 }
294
296
297 return 0;
298}
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. 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 CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
#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 ...
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 build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
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 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
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_filed)=0
set finite element field data
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
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
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.
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.
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 partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
MoFEMErrorCode partitionSimpleProblem(const std::string name, int verb=VERBOSE)
partition problem dofs
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
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 add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
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
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
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.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
base operator to do operations at Gauss Pt. level
Deprecated interface functions.
Class used to pass element data to calculate base functions on tet,triangle,edge.
Data on single entity (This is passed as argument to DataOperator::doWork)
FieldApproximationBase & getBase()
Get approximation base.
MatrixDouble & getDiffN(const FieldApproximationBase base)
get derivatives of base functions
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
data structure for finite element entity
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
structure to get information form mofem into EntitiesFieldData
MoFEMErrorCode getEntityRowIndices(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
MoFEMErrorCode getRowNodesIndices(EntitiesFieldData &data, const int bit_number) const
get row node indices from FENumeredDofEntity_multiIndex
MoFEMErrorCode getSpacesAndBaseOnEntities(EntitiesFieldData &data) const
Get field approximation space and base on entities.
virtual MoFEMErrorCode operator()()
function is run for every finite element
MoFEMErrorCode getFaceNodes(EntitiesFieldData &data) const
Get nodes on faces.
MoFEMErrorCode getEntityFieldData(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
virtual MoFEMErrorCode preProcess()
function is run at the beginning of loop
MoFEMErrorCode getColNodesIndices(EntitiesFieldData &data, const int bit_number) const
get col node indices from FENumeredDofEntity_multiIndex
MoFEMErrorCode getEntityColIndices(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
virtual MoFEMErrorCode postProcess()
function is run at the end of loop
Problem manager is used to build and partition problems.
Calculate base functions on tetrahedral.
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.