41 #include <Epetra_ConfigDefs.h> 44 #include <Epetra_MpiComm.h> 46 #include <Epetra_SerialComm.h> 50 #include <lifev/core/array/MapEpetra.hpp> 51 #include <lifev/core/array/VectorEpetra.hpp> 55 using namespace LifeV;
61 std::cout <<
"MPI Initialization" << std::endl;
62 MPI_Init ( &argc, &argv );
70 std::shared_ptr<Epetra_Comm> comm;
78 MPI_Comm_size ( MPI_COMM_WORLD, &nprocs );
79 MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
83 std::cout <<
"MPI processes: " << nprocs << std::endl;
85 std::cout <<
"MPI Epetra Initialization ... " << std::endl;
87 comm.reset (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
93 std::cout <<
"MPI SERIAL Epetra Initialization ... " << std::endl;
94 comm.reset (
new Epetra_SerialComm() );
97 std::cout << std::setprecision (15) << std::endl;
101 typedef std::shared_ptr<Vector> Vector_ptr;
103 Int MyGlobalIElementsA[3], MyGlobalIElementsB[2];
104 MyGlobalIElementsA[0] = 0;
105 MyGlobalIElementsA[1] = 1;
106 MyGlobalIElementsA[2] = 2;
107 MyGlobalIElementsB[0] = 0;
108 MyGlobalIElementsB[1] = 1;
110 MapEpetra mapA ( 3, 3, &MyGlobalIElementsA[0], comm);
111 MapEpetra mapB ( 2, 2, &MyGlobalIElementsB[0], comm);
113 Vector_ptr A1, B1, A2, B2, A3, B3, A4, B4;
114 A1.reset (
new Vector ( mapA, Unique ) );
115 B1.reset (
new Vector ( mapB, Unique ) );
116 A2.reset (
new Vector ( mapA, Unique ) );
117 B2.reset (
new Vector ( mapB, Unique ) );
118 A3.reset (
new Vector ( mapA, Unique ) );
119 B3.reset (
new Vector ( mapB, Unique ) );
120 A4.reset (
new Vector ( mapA, Unique ) );
121 B4.reset (
new Vector ( mapB, Unique ) );
124 for ( UInt i (0) ; i <
static_cast<UInt> (A1->size() ) ; ++i )
128 for ( UInt i (0) ; i <
static_cast<UInt> (B1->size() ) ; ++i )
130 (*B1) [i] = A1->size() + i;
133 for ( UInt i (0) ; i <
static_cast<UInt> (A2->size() ) ; ++i )
137 for ( UInt i (0) ; i <
static_cast<UInt> (B2->size() ) ; ++i )
139 (*B2) [i] = (A2->size() + i) * 10;
142 for ( UInt i (0) ; i <
static_cast<UInt> (A3->size() ) ; ++i )
146 for ( UInt i (0) ; i <
static_cast<UInt> (B3->size() ) ; ++i )
148 (*B3) [i] = (A3->size() + i) * 100;
151 for ( UInt i (0) ; i <
static_cast<UInt> (A4->size() ) ; ++i )
155 for ( UInt i (0) ; i <
static_cast<UInt> (B4->size() ) ; ++i )
157 (*B4) [i] = (A4->size() + i) * 1000;
160 UInt result = TestFunction ( A1, B1, A2, B2, A3, B3, A4, B4 );
168 typedef boost::numeric::ublas::vector<Real> VectorBOOST;
169 typedef std::shared_ptr<VectorBOOST> VectorBOOST_ptr;
172 VectorBOOST_ptr A1_BOOST, B1_BOOST, A2_BOOST, B2_BOOST;
174 A1_BOOST.reset (
new VectorBOOST (2) );
178 B1_BOOST.reset (
new VectorBOOST (3) );
183 A2_BOOST.reset (
new VectorBOOST (2) );
185 (*A2_BOOST) [1] = 10;
187 B2_BOOST.reset (
new VectorBOOST (3) );
188 (*B2_BOOST) [0] = 20;
189 (*B2_BOOST) [1] = 30;
190 (*B2_BOOST) [2] = 40;
199 std::cout << std::endl <<
"MPI Finalization" << std::endl;
VectorEpetra - The Epetra Vector format Wrapper.
int32_type Int
Generic integer data.
void updateInverseJacobian(const UInt &iQuadPt)
Epetra_Import const & importer()
Getter for the Epetra_Import.
int main(int argc, char **argv)
uint32_type UInt
generic unsigned integer (used mainly for addressing)