RefineGeometry is an executable block class capable of refine a surface geometry. More...

#include <RefineGeometry.hpp>

Inheritance diagram for mimmo::RefineGeometry:
Collaboration diagram for mimmo::RefineGeometry:

Public Member Functions

 RefineGeometry ()
 
 RefineGeometry (const bitpit::Config::Section &rootXML)
 
 RefineGeometry (const RefineGeometry &other)
 
virtual ~RefineGeometry ()
 
virtual void absorbSectionXML (const bitpit::Config::Section &slotXML, std::string name="")
 
void buildPorts ()
 
void clear ()
 
void execute ()
 
virtual void flushSectionXML (bitpit::Config::Section &slotXML, std::string name="")
 
RefineType getRefineType ()
 
RefineGeometryoperator= (RefineGeometry other)
 
void plotOptionalResults ()
 
void setRefineSteps (int steps)
 
void setRefineType (int type)
 
void setRefineType (RefineType type)
 
void setSmoothingSteps (int steps)
 
- Public Member Functions inherited from mimmo::BaseManipulation
 BaseManipulation ()
 
 BaseManipulation (const BaseManipulation &other)
 
virtual ~BaseManipulation ()
 
void activate ()
 
bool arePortsBuilt ()
 
void clear ()
 
void disable ()
 
void exec ()
 
BaseManipulationgetChild (int i=0)
 
ConnectionType getConnectionType ()
 
MimmoSharedPointer< MimmoObjectgetGeometry ()
 
MimmoSharedPointer< MimmoObject > & getGeometryReference ()
 
int getId ()
 
bitpit::Logger & getLog ()
 
std::string getName ()
 
int getNChild ()
 
int getNParent ()
 
int getNPortsIn ()
 
int getNPortsOut ()
 
BaseManipulationgetParent (int i=0)
 
std::unordered_map< PortID, PortIn * > getPortsIn ()
 
std::unordered_map< PortID, PortOut * > getPortsOut ()
 
uint getPriority ()
 
virtual std::vector< BaseManipulation * > getSubBlocksEmbedded ()
 
bool isActive ()
 
bool isApply ()
 
bool isChild (BaseManipulation *, int &)
 
bool isParent (BaseManipulation *, int &)
 
bool isPlotInExecution ()
 
BaseManipulationoperator= (const BaseManipulation &other)
 
void removePins ()
 
void removePinsIn ()
 
void removePinsOut ()
 
void setApply (bool flag=true)
 
void setGeometry (MimmoSharedPointer< MimmoObject > geometry)
 
void setId (int)
 
void setLog (bitpit::Logger &log)
 
void setName (std::string name)
 
void setOutputPlot (std::string path)
 
void setPlotInExecution (bool)
 
void setPriority (uint priority)
 
void unsetGeometry ()
 

Protected Member Functions

bool checkTriangulation ()
 
std::vector< long > greenRefineCell (const long &cellId, const long newVertexId, int iface)
 
void redgreenRefine (std::unordered_map< long, long > *mapping=nullptr, mimmo::MimmoSharedPointer< MimmoObject > coarsepatch=nullptr, mimmo::MimmoSharedPointer< MimmoObject > refinepatch=nullptr)
 
std::vector< long > redRefineCell (const long &cellId, const std::vector< long > &newVertexIds)
 
void smoothing (std::set< long > *constrainedVertices=nullptr)
 
void swap (RefineGeometry &x) noexcept
 
void ternaryRefine (std::unordered_map< long, long > *mapping=nullptr, mimmo::MimmoSharedPointer< MimmoObject > coarsepatch=nullptr, mimmo::MimmoSharedPointer< MimmoObject > refinepatch=nullptr)
 
std::vector< long > ternaryRefineCell (const long &cellId, const std::vector< bitpit::Vertex > &vertices, const std::array< double, 3 > &center)
 
- Protected Member Functions inherited from mimmo::BaseManipulation
void _apply (MimmoPiercedVector< darray3E > &displacements)
 
void addChild (BaseManipulation *child)
 
void addParent (BaseManipulation *parent)
 
void addPinIn (BaseManipulation *objIn, PortID portR)
 
void addPinOut (BaseManipulation *objOut, PortID portS, PortID portR)
 
virtual void apply ()
 
void cleanBufferIn (PortID port)
 
