MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode Class Reference
Collaboration diagram for FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode:
[legend]

Public Member Functions

 CsgNode (std::vector< CsgPolygon > _polygons)
 
 CsgNode ()
 
 ~CsgNode ()
 
void invert ()
 
std::vector< CsgPolygonclipPolygons (std::vector< CsgPolygon > _polygons)
 
void clipTo (CsgNode &bsp)
 
std::vector< CsgPolygonallPolygons ()
 
void build (std::vector< CsgPolygon > _polygons)
 
void plot (MInt tabCounter, const MChar *fileName)
 

Public Attributes

CsgPlane plane
 
MBool planeValid
 
CsgNodefront
 
CsgNodeback
 
std::vector< CsgPolygonpolygons
 

Detailed Description

template<MInt nDim, class SysEqn>
class FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode

Definition at line 1617 of file fvmbcartesiansolverxd.h.

Constructor & Destructor Documentation

◆ CsgNode() [1/2]

template<MInt nDim, class SysEqn >
FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::CsgNode ( std::vector< CsgPolygon _polygons)
inlineexplicit

Definition at line 1625 of file fvmbcartesiansolverxd.h.

1625 {
1626 planeValid = false;
1627 front = nullptr;
1628 back = nullptr;
1629 polygons.clear();
1630 this->build(std::move(_polygons));
1631 }
void build(std::vector< CsgPolygon > _polygons)
std::vector< CsgPolygon > polygons

◆ CsgNode() [2/2]

template<MInt nDim, class SysEqn >
FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::CsgNode ( )
inline

Definition at line 1633 of file fvmbcartesiansolverxd.h.

1633 {
1634 planeValid = false;
1635 front = nullptr;
1636 back = nullptr;
1637 polygons.clear();
1638 }

◆ ~CsgNode()

template<MInt nDim, class SysEqn >
FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::~CsgNode ( )
inline

Definition at line 1640 of file fvmbcartesiansolverxd.h.

1640 {
1641 this->polygons.clear();
1642 delete this->front;
1643 delete this->back;
1644 }

Member Function Documentation

◆ allPolygons()

template<MInt nDim, class SysEqn >
std::vector< CsgPolygon > FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::allPolygons ( )
inline

Definition at line 1683 of file fvmbcartesiansolverxd.h.

1683 {
1684 std::vector<CsgPolygon> _polygons(this->polygons);
1685 if(this->front) {
1686 std::vector<CsgPolygon> _polygons_front = this->front->allPolygons();
1687 for(MInt i = 0; (unsigned)i < _polygons_front.size(); i++)
1688 _polygons.push_back(_polygons_front[i]);
1689 }
1690 if(this->back) {
1691 std::vector<CsgPolygon> _polygons_back = this->back->allPolygons();
1692 for(MInt i = 0; (unsigned)i < _polygons_back.size(); i++)
1693 _polygons.push_back(_polygons_back[i]);
1694 }
1695 return _polygons;
1696 }
std::vector< CsgPolygon > allPolygons()
int32_t MInt
Definition: maiatypes.h:62

◆ build()

template<MInt nDim, class SysEqn >
void FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::build ( std::vector< CsgPolygon _polygons)
Author

Definition at line 31470 of file fvmbcartesiansolverxd.cpp.

31470 {
31471 if(_polygons.empty()) return;
31472 MInt polygonStartIndex = nDim == 3 ? 0 : 1;
31473 if(!planeValid) {
31474 this->plane = _polygons[0].plane.clone();
31475 planeValid = true;
31476 IF_CONSTEXPR(nDim == 3) {
31477 this->polygons.push_back(_polygons[0]);
31478 polygonStartIndex = 1;
31479 }
31480 }
31481 std::vector<CsgPolygon> _front;
31482 std::vector<CsgPolygon> _back;
31483 IF_CONSTEXPR(nDim == 2) { this->plane.insertCoplanarPolygon(&_polygons[0], &this->polygons, &this->polygons); }
31484 for(MInt i = polygonStartIndex; (unsigned)i < _polygons.size(); i++) {
31485 this->plane.splitPolygon(&_polygons[i], &this->polygons, &this->polygons, &_front, &_back);
31486 }
31487 if(_front.size() != 0u) {
31488 if(!this->front) // check if nullptr
31489 this->front = new CsgNode();
31490 this->front->build(_front);
31491 }
31492 if(_back.size() != 0u) {
31493 if(!this->back) this->back = new CsgNode();
31494 this->back->build(_back);
31495 }
31496}
void splitPolygon(CsgPolygon *polygon, std::vector< CsgPolygon > *coplanarFront, std::vector< CsgPolygon > *coplanarBack, std::vector< CsgPolygon > *front, std::vector< CsgPolygon > *back) const
void insertCoplanarPolygon(CsgPolygon *polygon, std::vector< CsgPolygon > *coplanarFront, std::vector< CsgPolygon > *coplanarBack) const

◆ clipPolygons()

