LifeV
testExportImport.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief test for ExporterEnsight
30 
31  @author Tiziano Passerini <tiziano@mathcs.emory.edu>
32  @contributor Simone Deparis
33  @maintainer
34 
35  @date 13-1-2011
36 
37  */
38 
39 
40 #include <Epetra_ConfigDefs.h>
41 #include <Epetra_Comm.h>
42 
43 
44 #include <lifev/core/LifeV.hpp>
45 #include "../importExport/RossEthierSteinmanDec.hpp"
46 #include "../importExport/TestImportExport.hpp"
47 
48 #include <lifev/core/filter/ExporterEnsight.hpp>
49 #include <lifev/core/filter/ExporterVTK.hpp>
50 #include <lifev/core/filter/ExporterHDF5.hpp>
51 
52 
56 
57 
58 
59 using namespace LifeV;
60 
61 int
62 main ( int argc, char** argv )
63 {
64  //MPI communicator initialization
65  std::shared_ptr<Epetra_Comm> commPtr;
66 
67 #ifdef HAVE_MPI
68  std::cout << "MPI Initialization" << std::endl;
69  MPI_Init ( &argc, &argv );
70 #endif
71 
72  //MPI Preprocessing
73 #ifdef EPETRA_MPI
74 
75  int nprocs;
76  int rank;
77 
78  MPI_Comm_size ( MPI_COMM_WORLD, &nprocs );
79  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
80 
81  if ( rank == 0 )
82  {
83  std::cout << "MPI processes: " << nprocs << std::endl;
84  std::cout << "MPI Epetra Initialization ... " << std::endl;
85  }
86  commPtr.reset ( new Epetra_MpiComm ( MPI_COMM_WORLD ) );
87 
88  commPtr->Barrier();
89 
90 #else
91 
92  std::cout << "MPI SERIAL Epetra Initialization ... " << std::endl;
93  commPtr.reset ( new Epetra_SerialComm() );
94 
95 #endif
96 
97  GetPot command_line (argc, argv);
98  TestImportExport testImportExport ( commPtr );
99 
100  bool passed (false);
101 
102  const std::string exporterName = command_line.follow ("ensight", 2, "-e", "--exporter");
103 
104  if ( exporterName.compare ( "vtk" ) == 0 )
105  {
106  passed = testImportExport.run<vtk_Type, vtk_Type > ( command_line, "export" );
107  }
108  else if ( exporterName.compare ( "ensight" ) == 0 )
109  {
110  passed = testImportExport.run<ensight_Type, ensight_Type > ( command_line, "export" );
111  }
112 #ifdef HAVE_HDF5
113  else
114  {
115  passed = testImportExport.run<hdf5_Type, hdf5_Type > ( command_line, "export" );
116  }
117 #endif
118 
119  // ----- End of test calls -----
120 
121 #ifdef HAVE_MPI
122  std::cout << "MPI Finalization" << std::endl;
123  MPI_Finalize();
124 #endif
125 
126  if (passed)
127  {
128  return EXIT_SUCCESS;
129  }
130  else
131  {
132  return EXIT_FAILURE;
133  }
134 }
ExporterEnsight data exporter.
LifeV::RegionMesh< LifeV::LinearTetra > mesh_Type
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
Definition: GetPot.hpp:507
LifeV::ExporterHDF5< TestImportExport::mesh_Type > hdf5_Type
LifeV::ExporterEnsight< TestImportExport::mesh_Type > ensight_Type
LifeV::ExporterVTK< TestImportExport::mesh_Type > vtk_Type
const std::string follow(const char *Default, unsigned No, const char *Option,...)
Definition: GetPot.hpp:1510
int main(int argc, char **argv)
ExporterVTK data exporter.
Definition: ExporterVTK.hpp:57