IOWavefrontOBJ.cpp
368 built = (built && createPortIn<WavefrontOBJData*, ManipulateWFOBJData>(this, &ManipulateWFOBJData::setData, M_WAVEFRONTDATA, true));
369 built = (built && createPortIn<MimmoPiercedVector<long>*, ManipulateWFOBJData>(this, &ManipulateWFOBJData::addAnnotation, M_LONGFIELD));
370 built = (built && createPortIn<MimmoPiercedVector<long>*, ManipulateWFOBJData>(this, &ManipulateWFOBJData::setRecomputeNormalsCells, M_LONGFIELD2));
372 built = (built && createPortOut<WavefrontOBJData*, ManipulateWFOBJData>(this, &ManipulateWFOBJData::getData, M_WAVEFRONTDATA));
373 built = (built && createPortOut<std::vector<long>, ManipulateWFOBJData>(this, &ManipulateWFOBJData::getPinnedMaterialGroup, M_VECTORLI));
374 built = (built && createPortOut<std::vector<long>, ManipulateWFOBJData>(this, &ManipulateWFOBJData::getPinnedCellGroup, M_VECTORLI2));
375 built = (built && createPortOut<std::vector<long>, ManipulateWFOBJData>(this, &ManipulateWFOBJData::getPinnedSmoothGroup, M_VECTORLI3));
376 built = (built && createPortOut<std::vector<long>, ManipulateWFOBJData>(this, &ManipulateWFOBJData::getPinnedObjectGroup, M_VECTORLI4));
468 *(m_log)<<"Error in "<<m_name<<" : cannot connect WavefrontOBJData with nullptr refGeometry member"<<std::endl;
505 void ManipulateWFOBJData::setMultipleAnnotationStrategy(ManipulateWFOBJData::OverlapAnnotationMode mode){
516 void ManipulateWFOBJData::setNormalsComputeStrategy(ManipulateWFOBJData::NormalsComputeMode mode){
625 void ManipulateWFOBJData::absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name ){
768 throw std::runtime_error("Error in ManipulateWOBJData::execute() : no valid WavefrontOBJData linked");
790 for(auto it = m_extData->normals->getPatch()->vertexBegin(); it!=m_extData->normals->getPatch()->vertexEnd(); ++it){
793 if(!bitpit::utils::DoubleFloatingEqual()(norm_temp, 1.0) && norm_temp > std::numeric_limits<double>::min()){
811 *(m_log)<<"WARNING in "<<m_name<<" : WavefrontOBJData::cellgroups own ref geometry is different form WavefrontOBJData::refGeometry member. Proceed with the last one..."<<std::endl;
816 *(m_log)<<"WARNING in "<<m_name<<" : WavefrontOBJData::cellgroups MPV missing refGeometry or have uncoherent ids. Skipping annotation stage"<<std::endl;
871 *(m_log)<<"WARNING in "<<m_name<<" : WavefrontOBJData::normals is nullptr. No normals to recompute..."<<std::endl;
875 *(m_log)<<"WARNING in "<<m_name<<" : WavefrontOBJData::refGeometry is null. Cannot recompute normals."<<std::endl;
940 assert(conn_normals[i] >= 0 && "ManipulateWFOBJData::computeNormals cannot insert new vertex normal into WavefrontOBJData::normals. Data can be compromised");
948 vnormals->addConnectedCell(conn_normals, motherCell.getType(), long(motherCell.getPID()), idCell, rank);
988 *(m_log)<<"WARNING in "<<m_name<<" : WavefrontOBJData::refGeometry is null. Cannot extract pinned lists..."<<std::endl;
1022 m_pinnedCellLists[1].insert(m_pinnedCellLists[1].end(), idcontainer.begin(), idcontainer.end());
1227 built = (built && createPortIn<MimmoSharedPointer<MimmoObject>, IOWavefrontOBJ>(this, &IOWavefrontOBJ::setGeometry, M_GEOM, mandatoryWrite));
1228 built = (built && createPortIn<WavefrontOBJData*, IOWavefrontOBJ>(this, &IOWavefrontOBJ::setData, M_WAVEFRONTDATA));
1230 built = (built && createPortOut<MimmoSharedPointer<MimmoObject>, IOWavefrontOBJ>(this, &IOWavefrontOBJ::getGeometry, M_GEOM));
1231 built = (built && createPortOut<WavefrontOBJData*, IOWavefrontOBJ>(this, &IOWavefrontOBJ::getData, M_WAVEFRONTDATA));
1232 built = (built && createPortOut<MimmoPiercedVector<std::string>*, IOWavefrontOBJ>(this, &IOWavefrontOBJ::getMaterials, M_STRINGFIELD));
1233 built = (built && createPortOut<MimmoPiercedVector<std::string>*, IOWavefrontOBJ>(this, &IOWavefrontOBJ::getCellGroups, M_STRINGFIELD2));
1234 built = (built && createPortOut<MimmoPiercedVector<long>*, IOWavefrontOBJ>(this, &IOWavefrontOBJ::getSmoothIds, M_LONGFIELD));
1235 built = (built && createPortOut<MimmoSharedPointer<MimmoObject>, IOWavefrontOBJ>(this, &IOWavefrontOBJ::getNormals, M_GEOM3));
1236 built = (built && createPortOut<MimmoSharedPointer<MimmoObject>, IOWavefrontOBJ>(this, &IOWavefrontOBJ::getTextures, M_GEOM2));
1237 built = (built && createPortOut<std::string, IOWavefrontOBJ>(this, &IOWavefrontOBJ::getMaterialFile, M_NAME));
1445 void IOWavefrontOBJ::absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name ){
1637 searchObjectPosition(in, objectPositions, objectNames, objectVCounters, totVCounters, nCellTot);
1805 textures->addConnectedCell(txtnewc, sanitizedCell.getType(), sanitizedCell.getPID(), idd, int(-1));
1830 normals->addConnectedCell(normalnewc, sanitizedCell.getType(), sanitizedCell.getPID(), idd, int(-1));
1866 (*m_log)<<"WARNING: no geometry linked in "<<m_name<<". Nothing to write on file "<<filename<<'\n';
1874 (*m_log)<<"WARNING: no OBJ optional data in "<<m_name<<". Nothing to write on file "<<filename<<'\n';
1879 (*m_log)<<"WARNING: in "<<m_name<<". OBJ optional data linked refers to a different geometry w.r.t that linked in the current class. Nothing to write on "<<filename<<'\n';
2223 void IOWavefrontOBJ::readObjectData(std::ifstream & in, const std::streampos &begObjectStream, const long &PID,
2244 // I have already calculated the number of lines for each one and stored in the input vCounter[0,1,2],
2245 // so i can read the block of v lines (that are vCounter[0] lines) without controlling the typ of line each time.
2258 // 1: v/vt v/vt v/vt (texture prop attached. Be aware vt index has uniquely correspondence with v index)
2260 // 3: v//vn v//vn v//vn (normal prop attached. Be aware vn index has uniquely correspondence with v index)
2386 *(m_log)<<"WARNING "<<m_name<<" : skipping unsupported facet while reading obj file. "<<std::endl;
2436 *(m_log)<<"WARNING "<<m_name<<" : unsupported flag "<<key<<" declaration while reading obj file. Ignoring..."<<std::endl;
2510 //connectivity time. Use insertion maps and regroup by cellgroups-materials if any in m_extData.
2549 bitpit::ConstProxyVector<long> txtIds= objData->textures->getCells().at(idCell).getVertexIds();
2561 bitpit::ConstProxyVector<long> txtIds= objData->textures->getCells().at(idCell).getVertexIds();
2562 bitpit::ConstProxyVector<long> normalIds= objData->normals->getCells().at(idCell).getVertexIds();
2576 bitpit::ConstProxyVector<long> normalIds= objData->normals->getCells().at(idCell).getVertexIds();
void swap(WavefrontOBJData &x) noexcept
Definition: IOWavefrontOBJ.cpp:53
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
Definition: IOWavefrontOBJ.cpp:1445
OverlapAnnotationMode getMultipleAnnotationStrategy()
Definition: IOWavefrontOBJ.cpp:402
void setRecomputeNormalsCells(MimmoPiercedVector< long > *cellList)
Definition: IOWavefrontOBJ.cpp:454
void computeAnnotations()
Definition: IOWavefrontOBJ.cpp:806
void setGeometryTolerance(double tolerance)
Definition: IOWavefrontOBJ.cpp:1401
@ ANGLE_WEIGHTED
std::unordered_map< long, std::string > inv_materialsList
Definition: IOWavefrontOBJ.hpp:64
void clearRecomputeNormalsCells()
Definition: IOWavefrontOBJ.cpp:590
@ SYNC
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
Definition: IOWavefrontOBJ.cpp:625
void swap(ManipulateWFOBJData &x) noexcept
Definition: IOWavefrontOBJ.cpp:347
MimmoSharedPointer< MimmoObject > textures
Definition: IOWavefrontOBJ.hpp:56
void autoCompleteCellFields()
Definition: IOWavefrontOBJ.cpp:137
void setDir(const std::string &pathdir)
Definition: IOWavefrontOBJ.cpp:1384
void setTextureUVMode(bool UVmode)
Definition: IOWavefrontOBJ.cpp:1428
std::string searchMaterialFile(std::ifstream &in)
Definition: IOWavefrontOBJ.cpp:2097
void read(const std::string &fullpath)
Definition: IOWavefrontOBJ.cpp:1601
void setPinCellGroups(const std::vector< std::string > &cellgroupsList)
Definition: IOWavefrontOBJ.cpp:543
MimmoObject is the basic geometry container for mimmo library.
Definition: MimmoObject.hpp:143
std::unordered_map< std::string, long > smoothidsList
Definition: IOWavefrontOBJ.hpp:61
std::unordered_set< std::string > m_pinObjects
Definition: IOWavefrontOBJ.hpp:238
NormalsComputeMode getNormalsComputeStrategy()
Definition: IOWavefrontOBJ.cpp:411
std::vector< MimmoPiercedVector< long > > m_annotations
Definition: IOWavefrontOBJ.hpp:233
MPVLocation
Define data location for the MimmoPiercedVector field.
Definition: MimmoPiercedVector.hpp:39
std::string getMaterialFile()
Definition: IOWavefrontOBJ.cpp:1285
MimmoSharedPointer< MimmoObject > getNormals()
Definition: IOWavefrontOBJ.cpp:1342
Executable block handling io of 3D surface polygonal mesh in *.obj format.
Definition: IOWavefrontOBJ.hpp:336
void setGeometry(MimmoSharedPointer< MimmoObject > geo)
Definition: IOWavefrontOBJ.cpp:1353
void setName(std::string name)
Definition: MimmoPiercedVector.tpp:364
MimmoPiercedVector< std::string > materials
Definition: IOWavefrontOBJ.hpp:52
std::unordered_map< std::string, long > cellgroupsList
Definition: IOWavefrontOBJ.hpp:62
TreeGroups regroupCells(const WavefrontOBJData *objData, const livector1D &cellList)
Definition: IOWavefrontOBJ.cpp:2606
@ CELL
MimmoPiercedVector< std::string > cellgroups
Definition: IOWavefrontOBJ.hpp:54
void setCheckNormalsMagnitude(bool flag)
Definition: IOWavefrontOBJ.cpp:493
void checkNormalsMagnitude()
Definition: IOWavefrontOBJ.cpp:786
bool completeMissingData(const mpv_t &defValue)
Definition: MimmoPiercedVector.tpp:567
void searchObjectPosition(std::ifstream &in, std::vector< std::streampos > &mapPos, std::vector< std::string > &mapNames, std::vector< std::array< long, 3 >> &mapVCountObject, std::array< long, 3 > &mapVCountTotal, long &nCellTot)
Definition: IOWavefrontOBJ.cpp:2131
void warningXML(bitpit::Logger *log, std::string name)
Definition: MimmoNamespace.cpp:211
int countSubstring(const std::string &str, const std::string &sub)
Definition: customOperators.cpp:46
void readObjectData(std::ifstream &in, const std::streampos &begObjectStream, const long &PID, const std::string &defaultGroup, const std::array< long, 3 > &vCounter, long &vOffset, long &vnOffset, long &vTxtOffset, long &cOffset)
Definition: IOWavefrontOBJ.cpp:2223
MimmoSharedPointer< MimmoObject > normals
Definition: IOWavefrontOBJ.hpp:57
void addAnnotation(MimmoPiercedVector< long > *annotation)
Definition: IOWavefrontOBJ.cpp:481
void setMultipleAnnotationStrategy(OverlapAnnotationMode mode)
Definition: IOWavefrontOBJ.cpp:505
void squeezeOutExcept(const std::vector< long int > &list, bool keepOrder=false)
Definition: MimmoPiercedVector.tpp:864
std::unordered_map< long, std::string > getSubParts()
Definition: IOWavefrontOBJ.cpp:1275
Executable block manipulating optional data of WavefrontOBJ mesh.
Definition: IOWavefrontOBJ.hpp:158
MimmoSharedPointer< MimmoObject > getGeometry() const
Definition: MimmoPiercedVector.tpp:170
std::vector< long > getPinnedCellGroup()
Definition: IOWavefrontOBJ.cpp:428
void setIgnoreCellGroups(bool ignore)
Definition: IOWavefrontOBJ.cpp:1420
bool m_checkNormalsMag
Definition: IOWavefrontOBJ.hpp:234
void extractPinnedLists()
Definition: IOWavefrontOBJ.cpp:984
void setFilename(const std::string &name)
Definition: IOWavefrontOBJ.cpp:1393
std::unordered_map< long, std::string > inv_cellgroupsList
Definition: IOWavefrontOBJ.hpp:66
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
Definition: BaseManipulation.cpp:615
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
Definition: IOWavefrontOBJ.cpp:1528
MimmoPiercedVector< std::string > * getCellGroups()
Definition: IOWavefrontOBJ.cpp:1307
MimmoPiercedVector< long > * getSmoothIds()
Definition: IOWavefrontOBJ.cpp:1318
void setPinSmoothIds(const std::vector< int > &smoothidsList)
Definition: IOWavefrontOBJ.cpp:559
OverlapAnnotationMode m_annMode
Definition: IOWavefrontOBJ.hpp:235
std::unordered_set< std::string > m_pinCellGroups
Definition: IOWavefrontOBJ.hpp:240
MimmoPiercedVector< std::string > * getMaterials()
Definition: IOWavefrontOBJ.cpp:1296
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
Definition: BaseManipulation.cpp:670
void setData(WavefrontOBJData *data)
Definition: IOWavefrontOBJ.cpp:1372
MimmoSharedPointer< MimmoObject > m_geometry
Definition: BaseManipulation.hpp:144
std::array< double, 3 > evalVNormal(bitpit::SurfaceKernel *mesh, long idCell, int locVertex)
Definition: IOWavefrontOBJ.cpp:1064
MimmoSharedPointer< MimmoObject > refGeometry
Definition: IOWavefrontOBJ.hpp:70
NormalsComputeMode m_normalsMode
Definition: IOWavefrontOBJ.hpp:236
MimmoPiercedVector< long > m_normalsCells
Definition: IOWavefrontOBJ.hpp:232
void setGeometry(MimmoSharedPointer< MimmoObject > geo)
Definition: MimmoPiercedVector.tpp:314
void clearAnnotations()
Definition: IOWavefrontOBJ.cpp:584
void setNormalsComputeStrategy(NormalsComputeMode mode)
Definition: IOWavefrontOBJ.cpp:516
struct for storing cell data attached to Wavefront OBJ polygonal mesh
Definition: IOWavefrontOBJ.hpp:45
std::vector< long > getPinnedObjectGroup()
Definition: IOWavefrontOBJ.cpp:446
std::unordered_set< std::string > m_pinMaterials
Definition: IOWavefrontOBJ.hpp:239
MimmoSharedPointer< MimmoObject > getTextures()
Definition: IOWavefrontOBJ.cpp:1329
NormalsComputeMode
Strategy Mode to recompute Wavefront vertex normals on a set of candidate cells.
Definition: IOWavefrontOBJ.hpp:177
void setDataLocation(MPVLocation loc)
Definition: MimmoPiercedVector.tpp:324
std::vector< long > getPinnedMaterialGroup()
Definition: IOWavefrontOBJ.cpp:420
void setData(WavefrontOBJData *data)
Definition: IOWavefrontOBJ.cpp:465
void setCleanDoubleMeshVertices(bool clean)
Definition: IOWavefrontOBJ.cpp:1412
std::unordered_map< long, std::string > inv_smoothidsList
Definition: IOWavefrontOBJ.hpp:65
MimmoPiercedVector< long > smoothids
Definition: IOWavefrontOBJ.hpp:53
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
Definition: IOWavefrontOBJ.cpp:728
void setPinObjects(const std::vector< std::string > &objectsList)
Definition: IOWavefrontOBJ.cpp:570
bool getCheckNormalsMagnitude()
Definition: IOWavefrontOBJ.cpp:393
std::unordered_set< int > m_pinSmoothIds
Definition: IOWavefrontOBJ.hpp:241
ManipulateWFOBJData()
Definition: IOWavefrontOBJ.cpp:307
IOWavefrontOBJ(IOMode mode=IOMode::READ)
Definition: IOWavefrontOBJ.cpp:1138
void write(const std::string &fullpath)
Definition: IOWavefrontOBJ.cpp:1864
MimmoSharedPointer< MimmoObject > getGeometry()
Definition: BaseManipulation.cpp:235
OverlapAnnotationMode
Strategy Mode to deal with Multiple Annotations on a target cell in ManipulateWFOBJData.
Definition: IOWavefrontOBJ.hpp:165
void printResumeFile(bool print)
Definition: IOWavefrontOBJ.cpp:1436
void swap(BaseManipulation &x) noexcept
Definition: BaseManipulation.cpp:140
void writeObjectData(WavefrontOBJData *objData, std::ofstream &out, const std::array< std::vector< long >, 3 > &vertexLists, const std::vector< long > &cellList, std::array< long, 3 > &vOffsets, std::array< std::unordered_map< long, long >, 3 > &vinsertion_maps, const std::string &defaultGroup, long &activeGroup, long &activeMaterial, long &activeSmoothId)
Definition: IOWavefrontOBJ.cpp:2467
virtual ~ManipulateWFOBJData()
Definition: IOWavefrontOBJ.cpp:341
std::array< std::vector< long >, 4 > m_pinnedCellLists
Definition: IOWavefrontOBJ.hpp:243
std::unordered_map< std::string, long > materialsList
Definition: IOWavefrontOBJ.hpp:60
std::vector< long > getPinnedSmoothGroup()
Definition: IOWavefrontOBJ.cpp:437
std::map< long, std::map< long, std::vector< long > > > TreeGroups
Definition: IOWavefrontOBJ.hpp:339
void setPinMaterials(const std::vector< std::string > &materialsList)
Definition: IOWavefrontOBJ.cpp:526