template<MInt nDim, class SysEqn >
std::vector< CsgPolygon > FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::clipPolygons ( std::vector< CsgPolygon _polygons)
inline

Definition at line 1658 of file fvmbcartesiansolverxd.h.

1658 {
1659 if(!planeValid) {
1660 return _polygons;
1661 }
1662 std::vector<CsgPolygon> _front;
1663 std::vector<CsgPolygon> _back;
1664 for(MInt i = 0; (unsigned)i < _polygons.size(); i++) {
1665 this->plane.splitPolygon(&_polygons[i], &_front, &_back, &_front, &_back);
1666 }
1667 if(this->front) _front = this->front->clipPolygons(_front);
1668 if(this->back)
1669 _back = this->back->clipPolygons(_back);
1670 else
1671 _back.clear();
1672 for(MInt i = 0; (unsigned)i < _back.size(); i++)
1673 _front.push_back(_back[i]);
1674 return _front;
1675 }
std::vector< CsgPolygon > clipPolygons(std::vector< CsgPolygon > _polygons)

◆ clipTo()

template<MInt nDim, class SysEqn >
void FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::clipTo ( CsgNode bsp)
inline

Definition at line 1677 of file fvmbcartesiansolverxd.h.

1677 {
1678 this->polygons = bsp.clipPolygons(this->polygons);
1679 if(this->front) this->front->clipTo(bsp);
1680 if(this->back) this->back->clipTo(bsp);
1681 }

◆ invert()

template<MInt nDim, class SysEqn >
void FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::invert ( )
inline

Definition at line 1646 of file fvmbcartesiansolverxd.h.

1646 {
1647 for(MInt i = 0; (unsigned)i < this->polygons.size(); i++) {
1648 this->polygons[i].flip();
1649 }
1650 this->plane.flip();
1651 if(this->front) this->front->invert();
1652 if(this->back) this->back->invert();
1653 CsgNode* temp = this->front;
1654 this->front = this->back;
1655 this->back = temp;
1656 }

◆ plot()

template<MInt nDim, class SysEqn >
void FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::plot ( MInt  tabCounter,
const MChar fileName 
)
inline

Definition at line 1701 of file fvmbcartesiansolverxd.h.

1701 {
1702 std::ofstream ofl;
1703 if(tabCounter == 0) {
1704 ofl.open(fileName);
1705 ofl.close();
1706 }
1707
1708 if(this->front) this->front->plot(tabCounter + 1, fileName);
1709
1710 ofl.open(fileName, std::ofstream::app);
1711
1712 if(ofl) {
1713 for(MInt count = 0; count < tabCounter; count++)
1714 ofl << " ";
1715 ofl << "node plane normal, w:";
1716 for(MInt dim = 0; dim < nDim; ++dim)
1717 ofl << " " << this->plane.normal.xx[dim];
1718 ofl << ", " << this->plane.w << std::endl;
1719
1720 for(MInt p = 0; (unsigned)p < this->polygons.size(); p++) {
1721 for(MInt count = 0; count < tabCounter; count++)
1722 ofl << " ";
1723 ofl << "polygon " << p << " plane normal, w:";
1724 for(MInt dim = 0; dim < nDim; ++dim)
1725 ofl << " " << this->polygons[p].plane.normal.xx[dim];
1726 ofl << ", " << this->polygons[p].plane.w << std::endl;
1727
1728 for(MInt count = 0; count < tabCounter; count++)
1729 ofl << " ";
1730 ofl << "polygon setIndex: " << this->polygons[p].setIndex << ", bodyId: " << this->polygons[p].bodyId
1731 << ", faceId: " << this->polygons[p].faceId << ", faceType: " << this->polygons[p].faceType << std::endl;
1732 }
1733 ofl << std::endl << std::endl;
1734 ofl.close();
1735 }
1736
1737 if(this->back) this->back->plot(tabCounter + 1, fileName);
1738 }
void plot(MInt tabCounter, const MChar *fileName)
constexpr std::underlying_type< FcCell >::type p(const FcCell property)
Converts property name to underlying integer value.

Member Data Documentation

◆ back

template<MInt nDim, class SysEqn >
CsgNode* FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::back

Definition at line 1622 of file fvmbcartesiansolverxd.h.

◆ front

template<MInt nDim, class SysEqn >
CsgNode* FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::front

Definition at line 1621 of file fvmbcartesiansolverxd.h.

◆ plane

template<MInt nDim, class SysEqn >
CsgPlane FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::plane

Definition at line 1619 of file fvmbcartesiansolverxd.h.

◆ planeValid

template<MInt nDim, class SysEqn >
MBool FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::planeValid

Definition at line 1620 of file fvmbcartesiansolverxd.h.

◆ polygons

template<MInt nDim, class SysEqn >
std::vector<CsgPolygon> FvMbCartesianSolverXD< nDim, SysEqn >::CsgNode::polygons

Definition at line 1623 of file fvmbcartesiansolverxd.h.


The documentation for this class was generated from the following files: