MFEM v4.10.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::FindPointsGSLIB Class Reference

FindPointsGSLIB can robustly evaluate a GridFunction on an arbitrary collection of points. See Mittal et al., "General Field Evaluation in High-Order Meshes on GPUs". (2025). Computers & Fluids. for technical details. More...

#include <gslib.hpp>

Inheritance diagram for mfem::FindPointsGSLIB:
[legend]
Collaboration diagram for mfem::FindPointsGSLIB:
[legend]

Classes

struct  DevStruct
 

Public Types

enum  AvgType { NONE , ARITHMETIC , HARMONIC }
 

Public Member Functions

 FindPointsGSLIB ()
 Serial constructor.
 
 FindPointsGSLIB (Mesh &mesh_in, const double bbox_rel_size_inc=0.1, const double newt_tol=1.0e-12, const int npt_max=256)
 Serial constructor + setup with given Mesh (see Setup)
 
 FindPointsGSLIB (MPI_Comm comm_)
 Constructor for ParMesh.
 
 FindPointsGSLIB (ParMesh &mesh_in, const double bbox_rel_size_inc=0.1, const double newt_tol=1.0e-12, const int npt_max=256)
 Constructor + setup with given ParMesh (see Setup)
 
virtual ~FindPointsGSLIB ()
 
 FindPointsGSLIB (const FindPointsGSLIB &)=delete
 
FindPointsGSLIBoperator= (const FindPointsGSLIB &)=delete
 
void Setup (Mesh &m, const double bbox_rel_size_inc=0.1, const double newt_tol=1.0e-12, const int npt_max=256)
 Preprocess the internal mesh in gslib.
 
void SetupSurf (Mesh &m, const double bbox_rel_size_inc=0.1, const double newt_tol=1.0e-12)
 Preprocess the surface mesh to compute data for FindPoints.
 
void SetupSurfWithAABBExpansion (Mesh &m, const Vector &aabb_sz_inc, const double newt_tol=1.0e-12)
 Preprocess the surface mesh to compute data for FindPoints using absolute AABB expansion.
 
void FindPoints (const Vector &point_pos, int point_pos_ordering=Ordering::byNODES)
 Searches positions given in physical space by point_pos.
 
void FindPoints (const ParticleVector &point_pos)
 Convenience function when point positions are in a ParticleVector.
 
void FindPointsSurf (const Vector &point_pos, int point_pos_ordering=Ordering::byNODES)
 Searches positions given in physical space by point_pos on surface mesh.
 
void FindPointsSurf (const ParticleVector &point_pos)
 Convenience function when point positions are in a ParticleVector.
 
void FindPoints (Mesh &m, const Vector &point_pos, const int point_pos_ordering=Ordering::byNODES, const double bbox_rel_size_inc=0.1, const double newt_tol=1.0e-12, const int npt_max=256)
 Setup FindPoints and search positions.
 
virtual void Interpolate (const GridFunction &field_in, Vector &field_out)
 Interpolation of field values at prescribed reference space positions.
 
virtual void Interpolate (const GridFunction &field_in, Vector &field_out, const int field_out_ordering)
 Interpolation of field values, with output ordering specification.
 
virtual void InterpolateSurf (const GridFunction &field_in, Vector &field_out)
 Same as Interpolate but for surface meshes.
 
virtual void InterpolateSurf (const GridFunction &field_in, Vector &field_out, const int field_out_ordering)
 Same as Interpolate but for surface meshes with specified output ordering.
 
void Interpolate (const Vector &point_pos, const GridFunction &field_in, Vector &field_out, int point_pos_ordering=Ordering::byNODES)
 Search positions and interpolate.
 
void Interpolate (const Vector &point_pos, const GridFunction &field_in, Vector &field_out, const int point_pos_ordering, const int field_out_ordering)
 Search positions and interpolate with given point and output ordering.
 
void Interpolate (Mesh &m, const Vector &point_pos, const GridFunction &field_in, Vector &field_out, const int point_pos_ordering=Ordering::byNODES)
 
virtual void SetL2AvgType (AvgType avgtype_)
 Average type to be used for L2 functions in-case a point is located at an element boundary where the function might be multi-valued.
 
virtual void SetDefaultInterpolationValue (double interp_value_)
 Set the default interpolation value for points that are not found in the mesh.
 
virtual void SetDistanceToleranceForPointsFoundOnBoundary (double bdr_tol_)
 Tolerance for detecting points outside the 'curvilinear' boundary.
 
virtual void SetGPUtoCPUFallback (bool mode)
 Enable/Disable use of CPU functions for GPU data if the gslib version is older.
 
virtual void FreeData ()
 Cleans up memory allocated internally by gslib.
 
virtual const Array< unsigned int > & GetCode () const
 Return code for each point searched by FindPoints: inside element (0), element boundary (1), or not found (2).
 
virtual const Array< unsigned int > & GetElem () const
 Return element number for each point found by FindPoints.
 
virtual const Array< unsigned int > & GetProc () const
 Return MPI rank on which each point was found by FindPoints.
 
virtual const VectorGetReferencePosition () const
 Return reference coordinates for each point found by FindPoints.
 
virtual const VectorGetDist () const
 Return distance between the sought and the found point in physical space.
 
virtual const Array< unsigned int > & GetGSLIBElem () const
 Return element number for each point found by FindPoints corresponding to GSLIB mesh. gsl_mfem_elem != gsl_elem for mesh with simplices.
 
virtual const VectorGetGSLIBReferencePosition () const
 Return reference coordinates in [-1,1] (internal range in GSLIB) for each point found by FindPoints.
 
Array< unsigned int > GetPointsNotFoundIndices () const
 Get array of indices of not-found points.
 
void GetAxisAlignedBoundingBoxes (Vector &aabb) const
 
void GetOrientedBoundingBoxes (DenseTensor &obbA, Vector &obbC, Vector &obbV) const
 
MeshGetBoundingBoxMesh (int type)
 Return the bounding boxes as a mesh on rank 0.
 
virtual const VectorGetGLLMesh () const
 Return the internal vector of mesh node coordinates at the GLL points.
 
