11 #ifndef _IFDATAIMPLEM_H_ 12 #define _IFDATAIMPLEM_H_ 14 #if defined(CH_Darwin) && defined(__GNUC__) && ( __GNUC__ == 3 ) 17 #define _GLIBCPP_USE_C99 1 27 #include "NamespaceHeader.H" 37 :m_cornerSigns (a_IFData.m_cornerSigns),
38 m_intersections (a_IFData.m_intersections),
39 m_globalCoord (a_IFData.m_globalCoord),
40 m_cellCenterCoord (a_IFData.m_cellCenterCoord),
41 m_parentCoord (a_IFData.m_parentCoord),
42 m_localCoord (a_IFData.m_localCoord),
43 m_maxOrder (a_IFData.m_maxOrder),
44 m_normalDerivatives (a_IFData.m_normalDerivatives),
45 m_badNormal (a_IFData.m_badNormal),
46 m_allVerticesIn (a_IFData.m_allVerticesIn),
47 m_allVerticesOut (a_IFData.m_allVerticesOut),
48 m_allVerticesOn (a_IFData.m_allVerticesOn)
64 const RvDim & a_cellCenter,
65 const int & a_maxOrder)
93 const RvDim & a_cellCenter,
94 const int & a_maxOrder)
119 const int & a_maxOrder,
125 typedef map<HDEdgeIndex,Real,LexLT<HDEdgeIndex> > HDEdgeIntersections;
127 typedef map<HDVertex,int,LexLT<HDVertex> > HDCornerSigns;
135 int fixedComp = a_idir;
156 for (
typename HDCornerSigns::const_iterator it = a_hIFData.
m_cornerSigns.begin();
159 const HDVertex& hVertex = it->first;
160 if (hVertex[fixedComp] == a_hilo)
163 for (
int j = 0; j <
dim; ++j)
167 vertex[j] = hVertex[j];
171 vertex[j] = hVertex[j+1];
183 m_allVerticesIn =
false;
189 for (
typename HDEdgeIntersections::const_iterator it = a_hIFData.
m_intersections.begin();
192 const HDEdgeIndex& hEdgeIndex = it->first;
194 int hEdgeDir = hEdgeIndex[0];
202 if (hEdgeDir < fixedComp)
204 if (hEdgeIndex[fixedComp] == a_hilo)
206 edgeIndex[0] = hEdgeDir;
208 for (
int j = 1; j <
dim; ++j)
212 edgeIndex[j] = hEdgeIndex[j];
216 edgeIndex[j] = hEdgeIndex[j+1];
222 else if (hEdgeDir > fixedComp)
224 if (hEdgeIndex[fixedComp+1] == a_hilo)
226 edgeIndex[0] = hEdgeDir - 1;
228 for (
int j = 1; j <
dim; ++j)
232 edgeIndex[j] = hEdgeIndex[j];
236 edgeIndex[j] = hEdgeIndex[j+1];
248 #if RECURSIVE_GEOMETRY_GENERATION == 0 277 for (
int order = 0; order <=
m_maxOrder; order++)
283 for (
int i = 0; i < derivatives.
size(); ++i)
285 const IvDim & derivative = derivatives[i];
287 for (
int idir = 0; idir <
dim; idir++)
317 int numVertices = 1 <<
dim;
319 for (
int i = 0; i < numVertices; ++i)
324 for (
int j = 0; j <
dim; ++j)
327 vertex[j] = (ii & 1);
333 for (
int idir = 0; idir <
dim; ++idir)
335 corner[idir] = vertex[idir] - 0.5;
368 for (
typename CornerSigns::const_iterator it0 =
m_cornerSigns.begin();
371 for (
typename CornerSigns::const_iterator it1 =
m_cornerSigns.begin();
397 const Real& intercept = it->second;
399 int varyDir = edgeIndex[0];
402 intersectPt[varyDir] = intercept;
404 for (
int i = 1; i <
dim; i++)
419 intersectPt[curDir] = loHi - 0.5;
436 bool connected =
true;
441 for (
int idir = 0; idir <
dim; ++idir)
443 if (a_vertex1[idir] != a_vertex2[idir])
470 thisEdge[0] = a_edgeDir;
472 for (
int idir = 0; idir <
dim; ++idir)
474 if (idir < a_edgeDir)
476 thisEdge[idir + 1] = a_vertex0[idir];
478 else if (idir > a_edgeDir)
480 thisEdge[idir] = a_vertex0[idir];
505 if ((lo ==
OUT && hi ==
IN) || (lo ==
IN && hi ==
OUT))
541 if (lo ==
IN && hi ==
ON)
546 else if (lo ==
ON && hi ==
IN)
559 int edgeDir = a_thisEdge[0];
567 for (
int idir = 0; idir <
dim; ++idir)
571 loEnd[idir] = a_thisEdge[idir + 1];
572 hiEnd[idir] = a_thisEdge[idir + 1];
574 else if (idir > edgeDir)
576 loEnd[idir] = a_thisEdge[idir];
577 hiEnd[idir] = a_thisEdge[idir];
585 for (
int idir = 0; idir <
dim; ++idir)
607 const RvDim & a_hiPt,
608 const int & a_edgeDir)
const 613 const unsigned int MAXITER = 100;
614 const Real EPS = 3.0e-15;
627 RvDim physCoordAPt = a_loPt;
628 RvDim physCoordBPt = a_hiPt;
638 pout() <<
"fa " << fa <<
" fb " << fb <<endl;
639 MayDay::Abort(
"IFData::BrentRootFinder. Root must be bracketed, but instead the supplied end points have the same sign.");
644 for (i = 0; i < MAXITER; i++)
667 xm = 0.5 * (c - bPt);
669 if (
Abs(xm) <= tol1 || fb == 0.0)
687 p = s * (2.0 * xm * q * (q-r) - (bPt-aPt) * (r-1.0));
688 q = (q-1.0) * (r-1.0) * (s-1.0);
727 if (xm < 0) bPt = bPt - tol1;
728 else bPt = bPt + tol1;
731 physCoordBPt[a_edgeDir] = ((1.0 - bPt)/2.0) * a_loPt[a_edgeDir] + ((1.0 + bPt)/2.0) * a_hiPt[a_edgeDir];
737 cerr <<
"BrentRootFinder: exceeding maximum iterations: " 747 const Real & a_pt)
const 768 for (
typename CornerSigns::const_iterator it =
m_cornerSigns.begin();
771 if (it->second ==
IN)
776 if (it->second ==
OUT)
781 if (it->second !=
ON)
790 string padding =
" ";
798 a_out << padding <<
"undefined IFData\n";
802 for (
typename CornerSigns::const_iterator it =
m_cornerSigns.begin();
805 a_out << padding <<
"Vertex " 812 a_out << padding <<
"\n";
814 for (
typename EdgeIntersections::const_iterator it =
m_intersections.begin();
818 std::ios::fmtflags origFlags = a_out.flags();
819 int origWidth = a_out.width();
820 int origPrecision = a_out.precision();
822 a_out << padding <<
"EdgeIndex " 826 << setiosflags(ios::showpoint)
827 << setiosflags(ios::scientific)
832 a_out.flags(origFlags);
833 a_out.width(origWidth);
834 a_out.precision(origPrecision);
836 a_out << padding <<
"\n";
841 a_out << padding <<
"m_badNormal = " <<
m_badNormal <<
"\n";
842 a_out << padding <<
"\n";
844 if (!m_allVerticesOut)
850 a_out << padding <<
"\n";
852 a_out << padding <<
"m_maxOrder = " <<
m_maxOrder <<
"\n";
854 std::ios::fmtflags origFlags = a_out.flags();
855 int origWidth = a_out.width();
856 int origPrecision = a_out.precision();
858 a_out << padding <<
"m_normalDerivatives = " <<
"\n";
864 for (
int idir = 0; idir <
dim; idir++)
866 a_out << padding <<
" " 872 << setiosflags(ios::showpoint)
873 << setiosflags(ios::scientific)
874 << (it->second)[idir]
877 a_out << padding <<
"\n";
880 a_out.flags(origFlags);
881 a_out.width(origWidth);
882 a_out.precision(origPrecision);
886 a_out << padding <<
"All vertices out" <<
"\n";
888 a_out << padding <<
"\n";
895 a_IFData.
print(a_out);
903 if (
this != &a_IFData)
939 #include "NamespaceFooter.H" std::ostream & pout()
Use this in place of std::cout for program output.
NormalDerivatives m_normalDerivatives
Definition: IFData.H:61
Definition: CoordinateSystem.H:34
Real BrentRootFinder(const RvDim &a_loPt, const RvDim &a_hiPt, const int &a_edgeDir) const
Definition: IFDataImplem.H:606
void makeEdgeKey(const int &a_edgeDir, const Vertex &a_vertex1, const Vertex &a_vertex2)
Definition: IFDataImplem.H:464
~IFData()
Definition: IFDataImplem.H:265
#define LARGEREALVAL
Definition: Notation.H:77
void checkIntersection(bool &a_hiOn, bool &a_loOn, const Real &a_pt) const
Definition: IFDataImplem.H:745
#define LARGEINTVAL
Definition: Notation.H:76
one dimensional dynamic array
Definition: Vector.H:52
virtual Real evaluate(const IvDim &a_multiIndex, const int &a_direction, const RvDim &a_point, const IFSlicer< dim > *a_ifSlicer)
Evaluate derivatives of the normal of an IFSlicer class.
Definition: NormalDerivativeImplem.H:27
bool isConnected(int &a_edgeDir, const Vertex &a_vertex1, const Vertex &a_vertex2)
Definition: IFDataImplem.H:432
CoordinateSystem< dim > m_parentCoord
Definition: IFData.H:57
This computes the derivatives of the normal of a sliced implicit function.
Definition: NormalDerivative.H:25
IFSlicer< dim > * m_function
Definition: IFData.H:53
#define TOLERANCE
Definition: Notation.H:78
IFData()
Definition: IFDataImplem.H:30
CoordinateSystem< dim > m_localCoord
Definition: IFData.H:58
void operator=(const IFData &a_ifData)
Definition: IFDataImplem.H:900
void setNormalDerivatives()
Definition: IFDataImplem.H:273
CoordinateSystem< dim > m_globalCoord
Definition: IFData.H:55
bool m_allVerticesOn
Definition: IFData.H:66
double Real
Definition: REAL.H:33
void makeCornerSigns()
Definition: IFDataImplem.H:308
#define ON
Definition: Notation.H:84
T Abs(const T &a_a)
Definition: Misc.H:53
size_t size() const
Definition: Vector.H:177
bool m_allVerticesIn
Definition: IFData.H:64
CoordinateSystem< dim > m_cellCenterCoord
Definition: IFData.H:56
Definition: IFSlicer.H:27
#define MACHINEPRECISION
Definition: Notation.H:79
Real getMagnitudeOfGradient()
Definition: NormalDerivativeImplem.H:64
bool m_allVerticesOut
Definition: IFData.H:65
T Min(const T &a_a, const T &a_b)
Definition: Misc.H:26
CornerSigns m_cornerSigns
Definition: IFData.H:51
void remakeCornerSigns()
Definition: IFDataImplem.H:762
ostream & operator<<(ostream &a_out, const IFData< dim > &a_IFData)
Definition: IFDataImplem.H:892
void defineLocalCoords()
Definition: IFDataImplem.H:383
int m_maxOrder
Definition: IFData.H:60
EdgeIntersections m_intersections
Definition: IFData.H:52
#define IN
Definition: Notation.H:85
void print(ostream &out) const
Definition: IFDataImplem.H:788
void findIntersectionPts()
Definition: IFDataImplem.H:365
#define OUT
Definition: Notation.H:83
Real rootFinder(const EdgeIndex &a_thisEdge)
Definition: IFDataImplem.H:553
void generateMultiIndices(Vector< IndexTM< int, dim > > &a_indices, const int &a_magnitude)
Definition: MultiIndexImplem.H:18
int dim
Definition: EBInterface.H:146
#define GLOBALDIM
Definition: Notation.H:35
static const IndexTM Zero
Definition: IndexTM.H:431
bool m_badNormal
Definition: IFData.H:62
#define RECURSIVE_GEOMETRY_GENERATION
Definition: Notation.H:40
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).