00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _COMPUTECUTCELLMOMENTS_H_
00012 #define _COMPUTECUTCELLMOMENTS_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 <map>
00021 using std::map;
00022
00023 #include "Vector.H"
00024 #include "REAL.H"
00025 #include "IndexTM.H"
00026
00027 #include "Notation.H"
00028 #include "LSquares.H"
00029 #include "IFData.H"
00030 #include "CutCellMoments.H"
00031 #include "RefinementCriterion.H"
00032
00033 #include "NamespaceHeader.H"
00034
00035 template <int dim> class LSProblem;
00036
00037 template <int dim> class ComputeCutCellMoments
00038 {
00039 public:
00040 typedef IndexTM<int,dim> IvDim;
00041 typedef IndexTM<Real,dim> RvDim;
00042
00043 typedef map<IvDim,Real,LexLT <IvDim > > PthMoment;
00044
00045 typedef map<IndexTM<int,dim-1>,Real,LexLT < IndexTM<int,dim-1> > > PthMomentLesserDimension;
00046
00047 typedef map<IndexTM<int,1>,Real > OneDMoments;
00048 typedef map<int,IvDim> LocPthMoment;
00049 typedef map<IvDim,int,LexLT <IvDim> > PthMomentLoc;
00050
00051 typedef map<Iv2,CutCellMoments<dim-1>, LexLT<Iv2> > BdCutCellMoments;
00052
00053
00054 ComputeCutCellMoments();
00055 ComputeCutCellMoments(const ComputeCutCellMoments<dim>& a_computeCutCellMoments);
00056
00057
00058 ComputeCutCellMoments(const IFData<dim>& a_info);
00059
00060
00061 ~ComputeCutCellMoments();
00062
00063 #if RECURSIVE_GEOMETRY_GENERATION == 0
00064 void computeMoments(const int & a_order,
00065 const int & a_degreeP,
00066 const bool & a_useConstraints,
00067 RefinementCriterion<dim> & a_refinementCriterion,
00068 const int & a_numberOfRefinements = 0);
00069 #else
00070 void computeMoments(const int & a_orderPmax,
00071 const int & a_degreePmax,
00072 const bool & a_useConstraints,
00073 RefinementCriterion<dim> & a_refinementCriterion,
00074 const int & a_numberOfRefinements = 0);
00075
00076 void computeMomentsRecursively(const int & a_orderPmax,
00077 const int & a_degreePmax,
00078 const bool & a_useConstraints,
00079 RefinementCriterion<dim> & a_refinementCriterion,
00080 const int & a_numberOfRefinements);
00081 #endif
00082
00083 Vector<Real> computeRhs(LSProblem<dim> & a_lsp,
00084 const int & a_order);
00085
00086
00087 #if RECURSIVE_GEOMETRY_GENERATION == 0
00088 Vector< CutCellMoments<dim> > refine(const int & a_order,
00089 const int & a_degreeP,
00090 #else
00091 Vector< CutCellMoments<dim> > refine(const int & a_orderPmax,
00092 const int & a_degreePmax,
00093 #endif
00094 const bool & a_useConstraints,
00095 RefinementCriterion<dim> & a_refinementCriterion,
00096 const IndexTM<int,dim> & a_refineInDir,
00097 const int & a_numberOfRefinements);
00098
00099 void addMomentMaps(const Vector<CutCellMoments<dim> > & a_refinedCutCellVector,
00100 #if RECURSIVE_GEOMETRY_GENERATION == 0
00101 const int & a_degreeP,
00102 #else
00103 const int & a_degreePmax,
00104 #endif
00105 const bool & a_useConstraints);
00106
00107 void addMoments(PthMoment & a_momentMap,
00108 PthMoment & a_refinedMomentMap,
00109 const IndexTM<Real,dim> & a_refinedCenterDelta);
00110
00111 void addBdMoments(CutCellMoments<dim> & a_coarseCutCell,
00112 const IFData<dim+1> & a_IFData,
00113 #if RECURSIVE_GEOMETRY_GENERATION == 0
00114 const int & a_degreeP,
00115 #else
00116 const int & a_degreePmax,
00117 #endif
00118 const bool & a_useConstraints,
00119 const IndexTM<Real,dim> & a_refinedCenterDelta,
00120 const IndexTM<int,dim> & a_localHilo);
00121
00122 #if RECURSIVE_GEOMETRY_GENERATION == 0
00123 void computeResiduals(const int & a_order,
00124 const int & a_degreeP,
00125 #else
00126 void computeResiduals(const int & a_orderPmax,
00127 const int & a_degreePmax,
00128 #endif
00129 const bool & a_useConstraints);
00130
00131 void computeResiduals(const Vector<CutCellMoments<dim> > & a_refinedCCMoms,
00132 #if RECURSIVE_GEOMETRY_GENERATION == 0
00133 const int & a_degreeP);
00134 #else
00135 const int & a_degreePmax);
00136 #endif
00137
00138
00139 void print(ostream& out) const;
00140
00141 void dump() const;
00142
00143
00144 void operator=(const ComputeCutCellMoments<dim>& a_computeCutCellMoments);
00145
00146 Real factorial(const IvDim & a_multiIndex) const;
00147
00148
00149 CutCellMoments<dim> m_cutCellMoments;
00150
00151
00152 bool m_boundaryMomentsComputed;
00153 };
00154
00155
00156 template <> class ComputeCutCellMoments<1>
00157 {
00158 public:
00159 typedef map<IndexTM<int,1>,Real> OneDMoments;
00160
00161
00162 ComputeCutCellMoments();
00163 ComputeCutCellMoments(const ComputeCutCellMoments<1> & a_computeCutCellMoments);
00164 ComputeCutCellMoments(const IFData<1>& a_info);
00165
00166
00167 ~ComputeCutCellMoments();
00168
00169 #if RECURSIVE_GEOMETRY_GENERATION == 0
00170 void computeMoments(const int & a_order,
00171 const int & a_degree,
00172 #else
00173 void computeMoments(const int & a_orderPmax,
00174 const int & a_degreePmax,
00175 #endif
00176 const bool & a_useConstraints,
00177 RefinementCriterion<1> & a_refinementCriterion);
00178
00179 void simpleComputeMoments(const Real & a_loPt,
00180 const Real & a_hiPt,
00181 #if RECURSIVE_GEOMETRY_GENERATION == 0
00182 const int & a_degree);
00183 #else
00184 const int & a_degreePmax);
00185 #endif
00186
00187 void computeMomentsUsingBinomial(const Real & a_loPt,
00188 const Real & a_hiPt,
00189 const int & a_loSign,
00190 const int & a_hiSign,
00191 #if RECURSIVE_GEOMETRY_GENERATION == 0
00192 const int & a_degree);
00193 #else
00194 const int & a_degreePmax);
00195 #endif
00196
00197
00198 void print(ostream& out) const;
00199
00200 void dump() const;
00201
00202
00203 void operator=(const ComputeCutCellMoments<1>& a_computeCutCellMoments);
00204
00205
00206 CutCellMoments<1> m_cutCellMoments;
00207 };
00208
00209 #include "NamespaceFooter.H"
00210
00211 #include "ComputeCutCellMomentsImplem.H"
00212
00213 #endif