Methods to support a custom interpolation procedure.

The physical-space point that the user seeks to interpolate at could be located inside an element on another mpi rank. To enable a custom interpolation procedure (e.g., strain tensor computation) we need a mechanism to first send element indices and reference-space coordinates to the mpi-ranks where each point is found. Then the custom interpolation can be done locally by the user before sending the interpolated values back to the mpi-ranks that the query originated from. Example usage looks something like this:

FindPoints() -> DistributePointInfoToOwningMPIRanks() -> Computation by user -> DistributeInterpolatedValues().

virtual void DistributePointInfoToOwningMPIRanks (Array< unsigned int > &recv_elem, Vector &recv_ref, Array< unsigned int > &recv_code)
 
virtual void DistributeInterpolatedValues (const Vector &int_vals, const int vdim, const int ordering, Vector &field_out) const
 

Protected Member Functions

void SetupCrystal ()
 
void FreeCrystal ()
 
virtual void InterpolateH1 (const GridFunction &field_in, Vector &field_out, const int field_out_ordering)
 
virtual void InterpolateGeneral (const GridFunction &field_in, Vector &field_out, const int field_out_ordering)
 
virtual void SetupSplitMeshes ()
 Since GSLIB is designed to work with quads/hexes, we split every triangle/tet/prism/pyramid element into quads/hexes.
 
virtual void SetupIntegrationRuleForSplitMesh (Mesh *mesh, IntegrationRule *irule, int order)
 Setup integration points that will be used to interpolate the nodal location at points expected by GSLIB.
 
virtual void SetupIntegrationRules (const int order, Array< IntegrationRule * > &ir_out)
 Build integration rules at the given order for each split mesh and store them in ir_out. Requires that SetupSplitMeshes has already been called.
 
virtual void SetupSplitMeshesAndIntegrationRules (const int order)
 Helper function that calls SetupSplitMeshes and SetupIntegrationRules.
 
virtual void GetNodalValues (const GridFunction *gf_in, Vector &node_vals, const Array< IntegrationRule * > *ir_in=nullptr, bool by_element=false) const
 Get GridFunction value at the points expected by GSLIB.
 
virtual void MapRefPosAndElemIndices ()
 Map {r,s,t} coordinates from [-1,1] to [0,1] for MFEM. For simplices, find the original element number (that was split into micro quads/hexes) during the setup phase.
 
void FindPointsLocal3 (const Vector &point_pos, int point_pos_ordering, Array< unsigned int > &gsl_code_dev_l, Array< unsigned int > &gsl_elem_dev_l, Vector &gsl_ref_l, Vector &gsl_dist_l, int npt)
 FindPoints locally on device for 3D.
 
void FindPointsLocal2 (const Vector &point_pos, int point_pos_ordering, Array< unsigned int > &gsl_code_dev_l, Array< unsigned int > &gsl_elem_dev_l, Vector &gsl_ref_l, Vector &gsl_dist_l, int npt)
 FindPoints locally on device for 2D.
 
void FindPointsSurfLocal3 (const Vector &point_pos, int point_pos_ordering, Array< unsigned int > &gsl_code_dev_l, Array< unsigned int > &gsl_elem_dev_l, Vector &gsl_ref_l, Vector &gsl_dist_l, int npt)
 FindPoints locally on device for 3D surface elements.
 
void FindPointsEdgeLocal3 (const Vector &point_pos, int point_pos_ordering, Array< unsigned int > &gsl_code_dev_l, Array< unsigned int > &gsl_elem_dev_l, Vector &gsl_ref_l, Vector &gsl_dist_l, int npt)
 FindPoints locally on device for 3D edge elements.
 
void FindPointsEdgeLocal2 (const Vector &point_pos, int point_pos_ordering, Array< unsigned int > &gsl_code_dev_l, Array< unsigned int > &gsl_elem_dev_l, Vector &gsl_ref_l, Vector &gsl_dist_l, int npt)
 FindPoints locally on device for 2D edge elements.
 
void InterpolateLocal3 (const Vector &field_in, Array< int > &gsl_elem_dev_l, Vector &gsl_ref_l, Vector &field_out, int npt, int ncomp, int dof1dsol)
 Interpolate on device for 3D.
 
void InterpolateLocal2 (const Vector &field_in, Array< int > &gsl_elem_dev_l, Vector &gsl_ref_l, Vector &field_out, int npt, int ncomp, int dof1dsol)
 Interpolate on device for 2D.
 
void InterpolateLocal1 (const Vector &field_in, Array< int > &gsl_elem_dev_l, Vector &gsl_ref_l, Vector &field_out, int npt, int ncomp, int dof1dsol)
 Interpolate on device for 1D.
 
void SetupDevice ()
 Prepare data for device execution for volume meshes.
 
void FindPointsOnDevice (const Vector &point_pos, const int point_pos_ordering=Ordering::byNODES)
 Searches positions given in physical space by point_pos. These positions can be ordered byNodes: (XXX...,YYY...,ZZZ) or byVDim: (XYZ,XYZ,....XYZ) specified by point_pos_ordering.
 
void InterpolateOnDevice (const Vector &field_in_evec, Vector &field_out, const int nel, const int ncomp, const int dof1dsol, const int ordering)
 Interpolation of field values at prescribed reference space positions.
 
void InterpolateSurfBase (const Vector &field_in, Vector &field_out, const int nel, const int ncomp, const int dof1dsol, const int field_out_ordering)
 Interpolation of field values at prescribed reference space positions for surface meshes.
 
void FindPointsEdgeSetup2 (DevStruct &devs, const double *const elx[2], const unsigned n, const unsigned int nel, const unsigned m, const double bbox_rel_size_inc, const unsigned int local_hash_size, const unsigned int global_hash_size, const Vector *aabb_sz_inc)
 Preprocess 2D surface mesh needed for FindPoints.
 
void FindPointsSurfSetup3 (DevStruct &devs, const double *const elx[3], const unsigned n, const unsigned int nel, const unsigned m, const double bbox_rel_size_inc, const unsigned int local_hash_size, const unsigned int global_hash_size, const int rD, const Vector *aabb_sz_inc)
 Preprocess 3D surface mesh needed for FindPoints.
 
