49 #pragma GCC diagnostic ignored "-Wunused-variable" 50 #pragma GCC diagnostic ignored "-Wunused-parameter" 52 #include <Epetra_ConfigDefs.h> 55 #include <Epetra_MpiComm.h> 57 #include <Epetra_SerialComm.h> 60 #pragma GCC diagnostic warning "-Wunused-variable" 61 #pragma GCC diagnostic warning "-Wunused-parameter" 69 #include <lifev/core/LifeV.hpp> 71 #include <lifev/core/mesh/MeshPartitioner.hpp> 72 #include <lifev/core/mesh/RegionMesh3DStructured.hpp> 73 #include <lifev/core/mesh/RegionMesh.hpp> 80 #include <lifev/core/fem/FESpace.hpp> 81 #include <lifev/core/array/VectorEpetra.hpp> 88 #include <lifev/eta/fem/ETFESpace.hpp> 96 #include <lifev/eta/expression/Integrate.hpp> 104 #include <boost/shared_ptr.hpp> 112 #include <lifev/level_set/fem/LevelSetQRAdapter.hpp> 120 using namespace LifeV;
133 return (x - 3 * y) / std::sqrt (10);
172 int main (
int argc,
char** argv )
176 MPI_Init (&argc, &argv);
177 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
179 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_SerialComm);
182 const bool verbose (Comm->MyPID() == 0);
194 std::cout <<
" -- Building and partitioning the mesh ... " << std::flush;
197 const UInt Nelements (10);
199 std::shared_ptr< mesh_Type > fullMeshPtr (
new mesh_Type);
201 regularMesh3D ( *fullMeshPtr, 1, Nelements, Nelements, Nelements,
false,
205 MeshPartitioner< mesh_Type > meshPart (fullMeshPtr, Comm);
211 std::cout <<
" done ! " << std::endl;
222 std::cout <<
" -- Building ETFESpace ... " << std::flush;
225 std::shared_ptr<ETFESpace< mesh_Type, MapEpetra, 3, 1 > > phiSpace
226 (
new ETFESpace< mesh_Type, MapEpetra, 3, 1 > (meshPart, &feTetraP1, Comm) );
230 std::cout <<
" done ! " << std::endl;
234 std::cout <<
" ---> Dofs: " << phiSpace->dof().numTotalDof() << std::endl;
244 std::cout <<
" -- Interpolation ... " << std::flush;
247 std::string phiOrder (
"P1");
248 FESpace<mesh_Type, MapEpetra> interpolationSpace (meshPart, phiOrder, 1, Comm);
250 vector_Type phiInterpolated (phiSpace->map(), Repeated);
251 interpolationSpace.interpolate (phiFct, phiInterpolated, 0.0);
255 std::cout <<
" done ! " << std::endl;
266 std::cout <<
" -- Computing the volume " << std::flush;
269 Real localVolume (0.0);
288 using namespace ExpressionAssembly;
290 std::shared_ptr<HeavisideFunctor> heaviside (
new HeavisideFunctor);
292 integrate ( elements (phiSpace->mesh() ),
293 adapt (phiSpace, phiInterpolated, quadRuleTetra1pt),
294 eval (heaviside, value (phiSpace, phiInterpolated) )
300 Real globalVolume (0.0);
303 Comm->SumAll (&localVolume, &globalVolume, 1);
307 std::cout <<
" done! " << std::endl;
311 std::cout <<
" Volume: " << globalVolume << std::endl;
329 Real absError (std::abs (globalVolume - 4) );
333 std::cout <<
" Error : " << absError << std::endl;
336 if ( absError < tol )
338 return ( EXIT_SUCCESS );
340 return ( EXIT_FAILURE );
int main(int argc, char **argv)
Real phiFct(const Real &, const Real &x, const Real &y, const Real &, const ID &)
HeavisideFunctor(const HeavisideFunctor &)
double Real
Generic real data.
return_Type operator()(const Real &value)
RegionMesh< LinearTetra > mesh_Type