54 #include <Epetra_ConfigDefs.h> 57 #include <Epetra_MpiComm.h> 59 #include <Epetra_SerialComm.h> 63 #include <lifev/core/LifeV.hpp> 65 #include <lifev/core/mesh/MeshPartitioner.hpp> 66 #include <lifev/core/mesh/RegionMesh3DStructured.hpp> 67 #include <lifev/core/mesh/RegionMesh.hpp> 68 #include <lifev/core/array/MatrixEpetra.hpp> 69 #include <lifev/eta/fem/ETFESpace.hpp> 70 #include <lifev/eta/expression/Integrate.hpp> 72 #include <boost/shared_ptr.hpp> 81 using namespace LifeV;
87 int main (
int argc,
char** argv )
91 MPI_Init (&argc, &argv);
92 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
94 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_SerialComm);
97 const bool verbose (Comm->MyPID() == 0);
109 std::cout <<
" -- Building and partitioning the mesh ... " << std::flush;
112 const UInt Nelements (10);
114 std::shared_ptr< mesh_Type > fullMeshPtr (
new mesh_Type ( Comm ) );
116 regularMesh3D ( *fullMeshPtr, 1, Nelements, Nelements, Nelements,
false,
120 std::shared_ptr< mesh_Type > meshPtr;
122 MeshPartitioner< mesh_Type > meshPart (fullMeshPtr, Comm);
123 meshPtr = meshPart.meshPartition();
130 std::cout <<
" done ! " << std::endl;
141 std::cout <<
" -- Building the scalar ETFESpace ... " << std::flush;
144 std::shared_ptr<ETFESpace< mesh_Type, MapEpetra, 3, 1 > > scalarSpace
145 (
new ETFESpace< mesh_Type, MapEpetra, 3, 1 > (meshPtr, &feTetraP1, Comm) );
149 std::cout <<
" done ! " << std::endl;
153 std::cout <<
" ---> Dofs: " << scalarSpace->dof().numTotalDof() << std::endl;
158 std::cout <<
" -- Defining the matrix ... " << std::flush;
163 std::cout <<
" -- Defining the matrix ... " << std::flush;
166 std::shared_ptr<matrix_Type> scalarMatrix (
new matrix_Type ( scalarSpace->map() ) );
168 *scalarMatrix *= 0.0;
172 std::cout <<
" done! " << std::endl;
177 std::cout <<
" done! " << std::endl;
230 std::cout <<
" -- Assembling the scalar matrix ... " << std::flush;
234 using namespace ExpressionAssembly;
280 VectorSmall<3> V1 (1.0, 0.0, 0.0);
282 integrate ( elements (scalarSpace->mesh() ),
286 dot ( grad (phi_i) , grad (phi_j) )
289 - dot ( grad (phi_i), phi_i * V1) *phi_j
297 std::cout <<
" done! " << std::endl;
313 std::cout <<
" -- Closing the matrix ... " << std::flush;
316 scalarMatrix->globalAssemble();
320 std::cout <<
" done ! " << std::endl;
323 Real matrixNorm ( scalarMatrix->normInf() );
327 std::cout <<
" Matrix norm : " << matrixNorm << std::endl;
334 Real matrixNormDiff (std::abs (matrixNorm - 3.2) );
338 std::cout <<
" Error : " << matrixNormDiff << std::endl;
341 Real testTolerance (1e-10);
343 if ( matrixNormDiff < testTolerance )
345 return ( EXIT_SUCCESS );
347 return ( EXIT_FAILURE );
int main(int argc, char **argv)
MatrixEpetra< Real > matrix_Type
double Real
Generic real data.
RegionMesh< LinearTetra > mesh_Type