void SetupSurfBase (Mesh &m, const double bbox_rel_size_inc, const Vector *aabb_sz_inc, const double newt_tol)
 Shared implementation for the public surface-setup methods.
 

Protected Attributes

Meshmesh
 
Array< Mesh * > mesh_split
 
Array< IntegrationRule * > ir_split
 
Array< IntegrationRule * > ir_split_sol
 
int ir_split_sol_order = -1
 Order at which ir_split_sol was built; -1 means not built.
 
Array< FiniteElementSpace * > fes_rst_map
 
Array< GridFunction * > gf_rst_map
 
FiniteElementCollectionfec_map_lin
 
void * fdataD
 
struct gslib::crystal * cr
 
struct gslib::comm * gsl_comm
 
int dim
 
int spacedim
 
int points_cnt
 
Array< unsigned int > gsl_code
 
Array< unsigned int > gsl_proc
 
Array< unsigned int > gsl_elem
 
Array< unsigned int > gsl_mfem_elem
 
Vector gsl_mesh
 
Vector gsl_ref
 
Vector gsl_dist
 
Vector gsl_mfem_ref
 
Array< unsigned int > recv_proc
 
Array< unsigned int > recv_index
 
bool setupflag
 
double default_interp_value
 
AvgType avgtype
 
Array< int > split_element_map
 
Array< int > split_element_index
 
Array< int > split_element_geom
 
int NE_split_total
 
int mesh_points_cnt
 
double bdr_tol
 
bool gpu_to_cpu_fallback = false
 
bool obb_check = true
 
struct mfem::FindPointsGSLIB::DevStruct DEV
 

Detailed Description

FindPointsGSLIB can robustly evaluate a GridFunction on an arbitrary collection of points. See Mittal et al., "General Field Evaluation in High-Order Meshes on GPUs". (2025). Computers & Fluids. for technical details.

There are three key functions in FindPointsGSLIB:

  1. Setup - constructs the internal data structures of gslib. See Setup.
  2. FindPoints - for any given arbitrary set of points in physical space, gslib finds the element number, MPI rank, and the reference space coordinates inside the element that each point is located in. gslib also returns a code that indicates whether the point was found inside an element, on element border, or not found in the domain. For points returned as found on element border, the point is either on an element edge/face or near the domain boundary, and gslib also returns a distance to the border. Points near (but outside) the domain boundary must then be marked as not found using the distance returned by gslib. See FindPoints.
  3. Interpolate - Interpolates any grid function at the points found using 2. For functions in L2 finite element space, use SetL2AvgType to specify how to interpolate values at points located at element boundaries where the function might be multi-valued. See Interpolate.

FindPointsGSLIB also provides interface to use these functions through a single call.

For custom interpolation (e.g., evaluating strain rate tensor), we provide functions that use gslib to send element index and corresponding reference-space coordinates for each point to the mpi rank that the element is located on. Then, custom interpolation can be defined locally by the user before sending the values back to mpi ranks where the query originated from. See DistributePointInfoToOwningMPIRanks and DistributeInterpolatedValues.

Definition at line 114 of file gslib.hpp.

Member Enumeration Documentation

◆ AvgType

Enumerator
NONE 
ARITHMETIC 
HARMONIC 

Definition at line 117 of file gslib.hpp.

Constructor & Destructor Documentation

◆ FindPointsGSLIB() [1/5]

mfem::FindPointsGSLIB::FindPointsGSLIB ( )

Serial constructor.

Definition at line 200 of file gslib.cpp.

◆ FindPointsGSLIB() [2/5]

mfem::FindPointsGSLIB::FindPointsGSLIB ( Mesh & mesh_in,
const double bbox_rel_size_inc = 0.1,
const double newt_tol = 1.0e-12,
const int npt_max = 256 )

Serial constructor + setup with given Mesh (see Setup)

Definition at line 232 of file gslib.cpp.

◆ FindPointsGSLIB() [3/5]

mfem::FindPointsGSLIB::FindPointsGSLIB ( MPI_Comm comm_)

Constructor for ParMesh.

Definition at line 262 of file gslib.cpp.

◆ FindPointsGSLIB() [4/5]

mfem::FindPointsGSLIB::FindPointsGSLIB ( ParMesh & mesh_in,
const double bbox_rel_size_inc = 0.1,
const double newt_tol = 1.0e-12,
const int npt_max = 256 )

Constructor + setup with given ParMesh (see Setup)

Definition at line 288 of file gslib.cpp.

◆ ~FindPointsGSLIB()

mfem::FindPointsGSLIB::~FindPointsGSLIB ( )
virtual

Definition at line 240 of file gslib.cpp.

◆ FindPointsGSLIB() [5/5]

mfem::FindPointsGSLIB::FindPointsGSLIB ( const FindPointsGSLIB & )
delete

Member Function Documentation

◆ DistributeInterpolatedValues()

void mfem::FindPointsGSLIB::DistributeInterpolatedValues ( const Vector & int_vals,
const int vdim,
const int ordering,
Vector & field_out ) const
virtual

Return interpolated values back to the mpi-ranks recv_proc that had sent the element indices and corresponding reference-space coordinates. Specify vdim and ordering (by nodes or by vdim) based on how the int_vals are structured. The received values are filled in field_out consistent with the original ordering of the points that were used in FindPoints.

Definition at line 4317 of file gslib.cpp.

◆ DistributePointInfoToOwningMPIRanks()

void mfem::FindPointsGSLIB::DistributePointInfoToOwningMPIRanks ( Array< unsigned int > & recv_elem,
Vector & recv_ref,
Array< unsigned int > & recv_code )
virtual

Distribute element indices in gsl_mfem_elem, the reference coordinates gsl_mfem_ref, and the code gsl_code to the corresponding mpi-rank gsl_proc for each point. The received information is provided locally in recv_elem, recv_ref (ordered by vdim), and recv_code. Note: The user can send empty Array/Vectors to the method as they are appropriately sized and filled internally.

