58 #pragma GCC diagnostic ignored "-Wunused-variable" 59 #pragma GCC diagnostic ignored "-Wunused-parameter" 61 #include <Epetra_ConfigDefs.h> 64 #include <Epetra_MpiComm.h> 66 #include <Epetra_SerialComm.h> 69 #pragma GCC diagnostic warning "-Wunused-variable" 70 #pragma GCC diagnostic warning "-Wunused-parameter" 73 #include <lifev/core/LifeV.hpp> 75 #include <lifev/core/mesh/MeshPartitioner.hpp> 76 #include <lifev/core/mesh/RegionMesh3DStructured.hpp> 77 #include <lifev/core/mesh/RegionMesh.hpp> 79 #include <lifev/core/array/MatrixEpetra.hpp> 81 #include <lifev/eta/fem/ETFESpace.hpp> 83 #include <lifev/eta/expression/Integrate.hpp> 85 #include <lifev/eta/fem/QRAdapterBase.hpp> 87 #include <boost/shared_ptr.hpp> 91 using namespace LifeV;
112 template<
typename MeshType >
258 bool positiveVertices (
false);
259 bool negativeVertices (
false);
261 for (
UInt iterVertex (0); iterVertex < 4; ++iterVertex)
263 Real x (M_mesh->element (elementID).point (iterVertex).coordinate (0) );
264 Real y (M_mesh->element (elementID).point (iterVertex).coordinate (1) );
268 negativeVertices =
true;
270 else if (x - 2 * y > 0)
272 positiveVertices =
true;
286 M_adaptedQR.reset (
new QuadratureRule (
"Monte-Carlo", TETRA, 3, 0, 0) );
291 Real x ( std::rand() /
Real (RAND_MAX) );
292 Real y ( std::rand() /
Real (RAND_MAX) );
293 Real z ( std::rand() /
Real (RAND_MAX) );
297 M_adaptedQR->addPoint (QuadraturePoint (x, y, z, 1.0 / (6.0 * M_nbPoints) ) );
319 if (position
[0
] - 2 * position
[1
] > 0)
342 int main (
int argc,
char** argv )
346 MPI_Init (&argc, &argv);
347 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
349 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_SerialComm);
352 const bool verbose (Comm->MyPID() == 0);
357 std::cout <<
" -- Building and partitioning the mesh ... " << std::flush;
360 const UInt Nelements (10);
362 std::shared_ptr< mesh_Type > fullMeshPtr (
new mesh_Type);
364 regularMesh3D ( *fullMeshPtr, 1, Nelements, Nelements, Nelements,
false,
368 MeshPartitioner< mesh_Type > meshPart (fullMeshPtr, Comm);
374 std::cout <<
" done ! " << std::endl;
386 std::cout <<
" -- Computing the volume (std) ... " << std::flush;
389 Real localIntegralStd (0.0);
392 using namespace ExpressionAssembly;
394 std::shared_ptr<fFunctor> fFct (
new fFunctor);
396 integrate ( elements (meshPart.meshPartition() ),
403 Real globalIntegralStd (0.0);
406 Comm->SumAll (&localIntegralStd, &globalIntegralStd, 1);
411 std::cout <<
" done! " << std::endl;
415 std::cout <<
" Integral: " << globalIntegralStd << std::endl;
427 std::cout <<
" -- Computing the volume (adapted) ... " << std::flush;
430 Real localIntegralAdapted (0.0);
433 using namespace ExpressionAssembly;
435 std::shared_ptr<fFunctor> fFct (
new fFunctor);
437 MCQuadrature<mesh_Type> myQuad (meshPart.meshPartition(), quadRuleTetra1pt, 1e4);
439 integrate ( elements (meshPart.meshPartition() ),
443 >> localIntegralAdapted;
446 Real globalIntegralAdapted (0.0);
449 Comm->SumAll (&localIntegralAdapted, &globalIntegralAdapted, 1);
454 std::cout <<
" done! " << std::endl;
458 std::cout <<
" Integral: " << globalIntegralAdapted << std::endl;
470 if ( std::abs (4 - globalIntegralAdapted) < 1e-2 )
472 return ( EXIT_SUCCESS );
474 return ( EXIT_FAILURE );
int main(int argc, char **argv)
QRAdapterBase< MCQuadrature< MeshType > > base_Type
MatrixEpetra< Real > matrix_Type
void computeQuadRule(UInt elementID)
Real const & operator[](UInt const &i) const
Operator [].
std::shared_ptr< MeshType > M_mesh
void update(UInt elementID)
fFunctor(const fFunctor &)
MCQuadrature(const MCQuadrature< MeshType > &qr)
return_Type operator()(const VectorSmall< 3 > &position)
std::shared_ptr< QuadratureRule > M_adaptedQR
double Real
Generic real data.
const QuadratureRule & standardQR() const
RegionMesh< LinearTetra > mesh_Type
MCQuadrature(std::shared_ptr< MeshType > mesh, const QuadratureRule &stdQR, const UInt &nbPoints)
QuadratureRule - The basis class for storing and accessing quadrature rules.
const QuadratureRule & adaptedQR() const
bool isAdaptedElement() const
uint32_type UInt
generic unsigned integer (used mainly for addressing)