genericinput_example_00001.cpp

Example of reading/writing a generic csv file of raw data.Using: GenericInput, GenericOutput, Chain

To run : ./genericinput_example_00001
To run (MPI Version): mpirun -np X genericinput_example_00001
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"
// =================================================================================== //
void test00001() {
/*
Creation of Generic output block to read a set of
point coordinates from point cloud as generic input in csv format.
*/
mimmo::GenericInput * read = new mimmo::GenericInput(true, true);
read->setReadFromFile(true);
read->setReadDir("input");
read->setFilename("generic_input_00001.csv");
read->setCSV(true);
/*
Creation of Generic output block to write a set of
point cloud coordinates as generic output in csv format.
*/
write->setFilename("generic_output_00001.csv");
write->setCSV(true);
/*
Define connection between read and write block, that is the list of point
coordinates.
*/
/*
Define the execution chain and push the interested block into it.
*/
ch0.addObject(read);
ch0.addObject(write);
/*
Execute the chain.
Use debug flag true to print out log info on execution.
*/
ch0.exec(true);
/*
Clean up & exit;
*/
delete read;
delete write;
}
// =================================================================================== //
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<<"genericinput_example_00001 exited with an error of type : "<<e.what()<<std::endl;
return 1;
}
#if MIMMO_ENABLE_MPI
MPI_Finalize();
#endif
return 0;
}
void setReadDir(std::string dir)
void exec(bool debug=false)
Definition: Chain.cpp:284
Chain is the class used to manage the chain execution of multiple executable blocks (manipulation obj...
Definition: Chain.hpp:48
void setFilename(std::string filename)
void setCSV(bool csv)
GenericOutput is the class that write generic data in a file output.
GenericInput is the class that set the initialization of a generic input data.
void setCSV(bool csv)
bool addPin(BaseManipulation *objSend, BaseManipulation *objRec, PortID portS, PortID portR, bool forced)
void setReadFromFile(bool readFromFile)
void setFilename(std::string filename)
int addObject(BaseManipulation *obj, int id_=-1)
Definition: Chain.cpp:170
#define M_COORDS