Definition at line 4258 of file gslib.cpp.

◆ FindPoints() [1/3]

void mfem::FindPointsGSLIB::FindPoints ( const ParticleVector & point_pos)
inline

Convenience function when point positions are in a ParticleVector.

Definition at line 487 of file gslib.hpp.

◆ FindPoints() [2/3]

void mfem::FindPointsGSLIB::FindPoints ( const Vector & point_pos,
int point_pos_ordering = Ordering::byNODES )

Searches positions given in physical space by point_pos.

These positions can be ordered byNodes: (XXX...,YYY...,ZZZ) or byVDim: (XYZ,XYZ,....XYZ) specified by point_pos_ordering.

This function populates the following member variables: gsl_code Return codes for each point: inside element (0), element boundary (1), not found (2). gsl_proc MPI proc ids where the points were found. gsl_elem Element ids where the points were found. Defaults to 0 for points that were not found. gsl_mfem_elem Element ids corresponding to MFEM-mesh where the points were found. gsl_mfem_elem != gsl_elem for simplices Defaults to 0 for points that were not found. gsl_ref Reference coordinates of the found point. Ordered by vdim (XYZ,XYZ,XYZ...). Defaults to -1 for points that were not found. Note: the gslib reference frame is [-1,1]. gsl_mfem_ref Reference coordinates gsl_ref mapped to [0,1]. Defaults to 0 for points that were not found. gsl_dist Distance between the sought and the found point in physical space.

Definition at line 1372 of file gslib.cpp.

◆ FindPoints() [3/3]

void mfem::FindPointsGSLIB::FindPoints ( Mesh & m,
const Vector & point_pos,
const int point_pos_ordering = Ordering::byNODES,
const double bbox_rel_size_inc = 0.1,
const double newt_tol = 1.0e-12,
const int npt_max = 256 )

Setup FindPoints and search positions.

Definition at line 2944 of file gslib.cpp.

◆ FindPointsEdgeLocal2()

void mfem::FindPointsGSLIB::FindPointsEdgeLocal2 ( const Vector & point_pos,
int point_pos_ordering,
Array< unsigned int > & gsl_code_dev_l,
Array< unsigned int > & gsl_elem_dev_l,
Vector & gsl_ref_l,
Vector & gsl_dist_l,
int npt )
protected

FindPoints locally on device for 2D edge elements.

Definition at line 574 of file findptsedge_local_2.cpp.

◆ FindPointsEdgeLocal3()

void mfem::FindPointsGSLIB::FindPointsEdgeLocal3 ( const Vector & point_pos,
int point_pos_ordering,
Array< unsigned int > & gsl_code_dev_l,
Array< unsigned int > & gsl_elem_dev_l,
Vector & gsl_ref_l,
Vector & gsl_dist_l,
int npt )
protected

FindPoints locally on device for 3D edge elements.

Definition at line 578 of file findptsedge_local_3.cpp.

◆ FindPointsEdgeSetup2()

void mfem::FindPointsGSLIB::FindPointsEdgeSetup2 ( DevStruct & devs,
const double *const elx[2],
const unsigned n,
const unsigned int nel,
const unsigned m,
const double bbox_rel_size_inc,
const unsigned int local_hash_size,
const unsigned int global_hash_size,
const Vector * aabb_sz_inc )
protected

Preprocess 2D surface mesh needed for FindPoints.

Definition at line 1093 of file gslib.cpp.

◆ FindPointsLocal2()

void mfem::FindPointsGSLIB::FindPointsLocal2 ( const Vector & point_pos,
int point_pos_ordering,
Array< unsigned int > & gsl_code_dev_l,
Array< unsigned int > & gsl_elem_dev_l,
Vector & gsl_ref_l,
Vector & gsl_dist_l,
int npt )
protected

FindPoints locally on device for 2D.

Definition at line 1030 of file findpts_local_2.cpp.

◆ FindPointsLocal3()

void mfem::FindPointsGSLIB::FindPointsLocal3 ( const Vector & point_pos,
int point_pos_ordering,
Array< unsigned int > & gsl_code_dev_l,
Array< unsigned int > & gsl_elem_dev_l,
Vector & gsl_ref_l,
Vector & gsl_dist_l,
int npt )
protected

FindPoints locally on device for 3D.

Definition at line 1654 of file findpts_local_3.cpp.

◆ FindPointsOnDevice()

void mfem::FindPointsGSLIB::FindPointsOnDevice ( const Vector & point_pos,
const int point_pos_ordering = Ordering::byNODES )
protected

Searches positions given in physical space by point_pos. These positions can be ordered byNodes: (XXX...,YYY...,ZZZ) or byVDim: (XYZ,XYZ,....XYZ) specified by point_pos_ordering.

Definition at line 1634 of file gslib.cpp.

◆ FindPointsSurf() [1/2]

void mfem::FindPointsGSLIB::FindPointsSurf ( const ParticleVector & point_pos)
inline

Convenience function when point positions are in a ParticleVector.

Definition at line 498 of file gslib.hpp.

◆ FindPointsSurf() [2/2]

void mfem::FindPointsGSLIB::FindPointsSurf ( const Vector & point_pos,
int point_pos_ordering = Ordering::byNODES )

Searches positions given in physical space by point_pos on surface mesh.

Definition at line 2235 of file gslib.cpp.

◆ FindPointsSurfLocal3()

void mfem::FindPointsGSLIB::FindPointsSurfLocal3 ( const Vector & point_pos,
int point_pos_ordering,
Array< unsigned int > & gsl_code_dev_l,
Array< unsigned int > & gsl_elem_dev_l,
Vector & gsl_ref_l,
Vector & gsl_dist_l,
int npt )
protected

FindPoints locally on device for 3D surface elements.

Definition at line 1098 of file findptssurf_local_3.cpp.

◆ FindPointsSurfSetup3()

