本文整理汇总了C++中Mesh::AssignGlobalID方法的典型用法代码示例。如果您正苦于以下问题:C++ Mesh::AssignGlobalID方法的具体用法?C++ Mesh::AssignGlobalID怎么用?C++ Mesh::AssignGlobalID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh::AssignGlobalID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char ** argv)
{
if( argc < 3 )
{
std::cout << "Usage: " << argv[0] << " mesh mesh_out" << std::endl;
return 0;
}
Mesh * m = new Mesh;
m->SetFileOption("VERBOSITY","2");
try{m->Load(argv[1]);} catch(...) { std::cout << "Cannot load the mesh " << argv[1] << std::endl; return -1;}
Mesh::GeomParam t;
t[MEASURE] = CELL | FACE;
t[ORIENTATION] = FACE;
t[NORMAL] = FACE;
//t[BARYCENTER] = CELL;
t[CENTROID] = CELL | FACE;
m->AssignGlobalID(CELL|FACE);
m->PrepareGeometricData(t);
double max[3] = {-1.0e20, -1.0e20, -1.0e20}, min[3] = {1.0e20,1.0e20,1.0e20};
Storage::real c[3] = {0,0,0}, nrm[3] = {0,0,0};
for(Mesh::iteratorNode it = m->BeginNode(); it != m->EndNode(); ++it)
{
it->Centroid(c);
if( c[0] > max[0] ) max[0] = c[0];
if( c[1] > max[1] ) max[1] = c[1];
if( c[2] > max[2] ) max[2] = c[2];
if( c[0] < min[0] ) min[0] = c[0];
if( c[1] < min[1] ) min[1] = c[1];
if( c[2] < min[2] ) min[2] = c[2];
}
if( max[0] <= min[0] ) {std::cout << "strange X " << min[0] << ":" << max[0] << std::endl; return -1;}
if( max[1] <= min[1] ) {std::cout << "strange Y " << min[1] << ":" << max[1] << std::endl; return -1;}
if( max[2] <= min[2] )
{
//2d mesh
if( m->GetDimensions() == 3 )
{
//offset from z-plane
min[2] -= 0.0001;
max[2] += 0.0001;
}
else
{
min[2] = -0.0001;
max[2] = +0.0001;
}
}
std::cout << "Mesh bounds: " << min[0] << ":" << max[0] << " " << min[1] << ":" << max[1] << " " << min[2] << ":" << max[2] << std::endl;
Tag material;
if( m->HaveTag("PERM") ) m->DeleteTag(m->GetTag("PERM"));
Tag vel = m->CreateTag("REFERENCE_VELOCITY",DATA_REAL,CELL,NONE,3);
Tag force = m->CreateTag("FORCE",DATA_REAL,CELL,NONE,1);
Tag tensor = m->CreateTag("PERM",DATA_REAL,CELL,NONE,6);
Tag solution_val = m->CreateTag("REFERENCE_SOLUTION",DATA_REAL,CELL|FACE|EDGE|NODE,NONE,1);
Tag solution_flux = m->CreateTag("REFERENCE_FLUX",DATA_REAL,FACE,FACE,1);
Tag saddle_val = m->CreateTag("SADDLE_SOLUTION",DATA_REAL,CELL,NONE,4);
Tag saddle_flux = m->CreateTag("SADDLE_FLUX",DATA_REAL,FACE,NONE,4);
Tag bndcond = m->CreateTag("BOUNDARY_CONDITION",DATA_REAL,FACE|EDGE,FACE|EDGE,3);
{
Storage::bulk_array name = m->self()->BulkArray(m->CreateTag("PROBLEMNAME",DATA_BULK,MESH,NONE));
name.replace(name.begin(),name.end(),problem_name.begin(),problem_name.end());
}
for(Mesh::iteratorElement it = m->BeginElement(CELL|FACE|EDGE|NODE); it != m->EndElement(); ++it)
{
it->Centroid(c);
if( it->GetElementType() == CELL )
{
Storage::real_array perm = it->RealArray(tensor);
perm[0] = 1.5;
perm[1] = 0.5;
perm[2] = 0.0;
perm[3] = 1.5;
perm[4] = 0.0;
perm[5] = 1.0;
}
Storage::real x = c[0];//(c[0]-min[0])/(max[0]-min[0]);
Storage::real y = c[1];//(c[1]-min[1])/(max[1]-min[1]);
Storage::real z = c[2];//(c[2]-min[2])/(max[2]-min[2]);
Storage::real sol = 16.0*(1-x)*y*(1-y);
Storage::real flux;
Storage::real dsolx = 16*(y-1)*y;
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
maxmin[0] = -1e20;
maxmin[1] = 1e20;
maxmin[2] = -1e20;
maxmin[3] = 1e20;
ElementArray<Node> nodes = it_cells[k].getNodes();
for (ElementArray<Node>::iterator it = nodes.begin(); it != nodes.end(); it++)
{
Storage::real_array cc = it->Coords();
for (int i = 0; i < (int)cc.size(); i++)
{
if (maxmin[2 * i + 0] < cc[i]) maxmin[2 * i + 0] = cc[i]; //max
if (maxmin[2 * i + 1] > cc[i]) maxmin[2 * i + 1] = cc[i]; //min
}
}
h = std::min(h,sqrt((maxmin[2]-maxmin[3])*(maxmin[2]-maxmin[3])+(maxmin[0]-maxmin[1])*(maxmin[0]-maxmin[1])));
}
if( fabs(y-y1) > 1.0e-9 && fabs(y-y2) > 1.0e-9 && x > 0 && x < 1 && y > 0 && y < 1 )
{
c[0] += rndx*h*alpha;
c[1] += rndy*h*alpha;
}
}
*/
}
Mesh::GeomParam t;
t[MEASURE] = CELL | FACE;
t[ORIENTATION] = FACE;
t[NORMAL] = FACE;
//t[BARYCENTER] = CELL;
t[CENTROID] = CELL | FACE | EDGE | NODE;
m->AssignGlobalID(CELL|FACE);
//m->RemoveGeometricData(t);
m->PrepareGeometricData(t);
double max[3] = {-1.0e20, -1.0e20, -1.0e20}, min[3] = {1.0e20,1.0e20,1.0e20};
Storage::real c[3] = {0,0,0}, nrm[3] = {0,0,0};
for(Mesh::iteratorNode it = m->BeginNode(); it != m->EndNode(); ++it)
{
it->Centroid(c);
if( c[0] > max[0] ) max[0] = c[0];
if( c[1] > max[1] ) max[1] = c[1];
if( c[2] > max[2] ) max[2] = c[2];
if( c[0] < min[0] ) min[0] = c[0];
if( c[1] < min[1] ) min[1] = c[1];
if( c[2] < min[2] ) min[2] = c[2];
}
if( max[0] <= min[0] ) {std::cout << "strange X " << min[0] << ":" << max[0] << std::endl; return -1;}
if( max[1] <= min[1] ) {std::cout << "strange Y " << min[1] << ":" << max[1] << std::endl; return -1;}
if( max[2] <= min[2] )
{
//2d mesh
if( m->GetDimensions() == 3 )
{
//offset from z-plane
min[2] -= 0.0001;
max[2] += 0.0001;
}
else
{
min[2] = -0.0001;
max[2] = +0.0001;
}