47 : mesh(mesh), longTranIndex(longTranIndex), vertIndex(vertIndex) {}
60 return mesh.
index(longTranElement().getNodeIndex(bottom_triangle_node_nr), vertIndex);
69 return mesh.
index(longTranElement().getNodeIndex(top_triangle_node_nr), vertIndex+1);
78 return mesh.
at(longTranElement().getNodeIndex(bottom_triangle_node_nr), vertIndex);
87 return mesh.
at(longTranElement().getNodeIndex(bottom_triangle_node_nr), vertIndex+1);
97 double getBaseArea()
const {
return longTranElement().getArea(); }
110 double getArea()
const {
return getBaseArea() * getHeight(); }
125 Box3D getBoundingBox()
const;
196 std::size_t size()
const override;
198 bool empty()
const override;
200 void writeXML(
XMLElement&
object)
const override;
208 Vec<3, double> at(std::size_t longTranIndex, std::size_t vertIndex)
const;
216 std::size_t
index(std::size_t longTranIndex, std::size_t vertIndex)
const {
218 longTranIndex * vertAxis->size() + vertIndex :
219 vertIndex * longTranMesh.
size() + longTranIndex;
227 std::pair<std::size_t, std::size_t> longTranAndVertIndices(std::size_t index)
const;
234 std::size_t vertIndex(std::size_t index)
const;
253 const std::size_t
vertSize = vertAxis->size();
268 enum class SideBoundaryDir { BACK, FRONT, LEFT, RIGHT, ALL };
270 static constexpr TriangularMesh2D::BoundaryDir boundaryDir3Dto2D(SideBoundaryDir d) {
return TriangularMesh2D::BoundaryDir(d); }
273 typedef boost::icl::right_open_interval<std::size_t> LayersInterval;
276 typedef boost::icl::interval_set<std::size_t, std::less, LayersInterval> LayersIntervalSet;
282 template <S
ideBoundaryDir boundaryDir>
283 std::set<std::size_t> boundaryNodes(
const LayersIntervalSet&
layers,
const GeometryD<3>& geometry,
const GeometryObject&
object,
const PathHints *path =
nullptr)
const;
300 LayersInterval layersIn(
const Box3D&
box)
const;
307 LayersIntervalSet layersIn(
const std::vector<Box3D>&
boxes)
const;
312 template <S
ideBoundaryDir boundaryDir>
318 template <S
ideBoundaryDir boundaryDir>
322 struct ExtrudedTriangularBoundaryImpl:
public BoundaryNodeSetImpl {
332 IteratorImpl(
const ExtrudedTriangularBoundaryImpl &boundary, std::set<std::size_t>::const_iterator longTranIter, std::size_t vertIndex)
333 : boundary(boundary), longTranIter(longTranIter), vertIndex(vertIndex)
341 return boundary.mesh.index(*longTranIter, vertIndex);
345 if (boundary.mesh.vertFastest) {
347 if (vertIndex == boundary.vertIndices.upper()) {
348 vertIndex = boundary.vertIndices.lower();
353 if (longTranIter == boundary.longTranIndices.end()) {
354 longTranIter = boundary.longTranIndices.begin();
361 return longTranIter ==
static_cast<const IteratorImpl&
>(other).longTranIter &&
365 std::unique_ptr<PolymorphicForwardIteratorImpl<std::size_t, std::size_t>>
clone()
const override {
366 return std::unique_ptr<PolymorphicForwardIteratorImpl<std::size_t, std::size_t>>(
new IteratorImpl(*
this));
373 std::set<std::size_t> longTranIndices;
375 LayersInterval vertIndices;
377 ExtrudedTriangularBoundaryImpl(
379 std::set<std::size_t> longTranIndices,
380 LayersInterval vertIndices)
381 : mesh(mesh), longTranIndices(
std::move(longTranIndices)), vertIndices(vertIndices)
385 bool contains(std::size_t mesh_index)
const override {
387 return vertIndices.lower() <= lt_v.second && lt_v.second < vertIndices.upper()
388 && longTranIndices.find(lt_v.first) != longTranIndices.end();
391 bool empty()
const override {
return vertIndices.lower() == vertIndices.upper() || longTranIndices.empty(); }
393 std::size_t
size()
const override {
return (vertIndices.upper() - vertIndices.lower()) * longTranIndices.size(); }
395 BoundaryNodeSetImpl::const_iterator begin()
const override {
396 return BoundaryNodeSetImpl::const_iterator(
new IteratorImpl(*
this, longTranIndices.begin(), vertIndices.lower()));
399 BoundaryNodeSetImpl::const_iterator
end()
const override {
400 return BoundaryNodeSetImpl::const_iterator(
402 new IteratorImpl(*
this, longTranIndices.end(), vertIndices.lower()) :
403 new IteratorImpl(*this, longTranIndices.begin(), vertIndices.upper())
409 struct ExtrudedTriangularWholeLayerBoundaryImpl:
public BoundaryNodeSetImpl {
413 const ExtrudedTriangularWholeLayerBoundaryImpl &
boundary;
417 IteratorImpl(
const ExtrudedTriangularWholeLayerBoundaryImpl &boundary, std::size_t longTranIndex)
418 : boundary(boundary), longTranIndex(longTranIndex)
422 return boundary.mesh.index(longTranIndex, boundary.vertIndex);
430 return longTranIndex ==
static_cast<const IteratorImpl&
>(other).longTranIndex;
433 std::unique_ptr<PolymorphicForwardIteratorImpl<std::size_t, std::size_t>>
clone()
const override {
434 return std::unique_ptr<PolymorphicForwardIteratorImpl<std::size_t, std::size_t>>(
new IteratorImpl(*
this));
441 std::size_t vertIndex;
444 : mesh(mesh), vertIndex(vertIndex)
448 bool contains(std::size_t mesh_index)
const override {
449 return mesh.
vertIndex(mesh_index) == this->vertIndex;
452 bool empty()
const override {
return mesh.
vertAxis->empty(); }
454 std::size_t
size()
const override {
return mesh.
vertAxis->size(); }
456 BoundaryNodeSetImpl::const_iterator begin()
const override {
457 return BoundaryNodeSetImpl::const_iterator(
new IteratorImpl(*
this, 0));
460 BoundaryNodeSetImpl::const_iterator
end()
const override {
461 return BoundaryNodeSetImpl::const_iterator(
new IteratorImpl(*
this, mesh.
longTranMesh.
size()));
468 template <S
ideBoundaryDir boundaryDir>
469 static Boundary getMeshBoundary();
476 template <S
ideBoundaryDir boundaryDir>
477 static Boundary getBoxBoundary(
const Box3D&
box);
485 BoundaryNodeSet topOrBottomBoundaryNodeSet(
const Box3D &
box,
bool top)
const;
495 BoundaryNodeSet topOrBottomBoundaryNodeSet(
const GeometryD<3>& geometry,
const GeometryObject&
object,
const PathHints *path,
bool top)
const;
499 static Boundary getBackBoundary();
500 static Boundary getFrontBoundary();
501 static Boundary getLeftBoundary();
502 static Boundary getRightBoundary();
503 static Boundary getBottomBoundary();
504 static Boundary getTopBoundary();
505 static Boundary getAllSidesBoundary();
507 static Boundary getBackOfBoundary(
const Box3D&
box);
508 static Boundary getFrontOfBoundary(
const Box3D&
box);
509 static Boundary getLeftOfBoundary(
const Box3D&
box);
510 static Boundary getRightOfBoundary(
const Box3D&
box);
511 static Boundary getBottomOfBoundary(
const Box3D&
box);
512 static Boundary getTopOfBoundary(
const Box3D&
box);
513 static Boundary getAllSidesOfBoundary(
const Box3D&
box);
518 return path ? getBackOfBoundary(
object, *path) : getBackOfBoundary(
object);
524 return path ? getFrontOfBoundary(
object, *path) : getFrontOfBoundary(
object);
530 return path ? getLeftOfBoundary(
object, *path) : getLeftOfBoundary(
object);
536 return path ? getRightOfBoundary(
object, *path) : getRightOfBoundary(
object);
542 return path ? getAllSidesBoundaryIn(
object, *path) : getAllSidesBoundaryIn(
object);
548 return path ? getTopOfBoundary(
object, *path) : getTopOfBoundary(
object);
554 return path ? getBottomOfBoundary(
object, *path) : getBottomOfBoundary(
object);