template<typename T , typename O >
bool createPortIn (O *obj, void(O::*setVar_)(T), PortID portR, bool mandatory=false, int family=0)
 
template<typename T , typename O >
bool createPortIn (T *var_, PortID portR, bool mandatory=false, int family=0)
 
template<typename T , typename O >
bool createPortOut (O *obj, T(O::*getVar_)(), PortID portS)
 
template<typename T , typename O >
bool createPortOut (T *var_, PortID portS)
 
void deletePorts ()
 
PortID findPinIn (PortIn &pin)
 
PortID findPinOut (PortOut &pin)
 
void initializeLogger (bool logexists)
 
void readBufferIn (PortID port)
 
void removePinIn (BaseManipulation *objIn, PortID portR)
 
void removePinIn (PortID portR, int j)
 
void removePinOut (BaseManipulation *objOut, PortID portS)
 
void removePinOut (PortID portS, int j)
 
void setBufferIn (PortID port, mimmo::IBinaryStream &input)
 
void swap (BaseManipulation &x) noexcept
 
void unsetChild (BaseManipulation *child)
 
void unsetParent (BaseManipulation *parent)
 
void write (MimmoSharedPointer< MimmoObject > geometry)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, MimmoPiercedVector< mpv_t > &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, MimmoPiercedVector< mpv_t > &data, Args ... args)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t > * > &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t > * > &data, Args ... args)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t >> &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t >> &data, Args ... args)
 

Protected Attributes

std::vector< long > m_activecells
 
int m_refinements
 
int m_steps
 
RefineType m_type
 
- Protected Attributes inherited from mimmo::BaseManipulation
bool m_active
 
bool m_apply
 
bool m_arePortsBuilt
 
bmumap m_child
 
int m_counter
 
bool m_execPlot
 
MimmoSharedPointer< MimmoObjectm_geometry
 
bitpit::Logger * m_log
 
std::string m_name
 
std::string m_outputPlot
 
bmumap m_parent
 
std::unordered_map< PortID, PortIn * > m_portIn
 
std::unordered_map< PortID, PortOut * > m_portOut
 
ConnectionType m_portsType
 
uint m_priority
 

Additional Inherited Members

- Public Types inherited from mimmo::BaseManipulation
typedef std::unordered_map< BaseManipulation *, int > bmumap
 
typedef pin::ConnectionType ConnectionType
 
typedef std::string PortID
 
- Static Protected Attributes inherited from mimmo::BaseManipulation
static int sm_baseManipulationCounter
 

Detailed Description

RefineGeometry is an executable block class capable of refine a surface geometry.

RefineGeometry is the object to refine a surface MimmoObject. After the execution of the block the geometry will be refined in function of the refinement method chosen. Beware, the original geometry is permanently modified after refinement.

At the end of the refinement a laplacian smoothing regularization can be performed. Two sub-steps are carried out, a positive and a negative smoothing step, that minimizes the effect on the sharp edges of the geometry. The smoothing is activated by imposing a number of smoothing steps > 0 (default = 0).

Ports available in RefineGeometry Class :


Port Input
PortType variable/function DataType
M_GEOM setGeometry (MC_SCALAR, MD_MIMMO_)
Port Output
PortType variable/function DataType
M_GEOM getGeometry (MC_SCALAR, MD_MIMMO_)

The xml available parameters, sections and subsections are the following :

Inherited from BaseManipulation:

  • ClassName: name of the class as mimmo.RefineGeometry;
  • Priority: uint marking priority in multi-chain execution;
  • PlotInExecution: boolean 0/1 print optional results of the class.
  • OutputPlot: target directory for optional results writing.

Proper of the class:

  • RefineType: refine method-> 0 Ternary , 1 Red-Green
  • RefineSteps: (uint) number of refinements. 0 means no refinement.
  • SmoothingSteps: (uint) number of smoothing steps. 0 means no smoothing.

Geometries have to be mandatorily passed through port.

Examples
geohandlers_example_00001.cpp.

Definition at line 92 of file RefineGeometry.hpp.

Constructor & Destructor Documentation

◆ RefineGeometry() [1/3]

mimmo::RefineGeometry::RefineGeometry ( )

Default constructor of RefineGeometry.

Definition at line 35 of file RefineGeometry.cpp.

