00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _IFDATAIMPLEM_H_
00012 #define _IFDATAIMPLEM_H_
00013
00014 #if defined(CH_Darwin) && defined(__GNUC__) && ( __GNUC__ == 3 )
00015
00016 #include <unistd.h>
00017 #define _GLIBCPP_USE_C99 1
00018 #endif
00019
00020 #include <iostream>
00021 #include <iomanip>
00022
00023 #include "MultiIndex.H"
00024 #include "NormalDerivative.H"
00025 #include "NormalDerivativeNew.H"
00026 #include "ParmParse.H"
00027 #include "NamespaceHeader.H"
00028
00029
00030 template <int dim> IFData<dim>::IFData()
00031 {
00032 m_function = NULL;
00033 }
00034
00035
00036 template <int dim> IFData<dim>::IFData(const IFData<dim>& a_IFData)
00037 :m_cornerSigns (a_IFData.m_cornerSigns),
00038 m_intersections (a_IFData.m_intersections),
00039 m_globalCoord (a_IFData.m_globalCoord),
00040 m_cellCenterCoord (a_IFData.m_cellCenterCoord),
00041 m_parentCoord (a_IFData.m_parentCoord),
00042 m_localCoord (a_IFData.m_localCoord),
00043 m_maxOrder (a_IFData.m_maxOrder),
00044 m_normalDerivatives (a_IFData.m_normalDerivatives),
00045 m_badNormal (a_IFData.m_badNormal),
00046 m_allVerticesIn (a_IFData.m_allVerticesIn),
00047 m_allVerticesOut (a_IFData.m_allVerticesOut),
00048 m_allVerticesOn (a_IFData.m_allVerticesOn)
00049 {
00050 CH_TIME("ifdata constructor 1");
00051 if (a_IFData.m_function != NULL)
00052 {
00053
00054 m_function = new IFSlicer<dim>(*(a_IFData.m_function));
00055 }
00056 else
00057 {
00058 m_function = NULL;
00059 }
00060 }
00061
00062
00063
00064
00065 template <int dim> IFData<dim>::IFData(const BaseIF & a_function,
00066 const RvDim & a_dx,
00067 const RvDim & a_cellCenter,
00068 const int & a_maxOrder)
00069 :m_globalCoord (a_cellCenter,a_dx),
00070 m_cellCenterCoord(IndexTM<Real,dim>::Zero,a_dx),
00071 m_parentCoord (IndexTM<Real,dim>::Zero,a_dx),
00072 m_maxOrder (a_maxOrder)
00073 {
00074 CH_TIME("ifdata constructor 2");
00075
00076
00077 m_function = new IFSlicer<dim>(a_function);
00078
00079
00080
00081 makeCornerSigns();
00082
00083
00084 findIntersectionPts();
00085
00086
00087
00088 defineLocalCoords();
00089
00090
00091 setNormalDerivatives();
00092 }
00093
00094
00095 template <int dim> IFData<dim>::IFData(IFSlicer<dim> * a_function,
00096 const RvDim & a_dx,
00097 const RvDim & a_cellCenter,
00098 const int & a_maxOrder)
00099 :m_globalCoord (a_cellCenter,a_dx),
00100 m_cellCenterCoord(IndexTM<Real,dim>::Zero,a_dx),
00101 m_parentCoord (IndexTM<Real,dim>::Zero,a_dx),
00102 m_maxOrder (a_maxOrder)
00103 {
00104 CH_TIME("ifdata constructor 3");
00105
00106 m_function = new IFSlicer<dim>(*a_function);
00107
00108
00109
00110 makeCornerSigns();
00111
00112
00113 findIntersectionPts();
00114
00115
00116 defineLocalCoords();
00117
00118
00119 setNormalDerivatives();
00120 }
00121
00122 template <int dim> IFData<dim>::IFData(const IFData<dim+1> & a_hIFData,
00123 const int & a_maxOrder,
00124 const int & a_idir,
00125 const int & a_hilo)
00126 {
00127 CH_TIME("ifdata constructor 4");
00128 typedef IndexTM<int,dim+1>HDEdgeIndex;
00129 typedef map<HDEdgeIndex,Real > HDEdgeIntersections;
00130 typedef IndexTM<int,dim+1>HDVertex;
00131 typedef map<HDVertex,int > HDCornerSigns;
00132
00133
00134 int pm = a_hilo;
00135 pm *= 2;
00136 pm -= 1;
00137
00138
00139 int fixedComp = a_idir;
00140 Real fixedValue = a_hIFData.m_globalCoord.convertDir(pm*0.5*a_hIFData.m_cellCenterCoord.m_dx[fixedComp],
00141 a_hIFData.m_cellCenterCoord,
00142 fixedComp);
00143
00144
00145 m_function = new IFSlicer<dim>(a_hIFData.m_function,fixedComp,fixedValue);
00146
00147
00148 m_globalCoord = CoordinateSystem<dim>(a_hIFData.m_globalCoord,fixedComp);
00149
00150
00151 m_cellCenterCoord = CoordinateSystem<dim>(a_hIFData.m_cellCenterCoord,fixedComp);
00152
00153
00154 m_parentCoord = CoordinateSystem<dim>(a_hIFData.m_localCoord,fixedComp);
00155
00156 m_allVerticesIn = true;
00157 m_allVerticesOut = true;
00158 m_allVerticesOn = true;
00159
00160 for (typename HDCornerSigns::const_iterator it = a_hIFData.m_cornerSigns.begin();
00161 it != a_hIFData.m_cornerSigns.end(); ++it)
00162 {
00163 const HDVertex& hVertex = it->first;
00164 if (hVertex[fixedComp] == a_hilo)
00165 {
00166 Vertex vertex;
00167 for (int j = 0; j < dim; ++j)
00168 {
00169 if (j < fixedComp)
00170 {
00171 vertex[j] = hVertex[j];
00172 }
00173 else
00174 {
00175 vertex[j] = hVertex[j+1];
00176 }
00177 }
00178
00179 m_cornerSigns[vertex] = it->second;
00180 if (m_cornerSigns[vertex] == IN)
00181 {
00182 m_allVerticesOut = false;
00183 m_allVerticesOn = false;
00184 }
00185 else if (m_cornerSigns[vertex] == OUT)
00186 {
00187 m_allVerticesIn = false;
00188 m_allVerticesOn = false;
00189 }
00190 }
00191 }
00192
00193 for (typename HDEdgeIntersections::const_iterator it = a_hIFData.m_intersections.begin();
00194 it != a_hIFData.m_intersections.end(); ++it)
00195 {
00196 const HDEdgeIndex& hEdgeIndex = it->first;
00197 EdgeIndex edgeIndex;
00198 int hEdgeDir = hEdgeIndex[0];
00199
00200
00201
00202
00203
00204
00205
00206 if (hEdgeDir < fixedComp)
00207 {
00208 if (hEdgeIndex[fixedComp] == a_hilo)
00209 {
00210 edgeIndex[0] = hEdgeDir;
00211
00212 for (int j = 1; j < dim; ++j)
00213 {
00214 if (j < fixedComp)
00215 {
00216 edgeIndex[j] = hEdgeIndex[j];
00217 }
00218 else
00219 {
00220 edgeIndex[j] = hEdgeIndex[j+1];
00221 }
00222 }
00223 m_intersections[edgeIndex] = it->second;
00224 }
00225 }
00226 else if (hEdgeDir > fixedComp)
00227 {
00228 if (hEdgeIndex[fixedComp+1] == a_hilo)
00229 {
00230 edgeIndex[0] = hEdgeDir - 1;
00231
00232 for (int j = 1; j < dim; ++j)
00233 {
00234 if (j < fixedComp+1)
00235 {
00236 edgeIndex[j] = hEdgeIndex[j];
00237 }
00238 else
00239 {
00240 edgeIndex[j] = hEdgeIndex[j+1];
00241 }
00242 }
00243 m_intersections[edgeIndex] = it->second;
00244 }
00245 }
00246 }
00247
00248
00249
00250 defineLocalCoords();
00251
00252 m_maxOrder = a_maxOrder;
00253
00254 if (!m_allVerticesOut && !m_allVerticesIn)
00255 {
00256 setNormalDerivatives();
00257 }
00258 else
00259 {
00260 m_badNormal = false;
00261 }
00262 }
00263
00264
00265 template <int dim> IFData<dim>::~IFData()
00266 {
00267 if (m_function != NULL)
00268 {
00269 delete m_function;
00270 }
00271 }
00272
00273 template <int dim> void IFData<dim>::setNormalDerivatives()
00274 {
00275 CH_TIME("ifdata::setNormalDerivatives");
00276 NormalDerivativeNew<dim> normalDerivative;
00277 typename NormalDerivativeNew<dim>::NormalDerivativeMap ndMap =
00278 normalDerivative.calculateAll(m_maxOrder,
00279 m_globalCoord.convert(RvDim::Zero,m_localCoord),
00280 m_function);
00281
00282
00283 for (int order = 0; order <= m_maxOrder; order++)
00284 {
00285 Vector<IvDim> derivatives;
00286
00287 generateMultiIndices(derivatives,order);
00288
00289 for (int i = 0; i < derivatives.size(); ++i)
00290 {
00291 const IvDim & derivative = derivatives[i];
00292
00293 for (int idir = 0; idir < dim; idir++)
00294 {
00295 m_normalDerivatives[derivative][idir] = ndMap[derivative][idir];
00296 }
00297 }
00298 }
00299
00300
00301 m_badNormal = false;
00302 }
00303
00304 template <int dim> void IFData<dim>::makeCornerSigns()
00305 {
00306 CH_TIME("ifdata::makeCornerSigns");
00307 m_allVerticesIn = true;
00308 m_allVerticesOut = true;
00309 m_allVerticesOn = true;
00310
00311 Vertex vertex;
00312
00313
00314 int numVertices = 1 << dim;
00315
00316 for (int i = 0; i < numVertices; ++i)
00317 {
00318 int ii = i;
00319
00320
00321 for (int j = 0; j < dim; ++j)
00322 {
00323
00324 vertex[j] = (ii & 1);
00325 ii = ii >> 1;
00326 }
00327
00328
00329 RvDim corner;
00330 for (int idir = 0; idir < dim; ++idir)
00331 {
00332 corner[idir] = vertex[idir] - 0.5;
00333 corner[idir] *= m_cellCenterCoord.m_dx[idir];
00334 }
00335
00336
00337 RvDim cornerCoord = m_globalCoord.convert(corner,m_cellCenterCoord);
00338
00339
00340 Real val = m_function->value(IndexTM<int,dim>::Zero,cornerCoord);
00341
00342
00343 if (val < -MACHINEPRECISION)
00344 {
00345 m_cornerSigns[vertex] = IN;
00346 m_allVerticesOut = false;
00347 m_allVerticesOn = false;
00348 }
00349 else if (val > MACHINEPRECISION)
00350 {
00351 m_cornerSigns[vertex] = OUT;
00352 m_allVerticesIn = false;
00353 m_allVerticesOn = false;
00354 }
00355 else
00356 {
00357 m_cornerSigns[vertex] = ON;
00358 }
00359 }
00360 }
00361
00362 template <int dim> void IFData<dim>::findIntersectionPts()
00363 {
00364 CH_TIME("ifdata::findIntersectionPoints");
00365
00366 for (typename CornerSigns::const_iterator it0 = m_cornerSigns.begin();
00367 it0 != m_cornerSigns.end(); ++it0)
00368 {
00369 for (typename CornerSigns::const_iterator it1 = m_cornerSigns.begin();
00370 it1 != m_cornerSigns.end(); ++it1)
00371 {
00372 int edgeDir = LARGEINTVAL;
00373 if (isConnected(edgeDir,it0->first,it1->first))
00374 {
00375
00376 makeEdgeKey(edgeDir,it0->first,it1->first);
00377 }
00378 }
00379 }
00380 }
00381 template <int dim> void IFData<dim>::defineLocalCoords()
00382 {
00383 CH_TIME("ifdata::defineLocalCoords");
00384
00385 m_localCoord.m_origin = m_cellCenterCoord.m_origin;
00386
00387
00388
00389
00390 if(!LocalCoordMoveSwitch::s_turnOffMoveLocalCoords)
00391 {
00392 if (m_intersections.size() == 0)
00393 {
00394 m_localCoord.m_origin = m_cellCenterCoord.m_origin;
00395 }
00396 else
00397 {
00398 m_localCoord.m_origin = RvDim::Zero;
00399
00400 for (typename EdgeIntersections::const_iterator it = m_intersections.begin();it != m_intersections.end(); ++it)
00401 {
00402 const EdgeIndex& edgeIndex = it->first;
00403 const Real& intercept = it->second;
00404
00405 int varyDir = edgeIndex[0];
00406
00407 RvDim intersectPt = RvDim::Zero;
00408 intersectPt[varyDir] = intercept;
00409
00410 for (int i = 1; i < dim; i++)
00411 {
00412 int curDir;
00413 int loHi;
00414
00415 if (i <= varyDir)
00416 {
00417 curDir = i-1;
00418 }
00419 else
00420 {
00421 curDir = i;
00422 }
00423
00424 loHi = edgeIndex[i];
00425 intersectPt[curDir] = loHi - 0.5;
00426 intersectPt[curDir] *= m_globalCoord.m_dx[curDir];
00427 }
00428
00429 m_localCoord.m_origin -= intersectPt;
00430 }
00431
00432 m_localCoord.m_origin /= m_intersections.size();
00433 }
00434 }
00435
00436 m_localCoord.m_dx = m_globalCoord.m_dx;
00437 }
00438
00439 template <int dim> bool IFData<dim>::isConnected(int & a_edgeDir,
00440 const Vertex & a_vertex1,
00441 const Vertex & a_vertex2)
00442 {
00443 CH_TIME("ifdata::isConnected");
00444 bool connected = true;
00445 int numDif = 0;
00446
00447
00448
00449 for (int idir = 0; idir < dim; ++idir)
00450 {
00451 if (a_vertex1[idir] != a_vertex2[idir])
00452 {
00453
00454 a_edgeDir = idir;
00455 numDif += 1;
00456 }
00457 }
00458
00459 if (numDif == 1)
00460 {
00461 connected = true;
00462 }
00463 else
00464 {
00465 connected = false;
00466 a_edgeDir = LARGEINTVAL;
00467 }
00468
00469 return connected;
00470 }
00471
00472 template <int dim> void IFData<dim>::makeEdgeKey(const int & a_edgeDir,
00473 const Vertex & a_vertex0,
00474 const Vertex & a_vertex1)
00475 {
00476 CH_TIME("ifdata::makeedgekey");
00477 EdgeIndex thisEdge;
00478
00479 thisEdge[0] = a_edgeDir;
00480
00481 for (int idir = 0; idir < dim; ++idir)
00482 {
00483 if (idir < a_edgeDir)
00484 {
00485 thisEdge[idir + 1] = a_vertex0[idir];
00486 }
00487 else if (idir > a_edgeDir)
00488 {
00489 thisEdge[idir] = a_vertex0[idir];
00490 }
00491 }
00492
00493 int lo = LARGEINTVAL;
00494 int hi = LARGEINTVAL;
00495
00496 if (m_cornerSigns.find(a_vertex0)!= m_cornerSigns.end())
00497 {
00498 lo = m_cornerSigns.find(a_vertex0)->second;
00499 }
00500 else
00501 {
00502 MayDay::Abort("Vertex not well defined in makeEdgeKey");
00503 }
00504
00505 if (m_cornerSigns.find(a_vertex1)!= m_cornerSigns.end())
00506 {
00507 hi = m_cornerSigns.find(a_vertex1)->second;
00508 }
00509 else
00510 {
00511 MayDay::Abort("Vertex not well defined in makeEdgeKey");
00512 }
00513
00514 if ((lo == OUT && hi == IN) || (lo == IN && hi == OUT))
00515 {
00516
00517 Real pt = rootFinder(thisEdge);
00518
00519
00520 bool hiOn = false;
00521 bool loOn = false;
00522
00523 checkIntersection(hiOn,loOn,pt);
00524
00525 if (hiOn || loOn)
00526 {
00527 if (loOn)
00528 {
00529 m_cornerSigns[a_vertex0] = ON;
00530 lo = ON;
00531 }
00532
00533 if (hiOn)
00534 {
00535 m_cornerSigns[a_vertex1] = ON;
00536 hi = ON;
00537 }
00538
00539 remakeCornerSigns();
00540 }
00541 else
00542 {
00543
00544 m_intersections[thisEdge] = 0.5*m_cellCenterCoord.m_dx[thisEdge[0]]*pt;
00545 }
00546 }
00547
00548
00549
00550 if (lo == IN && hi == ON)
00551 {
00552
00553 m_intersections[thisEdge] = -0.5*m_cellCenterCoord.m_dx[thisEdge[0]];
00554 }
00555 else if (lo == ON && hi == IN)
00556 {
00557
00558 m_intersections[thisEdge] = 0.5*m_cellCenterCoord.m_dx[thisEdge[0]];
00559 }
00560 }
00561
00562 template <int dim> Real IFData<dim>::rootFinder(const EdgeIndex& a_thisEdge)
00563 {
00564 CH_TIME("ifdata::rootfinder");
00565 Real pt = LARGEREALVAL;
00566
00567
00568
00569 int edgeDir = a_thisEdge[0];
00570
00571 Vertex loEnd;
00572 loEnd[edgeDir] = 0;
00573
00574 Vertex hiEnd;
00575 hiEnd[edgeDir] = 1;
00576
00577 for (int idir = 0; idir < dim; ++idir)
00578 {
00579 if (idir < edgeDir)
00580 {
00581 loEnd[idir] = a_thisEdge[idir + 1];
00582 hiEnd[idir] = a_thisEdge[idir + 1];
00583 }
00584 else if (idir > edgeDir)
00585 {
00586 loEnd[idir] = a_thisEdge[idir];
00587 hiEnd[idir] = a_thisEdge[idir];
00588 }
00589 }
00590
00591
00592
00593 RvDim loCorner;
00594 RvDim hiCorner;
00595 for (int idir = 0; idir < dim; ++idir)
00596 {
00597 loCorner[idir] = (loEnd[idir] - 0.5) * m_cellCenterCoord.m_dx[idir];
00598 hiCorner[idir] = (hiEnd[idir] - 0.5) * m_cellCenterCoord.m_dx[idir];
00599 }
00600
00601
00602 RvDim loPt = m_globalCoord.convert(loCorner,m_cellCenterCoord);
00603 RvDim hiPt = m_globalCoord.convert(hiCorner,m_cellCenterCoord);
00604
00605
00606
00607
00608
00609
00610 pt = BrentRootFinder(loPt,hiPt,edgeDir);
00611
00612
00613 return pt;
00614 }
00615
00616 template <int dim> Real IFData<dim>::BrentRootFinder(const RvDim & a_loPt,
00617 const RvDim & a_hiPt,
00618 const int & a_edgeDir) const
00619
00620
00621 {
00622 CH_TIME("ifdata::brentrootfinder");
00623
00624 const unsigned int MAXITER = 100;
00625 const Real EPS = 3.0e-15;
00626
00627 unsigned int i;
00628 Real aPt;
00629 Real bPt;
00630 Real c, fa, fb, fc;
00631 Real d, e;
00632 Real tol1, xm;
00633 Real p, q, r, s;
00634
00635 aPt = -1.0;
00636 bPt = 1.0;
00637
00638 RvDim physCoordAPt = a_loPt;
00639 RvDim physCoordBPt = a_hiPt;
00640
00641 fa = -m_function->value(IndexTM<int,dim>::Zero,physCoordAPt);
00642 fb = -m_function->value(IndexTM<int,dim>::Zero,physCoordBPt);
00643
00644
00645 c = d = e = 0.0;
00646
00647 if (fb*fa > 0)
00648 {
00649 pout() << "fa " << fa << " fb " << fb <<endl;
00650 MayDay::Abort("IFData::BrentRootFinder. Root must be bracketed, but instead the supplied end points have the same sign.");
00651 }
00652
00653 fc = fb;
00654
00655 for (i = 0; i < MAXITER; i++)
00656 {
00657 if (fb*fc > 0)
00658 {
00659
00660 c = aPt;
00661 fc = fa;
00662 d = bPt - aPt;
00663 e = d;
00664 }
00665
00666 if (Abs(fc) < Abs(fb))
00667 {
00668 aPt = bPt;
00669 bPt = c;
00670 c = aPt;
00671 fa = fb;
00672 fb = fc;
00673 fc = fa;
00674 }
00675
00676
00677 tol1 = 2.0 * EPS * Abs(bPt) + 0.5 * TOLERANCE;
00678 xm = 0.5 * (c - bPt);
00679
00680 if (Abs(xm) <= tol1 || fb == 0.0)
00681 {
00682 break;
00683 }
00684
00685 if (Abs(e) >= tol1 && Abs(fa) > Abs(fb))
00686 {
00687
00688 s = fb / fa;
00689 if (aPt == c)
00690 {
00691 p = 2.0 * xm * s;
00692 q = 1.0 - s;
00693 }
00694 else
00695 {
00696 q = fa / fc;
00697 r = fb / fc;
00698 p = s * (2.0 * xm * q * (q-r) - (bPt-aPt) * (r-1.0));
00699 q = (q-1.0) * (r-1.0) * (s-1.0);
00700 }
00701
00702
00703 if (p > 0) q = -q;
00704
00705 p = Abs(p);
00706
00707 if (2.0 * p < Min(((Real)3.0)*xm*q-Abs(tol1*q), Abs(e*q)))
00708 {
00709
00710 e = d;
00711 d = p / q;
00712 }
00713 else
00714 {
00715
00716 d = xm;
00717 e = d;
00718 }
00719 }
00720 else
00721 {
00722
00723 d = xm;
00724 e = d;
00725 }
00726
00727
00728 aPt = bPt;
00729 fa = fb;
00730
00731
00732 if (Abs(d) > tol1)
00733 {
00734 bPt = bPt + d;
00735 }
00736 else
00737 {
00738 if (xm < 0) bPt = bPt - tol1;
00739 else bPt = bPt + tol1;
00740 }
00741
00742 physCoordBPt[a_edgeDir] = ((1.0 - bPt)/2.0) * a_loPt[a_edgeDir] + ((1.0 + bPt)/2.0) * a_hiPt[a_edgeDir];
00743 fb = -m_function->value(IndexTM<int,dim>::Zero,physCoordBPt);
00744 }
00745
00746 if (i >= MAXITER)
00747 {
00748 cerr << "BrentRootFinder: exceeding maximum iterations: "
00749 << MAXITER
00750 << "\n";
00751 }
00752
00753 return bPt;
00754 }
00755
00756 template <int dim> void IFData<dim>::checkIntersection(bool & a_hiOn,
00757 bool & a_loOn,
00758 const Real & a_pt) const
00759 {
00760 a_hiOn = false;
00761 a_loOn = false;
00762
00763 if (a_pt >= 1.0 - MACHINEPRECISION)
00764 {
00765 a_hiOn = true;
00766 }
00767 else if (a_pt <= -1.0 + MACHINEPRECISION)
00768 {
00769 a_loOn = true;
00770 }
00771 }
00772
00773 template <int dim> void IFData<dim>::remakeCornerSigns()
00774 {
00775 m_allVerticesIn = true;
00776 m_allVerticesOut = true;
00777 m_allVerticesOn = true;
00778
00779 for (typename CornerSigns::const_iterator it = m_cornerSigns.begin();
00780 it != m_cornerSigns.end(); ++it)
00781 {
00782 if (it->second == IN)
00783 {
00784 m_allVerticesOut = false;
00785 }
00786
00787 if (it->second == OUT)
00788 {
00789 m_allVerticesIn = false;
00790 }
00791
00792 if (it->second != ON)
00793 {
00794 m_allVerticesOn = false;
00795 }
00796 }
00797 }
00798
00799 template <int dim> void IFData<dim>::print(ostream& a_out) const
00800 {
00801
00802
00803 string padding = " ";
00804 for (int i = 0; i < GLOBALDIM - dim; i++)
00805 {
00806 padding += " ";
00807 }
00808
00809 if (m_function == NULL)
00810 {
00811 a_out << padding << "undefined IFData\n";
00812 }
00813 else
00814 {
00815 for (typename CornerSigns::const_iterator it = m_cornerSigns.begin();
00816 it != m_cornerSigns.end(); ++it)
00817 {
00818 a_out << padding << "Vertex "
00819 << "("
00820 << it->first
00821 << ") = "
00822 << it->second
00823 << "\n";
00824 }
00825 a_out << padding << "\n";
00826
00827 for (typename EdgeIntersections::const_iterator it = m_intersections.begin();
00828 it != m_intersections.end(); ++it)
00829 {
00830
00831 std::ios::fmtflags origFlags = a_out.flags();
00832 int origWidth = a_out.width();
00833 int origPrecision = a_out.precision();
00834
00835 a_out << padding << "EdgeIndex "
00836 << it->first
00837 << " = "
00838 << setprecision(16)
00839 << setiosflags(ios::showpoint)
00840 << setiosflags(ios::scientific)
00841 << it->second
00842 << "\n";
00843
00844
00845 a_out.flags(origFlags);
00846 a_out.width(origWidth);
00847 a_out.precision(origPrecision);
00848 }
00849 a_out << padding << "\n";
00850
00851 a_out << padding << "m_allVerticesIn = " << m_allVerticesIn << "\n";
00852 a_out << padding << "m_allVerticesOut = " << m_allVerticesOut << "\n";
00853 a_out << padding << "m_allVerticesOn = " << m_allVerticesOn << "\n";
00854 a_out << padding << "m_badNormal = " << m_badNormal << "\n";
00855 a_out << padding << "\n";
00856
00857 if (!m_allVerticesOut)
00858 {
00859 a_out << padding << "m_globalCoord = " << m_globalCoord ;
00860 a_out << padding << "m_cellCenterCoord = " << m_cellCenterCoord;
00861 a_out << padding << "m_parentCoord = " << m_parentCoord ;
00862 a_out << padding << "m_localCoord = " << m_localCoord ;
00863 a_out << padding << "\n";
00864
00865 a_out << padding << "m_maxOrder = " << m_maxOrder << "\n";
00866
00867 std::ios::fmtflags origFlags = a_out.flags();
00868 int origWidth = a_out.width();
00869 int origPrecision = a_out.precision();
00870
00871 a_out << padding << "m_normalDerivatives = " << "\n";
00872
00873 for (typename NormalDerivatives::const_iterator it = m_normalDerivatives.begin();
00874 it != m_normalDerivatives.end();
00875 ++it)
00876 {
00877 for (int idir = 0; idir < dim; idir++)
00878 {
00879 a_out << padding << " "
00880 << it->first
00881 << ", "
00882 << idir
00883 << ": "
00884 << setprecision(16)
00885 << setiosflags(ios::showpoint)
00886 << setiosflags(ios::scientific)
00887 << (it->second)[idir]
00888 << "\n";
00889 }
00890 a_out << padding << "\n";
00891 }
00892
00893 a_out.flags(origFlags);
00894 a_out.width(origWidth);
00895 a_out.precision(origPrecision);
00896 }
00897 else
00898 {
00899 a_out << padding << "All vertices out" << "\n";
00900 }
00901 a_out << padding << "\n";
00902 }
00903 }
00904
00905 template <int dim> ostream& operator<<(ostream & a_out,
00906 const IFData<dim> & a_IFData)
00907 {
00908 a_IFData.print(a_out);
00909 return a_out;
00910 }
00911
00912
00913 template <int dim> void IFData<dim>::operator=(const IFData & a_IFData)
00914 {
00915
00916 if (this != &a_IFData)
00917 {
00918
00919 if (m_function != NULL)
00920 {
00921 delete m_function;
00922 }
00923
00924
00925 if (a_IFData.m_function != NULL)
00926 {
00927 m_function = new IFSlicer<dim>(*(a_IFData.m_function));
00928 }
00929 else
00930 {
00931 m_function = NULL;
00932 }
00933
00934 m_cornerSigns = a_IFData.m_cornerSigns;
00935 m_intersections = a_IFData.m_intersections;
00936
00937 m_globalCoord = a_IFData.m_globalCoord;
00938 m_cellCenterCoord = a_IFData.m_cellCenterCoord;
00939 m_parentCoord = a_IFData.m_parentCoord;
00940 m_localCoord = a_IFData.m_localCoord;
00941
00942 m_maxOrder = a_IFData.m_maxOrder;
00943 m_normalDerivatives = a_IFData.m_normalDerivatives;
00944 m_badNormal = a_IFData.m_badNormal;
00945
00946 m_allVerticesIn = a_IFData.m_allVerticesIn;
00947 m_allVerticesOut = a_IFData.m_allVerticesOut;
00948 m_allVerticesOn = a_IFData.m_allVerticesOn;
00949 }
00950 }
00951
00952 #include "NamespaceFooter.H"
00953
00954 #endif