stroid v0.6.0
Multi-block curvilinear mesh generation
Loading...
Searching...
No Matches
stroid::IO Namespace Reference

Mesh serialization and visualization helpers. More...

Enumerations

enum class  VISUALIZATION_MODE : uint8_t { NONE , ELEMENT_ID , BOUNDARY_ELEMENT_ID }
 Visualization modes for GLVis display. More...
 

Functions

void SaveStroidMesh (const StroidMesh &mesh, const std::string &filename, const std::string &comment="")
 
void SaveMesh (const mfem::Mesh &mesh, const std::string &filename)
 Save a mesh to MFEM's native .mesh format.
 
void SaveMesh (const stroid::StroidMesh &mesh, const std::string &filename)
 Overload of SaveMesh which accepts a StroidMesh type and will internally unpack it.
 
void SaveVTU (mfem::Mesh &mesh, const std::string &exportName)
 Save a mesh as a ParaView VTU dataset.
 
void SaveVTU (const stroid::StroidMesh &mesh, const std::string &exportName)
 Overload of SaveVTU which accepts a StroidMesh type and will internally unpack it.
 
std::unique_ptr< mfem::Mesh > MakeConformingVisualizationMesh (const mfem::Mesh &mesh)
 Make a display-only mesh copy with matching face subdivisions. This is purely for visualization and should not be used for any science goals.
 
void ViewMesh (mfem::Mesh &mesh, const std::string &title, VISUALIZATION_MODE mode, const std::string &vishost, int visport, bool conforming_display=true)
 Stream a mesh to a running GLVis server for interactive viewing.
 
void ViewMesh (const stroid::StroidMesh &mesh, const std::string &title, VISUALIZATION_MODE mode, const std::string &vishost, int visport, bool conforming_display=true)
 
void VisualizeFaceValence (mfem::Mesh &mesh, const std::string &vishost, int visport, bool conforming_display=true)
 Color boundary-adjacent elements by face valence (1=surface, 2=internal). Untagged elements are zero; elements touching several tagged faces use the maximum valence. Values are computed before display subdivision.
 
void VisualizeFaceValence (const stroid::StroidMesh &mesh, const std::string &vishost, int visport, bool conforming_display=true)
 
std::expected< StroidMesh, std::string > ParseStroidMesh (std::istream &is)
 
std::expected< StroidMesh, std::string > LoadStroidMesh (const std::string &filename)
 

Detailed Description

Mesh serialization and visualization helpers.

Enumeration Type Documentation

◆ VISUALIZATION_MODE

enum class stroid::IO::VISUALIZATION_MODE : uint8_t
strong

Visualization modes for GLVis display.

Enumerator
NONE 

No attribute visualization (default rendering).

ELEMENT_ID 

Color elements by their element attribute/ID.

BOUNDARY_ELEMENT_ID 

Color boundary-adjacent elements by boundary attribute/ID.

Function Documentation

◆ LoadStroidMesh()

std::expected< StroidMesh, std::string > stroid::IO::LoadStroidMesh ( const std::string & filename)

◆ MakeConformingVisualizationMesh()

std::unique_ptr< mfem::Mesh > stroid::IO::MakeConformingVisualizationMesh ( const mfem::Mesh & mesh)

Make a display-only mesh copy with matching face subdivisions. This is purely for visualization and should not be used for any science goals.

Parameters
meshSource mesh whose geometry is to be displayed.
Returns
Independently owned copy with no hanging faces.

◆ ParseStroidMesh()

std::expected< StroidMesh, std::string > stroid::IO::ParseStroidMesh ( std::istream & is)

◆ SaveMesh() [1/2]

void stroid::IO::SaveMesh ( const mfem::Mesh & mesh,
const std::string & filename )

Save a mesh to MFEM's native .mesh format.

Parameters
meshMesh to serialize.
filenameOutput path (including extension).

◆ SaveMesh() [2/2]

void stroid::IO::SaveMesh ( const stroid::StroidMesh & mesh,
const std::string & filename )

Overload of SaveMesh which accepts a StroidMesh type and will internally unpack it.

Parameters
meshStroidMesh to serialize.
filenamePath to save to
Note
This function is a utility wrapper to save a StroidMesh object in MFEM's native .mesh format. Data other than the mesh pointer in StroidMesh will not be saved (e.g. the reference mesh, the number of refinement levels, etc..). If you need to serialize an entire StroidMesh then please use the stroid::IO::SaveStroidMesh function

◆ SaveStroidMesh()

void stroid::IO::SaveStroidMesh ( const StroidMesh & mesh,
const std::string & filename,
const std::string & comment = "" )

◆ SaveVTU() [1/2]

void stroid::IO::SaveVTU ( const stroid::StroidMesh & mesh,
const std::string & exportName )

Overload of SaveVTU which accepts a StroidMesh type and will internally unpack it.

Parameters
meshStroidMesh to serialize.
filenamePath to save to
Note
This function is a utility wrapper to save a StroidMesh object in MFEM's native .mesh format. Data other than the mesh pointer in StroidMesh will not be saved (e.g. the reference mesh, the number of refinement levels, etc..). If you need to serialize an entire StroidMesh then please use the stroid::IO::SaveStroidVTU function

◆ SaveVTU() [2/2]

void stroid::IO::SaveVTU ( mfem::Mesh & mesh,
const std::string & exportName )

Save a mesh as a ParaView VTU dataset.

Parameters
meshMesh to export.
exportNameOutput base name (ParaView will add extensions).

◆ ViewMesh() [1/2]

void stroid::IO::ViewMesh ( const stroid::StroidMesh & mesh,
const std::string & title,
VISUALIZATION_MODE mode,
const std::string & vishost,
int visport,
bool conforming_display = true )

◆ ViewMesh() [2/2]

void stroid::IO::ViewMesh ( mfem::Mesh & mesh,
const std::string & title,
VISUALIZATION_MODE mode,
const std::string & vishost,
int visport,
bool conforming_display = true )

Stream a mesh to a running GLVis server for interactive viewing.

Parameters
meshMesh to display.
titleWindow title shown in GLVis.
modeAttribute visualization mode.
vishostGLVis server host.
visportGLVis server port.
conforming_displayRefine a display-only copy at hanging interfaces to prevent GLVis tessellation gaps. Set false to inspect the original element layout, which can show rendering gaps on curved interfaces.

◆ VisualizeFaceValence() [1/2]

void stroid::IO::VisualizeFaceValence ( const stroid::StroidMesh & mesh,
const std::string & vishost,
int visport,
bool conforming_display = true )

◆ VisualizeFaceValence() [2/2]

void stroid::IO::VisualizeFaceValence ( mfem::Mesh & mesh,
const std::string & vishost,
int visport,
bool conforming_display = true )

Color boundary-adjacent elements by face valence (1=surface, 2=internal). Untagged elements are zero; elements touching several tagged faces use the maximum valence. Values are computed before display subdivision.

Parameters
meshMesh whose boundary faces are inspected.
vishostGLVis server host.
visportGLVis server port.
conforming_displayUse the same display-only refinement as ViewMesh.