◆ RefineGeometry() [2/3]

mimmo::RefineGeometry::RefineGeometry ( const bitpit::Config::Section &  rootXML)

Custom constructor reading xml data

Parameters
[in]rootXMLreference to your xml tree section

Definition at line 46 of file RefineGeometry.cpp.

◆ ~RefineGeometry()

mimmo::RefineGeometry::~RefineGeometry ( )
virtual

Default destructor of RefineGeometry.

Definition at line 67 of file RefineGeometry.cpp.

◆ RefineGeometry() [3/3]

mimmo::RefineGeometry::RefineGeometry ( const RefineGeometry other)

Copy constructor of RefineGeometry.

Definition at line 72 of file RefineGeometry.cpp.

Member Function Documentation

◆ absorbSectionXML()

void mimmo::RefineGeometry::absorbSectionXML ( const bitpit::Config::Section &  slotXML,
std::string  name = "" 
)
virtual

It sets infos reading from a XML bitpit::Config::section.

Parameters
[in]slotXMLbitpit::Config::Section of XML file
[in]namename associated to the slot

Reimplemented from mimmo::BaseManipulation.

Definition at line 218 of file RefineGeometry.cpp.

◆ buildPorts()

void mimmo::RefineGeometry::buildPorts ( )
virtual

Building ports of the class

Implements mimmo::BaseManipulation.

Definition at line 104 of file RefineGeometry.cpp.

◆ checkTriangulation()

bool mimmo::RefineGeometry::checkTriangulation ( )
protected

Check if the target geometry of the class is a regular triangulation

Returns
true if a regular triangulation.

Definition at line 1171 of file RefineGeometry.cpp.

◆ clear()

void mimmo::RefineGeometry::clear ( )

Clear all stuffs in your class

Definition at line 168 of file RefineGeometry.cpp.

◆ execute()

void mimmo::RefineGeometry::execute ( )
virtual

Execution command. It refines the target surface geometry.

Implements mimmo::BaseManipulation.

Definition at line 177 of file RefineGeometry.cpp.

◆ flushSectionXML()

void mimmo::RefineGeometry::flushSectionXML ( bitpit::Config::Section &  slotXML,
std::string  name = "" 
)
virtual

It sets infos from class members in a XML bitpit::Config::section.

Parameters
[in]slotXMLbitpit::Config::Section of XML file
[in]namename associated to the slot

Reimplemented from mimmo::BaseManipulation.

Definition at line 266 of file RefineGeometry.cpp.

◆ getRefineType()

RefineType mimmo::RefineGeometry::getRefineType ( )

Return kind of refinement set for the object.

Returns
refine type

Definition at line 116 of file RefineGeometry.cpp.

◆ greenRefineCell()

std::vector< long > mimmo::RefineGeometry::greenRefineCell ( const long &  cellId,
const long  newVertexId,
int  splitEdgeIndex 
)
protected

It refines the target cell with green method.

Parameters
[in]cellIdId of the target cell
[in]newVertexIdId of the new vertex (already in the mesh) to be used to refine the cell
[in]splitEdgeIndexIndex of the edge to split
Returns
Ids of the new created cells

Definition at line 908 of file RefineGeometry.cpp.

◆ operator=()

RefineGeometry & mimmo::RefineGeometry::operator= ( RefineGeometry  other)

Assignement operator of RefineGeometry. Soft copy of MimmoObject

Definition at line 81 of file RefineGeometry.cpp.

◆ plotOptionalResults()

void mimmo::RefineGeometry::plotOptionalResults ( )
virtual

Plot stitched geometry in *.vtu file as optional result;

Reimplemented from mimmo::BaseManipulation.

Definition at line 279 of file RefineGeometry.cpp.

◆ redgreenRefine()

void mimmo::RefineGeometry::redgreenRefine ( std::unordered_map< long, long > *  mapping = nullptr,
mimmo::MimmoSharedPointer< MimmoObject coarsepatch = nullptr,
mimmo::MimmoSharedPointer< MimmoObject refinepatch = nullptr 
)
protected

Refinement by redgreen method. The starting elements must be all triangles. All the triangle edges are splitted for every cell in case of red refinement (bulk cells), only one edge is splitted in case of green refinement (boundary cells).

