Block-Structured AMR Software Framework
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
AMReX_EB2_IF_Spline.H
Go to the documentation of this file.
1
2#ifndef AMREX_EB2_IF_SPLINE_H_
3#define AMREX_EB2_IF_SPLINE_H_
4#include <AMReX_Config.H>
5
6#include <AMReX_EB2_IF_Base.H>
7#include <AMReX_RealVect.H>
8#include <AMReX.H>
9#include <AMReX_Vector.H>
10#include <AMReX_Array.H>
12
13namespace amrex::EB2 {
14
15/*
16 * Implicit function to specify a spline through a set of control points
17 */
18class SplineIF {
19 public:
20
21 void addSplineElement(std::vector<amrex::RealVect> pts) {
22 auto* theSpline = new SplineDistFcnElement2d();
23 theSpline->set_control_points(std::move(pts));
24 theSpline->calc_D();
25 geomElements.push_back(theSpline);
26 }
27
28 void addLineElement(std::vector<amrex::RealVect> pts) {
29 auto* theLine = new LineDistFcnElement2d();
30 theLine->set_control_points(std::move(pts));
31 geomElements.push_back(theLine);
32 }
33
34 [[nodiscard]] amrex::Real operator() (const amrex::RealArray& p) const {
36 distFcnElement2d * closesetGeomElement = nullptr;
37 amrex::Real dist;
38 dist = 1.0e29_rt;
39 amrex::RealVect x(AMREX_D_DECL(p[0], p[1], p[2]));
40 for (auto * geom : geomElements ) {
41 amrex::Real d = geom->cpdist(x, cp);
42 if (d < dist) {
43 dist = d;
44 closesetGeomElement = geom;
45 }
46 }
47 amrex::Real side = closesetGeomElement ? closesetGeomElement->cpside(x,cp) : Real(0.0);
48 return dist*side;
49 }
50
54};
55
56}
57#endif
Definition AMReX_EB2_IF_Spline.H:18
void addSplineElement(std::vector< amrex::RealVect > pts)
Definition AMReX_EB2_IF_Spline.H:21
void addLineElement(std::vector< amrex::RealVect > pts)
Definition AMReX_EB2_IF_Spline.H:28
amrex::Vector< distFcnElement2d * > geomElements
Definition AMReX_EB2_IF_Spline.H:53
amrex::Real operator()(const amrex::RealArray &p) const
Definition AMReX_EB2_IF_Spline.H:34
Definition AMReX_distFcnElement.H:29
A Real vector in SpaceDim-dimensional space.
Definition AMReX_RealVect.H:32
Definition AMReX_distFcnElement.H:58
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:27
Definition AMReX_distFcnElement.H:11
virtual amrex::Real cpside(amrex::RealVect pt, amrex::RealVect &cp) const =0
Definition AMReX_FabArrayBase.H:32
Array< Real, AMREX_SPACEDIM > RealArray
Definition AMReX_Array.H:26