void mfem::FindPointsGSLIB::FindPointsSurfSetup3 ( DevStruct & devs,
const double *const elx[3],
const unsigned n,
const unsigned int nel,
const unsigned m,
const double bbox_rel_size_inc,
const unsigned int local_hash_size,
const unsigned int global_hash_size,
const int rD,
const Vector * aabb_sz_inc )
protected

Preprocess 3D surface mesh needed for FindPoints.

Definition at line 1003 of file gslib.cpp.

◆ FreeCrystal()

void mfem::FindPointsGSLIB::FreeCrystal ( )
protected

Definition at line 306 of file gslib.cpp.

◆ FreeData()

void mfem::FindPointsGSLIB::FreeData ( )
virtual

Cleans up memory allocated internally by gslib.

Note that in parallel, this must be called before MPI_Finalize, as it calls MPI_Comm_free() for internal gslib communicators. FreeData is also called by the class destructor and there are no memory leaks if the destructor is called before MPI_Finalize(). If the destructor is called after MPI_Finalize(), there will be an error because gslib will try to invoke some MPI functions.

Definition at line 2984 of file gslib.cpp.

◆ GetAxisAlignedBoundingBoxes()

void mfem::FindPointsGSLIB::GetAxisAlignedBoundingBoxes ( Vector & aabb) const

Return the axis-aligned bounding boxes (AABB) computed during Setup. The size of the returned vector is (nel x nverts x dim), where nel is the number of elements (after splitting for simplicies), nverts is number of vertices (4 in 2D, 8 in 3D), and dim is the spatial dimension.

Definition at line 4373 of file gslib.cpp.

◆ GetBoundingBoxMesh()

Mesh * mfem::FindPointsGSLIB::GetBoundingBoxMesh ( int type)

Return the bounding boxes as a mesh on rank 0.

Parameters
[in]typeBounding-box type: 0 - AABB, 1 - OBB.
Returns
On rank 0, returns a newly allocated mesh containing the bounding boxes. The caller owns the returned pointer and is responsible for deleting it. On other ranks, returns nullptr.

Definition at line 4474 of file gslib.cpp.

◆ GetCode()

virtual const Array< unsigned int > & mfem::FindPointsGSLIB::GetCode ( ) const
inlinevirtual

Return code for each point searched by FindPoints: inside element (0), element boundary (1), or not found (2).

Definition at line 606 of file gslib.hpp.

◆ GetDist()

virtual const Vector & mfem::FindPointsGSLIB::GetDist ( ) const
inlinevirtual

Return distance between the sought and the found point in physical space.

Definition at line 614 of file gslib.hpp.

◆ GetElem()

virtual const Array< unsigned int > & mfem::FindPointsGSLIB::GetElem ( ) const
inlinevirtual

Return element number for each point found by FindPoints.

Definition at line 608 of file gslib.hpp.

◆ GetGLLMesh()

virtual const Vector & mfem::FindPointsGSLIB::GetGLLMesh ( ) const
inlinevirtual

Return the internal vector of mesh node coordinates at the GLL points.

Definition at line 690 of file gslib.hpp.

◆ GetGSLIBElem()

virtual const Array< unsigned int > & mfem::FindPointsGSLIB::GetGSLIBElem ( ) const
inlinevirtual

Return element number for each point found by FindPoints corresponding to GSLIB mesh. gsl_mfem_elem != gsl_elem for mesh with simplices.

Definition at line 619 of file gslib.hpp.

◆ GetGSLIBReferencePosition()

virtual const Vector & mfem::FindPointsGSLIB::GetGSLIBReferencePosition ( ) const
inlinevirtual

Return reference coordinates in [-1,1] (internal range in GSLIB) for each point found by FindPoints.

Definition at line 622 of file gslib.hpp.

◆ GetNodalValues()

void mfem::FindPointsGSLIB::GetNodalValues ( const GridFunction * gf_in,
Vector & node_vals,
const Array< IntegrationRule * > * ir_in = nullptr,
bool by_element = false ) const
protectedvirtual

Get GridFunction value at the points expected by GSLIB.

Parameters
[in]gf_inGrid function to evaluate.
[out]node_valsOutput values.
[in]ir_inIf non-null, use these rules instead of ir_split.
[in]by_elementIf true, output has element-major layout [nel][vdim][ndofs]; otherwise component-major layout [vdim][total_pts].

Definition at line 3364 of file gslib.cpp.

◆ GetOrientedBoundingBoxes()

void mfem::FindPointsGSLIB::GetOrientedBoundingBoxes ( DenseTensor & obbA,
Vector & obbC,
Vector & obbV ) const

Return the oriented bounding boxes (OBB) computed during Setup. Each OBB is represented using the inverse transformation (A^{-1}) and its center (x_c), such that a point x is inside the OBB if: -1 <= A^{-1}(x-x_c) <= 1. The inverse transformation is returned in obbA, a DenseTensor of size (dim x dim x nel), and the OBB centers are returned in obbC, a vector of size (nel x dim). The vertices of the OBBs are returned in obbV, a vector of size (nel x nverts x dim) .

Definition at line 4589 of file gslib.cpp.

◆ GetPointsNotFoundIndices()

Array< unsigned int > mfem::FindPointsGSLIB::GetPointsNotFoundIndices ( ) const

Get array of indices of not-found points.

Definition at line 4244 of file gslib.cpp.

◆ GetProc()

virtual const Array< unsigned int > & mfem::FindPointsGSLIB::GetProc ( ) const
inlinevirtual

Return MPI rank on which each point was found by FindPoints.

Definition at line 610 of file gslib.hpp.

◆ GetReferencePosition()

virtual const Vector & mfem::FindPointsGSLIB::GetReferencePosition ( ) const
inlinevirtual

Return reference coordinates for each point found by FindPoints.

Definition at line 612 of file gslib.hpp.

◆ Interpolate() [1/5]

void mfem::FindPointsGSLIB::Interpolate ( const GridFunction & field_in,
Vector & field_out )
virtual

Interpolation of field values at prescribed reference space positions.

Parameters
[in]field_inFunction values that will be interpolated on the reference positions. Note: it is assumed that field_in is in H1 and in the same space as the mesh that was given to Setup().
[out]field_outInterpolated values. For points that are not found the value is set to default_interp_value. The output ordering is determined from field_in.
Note
: field_out is moved to device if field_in is on device. Otherwise, field_out memory allocation is not changed.