Parameters
[out]mappingpointer to mapping container (new child cell id -> parent cell id)
[out]coarsepatchpointer to geometry containing the original parent cells
[out]refinepatchpointer to geometry containing the new children refined cells

Definition at line 461 of file RefineGeometry.cpp.

◆ redRefineCell()

std::vector< long > mimmo::RefineGeometry::redRefineCell ( const long &  cellId,
const std::vector< long > &  newVertexIds 
)
protected

It refines the target cell with red method.

Parameters
[in]cellIdId of the target cell
[in]newVertexIdsIds of the new vertices (already in the mesh) to be used to refine the cell
Returns
Ids of the new created cells

Definition at line 850 of file RefineGeometry.cpp.

◆ setRefineSteps()

void mimmo::RefineGeometry::setRefineSteps ( int  steps)

It sets the number of refinement steps

Parameters
[in]stepsrefinement steps
Examples
geohandlers_example_00001.cpp.

Definition at line 150 of file RefineGeometry.cpp.

◆ setRefineType() [1/2]

void mimmo::RefineGeometry::setRefineType ( int  type)

It sets refinement method of refine block

Parameters
[in]typerefine type

Definition at line 137 of file RefineGeometry.cpp.

◆ setRefineType() [2/2]

void mimmo::RefineGeometry::setRefineType ( RefineType  type)

It sets refinement method of refine block

Parameters
[in]typerefine type
Examples
geohandlers_example_00001.cpp.

Definition at line 126 of file RefineGeometry.cpp.

◆ setSmoothingSteps()

void mimmo::RefineGeometry::setSmoothingSteps ( int  steps)

It sets the number of positive/negative laplacian smoothing steps

Parameters
[in]stepssmoothing steps
Examples
geohandlers_example_00001.cpp.

Definition at line 160 of file RefineGeometry.cpp.

◆ smoothing()

void mimmo::RefineGeometry::smoothing ( std::set< long > *  constrainedVertices = nullptr)
protected

Perform the laplacian smoothing for the surface patch. Each step is divided in two sub-steps, a laplacian smoothing and a laplacian anti-smoothing with negative coefficient.

Parameters
[in]constrainedVerticesPointer to set of constrined vertices indices

Definition at line 959 of file RefineGeometry.cpp.

◆ swap()

void mimmo::RefineGeometry::swap ( RefineGeometry x)
protectednoexcept

Swap function of RefineGeometry.

Parameters
[in]xobject to be swapped.

Definition at line 91 of file RefineGeometry.cpp.

◆ ternaryRefine()

void mimmo::RefineGeometry::ternaryRefine ( std::unordered_map< long, long > *  mapping = nullptr,
mimmo::MimmoSharedPointer< MimmoObject coarsepatch = nullptr,
mimmo::MimmoSharedPointer< MimmoObject refinepatch = nullptr 
)
protected

Global refinement by ternary method. A vertex is added on the barycenter of each cell. One triangle for each edge is added for every cell.

Definition at line 288 of file RefineGeometry.cpp.

◆ ternaryRefineCell()

std::vector< long > mimmo::RefineGeometry::ternaryRefineCell ( const long &  cellId,
const std::vector< bitpit::Vertex > &  vertices,
const std::array< double, 3 > &  center 
)
protected

It refines the target cell with perimeter defined by vertices and center point.

Parameters
[in]cellIdcell id of the cell to be refined
[in]verticesperimeter vertices of the cell
[in]centercenter point of the cell
Returns
Cell ids of the new refined cells insert in the geometry

Note: the old refined cell is not deleted from the geometry in this function.

Definition at line 412 of file RefineGeometry.cpp.

Member Data Documentation

◆ m_activecells

std::vector<long> mimmo::RefineGeometry::m_activecells
protected

Cells Id candidate to be refined.

Definition at line 99 of file RefineGeometry.hpp.

◆ m_refinements

int mimmo::RefineGeometry::m_refinements
protected

Number of refinements. Default 1

Definition at line 96 of file RefineGeometry.hpp.

◆ m_steps

int mimmo::RefineGeometry::m_steps
protected

Smoothing steps after the refinement.

Definition at line 97 of file RefineGeometry.hpp.

◆ m_type

RefineType mimmo::RefineGeometry::m_type
protected

Refine mode. Default 1 - RedGreen

Definition at line 95 of file RefineGeometry.hpp.


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