00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011
00012
00013
00014 #ifndef GENERALFUNCS_H
00015 #define GENERALFUNCS_H
00016 #include <iostream>
00017 #include <cstdio>
00018 #include "LevelData.H"
00019 #include "NodeFArrayBox.H"
00020 #include "Vector.H"
00021 #include "RealVect.H"
00022
00023 #include "UsingNamespace.H"
00024
00025 Box boxFromVector(const Vector<int>& a_ints,
00026 int a_start = 0);
00027
00028 int readGrids(Vector<DisjointBoxLayout>& a_vectGrids,
00029 Vector<ProblemDomain>& a_vectDomain,
00030 Vector<Real>& a_vectDx,
00031 Vector<int>& a_vectRefRatio,
00032 RealVect& a_probLo,
00033 RealVect& a_probHi,
00034 int& a_numlevels,
00035 const bool a_verbose,
00036 int a_refined = 1);
00037
00038 int readGrids(Vector<DisjointBoxLayout>& a_vectGrids,
00039 Vector<Box>& a_vectDomain,
00040 Vector<Real>& a_vectDx,
00041 Vector<int>& a_vectRefRatio,
00042 RealVect& a_probLo,
00043 RealVect& a_probHi,
00044 int& a_numlevels,
00045 const bool a_verbose,
00046 int a_refined = 1);
00047
00048 int
00049 readDomain(Vector<ProblemDomain>& a_vectDomain,
00050 Vector<Real>& a_vectDx,
00051 Vector<int>& a_vectRefRatio,
00052 RealVect& a_probLo,
00053 RealVect& a_probHi,
00054 int& a_numlevels,
00055 const bool a_verbose,
00056 int a_refined = 1);
00057
00058 int setGridsTwoLevel(const IntVect& a_lengths,
00059 const IntVect& a_offsets,
00060 const IntVect& a_sublengths,
00061 const int a_refRatio,
00062 const Real a_dx,
00063 Vector<DisjointBoxLayout>& a_vectGrids,
00064 Vector<ProblemDomain>& a_vectDomain,
00065 Vector<Real>& a_vectDx,
00066 Vector<int>& a_vectRefRatio,
00067 const bool a_verbose);
00068
00069 int getGridsLevel(Vector<Box>& a_grids,
00070 const ProblemDomain& a_domain,
00071 const Vector<int>& a_subdomainIndices,
00072 const int a_boxCount,
00073 const Vector<int>& a_boxIndices);
00074
00075 int assignAllGrids(Vector<DisjointBoxLayout>& a_vectGrids,
00076 const Vector<ProblemDomain>& a_vectDomain,
00077 const Vector<Vector<Box> >& a_boxes,
00078 int a_maxboxsize = 0,
00079 int a_blockFactor = 1);
00080
00081 int assignLevelGrids(Vector<DisjointBoxLayout>& a_vectGrids,
00082 const ProblemDomain& a_domain,
00083 const Vector<Box>& a_boxes,
00084 int a_level,
00085 int a_maxboxsize = 0,
00086 int a_blockFactor = 1);
00087
00088 int assignLevelGrids(DisjointBoxLayout& a_vectGrids,
00089 const ProblemDomain& a_domain,
00090 const Vector<Box>& a_boxes,
00091 int a_maxboxsize = 0,
00092 int a_blockFactor = 1);
00093
00094 int assignDx(Vector<Real>& a_vectDx,
00095 const Vector<int>& a_vectRefRatio,
00096 const Real a_dx0,
00097 const int a_numlevels);
00098
00099 int assignDomains(Vector<ProblemDomain>& a_vectDomain,
00100 const Vector<int>& a_vectRefRatio,
00101 const ProblemDomain& a_baseDomain,
00102 const int a_numlevels);
00103
00104 int getDiff(Vector<LevelData<NodeFArrayBox>* >& a_vectDiff,
00105 const Vector<LevelData<NodeFArrayBox>* >& a_vectPhi1,
00106 const Vector<LevelData<NodeFArrayBox>* >& a_vectPhi2);
00107
00108 int getMagnitude(Vector<LevelData<NodeFArrayBox>* >& a_vectMag,
00109 const Vector<LevelData<NodeFArrayBox>* >& a_vectField);
00110
00111 int getTruncError(Vector<LevelData<NodeFArrayBox>* >& a_vectErr,
00112 const Vector<LevelData<NodeFArrayBox>* >& a_vectLap,
00113 const Vector<LevelData<NodeFArrayBox>* >& a_vectRhs,
00114 const Vector<DisjointBoxLayout>& a_vectGrids,
00115 const Vector<ProblemDomain>& a_vectDomain,
00116 const Vector<int>& a_vectRatio,
00117 const Vector<Real>& a_vectDx,
00118 const int a_numlevels,
00119 const bool a_verbose);
00120
00121 int getTruncError(Vector<LevelData<NodeFArrayBox>* >& a_vectErr,
00122 const Vector<LevelData<NodeFArrayBox>* >& a_vectLap,
00123 const Vector<LevelData<NodeFArrayBox>* >& a_vectRhs,
00124 const Vector<DisjointBoxLayout>& a_vectGrids,
00125 const Vector<Box>& a_vectDomain,
00126 const Vector<int>& a_vectRatio,
00127 const Vector<Real>& a_vectDx,
00128 const int a_numlevels,
00129 const bool a_verbose);
00130
00131 int project2(Vector<LevelData<NodeFArrayBox>* >& a_vectProj,
00132 const Vector<LevelData<NodeFArrayBox>* >& a_vectPhi,
00133 const Vector<DisjointBoxLayout>& a_vectGrids);
00134
00135
00136 int printErrorNorms(const string& a_prefix,
00137 Real a_dxFine,
00138 int a_deginterp,
00139 Real a_normMaxerrFine,
00140 Real a_norm1errFine,
00141 Real a_norm2errFine,
00142 Real a_normMaxerrCoarse,
00143 Real a_norm1errCoarse,
00144 Real a_norm2errCoarse);
00145
00146 int printDiffNorms(const string& a_prefix,
00147 Real a_dxFine,
00148 int a_deginterp,
00149 Real a_normMaxdiff,
00150 Real a_norm1diff,
00151 Real a_norm2diff);
00152
00153 #endif