21 #include "libmesh/libmesh_config.h" 22 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 23 #include "libmesh/inf_fe_map.h" 24 #include "libmesh/inf_fe.h" 25 #include "libmesh/fe.h" 26 #include "libmesh/elem.h" 27 #include "libmesh/inf_fe_macro.h" 28 #include "libmesh/libmesh_logging.h" 30 #include "libmesh/type_tensor.h" 41 const Elem * inf_elem,
42 const Point & reference_point)
45 libmesh_assert_not_equal_to (
dim, 0);
49 const Real v (reference_point(
dim-1));
56 base_point = inf_elem->
point(0);
60 base_point =
FEMap::map (
dim-1, base_elem.get(), reference_point);
64 libmesh_error_msg(
"Unknown dim = " <<
dim);
75 return (base_point-inf_elem->
origin())*2/(1-v)+inf_elem->
origin();
77 #if 0 // Leave this documented, but w/o unreachable-code warnings 82 const Point outer_point (base_point * 2. - inf_elem->
origin());
88 p.add_scaled (outer_point,
eval (v, radial_mapping_order, 1));
97 const Elem * inf_elem,
98 const Point & physical_point,
103 libmesh_assert_greater_equal (tolerance, 0.);
107 LOG_SCOPE(
"inverse_map()",
"InfFEMap");
140 libmesh_error_msg(
"ERROR: InfFE::inverse_map is not yet implemented in 2d");
144 const Point xi ( base_elem->point(1) - base_elem->point(0));
145 const Point eta( base_elem->point(2) - base_elem->point(0));
146 const Point zeta( physical_point - o);
149 Point n(xi.cross(eta));
150 Real c_factor = (base_elem->point(0) - o)*n/(zeta*n) - 1.;
161 intersection.
add_scaled(physical_point,1.+c_factor);
165 if (!base_elem->has_affine_map())
167 unsigned int iter_max = 20;
178 for(
unsigned int it=0; it<iter_max; ++it)
185 Point intersection_guess;
186 for(
unsigned int i=0; i<n_sf; ++i)
190 base_elem->default_order(),
195 base_elem->default_order(),
201 base_elem->default_order(),
207 TypeVector<Real> F(physical_point + c_factor*(physical_point-o) - intersection_guess);
210 J(0,0) = (physical_point-o)(0);
211 J(0,1) = -dxyz_dxi(0);
212 J(0,2) = -dxyz_deta(0);
213 J(1,0) = (physical_point-o)(1);
214 J(1,1) = -dxyz_dxi(1);
215 J(1,2) = -dxyz_deta(1);
216 J(2,0) = (physical_point-o)(2);
217 J(2,1) = -dxyz_dxi(2);
218 J(2,2) = -dxyz_deta(2);
226 if ( delta.
norm() < tol )
229 if (base_elem->contains_point(intersection_guess,
TOLERANCE*0.1))
231 intersection = intersection_guess;
241 c_factor -= delta(0);
242 ref_point(0) -= delta(1);
243 ref_point(1) -= delta(2);
253 libmesh_error_msg(
"Invalid dim = " <<
dim);
260 tolerance, secure, secure);
287 v = 1.-2.*a_dist/fp_o_dist;
295 if ((-1.-1.e-5 < v && v < 1.) || secure)
298 const Point diff = physical_point - check;
300 if (diff.
norm() > tolerance)
301 libmesh_warning(
"WARNING: diff is " << diff.
norm());
312 const std::vector<Point> & physical_points,
313 std::vector<Point> & reference_points,
314 const Real tolerance,
319 const std::size_t n_points = physical_points.size();
323 reference_points.resize(n_points);
327 for (
unsigned int p=0; p<n_points; p++)
328 reference_points[p] =
336 #endif //ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS void add_scaled(const TypeVector< T2 > &, const T &)
Add a scaled value to this vector without creating a temporary.
Order
defines an enum for polynomial orders.
auto norm() const -> decltype(std::norm(T()))
virtual Point origin() const
static OutputShape shape(const ElemType t, const Order o, const unsigned int i, const Point &p)
static Point map(const unsigned int dim, const Elem *inf_elem, const Point &reference_point)
static constexpr Real TOLERANCE
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
static Real eval(Real v, Order o, unsigned int i)
This is the base class from which all geometric element types are derived.
void solve(const TypeVector< T > &b, TypeVector< T > &x) const
Solve the 2x2 or 3x3 system of equations A*x = b for x by directly inverting A and multiplying it by ...
static OutputShape shape_deriv(const ElemType t, const Order o, const unsigned int i, const unsigned int j, const Point &p)
The libMesh namespace provides an interface to certain functionality in the library.
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
static std::unique_ptr< const Elem > build_elem(const Elem *inf_elem)
Build the base element of an infinite element.
This class defines a tensor in LIBMESH_DIM dimensional space of type T.
virtual unsigned int n_shape_functions() const override
static Order mapping_order()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static Point map(const unsigned int dim, const Elem *elem, const Point &reference_point)
A Point defines a location in LIBMESH_DIM dimensional Real space.
const Point & point(const unsigned int i) const