core_example_00002.cpp
1 /*---------------------------------------------------------------------------*\
2  *
3  * mimmo
4  *
5  * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6  *
7  * -------------------------------------------------------------------------
8  * License
9  * This file is part of mimmo.
10  *
11  * mimmo is free software: you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License v3 (LGPL)
13  * as published by the Free Software Foundation.
14  *
15  * mimmo is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with mimmo. If not, see <http://www.gnu.org/licenses/>.
22  *
23  \ *---------------------------------------------------------------------------*/
24 
25 #include "Lattice.hpp"
26 #include <bitpit_common.hpp>
27 
28 // =================================================================================== //
43 // =================================================================================== //
44 
45 void test00002() {
46 
47  /*
48  Create a Lattice of cylindrical shape
49  */
50  mimmo::Lattice * latt3 = new mimmo::Lattice();
52  latt3->setOrigin({{0.5, 0.0, 0.0}});
53  latt3->setSpan({{0.75, 2.0*BITPIT_PI, 0.4}});
54  latt3->setInfLimits({{0.25, 0.0, 0.0}});
55  latt3->setRefSystem({{0,1,0}}, {{0,0,1}}, {{1,0,0}});
56  latt3->setDimension(iarray3E({{2, 35, 2}}));
57  latt3->setPlotInExecution(true);
58  latt3->exec();
59 
60  /*
61  Create a Lattice of wedge shape (prism with triangular basis)
62  */
63  mimmo::Lattice * lattw = new mimmo::Lattice();
65  lattw->setOrigin({{1.0, 0.0, 0.0}});
66  lattw->setSpan({{1.0, 0.75, 0.4}});
67  lattw->setRefSystem(2, {{0,1,0}});
68  lattw->setDimension(iarray3E({{5, 5, 4}}));
69  lattw->setPlotInExecution(true);
70  lattw->exec();
71 
72 
73  /* Clean up & exit;
74  */
75  delete lattw;
76  delete latt3;
77 
78  return;
79 }
80 
81 // =================================================================================== //
82 
83 int main( int argc, char *argv[] ) {
84 
85  BITPIT_UNUSED(argc);
86  BITPIT_UNUSED(argv);
87 
88 #if MIMMO_ENABLE_MPI
89  MPI_Init(&argc, &argv);
90 #endif
91  try{
93  test00002();
94  }
95  catch(std::exception & e){
96  std::cout<<"core_example_00002 exited with an error of type : "<<e.what()<<std::endl;
97  return 1;
98  }
99 #if MIMMO_ENABLE_MPI
100  MPI_Finalize();
101 #endif
102 
103  return 0;
104 }
std::array< int, 3 > iarray3E
void setDimension(ivector1D dim)
void setRefSystem(darray3E, darray3E, darray3E)
void setOrigin(darray3E origin)
void setShape(ShapeType type=ShapeType::CUBE)
void setSpan(double, double, double)
void setInfLimits(double val, int dir)
Structured 3D Cartesian Mesh.
Definition: Lattice.hpp:103