Commit 97325e21 authored by untereiner's avatar untereiner

correction import volumetric meshes

parent f463bd36
......@@ -166,6 +166,17 @@ void MyQT::cb_Open()
position = myMap.getAttribute<PFP::VEC3,VERTEX>(attrNames[0]) ;
}
if(extension == std::string(".ts"))
{
if(!Algo::Volume::Import::importMeshV<PFP>(myMap, filename, attrNames, Algo::Volume::Import::TS))
{
std::cerr << "could not import " << filename << std::endl ;
return ;
}
else
position = myMap.getAttribute<PFP::VEC3,VERTEX>(attrNames[0]) ;
}
if(extension == std::string(".off"))
{
......@@ -408,6 +419,16 @@ int main(int argc, char **argv)
position = myMap.getAttribute<PFP::VEC3,VERTEX>(attrNames[0]) ;
}
if(extension == std::string(".ts"))
{
if(!Algo::Volume::Import::importMeshV<PFP>(myMap, filename, attrNames, Algo::Volume::Import::TS))
{
std::cerr << "could not import " << filename << std::endl ;
return 1;
}
else
position = myMap.getAttribute<PFP::VEC3,VERTEX>(attrNames[0]) ;
}
if(extension == std::string(".off"))
{
......
......@@ -66,24 +66,29 @@ int main(int argc, char **argv)
// get a handler to the 3D vector attribute created by the import
VertexAttribute<PFP::VEC3> position = myMap.getAttribute<PFP::VEC3, VERTEX>(attrNames[0]);
FaceAttribute<PFP::VEC3> positionF = myMap.getAttribute<PFP::VEC3, FACE>("position") ;
if(!positionF.isValid())
positionF = myMap.addAttribute<PFP::VEC3, FACE>("position") ;
Algo::Surface::Geometry::computeCentroidFaces<PFP>(myMap, position, positionF) ;
//
// Dual
//
myMap.computeDual();
// FaceAttribute<PFP::VEC3> positionF = myMap.getAttribute<PFP::VEC3, FACE>("position") ;
// if(!positionF.isValid())
// positionF = myMap.addAttribute<PFP::VEC3, FACE>("position") ;
//
// Algo::Surface::Geometry::computeCentroidFaces<PFP>(myMap, position, positionF) ;
// myMap.computeDual();
// position = positionF ;
EdgeAttribute<PFP::VEC3> positionE = myMap.getAttribute<PFP::VEC3, Edge>("position") ;
if(!positionE.isValid())
positionE = myMap.addAttribute<PFP::VEC3, EDGE>("position") ;
Algo::Surface::Geometry::computeCentroidEdges<PFP>(myMap, position, positionF) ;
myMap.computeDual();
position = positionF ;
myMap.check();
//turn_to<VertexAttribute<PFP::VEC3>, FaceAttribute<PFP::VEC3> >(&positionF);
//turn_to<FaceAttribute<PFP::VEC3>, VertexAttribute<PFP::VEC3> >(position);
//const std::type_info &t1 = typeid(&positionF);
//std::cout << "type name : " << t1.name() << std::endl;
Algo::Surface::Export::exportOFF<PFP>(myMap, position, "result.off");
std::cout << "Exported" << std::endl;
......
......@@ -38,8 +38,6 @@ namespace Import
template <typename PFP>
bool importChoupi(const std::string& filename, std::vector<typename PFP::VEC3>& tabV, std::vector<unsigned int>& tabE)
{
std::cout << "immport choupiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii" << std::endl;
typedef typename PFP::VEC3 VEC3;
//open file
......
......@@ -149,17 +149,25 @@ bool importNodeWithELERegions(typename PFP::MAP& map, const std::string& filenam
std::stringstream oss(line);
oss >> nbe;
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map);
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map,false);
Geom::Vec4ui pt;
oss >> pt[0];
--(pt[0]);
// oss >> pt[0];
// --(pt[0]);
// oss >> pt[1];
// --(pt[1]);
// oss >> pt[2];
// --(pt[2]);
// oss >> pt[3];
// --(pt[3]);
oss >> pt[1];
--(pt[1]);
oss >> pt[2];
--(pt[2]);
oss >> pt[3];
--(pt[3]);
oss >> pt[0];
--(pt[0]);
//regions ?
//oss >> nbe;
......
......@@ -148,7 +148,7 @@ bool importOFFWithELERegions(typename PFP::MAP& map, const std::string& filename
std::stringstream oss(line);
oss >> nbe;
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map);
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map,false);
Geom::Vec4ui pt;
oss >> pt[0];
......
......@@ -116,7 +116,7 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
std::stringstream oss(ligne);
oss >> nbe; //number of vertices = 4 or used for region mark
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map);
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map,false);
Geom::Vec4ui pt;
oss >> pt[0];
......
......@@ -120,10 +120,8 @@ bool importTs(typename PFP::MAP& map, const std::string& filename, std::vector<s
} while(ligne.size() == 0);
std::stringstream oss(ligne);
oss >> nbe; //number of vertices = 4
assert(nbe == 4);
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map);
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map,false);
Geom::Vec4ui pt;
oss >> pt[0];
......@@ -170,6 +168,8 @@ bool importTs(typename PFP::MAP& map, const std::string& filename, std::vector<s
//end of tetra
}
fp.close();
//Association des phi3
unsigned int nbBoundaryFaces = 0 ;
for (Dart d = map.begin(); d != map.end(); map.next(d))
......@@ -210,7 +210,6 @@ bool importTs(typename PFP::MAP& map, const std::string& filename, std::vector<s
CGoGNout << "Map closed (" << nbBoundaryFaces << " boundary faces)" << CGoGNendl;
}
fp.close();
return true;
}
......
......@@ -955,14 +955,13 @@ void Map2::computeDual()
//TODO triangulation of the boundary face to compute correctly the dual(dual(T)) of mesh T
void Map2::computeDualBorderConstraint()
{
//unmarkBoundary
std::vector<Dart> oldb;
for(Dart d = begin(); d != end(); next(d))
{
if(isBoundaryMarked2(d))
{
oldb.push_back(d);
boundaryUnmarkOrbit<FACE,2>(d);
fillHole(d);
}
}
......
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