本文整理汇总了C++中VertexAttribute::name方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexAttribute::name方法的具体用法?C++ VertexAttribute::name怎么用?C++ VertexAttribute::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VertexAttribute
的用法示例。
在下文中一共展示了VertexAttribute::name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fp
bool MeshTablesVolume<PFP>::importTs(const std::string& filename, std::vector<std::string>& attrNames)
{
//
VertexAttribute<VEC3> position = m_map.template getAttribute<VEC3, VERTEX>("position") ;
if (!position.isValid())
position = m_map.template addAttribute<VEC3, VERTEX>("position") ;
attrNames.push_back(position.name()) ;
//
VertexAttribute<REAL> scalar = m_map.template getAttribute<REAL, VERTEX>("scalar");
if (!scalar.isValid())
scalar = m_map.template addAttribute<REAL, VERTEX>("scalar") ;
attrNames.push_back(scalar.name()) ;
//
AttributeContainer& container = m_map.template getAttributeContainer<VERTEX>() ;
// open file
std::ifstream fp(filename.c_str(), std::ios::in);
if (!fp.good())
{
CGoGNerr << "Unable to open file " << filename << CGoGNendl;
return false;
}
std::string ligne;
// reading number of vertices/tetrahedra
std::getline (fp, ligne);
std::stringstream oss(ligne);
oss >> m_nbVertices;
oss >> m_nbVolumes;
//reading vertices
std::vector<unsigned int> verticesID;
verticesID.reserve(m_nbVertices);
for(unsigned int i = 0; i < m_nbVertices; ++i)
{
do
{
std::getline (fp, ligne);
} while (ligne.size() == 0);
std::stringstream oss(ligne);
float x,y,z;
oss >> x;
oss >> y;
oss >> z;
VEC3 pos(x,y,z);
unsigned int id = container.insertLine();
position[id] = pos;
verticesID.push_back(id);
float scal;
oss >> scal;
scalar[id] = scal;
}
//Read and embed all tetrahedrons
for(unsigned int i = 0; i < m_nbVolumes ; ++i)
{
do
{
std::getline(fp,ligne);
} while(ligne.size() == 0);
std::stringstream oss(ligne);
m_nbFaces.push_back(4);
int s0,s1,s2,s3,nbe;
oss >> s0;
oss >> s1;
oss >> s2;
oss >> s3;
typename PFP::VEC3 P = position[verticesID[s0]];
typename PFP::VEC3 A = position[verticesID[s1]];
typename PFP::VEC3 B = position[verticesID[s2]];
typename PFP::VEC3 C = position[verticesID[s3]];
if(Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::UNDER)
{
int ui = s1;
s1 = s2;
s2 = ui;
}
//if regions are defined use this number
//.........这里部分代码省略.........
示例2: fnode
bool MeshTablesVolume<PFP>::importNodeWithELERegions(const std::string& filenameNode, const std::string& filenameELE, std::vector<std::string>& attrNames)
{
VertexAttribute<VEC3> position = m_map.template getAttribute<VEC3, VERTEX>("position") ;
if (!position.isValid())
position = m_map.template addAttribute<VEC3, VERTEX>("position") ;
attrNames.push_back(position.name()) ;
AttributeContainer& container = m_map.template getAttributeContainer<VERTEX>() ;
//open file
std::ifstream fnode(filenameNode.c_str(), std::ios::in);
if (!fnode.good())
{
CGoGNerr << "Unable to open file " << filenameNode << CGoGNendl;
return false;
}
std::ifstream fele(filenameELE.c_str(), std::ios::in);
if (!fele.good())
{
CGoGNerr << "Unable to open file " << filenameELE << CGoGNendl;
return false;
}
std::string line;
//Reading NODE file
//First line: [# of points] [dimension (must be 3)] [# of attributes] [# of boundary markers (0 or 1)]
unsigned int nbe;
{
do
{
std::getline(fnode,line);
}while(line.size() == 0);
std::stringstream oss(line);
oss >> m_nbVertices;
oss >> nbe;
oss >> nbe;
oss >> nbe;
}
//Reading number of tetrahedra in ELE file
unsigned int nbv;
{
do
{
std::getline(fele,line);
}while(line.size() == 0);
std::stringstream oss(line);
oss >> m_nbVolumes;
oss >> nbv ;
oss >> nbv;
}
//Reading vertices
std::map<unsigned int,unsigned int> verticesMapID;
for(unsigned int i = 0 ; i < m_nbVertices ; ++i)
{
do
{
std::getline(fnode,line);
}while(line.size() == 0);
std::stringstream oss(line);
int idv;
oss >> idv;
float x,y,z;
oss >> x;
oss >> y;
oss >> z;
//we can read colors informations if exists
VEC3 pos(x,y,z);
unsigned int id = container.insertLine();
position[id] = pos;
verticesMapID.insert(std::pair<unsigned int, unsigned int>(idv,id));
}
// reading tetrahedra
m_nbFaces.reserve(m_nbVolumes*4);
m_emb.reserve(m_nbVolumes*12);
for(unsigned i = 0; i < m_nbVolumes ; ++i)
{
do
{
std::getline(fele,line);
} while(line.size() == 0);
std::stringstream oss(line);
oss >> nbe;
m_nbFaces.push_back(4);
//.........这里部分代码省略.........
示例3: fp
bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<std::string>& attrNames)
{
VertexAttribute<VEC3, MAP> position = m_map.template getAttribute<VEC3, VERTEX, MAP>("position") ;
if (!position.isValid())
position = m_map.template addAttribute<VEC3, VERTEX, MAP>("position") ;
attrNames.push_back(position.name()) ;
AttributeContainer& container = m_map.template getAttributeContainer<VERTEX>() ;
//open file
std::ifstream fp(filename.c_str(), std::ios::in);
if (!fp.good())
{
CGoGNerr << "Unable to open file " << filename << CGoGNendl;
return false;
}
std::string ligne;
// reading number of vertices
std::getline (fp, ligne);
std::stringstream oss(ligne);
oss >> m_nbVertices;
// reading number of tetrahedra
std::getline (fp, ligne);
std::stringstream oss2(ligne);
oss2 >> m_nbVolumes;
//reading vertices
std::vector<unsigned int> verticesID;
verticesID.reserve(m_nbVertices);
for(unsigned int i = 0; i < m_nbVertices; ++i)
{
do
{
std::getline (fp, ligne);
} while (ligne.size() == 0);
std::stringstream oss(ligne);
float x,y,z;
oss >> x;
oss >> y;
oss >> z;
// TODO : if required read other vertices attributes here
VEC3 pos(x,y,z);
unsigned int id = container.insertLine();
position[id] = pos;
verticesID.push_back(id);
}
// reading volumes
m_nbFaces.reserve(m_nbVolumes*4);
m_emb.reserve(m_nbVolumes*12);
unsigned int nbc = 0;
for (unsigned int i = 0; i < m_nbVolumes ; ++i)
{
do
{
std::getline (fp, ligne);
} while (ligne.size()==0);
std::stringstream oss(ligne);
int n;
oss >> n; // type of volumes
if(!oss.good())
{
oss.clear();
char dummy;
oss >> dummy; // type of volumes
oss >> dummy;
if(dummy == 'C')// connector
{
++nbc;
m_nbFaces.push_back(3);
int s0,s1,s2,s3;
oss >> s0;
oss >> s1;
oss >> s2;
oss >> s3;
//std::cout << "connector " << s0 << " " << s1 << " " << s2 << " " << s3 << std::endl;
m_emb.push_back(verticesID[s0]);
m_emb.push_back(verticesID[s1]);
m_emb.push_back(verticesID[s2]);
m_emb.push_back(verticesID[s3]);
//.........这里部分代码省略.........
示例4: foff
bool MeshTablesVolume<PFP>::importOFFWithELERegions(const std::string& filenameOFF, const std::string& filenameELE, std::vector<std::string>& attrNames)
{
VertexAttribute<VEC3> position = m_map.template getAttribute<VEC3, VERTEX>("position") ;
if (!position.isValid())
position = m_map.template addAttribute<VEC3, VERTEX>("position") ;
attrNames.push_back(position.name()) ;
AttributeContainer& container = m_map.template getAttributeContainer<VERTEX>() ;
// open files
std::ifstream foff(filenameOFF.c_str(), std::ios::in);
if (!foff.good())
{
CGoGNerr << "Unable to open OFF file " << CGoGNendl;
return false;
}
std::ifstream fele(filenameELE.c_str(), std::ios::in);
if (!fele.good())
{
CGoGNerr << "Unable to open ELE file " << CGoGNendl;
return false;
}
std::string line;
//OFF reading
std::getline(foff, line);
if(line.rfind("OFF") == std::string::npos)
{
CGoGNerr << "Problem reading off file: not an off file"<<CGoGNendl;
CGoGNerr << line << CGoGNendl;
return false;
}
//Reading number of vertex/faces/edges in OFF file
unsigned int nbe;
{
do
{
std::getline(foff,line);
}while(line.size() == 0);
std::stringstream oss(line);
oss >> m_nbVertices;
oss >> nbe;
oss >> nbe;
oss >> nbe;
}
//Reading number of tetrahedra in ELE file
unsigned int nbv;
{
do
{
std::getline(fele,line);
}while(line.size() == 0);
std::stringstream oss(line);
oss >> m_nbVolumes;
oss >> nbv ;
oss >> nbv;
}
//Reading vertices
std::vector<unsigned int> verticesID;
verticesID.reserve(m_nbVertices);
for(unsigned int i = 0 ; i < m_nbVertices ; ++i)
{
do
{
std::getline(foff,line);
}while(line.size() == 0);
std::stringstream oss(line);
float x,y,z;
oss >> x;
oss >> y;
oss >> z;
//we can read colors informations if exists
VEC3 pos(x,y,z);
unsigned int id = container.insertLine();
position[id] = pos;
verticesID.push_back(id);
}
// reading tetrahedra
m_nbFaces.reserve(m_nbVolumes*4);
m_emb.reserve(m_nbVolumes*12);
for(unsigned i = 0; i < m_nbVolumes ; ++i)
{
do
{
std::getline(fele,line);
//.........这里部分代码省略.........