Reimplemented in mfem::OversetFindPointsGSLIB.

Definition at line 3679 of file gslib.cpp.

◆ Interpolate() [2/5]

void mfem::FindPointsGSLIB::Interpolate ( const GridFunction & field_in,
Vector & field_out,
const int field_out_ordering )
virtual

Interpolation of field values, with output ordering specification.

Reimplemented in mfem::OversetFindPointsGSLIB.

Definition at line 3685 of file gslib.cpp.

◆ Interpolate() [3/5]

void mfem::FindPointsGSLIB::Interpolate ( const Vector & point_pos,
const GridFunction & field_in,
Vector & field_out,
const int point_pos_ordering,
const int field_out_ordering )

Search positions and interpolate with given point and output ordering.

Definition at line 2965 of file gslib.cpp.

◆ Interpolate() [4/5]

void mfem::FindPointsGSLIB::Interpolate ( const Vector & point_pos,
const GridFunction & field_in,
Vector & field_out,
int point_pos_ordering = Ordering::byNODES )

Search positions and interpolate.

The ordering (byNODES or byVDIM) of the output values in field_out corresponds to the ordering used in the input GridFunction field_in.

Definition at line 2956 of file gslib.cpp.

◆ Interpolate() [5/5]

void mfem::FindPointsGSLIB::Interpolate ( Mesh & m,
const Vector & point_pos,
const GridFunction & field_in,
Vector & field_out,
const int point_pos_ordering = Ordering::byNODES )

Setup FindPoints, search positions and interpolate. The ordering (byNODES or byVDIM) of the output values in field_out corresponds to the ordering used in the input GridFunction field_in.

Definition at line 2975 of file gslib.cpp.

◆ InterpolateGeneral()

void mfem::FindPointsGSLIB::InterpolateGeneral ( const GridFunction & field_in,
Vector & field_out,
const int field_out_ordering )
protectedvirtual

Uses GSLIB Crystal Router for communication followed by MFEM's interpolation functions. Updates field_out on host.

Definition at line 4073 of file gslib.cpp.

◆ InterpolateH1()

void mfem::FindPointsGSLIB::InterpolateH1 ( const GridFunction & field_in,
Vector & field_out,
const int field_out_ordering )
protectedvirtual

Use GSLIB for communication and interpolation. Updates field_out on host.

Definition at line 3993 of file gslib.cpp.

◆ InterpolateLocal1()

void mfem::FindPointsGSLIB::InterpolateLocal1 ( const Vector & field_in,
Array< int > & gsl_elem_dev_l,
Vector & gsl_ref_l,
Vector & field_out,
int npt,
int ncomp,
int dof1dsol )
protected

Interpolate on device for 1D.

Definition at line 97 of file interpolate_local_1.cpp.

◆ InterpolateLocal2()

void mfem::FindPointsGSLIB::InterpolateLocal2 ( const Vector & field_in,
Array< int > & gsl_elem_dev_l,
Vector & gsl_ref_l,
Vector & field_out,
int npt,
int ncomp,
int dof1dsol )
protected

Interpolate on device for 2D.

Definition at line 108 of file interpolate_local_2.cpp.

◆ InterpolateLocal3()

void mfem::FindPointsGSLIB::InterpolateLocal3 ( const Vector & field_in,
Array< int > & gsl_elem_dev_l,
Vector & gsl_ref_l,
Vector & field_out,
int npt,
int ncomp,
int dof1dsol )
protected

Interpolate on device for 3D.

Definition at line 111 of file interpolate_local_3.cpp.

◆ InterpolateOnDevice()

void mfem::FindPointsGSLIB::InterpolateOnDevice ( const Vector & field_in_evec,
Vector & field_out,
const int nel,
const int ncomp,
const int dof1dsol,
const int ordering )
protected

Interpolation of field values at prescribed reference space positions.

Parameters
[in]field_in_evecE-vector of grid function to be interpolated. Assumed ordering is NDOFSxVDIMxNEL
[in]nelNumber of elements in the mesh.
[in]ncompNumber of components in the field.
[in]dof1dsolNumber of degrees of freedom in each reference space direction.
[in]orderingOrdering of the out field values: byNodes/byVDIM
[out]field_outInterpolated values. For points that are not found the value is set to default_interp_value.

Definition at line 1988 of file gslib.cpp.

◆ InterpolateSurf() [1/2]

void mfem::FindPointsGSLIB::InterpolateSurf ( const GridFunction & field_in,
Vector & field_out )
virtual

Same as Interpolate but for surface meshes.

Definition at line 3873 of file gslib.cpp.

◆ InterpolateSurf() [2/2]

void mfem::FindPointsGSLIB::InterpolateSurf ( const GridFunction & field_in,
Vector & field_out,
const int field_out_ordering )
virtual

Same as Interpolate but for surface meshes with specified output ordering.

Definition at line 3879 of file gslib.cpp.

◆ InterpolateSurfBase()

void mfem::FindPointsGSLIB::InterpolateSurfBase ( const Vector & field_in,
Vector & field_out,
const int nel,
const int ncomp,
const int dof1dsol,
const int field_out_ordering )
protected

Interpolation of field values at prescribed reference space positions for surface meshes.

Definition at line 2730 of file gslib.cpp.

◆ MapRefPosAndElemIndices()

void mfem::FindPointsGSLIB::MapRefPosAndElemIndices ( )
protectedvirtual

Map {r,s,t} coordinates from [-1,1] to [0,1] for MFEM. For simplices, find the original element number (that was split into micro quads/hexes) during the setup phase.

Definition at line 3502 of file gslib.cpp.

◆ operator=()

FindPointsGSLIB & mfem::FindPointsGSLIB::operator= ( const FindPointsGSLIB & )
delete

◆ SetDefaultInterpolationValue()

virtual void mfem::FindPointsGSLIB::SetDefaultInterpolationValue ( double interp_value_)
inlinevirtual

