diff --git a/MeshLib/MeshEditing/MeshRevision.cpp b/MeshLib/MeshEditing/MeshRevision.cpp index 1f607761a5dd6fb602ac9cfe99d83c4e22c9995d..3ec57ff5500ea7f361962f4bddba83e254b5eb37 100644 --- a/MeshLib/MeshEditing/MeshRevision.cpp +++ b/MeshLib/MeshEditing/MeshRevision.cpp @@ -225,9 +225,10 @@ void MeshRevision::resetNodeIDs() nodes[i]->setID(i); } - - -bool MeshRevision::subdivideElement(MeshLib::Element const*const element, const std::vector<MeshLib::Node*> &nodes, std::vector<MeshLib::Element*> &elements) const +bool MeshRevision::subdivideElement( + MeshLib::Element const*const element, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> & elements) const { unsigned n_new_elems (0); if (element->getGeomType() == MeshElemType::QUAD) @@ -242,10 +243,10 @@ bool MeshRevision::subdivideElement(MeshLib::Element const*const element, const } void MeshRevision::reduceElement(MeshLib::Element const*const element, - unsigned n_unique_nodes, - const std::vector<MeshLib::Node*> &nodes, - std::vector<MeshLib::Element*> &elements, - unsigned min_elem_dim) const + unsigned n_unique_nodes, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> & elements, + unsigned min_elem_dim) const { /*************** * TODO: modify neighbouring elements if one elements has been subdivided @@ -270,7 +271,9 @@ void MeshRevision::reduceElement(MeshLib::Element const*const element, ERR ("Error: Unknown element type."); } -unsigned MeshRevision::subdivideQuad(MeshLib::Element const*const quad, const std::vector<MeshLib::Node*> &nodes, std::vector<MeshLib::Element*> &new_elements) const +unsigned MeshRevision::subdivideQuad(MeshLib::Element const*const quad, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> &new_elements) const { MeshLib::Node** tri1_nodes = new MeshLib::Node*[3]; tri1_nodes[0] = nodes[quad->getNode(0)->getID()]; @@ -287,7 +290,9 @@ unsigned MeshRevision::subdivideQuad(MeshLib::Element const*const quad, const st return 2; } -unsigned MeshRevision::subdivideHex(MeshLib::Element const*const hex, const std::vector<MeshLib::Node*> &nodes, std::vector<MeshLib::Element*> &new_elements) const +unsigned MeshRevision::subdivideHex(MeshLib::Element const*const hex, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> &new_elements) const { MeshLib::Node** prism1_nodes = new MeshLib::Node*[6]; prism1_nodes[0] = nodes[hex->getNode(0)->getID()]; @@ -314,7 +319,9 @@ unsigned MeshRevision::subdivideHex(MeshLib::Element const*const hex, const std: return 6; } -unsigned MeshRevision::subdividePyramid(MeshLib::Element const*const pyramid, const std::vector<MeshLib::Node*> &nodes, std::vector<MeshLib::Element*> &new_elements) const +unsigned MeshRevision::subdividePyramid(MeshLib::Element const*const pyramid, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> &new_elements) const { MeshLib::Node** tet1_nodes = new MeshLib::Node*[4]; tet1_nodes[0] = nodes[pyramid->getNode(0)->getID()]; @@ -333,7 +340,9 @@ unsigned MeshRevision::subdividePyramid(MeshLib::Element const*const pyramid, co return 2; } -unsigned MeshRevision::subdividePrism(MeshLib::Element const*const prism, const std::vector<MeshLib::Node*> &nodes, std::vector<MeshLib::Element*> &new_elements) const +unsigned MeshRevision::subdividePrism(MeshLib::Element const*const prism, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> &new_elements) const { MeshLib::Node** tet1_nodes = new MeshLib::Node*[4]; tet1_nodes[0] = nodes[prism->getNode(0)->getID()]; @@ -360,10 +369,10 @@ unsigned MeshRevision::subdividePrism(MeshLib::Element const*const prism, const } unsigned MeshRevision::reduceHex(MeshLib::Element const*const org_elem, - unsigned n_unique_nodes, - const std::vector<MeshLib::Node*> &nodes, - std::vector<MeshLib::Element*> &new_elements, - unsigned min_elem_dim) const + unsigned n_unique_nodes, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> &new_elements, + unsigned min_elem_dim) const { // TODO? // if two diametral nodes collapse, all kinds of bizarre (2D-)element combinations could be the result. @@ -525,10 +534,10 @@ unsigned MeshRevision::reduceHex(MeshLib::Element const*const org_elem, } void MeshRevision::reducePyramid(MeshLib::Element const*const org_elem, - unsigned n_unique_nodes, - const std::vector<MeshLib::Node*> &nodes, - std::vector<MeshLib::Element*> &new_elements, - unsigned min_elem_dim) const + unsigned n_unique_nodes, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> & new_elements, + unsigned min_elem_dim) const { if (n_unique_nodes == 4) { @@ -544,10 +553,10 @@ void MeshRevision::reducePyramid(MeshLib::Element const*const org_elem, } unsigned MeshRevision::reducePrism(MeshLib::Element const*const org_elem, - unsigned n_unique_nodes, - const std::vector<MeshLib::Node*> &nodes, - std::vector<MeshLib::Element*> &new_elements, - unsigned min_elem_dim) const + unsigned n_unique_nodes, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> & new_elements, + unsigned min_elem_dim) const { // TODO? // In theory a node from the bottom triangle and a node from the top triangle that are not connected by an edge @@ -618,7 +627,7 @@ unsigned MeshRevision::reducePrism(MeshLib::Element const*const org_elem, } MeshLib::Element* MeshRevision::constructLine(MeshLib::Element const*const element, - const std::vector<MeshLib::Node*> &nodes) const + const std::vector<MeshLib::Node*> &nodes) const { MeshLib::Node** line_nodes = new MeshLib::Node*[2]; line_nodes[0] = nodes[element->getNode(0)->getID()]; @@ -664,7 +673,10 @@ MeshLib::Element* MeshRevision::constructTri(MeshLib::Element const*const elemen return new MeshLib::Tri(tri_nodes, element->getValue()); } -MeshLib::Element* MeshRevision::constructFourNodeElement(MeshLib::Element const*const element, const std::vector<MeshLib::Node*> &nodes, unsigned min_elem_dim) const +MeshLib::Element* MeshRevision::constructFourNodeElement( + MeshLib::Element const*const element, + std::vector<MeshLib::Node*> const& nodes, + unsigned min_elem_dim) const { MeshLib::Node** new_nodes = new MeshLib::Node*[4]; unsigned count(0); @@ -711,7 +723,8 @@ MeshLib::Element* MeshRevision::constructFourNodeElement(MeshLib::Element const* return nullptr; } -unsigned MeshRevision::findPyramidTopNode(const MeshLib::Element &element, const std::array<std::size_t,4> &base_node_ids) const +unsigned MeshRevision::findPyramidTopNode(MeshLib::Element const& element, + std::array<std::size_t,4> const& base_node_ids) const { const std::size_t nNodes (element.getNBaseNodes()); for (std::size_t i=0; i<nNodes; ++i) @@ -731,7 +744,8 @@ unsigned MeshRevision::lutHexDiametralNode(unsigned id) const return _hex_diametral_nodes[id]; } -const std::array<unsigned,4> MeshRevision::lutHexCuttingQuadNodes(unsigned id1, unsigned id2) const +const std::array<unsigned,4> MeshRevision::lutHexCuttingQuadNodes( + unsigned id1, unsigned id2) const { std::array<unsigned,4> nodes; if (id1==0 && id2==1) { nodes[0]=3; nodes[1]=2; nodes[2]=5; nodes[3]=4; } @@ -762,7 +776,8 @@ const std::array<unsigned,4> MeshRevision::lutHexCuttingQuadNodes(unsigned id1, return nodes; } -const std::pair<unsigned, unsigned> MeshRevision::lutHexBackNodes(unsigned i, unsigned j, unsigned k, unsigned l) const +const std::pair<unsigned, unsigned> MeshRevision::lutHexBackNodes( + unsigned i, unsigned j, unsigned k, unsigned l) const { // collapsed edges are *not* connected std::pair<unsigned, unsigned> back(std::numeric_limits<unsigned>::max(), std::numeric_limits<unsigned>::max()); diff --git a/MeshLib/MeshEditing/MeshRevision.h b/MeshLib/MeshEditing/MeshRevision.h index 4977c238968c7b035beb086e274988b947514bf0..37666653801e4183ef52f570dc3fc41288560301 100644 --- a/MeshLib/MeshEditing/MeshRevision.h +++ b/MeshLib/MeshEditing/MeshRevision.h @@ -136,13 +136,14 @@ private: * @return The number of newly created elements */ unsigned reducePrism(MeshLib::Element const*const prism, - unsigned n_unique_nodes, - const std::vector<MeshLib::Node*> &nodes, - std::vector<MeshLib::Element*> &new_elements, - unsigned min_elem_dim) const; - + unsigned n_unique_nodes, + std::vector<MeshLib::Node*> const& nodes, + std::vector<MeshLib::Element*> & new_elements, + unsigned min_elem_dim) const; + // In an element with 5 unique nodes, return the node that will be the top of the resulting pyramid - unsigned findPyramidTopNode(const MeshLib::Element &element, const std::array<std::size_t,4> &base_node_ids) const; + unsigned findPyramidTopNode(MeshLib::Element const& element, + std::array<std::size_t,4> const& base_node_ids) const; /// Lookup-table for returning the diametral node id of the given node id in a Hex unsigned lutHexDiametralNode(unsigned id) const;