Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
Shape function space for linear triangle on sphere, obtained from the canonical linear (affine) functions. It is mapped using gnomonic projection to a plane tangent at the first vertex It works well for edges that are great circle arcs; RLL meshes do not have this property, but HOMME or MPAS meshes do have it. More...
#include <ElemUtil.hpp>
Public Member Functions | |
SphericalTri (const std::vector< CartVect > &vertices) | |
virtual | ~SphericalTri () |
virtual bool | inside_box (const CartVect &pos, double &tol) const |
CartVect | ievaluate (const CartVect &x, double tol=1e-6, const CartVect &x0=CartVect(0.0)) const |
Evaluate the inverse map (calculate \(\vec \xi = F^-1($\vec x)\) to given tolerance) | |
Protected Attributes | |
CartVect | v1 |
Matrix3 | transf |
Shape function space for linear triangle on sphere, obtained from the canonical linear (affine) functions. It is mapped using gnomonic projection to a plane tangent at the first vertex It works well for edges that are great circle arcs; RLL meshes do not have this property, but HOMME or MPAS meshes do have it.
Definition at line 382 of file ElemUtil.hpp.
moab::Element::SphericalTri::SphericalTri | ( | const std::vector< CartVect > & | vertices | ) |
Definition at line 553 of file ElemUtil.cpp.
References moab::CartVect::length(), moab::Element::LinearTri::set_vertices(), transf, and v1.
{ vertex.resize( vertices.size() ); vertex = vertices; // project the vertices to the plane tangent at first vertex v1 = vertex[0]; // member data double v1v1 = v1 % v1; // this is 1, in general, for unit sphere meshes for( int j = 1; j < 3; j++ ) { // first, bring all vertices in the gnomonic plane // the new vertex will intersect the plane at vnew // so that (vnew-v1)%v1 is 0 ( vnew is in the tangent plane, i.e. normal to v1 ) // pos is the old position of the vertex, and it is in general on the sphere // vnew = alfa*pos; (alfa*pos-v1)%v1 = 0 <=> alfa*(pos%v1)=v1%v1 <=> alfa = // v1v1/(pos%v1) // <=> vnew = ( v1v1/(pos%v1) )*pos CartVect vnew = v1v1 / ( vertex[j] % v1 ) * vertex[j]; vertex[j] = vnew; } // will compute a transf matrix, such that a new point will be transformed with // newpos = transf * (vnew-v1), and it will be a point in the 2d plane // the transformation matrix will be oriented in such a way that orientation will be // positive CartVect vx = vertex[1] - v1; // this will become Ox axis // z axis will be along v1, in such a way that orientation of the quad is positive // look at the first 2 edges CartVect vz = vx * ( vertex[2] - vertex[1] ); vz = vz / vz.length(); vx = vx / vx.length(); CartVect vy = vz * vx; transf = Matrix3( vx[0], vx[1], vx[2], vy[0], vy[1], vy[2], vz[0], vz[1], vz[2] ); vertex[0] = CartVect( 0. ); for( int j = 1; j < 3; j++ ) vertex[j] = transf * ( vertex[j] - v1 ); LinearTri::set_vertices( vertex ); }
virtual moab::Element::SphericalTri::~SphericalTri | ( | ) | [inline, virtual] |
Definition at line 386 of file ElemUtil.hpp.
{};
CartVect moab::Element::SphericalTri::ievaluate | ( | const CartVect & | x, |
double | tol = 1e-6 , |
||
const CartVect & | x0 = CartVect( 0.0 ) |
||
) | const [virtual] |
Evaluate the inverse map (calculate \(\vec \xi = F^-1($\vec x)\) to given tolerance)
Reimplemented from moab::Element::LinearTri.
Definition at line 593 of file ElemUtil.cpp.
Referenced by moab::Coupler::nat_param(), and test_spherical_tri().
bool moab::Element::SphericalTri::inside_box | ( | const CartVect & | pos, |
double & | tol | ||
) | const [virtual] |
Reimplemented from moab::Element::Map.
Definition at line 603 of file ElemUtil.cpp.
Referenced by test_spherical_tri().
Matrix3 moab::Element::SphericalTri::transf [protected] |
Definition at line 392 of file ElemUtil.hpp.
Referenced by ievaluate(), inside_box(), and SphericalTri().
CartVect moab::Element::SphericalTri::v1 [protected] |
Definition at line 391 of file ElemUtil.hpp.
Referenced by ievaluate(), inside_box(), and SphericalTri().