Set the default interpolation value for points that are not found in the mesh.

Definition at line 568 of file gslib.hpp.

◆ SetDistanceToleranceForPointsFoundOnBoundary()

virtual void mfem::FindPointsGSLIB::SetDistanceToleranceForPointsFoundOnBoundary ( double bdr_tol_)
inlinevirtual

Tolerance for detecting points outside the 'curvilinear' boundary.

When using FindPoints, gslib may return points as found on the boundary even when they are slightly outside the domain. This tolerance is used to filter such points based on the distance^2 value and mark them as not found.

Note
When the SetupSurfWithAABBExpansion method is used for surface meshes, this tolerance is automatically computed based on the size of expanded AABBs. Using this method will override that computed tolerance.

Definition at line 584 of file gslib.hpp.

◆ SetGPUtoCPUFallback()

virtual void mfem::FindPointsGSLIB::SetGPUtoCPUFallback ( bool mode)
inlinevirtual

Enable/Disable use of CPU functions for GPU data if the gslib version is older.

Definition at line 591 of file gslib.hpp.

◆ SetL2AvgType()

virtual void mfem::FindPointsGSLIB::SetL2AvgType ( AvgType avgtype_)
inlinevirtual

Average type to be used for L2 functions in-case a point is located at an element boundary where the function might be multi-valued.

Definition at line 565 of file gslib.hpp.

◆ Setup()

void mfem::FindPointsGSLIB::Setup ( Mesh & m,
const double bbox_rel_size_inc = 0.1,
const double newt_tol = 1.0e-12,
const int npt_max = 256 )

Preprocess the internal mesh in gslib.

Initializes the internal mesh in gslib, by sending the positions of the Gauss-Lobatto nodes of the input Mesh object m. Note: not tested with periodic (L2). Note: the input mesh m must have Nodes set.

Parameters
[in]mInput mesh.
[in]bbox_rel_size_inc(Optional) Relative size increase applied when expanding each element bounding box.
[in]newt_tol(Optional) Newton tolerance for the gslib search methods.
[in]npt_max(Optional) Number of points for simultaneous iteration. This alters performance and memory footprint.

Definition at line 321 of file gslib.cpp.

◆ SetupCrystal()

void mfem::FindPointsGSLIB::SetupCrystal ( )
protected

Definition at line 297 of file gslib.cpp.

◆ SetupDevice()

void mfem::FindPointsGSLIB::SetupDevice ( )
protected

Prepare data for device execution for volume meshes.

Definition at line 1507 of file gslib.cpp.

◆ SetupIntegrationRuleForSplitMesh()

void mfem::FindPointsGSLIB::SetupIntegrationRuleForSplitMesh ( Mesh * mesh,
IntegrationRule * irule,
int order )
protectedvirtual

Setup integration points that will be used to interpolate the nodal location at points expected by GSLIB.

Definition at line 3222 of file gslib.cpp.

◆ SetupIntegrationRules()

void mfem::FindPointsGSLIB::SetupIntegrationRules ( const int order,
Array< IntegrationRule * > & ir_out )
protectedvirtual

Build integration rules at the given order for each split mesh and store them in ir_out. Requires that SetupSplitMeshes has already been called.

Definition at line 3273 of file gslib.cpp.

◆ SetupSplitMeshes()

void mfem::FindPointsGSLIB::SetupSplitMeshes ( )
protectedvirtual

Since GSLIB is designed to work with quads/hexes, we split every triangle/tet/prism/pyramid element into quads/hexes.

Definition at line 3026 of file gslib.cpp.

◆ SetupSplitMeshesAndIntegrationRules()

void mfem::FindPointsGSLIB::SetupSplitMeshesAndIntegrationRules ( const int order)
protectedvirtual

Helper function that calls SetupSplitMeshes and SetupIntegrationRules.

Definition at line 3316 of file gslib.cpp.

◆ SetupSurf()

void mfem::FindPointsGSLIB::SetupSurf ( Mesh & m,
const double bbox_rel_size_inc = 0.1,
const double newt_tol = 1.0e-12 )

Preprocess the surface mesh to compute data for FindPoints.

Definition at line 1193 of file gslib.cpp.

◆ SetupSurfBase()

void mfem::FindPointsGSLIB::SetupSurfBase ( Mesh & m,
const double bbox_rel_size_inc,
const Vector * aabb_sz_inc,
const double newt_tol )
protected

Shared implementation for the public surface-setup methods.

Initializes the surface-search data structures, builds the split-element representation expected by gslib, and constructs the element bounding boxes used by the MFEM surface kernels.

If aabb_sz_inc is null, the setup stores the default oriented bounding boxes and uses bbox_rel_size_inc as their relative size increase factor.

If aabb_sz_inc is non-null, the setup stores axis-aligned bounding boxes only, applies the requested absolute AABB expansion in each physical direction, and adjusts the tolerance bdr_tol so points found in the expanded region are classified as border points.

Parameters
[in]mInput surface mesh.
[in]bbox_rel_size_incRelative size increase applied when expanding each element bounding box during setup.
[in]aabb_sz_incOptional total absolute AABB expansion applied to the stored axis-aligned bounding boxes after construction.
[in]newt_tolNewton tolerance for the point-search kernels.

Definition at line 1207 of file gslib.cpp.

◆ SetupSurfWithAABBExpansion()

void mfem::FindPointsGSLIB::SetupSurfWithAABBExpansion ( Mesh & m,
const Vector & aabb_sz_inc,
const double newt_tol = 1.0e-12 )

Preprocess the surface mesh to compute data for FindPoints using absolute AABB expansion.

This method computes only axis-aligned bounding boxes and increases their total length by a user-specified amount in each physical direction. The absolute AABB expansion is applied symmetrically to the lower and upper bounds.

The size of aabb_sz_inc determines how the expansion values are interpreted:

  • 1: one expansion value used in every direction for every element
  • NElements: one expansion value per element, reused in x/y/z directions
  • SpaceDim: one expansion value per physical direction, reused for every element
  • NElements*SpaceDim: one expansion value per element and direction, ordered as (dx1,dy1,dz1, ... dxN,dyN,dzN)

