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" 64 #include <lifev/core/LifeV.hpp> 66 #include <lifev/core/fem/QuadratureRuleProvider.hpp> 68 #include <lifev/core/mesh/MeshPartitioner.hpp> 69 #include <lifev/core/mesh/RegionMesh3DStructured.hpp> 70 #include <lifev/core/mesh/RegionMesh.hpp> 72 #include <lifev/core/array/MatrixEpetra.hpp> 74 #include <lifev/eta/fem/ETFESpace.hpp> 76 #include <lifev/eta/expression/Integrate.hpp> 78 #include <boost/shared_ptr.hpp> 86 using namespace LifeV;
92 int main (
int argc,
char** argv )
96 MPI_Init (&argc, &argv);
97 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
99 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_SerialComm);
102 const bool verbose (Comm->MyPID() == 0);
107 std::cout <<
" -- Building and partitioning the mesh ... " << std::flush;
110 const UInt Nelements (10);
112 std::shared_ptr< mesh_Type > fullMeshPtr (
new mesh_Type);
114 regularMesh3D ( *fullMeshPtr, 1, Nelements, Nelements, Nelements,
false,
118 MeshPartitioner< mesh_Type > meshPart (fullMeshPtr, Comm);
124 std::cout <<
" done ! " << std::endl;
130 std::cout <<
" -- Building ETFESpaces ... " << std::flush;
133 std::shared_ptr<ETFESpace< mesh_Type, MapEpetra, 3, 1 > > uSpace
134 (
new ETFESpace< mesh_Type, MapEpetra, 3, 1 > (meshPart, &feTetraP1, Comm) );
138 std::cout <<
" done ! " << std::endl;
142 std::cout <<
" ---> Dofs: " << uSpace->dof().numTotalDof() << std::endl;
148 std::cout <<
" -- Defining the matrix ... " << std::flush;
151 std::shared_ptr<matrix_Type> systemMatrix (
new matrix_Type ( uSpace->map() ) );
153 *systemMatrix *= 0.0;
157 std::cout <<
" done! " << std::endl;
163 std::cout <<
" -- Assembling the Laplace matrix ... " << std::flush;
168 using namespace ExpressionAssembly;
192 integrate ( elements (uSpace->mesh() ),
193 QuadratureRuleProvider::provideExactness (TETRA, 0),
196 dot ( grad (phi_i) , grad (phi_j) )
203 std::cout <<
" done! " << std::endl;
216 std::cout <<
" -- Changing the behaviour of the QRProvider ... " << std::flush;
221 QuadratureRuleProvider::setBehaviorNoPreciseExactness (QuadratureRuleProvider::WarningAndReturnSup );
226 std::cout <<
" done ! " << std::endl;
237 std::cout <<
" -- Closing the matrix ... " << std::flush;
240 systemMatrix->globalAssemble();
244 std::cout <<
" done ! " << std::endl;
248 Real matrixNorm ( systemMatrix->normInf() );
252 std::cout <<
" Matrix norm : " << matrixNorm << std::endl;
260 Real matrixNormDiff (std::abs (matrixNorm - 3.2) );
264 std::cout <<
" Error : " << matrixNormDiff << std::endl;
267 Real testTolerance (1e-10);
269 if ( matrixNormDiff < testTolerance )
271 return ( EXIT_SUCCESS );
273 return ( EXIT_FAILURE );
int main(int argc, char **argv)
MatrixEpetra< Real > matrix_Type
double Real
Generic real data.
RegionMesh< LinearTetra > mesh_Type