Commit 424530df authored by Lionel Untereiner's avatar Lionel Untereiner

import / export choupi

parent da676e6e
......@@ -134,8 +134,15 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good = allDarts) ;
/**
* export meshes used at the workbench
* export just a list of vertices and edges connectivity
* @param map
* @param position
* @return
*/
template <typename PFP>
bool exportChoupi<typename PFP::MAP& map, const typename PFP::TVEC3& position const FunctorSelect& good = allDarts) ;
bool exportChoupi(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
} // namespace Export
......
......@@ -918,6 +918,39 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
return true ;
}
template <typename PFP>
bool exportChoupi(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good)
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
std::ofstream out(filename, std::ios::out) ;
if (!out.good())
{
CGoGNerr << "Unable to open file " << CGoGNendl ;
return false ;
}
out << map.getNbOrbits(VERTEX) << " " << map.getNbOrbits(EDGE) << std::endl;
TraversorV<typename PFP::MAP> travV(map);
for(Dart dit = travV.begin() ; dit != travV.end() ; dit = travV.next())
{
out << map.getEmbedding(VERTEX, dit) << " " << position[dit] << std::endl;
}
TraversorE<typename PFP::MAP> travE(map);
unsigned int indexE = 0;
for(Dart dit = travE.begin() ; dit != travE.end() ; dit = travE.next())
{
out << indexE << " " << map.getEmbedding(VERTEX, dit) << " " << map.getEmbedding(VERTEX, map.phi2(dit)) << std::endl;
++indexE;
}
out.close() ;
return true ;
}
} // namespace Export
} // namespace Algo
......
......@@ -83,6 +83,15 @@ template <typename PFP>
bool importMoka(typename PFP::MAP& gmap, const std::string& filename, std::vector<std::string>& attrNames);
/**
* import a Choupi file
* @param map
* @param filename
* @return
*/
template <typename PFP>
bool importChoupi(const std::string& filename, const std::vector<typename PFP::VEC3>& tabV, const std::vector<unsigned int>& tabE);
/*
* TODO a transformer en utilisant un MeshTableVolume.
*/
......@@ -117,4 +126,6 @@ bool importTs(typename PFP::MAP& the_map, const std::string& filename, std::vect
#include "Algo/Import/importTs.hpp"
#include "Algo/Import/importNodeEle.hpp"
#include "Algo/Import/importChoupi.hpp"
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment