geohandlers_example_00000.cpp
Example of usage of selection block to select a sub-patch of an input geometry.Using: SelectionByCylinder, MimmoGeometry, Chain.
To run : ./geohandlers_example_00000
To run (MPI version): mpirun -np X geohandlers_example_00000
visit: mimmo website
/*---------------------------------------------------------------------------*\
*
* mimmo
*
* Copyright (C) 2015-2021 OPTIMAD engineering Srl
*
* -------------------------------------------------------------------------
* License
* This file is part of mimmo.
*
* mimmo is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License v3 (LGPL)
* as published by the Free Software Foundation.
*
* mimmo is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with mimmo. If not, see <http://www.gnu.org/licenses/>.
*
\ *---------------------------------------------------------------------------*/
#include "mimmo_geohandlers.hpp"
#include <bitpit_common.hpp>
// =================================================================================== //
// =================================================================================== //
void test00001() {
/*
Read a STL geometry (namely a plane). Convert mode will also write the just read geometry
in the new stl file (specified with setWriteFilename)
*/
mimmo0->setReadFileType(FileType::STL);
mimmo0->setWriteFileType(FileType::STL);
/*
Write a STL geometry.
*/
mimmo1->setWriteDir(".");
mimmo1->setWriteFileType(FileType::STL);
mimmo1->setWriteFilename("geohandlers_output_00000.0001");
/*
Select a subportion of geometry using a cylinder shape
*/
sel3->setOrigin({{0.5, 0.0, 0.0}});
sel3->setSpan({{0.75, 2.0*BITPIT_PI, 0.4}});
sel3->setInfLimits({{0.25, 0.0, 0.0}});
sel3->setRefSystem({{0,1,0}}, {{0,0,1}}, {{1,0,0}});
/*
Define block pin connections.
*/
/*
Setup execution chain.
*/
mimmo::Chain ch0;
ch0.addObject(mimmo0);
ch0.addObject(sel3);
ch0.addObject(mimmo1);
/*
Execute the chain.
Use debug flag true to to print out the execution steps.
*/
/* Clean up & exit;
*/
delete sel3;
delete mimmo0;
delete mimmo1;
return;
}
// =================================================================================== //
int main( int argc, char *argv[] ) {
BITPIT_UNUSED(argc);
BITPIT_UNUSED(argv);
#if MIMMO_ENABLE_MPI
MPI_Init(&argc, &argv);
#endif
try{
test00001();
}
catch(std::exception & e){
std::cout<<"geohandlers_example_00000 exited with an error of type : "<<e.what()<<std::endl;
return 1;
}
#if MIMMO_ENABLE_MPI
MPI_Finalize();
#endif
return 0;
}
void setInfLimits(double val, int dir)
Definition: BasicShapes.cpp:163
Chain is the class used to manage the chain execution of multiple executable blocks (manipulation obj...
Definition: Chain.hpp:48
void setWriteFileType(FileType type)
Definition: MimmoGeometry.cpp:230
void setWriteFilename(std::string filename)
Definition: MimmoGeometry.cpp:268
void setRefSystem(darray3E, darray3E, darray3E)
Definition: BasicShapes.cpp:196
void setReadFilename(std::string filename)
Definition: MimmoGeometry.cpp:221
bool addPin(BaseManipulation *objSend, BaseManipulation *objRec, PortID portS, PortID portR, bool forced)
Definition: MimmoNamespace.cpp:68
MimmoGeometry is an executable block class wrapping(linking or internally instantiating) a Mimmo Obje...
Definition: MimmoGeometry.hpp:151
void setPlotInExecution(bool)
Definition: BaseManipulation.cpp:443
void setReadFileType(FileType type)
Definition: MimmoGeometry.cpp:192