11 #ifndef _NORMALDERIVATIVENEW_H_ 12 #define _NORMALDERIVATIVENEW_H_ 20 #include "NamespaceHeader.H" 57 const RvDim & a_point,
64 for (
int idir = 0; idir <
dim; idir++)
66 Real dxd = a_implicitFunction->
67 value(BASISV_TM<int,dim>(idir), a_point);
68 if (idir == a_direction)
73 return value / sqrt(lenGradIF);
90 ScalarPowerMap phiDerivs;
91 ScalarPowerMap lDerivs;
92 NormalDerivativeMap nDerivs;
98 for (bit.
begin(); bit.
ok(); ++bit)
101 for(
int idir = 0; idir <
dim; idir++)
103 pow[idir] = bit()[idir];
105 if (pow.
sum() <= a_maxP)
113 typename NormalDerivativeMap::const_iterator it;
114 for (it = nDerivs.begin(); it != nDerivs.end(); ++it)
117 addLDeriv(lDerivs, phiDerivs, nDerivs, p);
118 addNDeriv(nDerivs, phiDerivs, lDerivs, p);
132 ScalarPowerMap& a_phiDerivs,
133 const RvDim& a_point,
135 const int& a_maxPartial)
141 for (bit.
begin(); bit.
ok(); ++bit)
143 if (bit().sum() <= a_maxPartial)
146 for(
int idir = 0; idir <
dim; idir++)
148 deriv[idir]= bit()[idir];
151 a_phiDerivs[deriv] = a_implicitFunction->
value(deriv, a_point);
158 ScalarPowerMap& a_lDerivs,
159 ScalarPowerMap& a_phiDerivs,
160 NormalDerivativeMap& a_nDerivs,
161 const IvDim& a_deriv)
168 for (
int d=0; d <
dim; ++d)
170 Real val = a_phiDerivs[BASISV_TM<int,dim>(d)];
174 a_lDerivs[a_deriv] = sqrt(len);
180 for (dir=0; dir <
dim-1; ++dir)
181 if (a_deriv[dir] > 0)
185 IvDim q = a_deriv - BASISV_TM<int,dim>(dir);
186 typename NormalDerivativeMap::const_iterator it;
187 for (it = a_nDerivs.begin(); it != a_nDerivs.end(); ++it)
193 RvDim dn = a_nDerivs[r];
194 for (
int d=0; d <
dim; ++d)
196 IvDim dphip = q - r + BASISV_TM<int,dim>(d) +
197 BASISV_TM<int,dim>(dir);
198 dl += coef * dn[d] * a_phiDerivs[dphip];
202 a_lDerivs[a_deriv] = dl;
207 NormalDerivativeMap& a_nDerivs,
208 ScalarPowerMap& a_phiDerivs,
209 ScalarPowerMap& a_lDerivs,
210 const IvDim& a_deriv)
213 typename NormalDerivativeMap::const_iterator it;
214 for (it = a_nDerivs.begin(); it != a_nDerivs.end(); ++it)
217 if ((q <= a_deriv) && (q != a_deriv))
220 dn += (coef * a_lDerivs[a_deriv-q]) * it->second;
226 for (
int d=0; d <
dim; ++d)
227 dphi[d] = a_phiDerivs[a_deriv + BASISV_TM<int,dim>(d)];
228 a_nDerivs[a_deriv] = (dphi - dn) / l;
234 static int nChoosek(
const IvDim& a_n,
const IvDim& a_k)
239 IvDim diff = a_n - a_k;
241 for (
int d = 0; d <
dim; ++d)
243 for (
int i=diff[d]+1; i <= a_n[d]; ++i)
245 for (
int i=2; i <= a_k[d]; ++i)
249 return numer / denom;
255 MayDay::Abort(
"NormalDerivativeNew doesn't allow copy construction");
260 MayDay::Abort(
"NormalDerivativeNew doesn't allow assignment");
264 #include "NamespaceFooter.H" bool ok()
Definition: BoxIterator.H:281
#define CH_assert(cond)
Definition: CHArray.H:37
NormalDerivativeNew(const NormalDerivativeNew &a_input)
Definition: NormalDerivativeNew.H:253
Real normal(const int &a_direction, const RvDim &a_point, const IFSlicer< dim > *a_implicitFunction) const
Evaluate the normal of a BaseIF subclass.
Definition: NormalDerivativeNew.H:56
IndexTM< int, dim > IvDim
Definition: NormalDerivativeNew.H:29
iterates through the IntVects of a Box
Definition: BoxIterator.H:37
map< IvDim, Real, LexLT< IvDim > > ScalarPowerMap
Definition: NormalDerivativeNew.H:34
void operator=(const NormalDerivativeNew &a_input)
Definition: NormalDerivativeNew.H:258
T sum() const
Definition: IndexTMI.H:260
NormalDerivativeNew()
Null constructor.
Definition: NormalDerivativeNewImplem.H:17
static const IntVect Unit
Definition: IntVect.H:659
void addNDeriv(NormalDerivativeMap &a_nDerivs, ScalarPowerMap &a_phiDerivs, ScalarPowerMap &a_lDerivs, const IvDim &a_deriv)
Definition: NormalDerivativeNew.H:206
This computes the derivatives of the normal of a sliced implicit function.
Definition: NormalDerivativeNew.H:26
double Real
Definition: REAL.H:33
NormalDerivativeMap calculateAll(const int &a_maxP, const RvDim &a_point, const IFSlicer< dim > *a_implicitFunction)
Evaluate all derivatives of the normal of an IFSlicer class.
Definition: NormalDerivativeNew.H:84
virtual ~NormalDerivativeNew()
Destructor.
Definition: NormalDerivativeNewImplem.H:22
static const IntVect Zero
Definition: IntVect.H:654
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
void begin()
Definition: BoxIterator.H:150
Definition: IFSlicer.H:27
static int nChoosek(const IvDim &a_n, const IvDim &a_k)
Definition: NormalDerivativeNew.H:234
map< IvDim, RvDim, LexLT< IvDim > > NormalDerivativeMap
Definition: NormalDerivativeNew.H:35
virtual Real value(const IndexTM< int, dim > &a_partialDerivative, const IndexTM< Real, dim > &a_point) const
Return the partial derivative evaluated at a_point.
Definition: IFSlicerImplem.H:60
IndexTM< Real, dim > RvDim
Definition: NormalDerivativeNew.H:30
int dim
Definition: EBInterface.H:146
void addLDeriv(ScalarPowerMap &a_lDerivs, ScalarPowerMap &a_phiDerivs, NormalDerivativeMap &a_nDerivs, const IvDim &a_deriv)
Definition: NormalDerivativeNew.H:157
static const IndexTM Zero
Definition: IndexTM.H:467
void calculatePhiDerivs(ScalarPowerMap &a_phiDerivs, const RvDim &a_point, const IFSlicer< dim > *a_implicitFunction, const int &a_maxPartial)
Definition: NormalDerivativeNew.H:131
static void Abort(const char *const a_msg=m_nullString)
Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).