MFEM  v4.3.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mfem::FindPointsGSLIB Class Reference

FindPointsGSLIB can robustly evaluate a GridFunction on an arbitrary collection of points. There are three key functions in FindPointsGSLIB: More...

#include <gslib.hpp>

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

Public Types

enum  AvgType { NONE, ARITHMETIC, HARMONIC }
 

Public Member Functions

 FindPointsGSLIB ()
 
 FindPointsGSLIB (MPI_Comm comm_)
 
virtual ~FindPointsGSLIB ()
 
void Setup (Mesh &m, const double bb_t=0.1, const double newt_tol=1.0e-12, const int npt_max=256)
 
void FindPoints (const Vector &point_pos)
 
void FindPoints (Mesh &m, const Vector &point_pos, const double bb_t=0.1, const double newt_tol=1.0e-12, const int npt_max=256)
 Setup FindPoints and search positions. More...
 
virtual void Interpolate (const GridFunction &field_in, Vector &field_out)
 
void Interpolate (const Vector &point_pos, const GridFunction &field_in, Vector &field_out)
 
void Interpolate (Mesh &m, const Vector &point_pos, const GridFunction &field_in, Vector &field_out)
 
virtual void SetL2AvgType (AvgType avgtype_)
 
virtual void SetDefaultInterpolationValue (double interp_value_)
 
virtual void FreeData ()
 
virtual const Array< unsigned
int > & 
GetCode () const
 
virtual const Array< unsigned
int > & 
GetElem () const
 Return element number for each point found by FindPoints. More...
 
virtual const Array< unsigned
int > & 
GetProc () const
 Return MPI rank on which each point was found by FindPoints. More...
 
virtual const VectorGetReferencePosition () const
 Return reference coordinates for each point found by FindPoints. More...
 
virtual const VectorGetDist () const
 
virtual const Array< unsigned
int > & 
GetGSLIBElem () const
 
virtual const VectorGetGSLIBReferencePosition () const
 

Protected Member Functions

virtual void GetNodeValues (const GridFunction &gf_in, Vector &node_vals)
 Get GridFunction from MFEM format to GSLIB format. More...
 
virtual void GetQuadHexNodalCoordinates ()
 
virtual void GetSimplexNodalCoordinates ()
 
virtual void InterpolateH1 (const GridFunction &field_in, Vector &field_out)
 Use GSLIB for communication and interpolation. More...
 
virtual void InterpolateGeneral (const GridFunction &field_in, Vector &field_out)
 
virtual void MapRefPosAndElemIndices ()
 

Protected Attributes

Meshmesh
 
Meshmeshsplit
 
IntegrationRuleir_simplex
 
struct gslib::findpts_data_2 * fdata2D
 
struct gslib::findpts_data_3 * fdata3D
 
struct gslib::crystal * cr
 
struct gslib::comm * gsl_comm
 
int dim
 
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
 
bool setupflag
 
double default_interp_value
 
AvgType avgtype
 

Detailed Description

FindPointsGSLIB can robustly evaluate a GridFunction on an arbitrary collection of points. There are three key functions in FindPointsGSLIB:

  1. Setup - constructs the internal data structures of gslib.
  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.
  3. Interpolate - Interpolates any grid function at the points found using 2.

FindPointsGSLIB provides interface to use these functions individually or using a single call.

Definition at line 47 of file gslib.hpp.

Member Enumeration Documentation

Enumerator
NONE 
ARITHMETIC 
HARMONIC 

Definition at line 50 of file gslib.hpp.

Constructor & Destructor Documentation

mfem::FindPointsGSLIB::FindPointsGSLIB ( )

Definition at line 35 of file gslib.cpp.

mfem::FindPointsGSLIB::FindPointsGSLIB ( MPI_Comm  comm_)

Definition at line 63 of file gslib.cpp.

mfem::FindPointsGSLIB::~FindPointsGSLIB ( )
virtual

Definition at line 54 of file gslib.cpp.

Member Function Documentation

void mfem::FindPointsGSLIB::FindPoints ( const Vector point_pos)

Searches positions given in physical space by point_pos. These positions must by ordered by nodes: (XXX...,YYY...,ZZZ). 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 129 of file gslib.cpp.

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

Setup FindPoints and search positions.

Definition at line 187 of file gslib.cpp.

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.

