35 #include <Epetra_ConfigDefs.h>    38 #include <Epetra_MpiComm.h>    40 #include <Epetra_SerialComm.h>    43 #include <Teuchos_ParameterList.hpp>    45 #include <lifev/core/LifeV.hpp>    47 #include <lifev/core/array/MatrixEpetra.hpp>    49 #include <lifev/core/fem/FESpace.hpp>    51 #include <lifev/core/filter/GetPot.hpp>    53 #include <lifev/core/mesh/MeshPartitionTool.hpp>    54 #include <lifev/core/mesh/RegionMesh3DStructured.hpp>    55 #include <lifev/core/mesh/RegionMesh.hpp>    57 #include <lifev/core/solver/ADRAssembler.hpp>    59 using namespace LifeV;
    68 int main ( 
int argc, 
char** argv )
    72     MPI_Init (&argc, &argv);
    73     std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
    75     std::shared_ptr<Epetra_Comm> Comm (
new Epetra_SerialComm);
    78     const bool verbose (Comm->MyPID() == 0);
    82     GetPot cl (argc, argv);
    83     const UInt numElements = cl.follow (9, 
"--num-elem");
    86     const std::string graphLib = cl.follow (
"parmetis", 
"--graph-lib");
    88     if (verbose) std::cout << 
" ---> Number of elements : "    89                                << numElements << std::endl;
    95         std::cout << 
" -- Building the mesh ... " << std::flush;
    97     std::shared_ptr< mesh_Type > fullMeshPtr (
new RegionMesh<LinearTetra>);
    98     std::shared_ptr< mesh_Type > meshPart;
    99     regularMesh3D ( *fullMeshPtr, 1, numElements, numElements, numElements, 
false,
   104         std::cout << 
" done ! " << std::endl;
   109         std::cout << 
" -- Partitioning the mesh ... " << std::flush;
   112         Teuchos::ParameterList meshParameters;
   113         meshParameters.set (
"num-parts", Comm->NumProc(), 
"");
   114         meshParameters.set (
"graph-lib", graphLib, 
"");
   115         meshCutter_Type meshCutter (fullMeshPtr, Comm, meshParameters);
   116         if (! meshCutter.success() )
   120                 std::cout << 
"Partitioning failed." << std::endl;
   124         meshPart = meshCutter.meshPart();
   128         std::cout << 
" done ! " << std::endl;
   133         std::cout << 
" -- Freeing the global mesh ... " << std::flush;
   138         std::cout << 
" done ! " << std::endl;
   144         std::cout << 
" -- Building FESpaces ... " << std::flush;
   146     std::string uOrder (
"P1");
   147     std::string bOrder (
"P1");
   148     std::shared_ptr < FESpace < mesh_Type,
   150           uFESpace (
new FESpace < mesh_Type,
   151                     MapEpetra > (meshPart,
   156     std::shared_ptr < FESpace < mesh_Type,
   158           betaFESpace (
new FESpace < mesh_Type,
   159                        MapEpetra > (meshPart,
   166         std::cout << 
" done ! " << std::endl;
   168     if (verbose) std::cout << 
" ---> Dofs: "   169                                << uFESpace->dof().numTotalDof() << std::endl;
   175         std::cout << 
" -- Building assembler ... " << std::flush;
   177     ADRAssembler<mesh_Type, matrix_Type, vector_Type> adrAssembler;
   180         std::cout << 
" done! " << std::endl;
   185         std::cout << 
" -- Setting up assembler ... " << std::flush;
   187     adrAssembler.setup (uFESpace, betaFESpace);
   190         std::cout << 
" done! " << std::endl;
   195         std::cout << 
" -- Defining the matrix ... " << std::flush;
   197     std::shared_ptr<matrix_Type>
   198     systemMatrix (
new matrix_Type (uFESpace->map() ) );
   199     *systemMatrix *= 0.0;
   202         std::cout << 
" done! " << std::endl;
   209         std::cout << 
" -- Adding the diffusion ... " << std::flush;
   211     adrAssembler.addDiffusion (systemMatrix, 1.0);
   214         std::cout << 
" done! " << std::endl;
   218         std::cout << 
" Time needed : "   219                   << adrAssembler.diffusionAssemblyChrono().diffCumul()
   225         std::cout << 
" -- Closing the matrix ... " << std::flush;
   227     systemMatrix->globalAssemble();
   230         std::cout << 
" done ! " << std::endl;
   233     Real matrixNorm (systemMatrix->normFrobenius() );
   236         std::cout << 
" ---> Norm 1 : " << matrixNorm << std::endl;
   238     if ( std::fabs (matrixNorm - 35.908 ) > 1e-3)
   240         std::cout << 
" <!> Matrix has changed !!! <!> " << std::endl;
   246         std::cout << 
"End Result: TEST PASSED" << std::endl;
   253     return ( EXIT_SUCCESS );
 VectorEpetra - The Epetra Vector format Wrapper. 
 
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler. 
 
MatrixEpetra< Real > matrix_Type
 
int main(int argc, char **argv)
 
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file. 
 
std::shared_ptr< feSpace_Type > feSpacePtr_Type
 
FESpace< mesh_Type, MapEpetra > feSpace_Type
 
MeshPartitionTool< mesh_Type > meshCutter_Type
 
Epetra_Import const  & importer()
Getter for the Epetra_Import. 
 
double Real
Generic real data. 
 
RegionMesh< LinearTetra > mesh_Type