本文整理汇总了C++中Boundary::marker方法的典型用法代码示例。如果您正苦于以下问题:C++ Boundary::marker方法的具体用法?C++ Boundary::marker怎么用?C++ Boundary::marker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boundary
的用法示例。
在下文中一共展示了Boundary::marker方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transformMeshToTriangle_
void TriangleWrapper::transformMeshToTriangle_(const Mesh & mesh,
triangulateio & trimesh){
#if USE_LIBTRIANGLE
//! node section
int nVerts = mesh.nodeCount();
trimesh.numberofpoints = nVerts;
trimesh.numberofpointattributes = 0; // only one Parameter
trimesh.pointlist = new double[2 * nVerts];
trimesh.pointmarkerlist = new int[nVerts];
for (int i = 0; i < nVerts; i ++){
trimesh.pointlist[i * 2] = mesh.node(i).x();
trimesh.pointlist[i * 2 + 1] = mesh.node(i).y();
trimesh.pointmarkerlist[i] = mesh.node(i).marker();
}
//! edge section;
int nEdges = mesh.boundaryCount();
int edgeCounter = 0;
trimesh.numberofsegments = nEdges;
trimesh.segmentlist = new int[2 * nEdges];
trimesh.segmentmarkerlist = new int[nEdges];
for (int i = 0; i < nEdges; i ++){
Boundary * edge = &mesh.boundary(i);
trimesh.segmentlist[edgeCounter * 2] = edge->node(0).id();
trimesh.segmentlist[edgeCounter * 2 + 1] = edge->node(1).id();
trimesh.segmentmarkerlist[edgeCounter] = edge->marker();
edgeCounter++;
}
//! Holes;
uint nHoles = mesh.holeMarker().size();//domain.holeCount();
trimesh.numberofholes = nHoles;
trimesh.holelist = new double[2 * nHoles + 1];
for (uint i = 0; i < nHoles; i ++){
trimesh.holelist[i * 2] = mesh.holeMarker()[i].x();
trimesh.holelist[i * 2 + 1] = mesh.holeMarker()[i].y();
}
//! Regions;
int nRegions = mesh.regionMarker().size();//domain.regionCount();
trimesh.numberofregions = nRegions;
trimesh.regionlist = new double[4 * nRegions + 1];
uint count = 0;
for (Mesh::RegionMarkerList::const_iterator
it = mesh.regionMarker().begin(); it != mesh.regionMarker().end(); it ++){
// std::cout << it->pos().x() << " " << it->pos().y() << " "
// << it->marker() << " "
// << it->area() << std::endl;
trimesh.regionlist[count * 4] = it->x();
trimesh.regionlist[count * 4 + 1] = it->y();
trimesh.regionlist[count * 4 + 2] = it->marker();
trimesh.regionlist[count * 4 + 3] = it->area();
count ++;
}
#else
std::cerr << WHERE_AM_I << " Triangle not installed" << std::endl;
#endif
}
示例2: addTriangleBoundary
bool addTriangleBoundary(Mesh & mesh, double xBoundary, double yBoundary, int cellMarker,
bool save){
int boundMarker = -5;
mesh.createNeighbourInfos(true);
Boundary *b = NULL;
for (std::vector < Boundary * >::const_iterator it = mesh.boundaries().begin();
it != mesh.boundaries().end(); it ++){
b = (*it);
if (! b->leftCell() || ! b->rightCell()) {
if (b->marker() != MARKER_BOUND_HOMOGEN_NEUMANN){
b->setMarker(boundMarker);
}
}
}
std::vector < Boundary * > markedBoundaries(mesh.findBoundaryByMarker(boundMarker));
Boundary *start(markedBoundaries.front());
std::list < Node * > boundNodes;
boundNodes.push_back(& start->node(0));
Boundary * thisBoundary = start;
while (thisBoundary != NULL){
Node * thisNode = boundNodes.back();
Boundary * nextBoundary = NULL;
for (std::set < Boundary * >::iterator it = thisNode->boundSet().begin();
it != thisNode->boundSet().end(); it++){
if ((*it)->marker() == boundMarker && (*it) != thisBoundary){
nextBoundary = (*it);
break;
}
}
if (nextBoundary){
Node * nextNode = NULL;
if (&nextBoundary->node(0) != thisNode){
nextNode = &nextBoundary->node(0);
} else {
nextNode = &nextBoundary->node(1);
}
//** Check closed polygones here
if (find(boundNodes.begin(), boundNodes.end(), nextNode) == boundNodes.end()) {
boundNodes.push_back(nextNode);
} else {
break;
}
}
thisBoundary = nextBoundary;
}
boundNodes.push_front(& start->node(1));
thisBoundary = start;
while (thisBoundary != NULL){
Node * thisNode = boundNodes.front();
Boundary * nextBoundary = NULL;
for (std::set < Boundary * >::iterator it = thisNode->boundSet().begin();
it != thisNode->boundSet().end(); it++){
if ((*it)->marker() == boundMarker && (*it) != thisBoundary){
nextBoundary = (*it);
break;
}
}
if (nextBoundary){
Node * nextNode = NULL;
if (& nextBoundary->node(0) != thisNode){
nextNode = & nextBoundary->node(0);
} else {
nextNode = & nextBoundary->node(1);
}
//** Check closed polygones here
if (find(boundNodes.begin(), boundNodes.end(), nextNode) == boundNodes.end()) {
boundNodes.push_front(nextNode);
} else {
break;
}
}
thisBoundary = nextBoundary;
}
Mesh poly;
std::vector < Node * > innerBound;
for (std::list < Node * >::iterator it = boundNodes.begin();
it != boundNodes.end(); it ++){
innerBound.push_back(poly.createNode((*it)->pos()));
}
//** looking for polygon ends
Node * upperLeftSurface = innerBound.front();
Node * upperRightSurface = innerBound.back();
if (upperLeftSurface->pos()[0] > upperRightSurface->pos()[0]){
upperLeftSurface = innerBound.back();
upperRightSurface = innerBound.front();
}
//.........这里部分代码省略.........