Definition at line 212 of file gslib.cpp.

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

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

Definition at line 169 of file gslib.hpp.

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

Return distance between the sought and the found point in physical space, for each point found by FindPoints.

Definition at line 178 of file gslib.hpp.

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

Return element number for each point found by FindPoints.

Definition at line 171 of file gslib.hpp.

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 182 of file gslib.hpp.

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 185 of file gslib.hpp.

void mfem::FindPointsGSLIB::GetNodeValues ( const GridFunction gf_in,
Vector node_vals 
)
protectedvirtual

Get GridFunction from MFEM format to GSLIB format.

Definition at line 233 of file gslib.cpp.

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

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

Definition at line 173 of file gslib.hpp.

void mfem::FindPointsGSLIB::GetQuadHexNodalCoordinates ( )
protectedvirtual

Get nodal coordinates from mesh to the format expected by GSLIB for quads and hexes

Definition at line 290 of file gslib.cpp.

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

Return reference coordinates for each point found by FindPoints.

Definition at line 175 of file gslib.hpp.

void mfem::FindPointsGSLIB::GetSimplexNodalCoordinates ( )
protectedvirtual

Convert simplices to quad/hexes and then get nodal coordinates for each split element into format expected by GSLIB

Definition at line 328 of file gslib.cpp.

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.

Definition at line 582 of file gslib.cpp.

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

Search positions and interpolate

Definition at line 198 of file gslib.cpp.

void mfem::FindPointsGSLIB::Interpolate ( Mesh m,
const Vector point_pos,
const GridFunction field_in,
Vector field_out 
)

Setup FindPoints, search positions and interpolate

Definition at line 205 of file gslib.cpp.

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

Uses GSLIB Crystal Router for communication followed by MFEM's interpolation functions

Definition at line 699 of file gslib.cpp.

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

Use GSLIB for communication and interpolation.

Definition at line 657 of file gslib.cpp.

void mfem::FindPointsGSLIB::MapRefPosAndElemIndices ( )
protectedvirtual

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

Definition at line 492 of file gslib.cpp.

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 157 of file gslib.hpp.

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 153 of file gslib.hpp.

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

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]bb_t(Optional) Relative size of bounding box around each element.
[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 75 of file gslib.cpp.

Member Data Documentation

AvgType mfem::FindPointsGSLIB::avgtype
protected

Definition at line 64 of file gslib.hpp.

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

Definition at line 57 of file gslib.hpp.

double mfem::FindPointsGSLIB::default_interp_value
protected

Definition at line 63 of file gslib.hpp.

int mfem::FindPointsGSLIB::dim
protected

Definition at line 59 of file gslib.hpp.

struct gslib::findpts_data_2* mfem::FindPointsGSLIB::fdata2D
protected

Definition at line 55 of file gslib.hpp.

struct gslib::findpts_data_3* mfem::FindPointsGSLIB::fdata3D
protected

Definition at line 56 of file gslib.hpp.

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

Definition at line 60 of file gslib.hpp.

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

Definition at line 58 of file gslib.hpp.

Vector mfem::FindPointsGSLIB::gsl_dist
protected

Definition at line 61 of file gslib.hpp.

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

Definition at line 60 of file gslib.hpp.

Vector mfem::FindPointsGSLIB::gsl_mesh
protected

Definition at line 61 of file gslib.hpp.

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

Definition at line 60 of file gslib.hpp.

Vector mfem::FindPointsGSLIB::gsl_mfem_ref
protected

Definition at line 61 of file gslib.hpp.

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

Definition at line 60 of file gslib.hpp.

Vector mfem::FindPointsGSLIB::gsl_ref
protected

Definition at line 61 of file gslib.hpp.

IntegrationRule* mfem::FindPointsGSLIB::ir_simplex
protected

Definition at line 54 of file gslib.hpp.

Mesh* mfem::FindPointsGSLIB::mesh
protected

Definition at line 53 of file gslib.hpp.

Mesh * mfem::FindPointsGSLIB::meshsplit
protected

Definition at line 53 of file gslib.hpp.

int mfem::FindPointsGSLIB::points_cnt
protected

Definition at line 59 of file gslib.hpp.

bool mfem::FindPointsGSLIB::setupflag
protected

Definition at line 62 of file gslib.hpp.


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