Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9e94540
MeshModification::all_rbb() function
roystgnr Dec 24, 2024
e7f92fb
all_rbb support for 2.5D meshes
roystgnr Apr 23, 2026
3fcaa64
Add 1D support to all_rbb()
roystgnr Apr 23, 2026
46cebc0
Add some all_rbb() unit tests
roystgnr Apr 24, 2026
9b69d81
Re-bootstrap
roystgnr Apr 24, 2026
b5462ea
Fix whitespace
roystgnr Apr 24, 2026
564dbf5
Fix test for non-tensor-product elements
roystgnr Apr 24, 2026
c7eea5f
Fix test for NodeElem case
roystgnr Apr 24, 2026
e3e8ba2
Fix for all_rbb() edge/quad case
roystgnr Apr 24, 2026
d7117a7
Use clearer parameter names
roystgnr Apr 30, 2026
5de8db2
Fix all_rbb() chord calculations
roystgnr Apr 30, 2026
7eb6e2b
Fix volume() for higher-order RBB edges
roystgnr Apr 30, 2026
b33f2c5
Add unit tests for RBB circles
roystgnr Apr 30, 2026
c0662bf
Use min-energy Steiner surface, not cylinder hack
roystgnr May 18, 2026
3e8b9c3
Formula tweak
roystgnr May 18, 2026
f74479e
all_rbb() tests for quad disks
roystgnr May 18, 2026
926a0cf
Add all_rbb() Tri6 tests
roystgnr May 18, 2026
1410a70
Use almost_equal again where appropriate
roystgnr May 19, 2026
2ebc531
Capture almost_equal in the correct lambda
roystgnr May 19, 2026
50a7915
Fix atavistic + broken comments
roystgnr May 22, 2026
eb4a3e3
"else if" in extrude_dir checks
roystgnr May 22, 2026
1c90614
Try adding some more unit tests to the trivial case
roystgnr May 22, 2026
a9f2ab3
Fix NodeElem::hmin()
roystgnr May 22, 2026
40a9bd2
Non-planar non-Lagrange Fall back on Elem::volume
roystgnr May 23, 2026
db617bb
Don't fall back on Elem::volume() in C0Polygon
roystgnr May 23, 2026
598356a
Better comments on volume() vs mapping_type()
roystgnr May 23, 2026
09a5fd6
Don't try RBB Prisms yet
roystgnr May 23, 2026
44e918f
Clean up the new all_rbb() test assertions
roystgnr May 23, 2026
b520b1c
Comment out Prism tests *and* instantiations
roystgnr May 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/mesh/mesh_generation.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ void build_square (UnstructuredMesh & mesh,
* Meshes a spherical or mapped-spherical domain.
*/
void build_sphere (UnstructuredMesh & mesh,
const Real rad=1,
const unsigned int nr=2,
const Real radius=1,
const unsigned int n_refinements=2,
const ElemType type=INVALID_ELEM,
const unsigned int n_smooth=2,
const bool flat=true);
Expand Down
8 changes: 8 additions & 0 deletions include/mesh/mesh_modification.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ void scale (MeshBase & mesh,
*/
void all_tri (MeshBase & mesh);

/**
* Converts all element geometric mappings from the default Lagrange
* to the more flexible Rational-Bezier-Bernstein. When elements have
* curved edges and/or faces, node weights are chosen so that the new
* edges interpolate the old edge node locations with a circular arc.
*/
void all_rbb (MeshBase & mesh);

/**
* Smooth the mesh with a simple Laplace smoothing algorithm. The mesh is
* smoothed \p n_iterations times. If the parameter \p power is 0, each
Expand Down
4 changes: 3 additions & 1 deletion src/geom/cell_c0polyhedron.C
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ void C0Polyhedron::connectivity(const unsigned int /*sf*/,

Real C0Polyhedron::volume () const
{
// This specialization is good for Lagrange mappings only
// This specialization is ... probably good for general non-Lagrange
// mappings, since we require our polyhedral faces to be planar, but
// I'd rather be slow than wrong.
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

Expand Down
2 changes: 1 addition & 1 deletion src/geom/cell_hex20.C
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Hex20::second_order_child_vertex (const unsigned int n) const

Real Hex20::volume () const
{
// This specialization is good for Lagrange mappings only
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

Expand Down
2 changes: 1 addition & 1 deletion src/geom/cell_hex27.C
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ Hex27::second_order_child_vertex (const unsigned int n) const

Real Hex27::volume () const
{
// This specialization is good for Lagrange mappings only
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

Expand Down
4 changes: 4 additions & 0 deletions src/geom/cell_hex8.C
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ Point Hex8::true_centroid () const

Real Hex8::volume () const
{
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

// Make copies of our points. It makes the subsequent calculations a bit
// shorter and avoids dereferencing the same pointer multiple times.
Point
Expand Down
2 changes: 1 addition & 1 deletion src/geom/cell_prism15.C
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ Prism15::second_order_child_vertex (const unsigned int n) const

Real Prism15::volume () const
{
// This specialization is good for Lagrange mappings only
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

Expand Down
2 changes: 1 addition & 1 deletion src/geom/cell_prism18.C
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ Prism18::second_order_child_vertex (const unsigned int n) const

Real Prism18::volume () const
{
// This specialization is good for Lagrange mappings only
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

Expand Down
4 changes: 4 additions & 0 deletions src/geom/cell_prism6.C
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ Point Prism6::true_centroid () const

Real Prism6::volume () const
{
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

VolumeIntegral vi;
cell_integral(this, vi);
return vi.vol;
Expand Down
2 changes: 1 addition & 1 deletion src/geom/cell_pyramid13.C
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ unsigned short int Pyramid13::second_order_adjacent_vertex (const unsigned int n

Real Pyramid13::volume () const
{
// This specialization is good for Lagrange mappings only
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

Expand Down
2 changes: 1 addition & 1 deletion src/geom/cell_pyramid14.C
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ unsigned short int Pyramid14::second_order_adjacent_vertex (const unsigned int n

Real Pyramid14::volume () const
{
// This specialization is good for Lagrange mappings only
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

Expand Down
4 changes: 4 additions & 0 deletions src/geom/cell_pyramid5.C
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ Point Pyramid5::true_centroid () const

Real Pyramid5::volume () const
{
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

// The pyramid with a bilinear base has volume given by the
// formula in: "Calculation of the Volume of a General Hexahedron
// for Flow Predictions", AIAA Journal v.23, no.6, 1984, p.954-
Expand Down
2 changes: 1 addition & 1 deletion src/geom/cell_tet10.C
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ Real Tet10::embedding_matrix (const unsigned int i,

Real Tet10::volume () const
{
// This specialization is good for Lagrange mappings only
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

Expand Down
3 changes: 3 additions & 0 deletions src/geom/cell_tet4.C
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ Point Tet4::true_centroid () const

Real Tet4::volume () const
{
// This specialization is good for non-Lagrange mappings too! Even
// with differing vertex weights we've still got p=1 planar faces.

// The volume of a tetrahedron is 1/6 the box product formed
// by its base and apex vectors
Point a = point(3) - point(0);
Expand Down
4 changes: 4 additions & 0 deletions src/geom/edge_edge3.C
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ Edge3::second_order_child_vertex (const unsigned int) const

Real Edge3::volume () const
{
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

// Finding the (exact) length of a general quadratic element
// is a surprisingly complicated formula.
Point A = this->point(0) + this->point(1) - 2*this->point(2);
Expand Down
4 changes: 4 additions & 0 deletions src/geom/edge_edge4.C
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ dof_id_type Edge4::key () const

Real Edge4::volume () const
{
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

// Make copies of our points. It makes the subsequent calculations a bit
// shorter and avoids dereferencing the same pointer multiple times.
Point
Expand Down
8 changes: 6 additions & 2 deletions src/geom/elem.C
Original file line number Diff line number Diff line change
Expand Up @@ -682,11 +682,15 @@ Point Elem::vertex_average() const

Real Elem::hmin() const
{
Real h_min=std::numeric_limits<Real>::max();

// Avoid calling a virtual a lot of times
const auto n_vertices = this->n_vertices();

// Special case for NodeElem
if (!n_vertices)
return 0;

Real h_min=std::numeric_limits<Real>::max();

for (unsigned int n_outer=0; n_outer<n_vertices; n_outer++)
for (unsigned int n_inner=n_outer+1; n_inner<n_vertices; n_inner++)
{
Expand Down
8 changes: 5 additions & 3 deletions src/geom/face_c0polygon.C
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,11 @@ void C0Polygon::connectivity(const unsigned int /*sf*/,

Real C0Polygon::volume () const
{
// This specialization is good for Lagrange mappings only
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();
// This specialization is good for non-Lagrange mappings, but
// remember to be more careful when we extend it to non-planar or
// non p=1 polygon types.
// if (this->mapping_type() != LAGRANGE_MAP)
// return this->Elem::volume();

// We use a triangulation to calculate here; assert that it's as
// consistent as possible.
Expand Down
6 changes: 6 additions & 0 deletions src/geom/face_quad4.C
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ Point Quad4::true_centroid () const

Real Quad4::volume () const
{
// This specialization is good for Lagrange mappings only in general
// (consider that we might have a non-planar quad with non-equal
// vertex weights)
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

// Make copies of our points. It makes the subsequent calculations a bit
// shorter and avoids dereferencing the same pointer multiple times.
Point
Expand Down
3 changes: 3 additions & 0 deletions src/geom/face_tri3.C
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ Point Tri3::true_centroid () const

Real Tri3::volume () const
{
// This specialization is good for non-Lagrange mappings too! Even
// with differing vertex weights we've still got a p=1 planar face.

// 3-node triangles have the following formula for computing the area
return 0.5 * cross_norm(point(1) - point(0),
point(2) - point(0));
Expand Down
2 changes: 1 addition & 1 deletion src/geom/face_tri6.C
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ BoundingBox Tri6::loose_bounding_box () const

Real Tri6::volume () const
{
// This specialization is good for Lagrange mappings only
// This specialization is good for Lagrange mappings only in general
if (this->mapping_type() != LAGRANGE_MAP)
return this->Elem::volume();

Expand Down
Loading