This method disables the oriented bounding-box precheck because the stored boxes are modified only in their axis-aligned representation.

Parameters
[in]mInput surface mesh.
[in]aabb_sz_incTotal absolute AABB expansion applied in each physical direction to the stored axis-aligned bounding boxes.
[in]newt_tolNewton tolerance for the point-search kernels.
Note
We disable the oriented bounding box check with this setup. bdr_tol is also adjusted so that all points in the AABBs can be found.

Definition at line 1200 of file gslib.cpp.

Member Data Documentation

◆ avgtype

AvgType mfem::FindPointsGSLIB::avgtype
protected

Definition at line 142 of file gslib.hpp.

◆ bdr_tol

double mfem::FindPointsGSLIB::bdr_tol
protected

Definition at line 151 of file gslib.hpp.

◆ cr

struct gslib::crystal* mfem::FindPointsGSLIB::cr
protected

Definition at line 134 of file gslib.hpp.

◆ default_interp_value

double mfem::FindPointsGSLIB::default_interp_value
protected

Definition at line 141 of file gslib.hpp.

◆ DEV

struct mfem::FindPointsGSLIB::DevStruct mfem::FindPointsGSLIB::DEV
protected

◆ dim

int mfem::FindPointsGSLIB::dim
protected

Definition at line 136 of file gslib.hpp.

◆ fdataD

void* mfem::FindPointsGSLIB::fdataD
protected

Definition at line 133 of file gslib.hpp.

◆ fec_map_lin

FiniteElementCollection* mfem::FindPointsGSLIB::fec_map_lin
protected

Definition at line 132 of file gslib.hpp.

◆ fes_rst_map

Array<FiniteElementSpace *> mfem::FindPointsGSLIB::fes_rst_map
protected

Definition at line 130 of file gslib.hpp.

◆ gf_rst_map

Array<GridFunction *> mfem::FindPointsGSLIB::gf_rst_map
protected

Definition at line 131 of file gslib.hpp.

◆ gpu_to_cpu_fallback

bool mfem::FindPointsGSLIB::gpu_to_cpu_fallback = false
protected

Definition at line 153 of file gslib.hpp.

◆ gsl_code

Array<unsigned int> mfem::FindPointsGSLIB::gsl_code
protected

Definition at line 137 of file gslib.hpp.

◆ gsl_comm

struct gslib::comm* mfem::FindPointsGSLIB::gsl_comm
protected

Definition at line 135 of file gslib.hpp.

◆ gsl_dist

Vector mfem::FindPointsGSLIB::gsl_dist
protected

Definition at line 138 of file gslib.hpp.

◆ gsl_elem

Array<unsigned int> mfem::FindPointsGSLIB::gsl_elem
protected

Definition at line 137 of file gslib.hpp.

◆ gsl_mesh

Vector mfem::FindPointsGSLIB::gsl_mesh
protected

Definition at line 138 of file gslib.hpp.

◆ gsl_mfem_elem

Array<unsigned int> mfem::FindPointsGSLIB::gsl_mfem_elem
protected

Definition at line 137 of file gslib.hpp.

◆ gsl_mfem_ref

Vector mfem::FindPointsGSLIB::gsl_mfem_ref
protected

Definition at line 138 of file gslib.hpp.

◆ gsl_proc

Array<unsigned int> mfem::FindPointsGSLIB::gsl_proc
protected

Definition at line 137 of file gslib.hpp.

◆ gsl_ref

Vector mfem::FindPointsGSLIB::gsl_ref
protected

Definition at line 138 of file gslib.hpp.

◆ ir_split

Array<IntegrationRule *> mfem::FindPointsGSLIB::ir_split
protected

Definition at line 124 of file gslib.hpp.

◆ ir_split_sol

Array<IntegrationRule *> mfem::FindPointsGSLIB::ir_split_sol
protected

Integration rules built at the field polynomial order (only for surface meshes when mesh order is not the same as gridfunction order).

Definition at line 127 of file gslib.hpp.

◆ ir_split_sol_order

int mfem::FindPointsGSLIB::ir_split_sol_order = -1
protected

Order at which ir_split_sol was built; -1 means not built.

Definition at line 129 of file gslib.hpp.

◆ mesh

Mesh* mfem::FindPointsGSLIB::mesh
protected

Definition at line 120 of file gslib.hpp.

◆ mesh_points_cnt

int mfem::FindPointsGSLIB::mesh_points_cnt
protected

Definition at line 148 of file gslib.hpp.

◆ mesh_split

Array<Mesh *> mfem::FindPointsGSLIB::mesh_split
protected

Definition at line 121 of file gslib.hpp.

◆ NE_split_total

int mfem::FindPointsGSLIB::NE_split_total
protected

Definition at line 147 of file gslib.hpp.

◆ obb_check

bool mfem::FindPointsGSLIB::obb_check = true
protected

Definition at line 159 of file gslib.hpp.

◆ points_cnt

int mfem::FindPointsGSLIB::points_cnt
protected

Definition at line 136 of file gslib.hpp.

◆ recv_index

Array<unsigned int> mfem::FindPointsGSLIB::recv_index
protected

Definition at line 139 of file gslib.hpp.

◆ recv_proc

Array<unsigned int> mfem::FindPointsGSLIB::recv_proc
protected

Definition at line 139 of file gslib.hpp.

◆ setupflag

bool mfem::FindPointsGSLIB::setupflag
protected

Definition at line 140 of file gslib.hpp.

◆ spacedim

int mfem::FindPointsGSLIB::spacedim
protected

Definition at line 136 of file gslib.hpp.

◆ split_element_geom

Array<int> mfem::FindPointsGSLIB::split_element_geom
protected

Definition at line 146 of file gslib.hpp.

◆ split_element_index

Array<int> mfem::FindPointsGSLIB::split_element_index
protected

Definition at line 144 of file gslib.hpp.

◆ split_element_map

Array<int> mfem::FindPointsGSLIB::split_element_map
protected

Definition at line 143 of file gslib.hpp.


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