specfem::algorithms::locate_point

2D Overloads

specfem::point::local_coordinates<specfem::dimension::type::dim2> specfem::algorithms::locate_point(const specfem::point::global_coordinates<specfem::dimension::type::dim2> &coordinates, const specfem::assembly::mesh<specfem::dimension::type::dim2> &mesh)

Convert global coordinates to local coordinates in a 2D mesh.

Parameters:
  • coordinates – Global coordinates to convert

  • mesh – 2D spectral element mesh

Returns:

Local coordinates within the containing element

specfem::point::global_coordinates<specfem::dimension::type::dim2> specfem::algorithms::locate_point(const specfem::point::local_coordinates<specfem::dimension::type::dim2> &coordinates, const specfem::assembly::mesh<specfem::dimension::type::dim2> &mesh)

Convert local coordinates to global coordinates in a 2D mesh.

Parameters:
  • coordinates – Local coordinates to convert

  • mesh – 2D spectral element mesh

Returns:

Global coordinates in physical space

specfem::point::global_coordinates<specfem::dimension::type::dim2> specfem::algorithms::locate_point(const specfem::kokkos::HostTeam::member_type &team_member, const specfem::point::local_coordinates<specfem::dimension::type::dim2> &coordinates, const specfem::assembly::mesh<specfem::dimension::type::dim2> &mesh)

Convert local coordinates to global coordinates in a 2D mesh using team parallelism.

Parameters:
  • team_member – Kokkos team member for parallel execution

  • coordinates – Local coordinates to convert

  • mesh – 2D spectral element mesh

Returns:

Global coordinates in physical space

3D Overloads

specfem::point::local_coordinates<specfem::dimension::type::dim3> specfem::algorithms::locate_point(const specfem::point::global_coordinates<specfem::dimension::type::dim3> &coordinates, const specfem::assembly::mesh<specfem::dimension::type::dim3> &mesh)

Convert global coordinates to local coordinates in a 3D mesh.

Parameters:
  • coordinates – Global coordinates to convert

  • mesh – 3D spectral element mesh

Returns:

Local coordinates within the containing element

specfem::point::global_coordinates<specfem::dimension::type::dim3> specfem::algorithms::locate_point(const specfem::point::local_coordinates<specfem::dimension::type::dim3> &coordinates, const specfem::assembly::mesh<specfem::dimension::type::dim3> &mesh)

Convert local coordinates to global coordinates in a 3D mesh.

Parameters:
  • coordinates – Local coordinates to convert

  • mesh – 3D spectral element mesh

Returns:

Global coordinates in physical space

specfem::point::global_coordinates<specfem::dimension::type::dim3> specfem::algorithms::locate_point(const specfem::kokkos::HostTeam::member_type &team_member, const specfem::point::local_coordinates<specfem::dimension::type::dim3> &coordinates, const specfem::assembly::mesh<specfem::dimension::type::dim3> &mesh)

Convert local coordinates to global coordinates in a 3D mesh using team parallelism.

Parameters:
  • team_member – Kokkos team member for parallel execution

  • coordinates – Local coordinates to convert

  • mesh – 3D spectral element mesh

Returns:

Global coordinates in physical space

Edge Location Functions

std::pair<type_real, bool> specfem::algorithms::locate_point_on_edge(const specfem::point::global_coordinates<specfem::dimension::type::dim2> &coordinates, const specfem::assembly::mesh<specfem::dimension::type::dim2> &mesh, const int &ispec, const specfem::mesh_entity::dim2::type &constraint)

Given an edge (ispec, constraint), finds the best fit local coordinate on that edge to the given global coordinates. Coordinates will be clamped to [-1,1], even if a point outside that range is a better fit. In such a case, the second return value will be false.

Parameters:
  • coordinates – - global coordinates to match to

  • mesh – - assembly::mesh struct

  • ispec – - element index whose local coordinates to find

  • constraint – - edge to compute for

Returns:

std::pair<type_real,bool> - the edge local coordinate and whether or not the minimum found is a critical point (false is returned if the best fit coordinate is out of bounds).

specfem::point::global_coordinates<specfem::dimension::type::dim2> specfem::algorithms::locate_point_on_edge(const type_real &coordinate, const specfem::assembly::mesh<specfem::dimension::type::dim2> &mesh, const int &ispec, const specfem::mesh_entity::dim2::type &constraint)

Convert edge coordinate to global coordinates.

Given an edge (ispec, constraint) and the coordinate along it, finds the global coordinates.

Parameters:
  • coordinate – Local coordinate along edge

  • mesh – 2D spectral element mesh

  • ispec – Element index whose local coordinates to find

  • constraint – Edge to compute for

Returns:

Global coordinates of the point