genericinput_example_00004.cpp
Example of reading point positions and displacements related to a RBF manipulator, and applying deformation to a target meshUsing: IOCloudPoints, MRBF, MimmoGeometry, Chain
To run : ./genericinput_example_00003
To run (MPI version): mpirun -np X genericinput_example_00003
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_iogeneric.hpp"
#include "MRBF.hpp"
// =================================================================================== //
void test00004() {
/*
Reading and Writing a STL geometry (namely a plane)
*/
read->setReadFileType(FileType::STL);
read->setWriteFileType(FileType::SURFVTU);
/*
Reading a point cloud and their associated displacements from file.
These will serve as input to create the RBF manipulator
*/
/*
Create the RBF manipulator. Shape and Support Radius of RBF function
need to be specified
*/
rbf->setFunction(bitpit::RBFBasisFunction::C1C1);
rbf->setSupportRadiusReal(0.6);
rbf->setApply(true); //when chain executed, this will apply directly the deformation calculated to the target geometry
/*
Create block connections.
*/
/*
Define the execution chain.
*/
mimmo::Chain ch0;
ch0.addObject(read);
ch0.addObject(iocp);
ch0.addObject(rbf);
/*
Execute the chain.
Use debug flag true to print out the execution steps.
*/
/*
print the deformed geometry
*/
/* Clean up & exit;
*/
delete read;
delete iocp;
delete rbf;
}
// =================================================================================== //
int main( int argc, char *argv[] ) {
BITPIT_UNUSED(argc);
BITPIT_UNUSED(argv);
#if MIMMO_ENABLE_MPI
MPI_Init(&argc, &argv);
#endif
try{
test00004();
}
catch(std::exception & e){
std::cout<<"genericinput_example_00004 exited with an error of type : "<<e.what()<<std::endl;
return 1;
}
#if MIMMO_ENABLE_MPI
MPI_Finalize();
#endif
return 0;
}
void setReadFilename(std::string filename)
Definition: IOCloudPoints.cpp:167
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 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
IOCloudPoints is the class to read from file a set of cloud 3D points w/ attached a scalar field of f...
Definition: IOCloudPoints.hpp:131
MimmoSharedPointer< MimmoObject > getGeometry()
Definition: BaseManipulation.cpp:235
void setFunction(const MRBFBasisFunction &funct, bool isCompact=false)
Definition: MRBF.cpp:594