bool rspfEllipsoid::loadState(const rspfKeywordlist& kwl, const char* prefix) { const char* lookup = kwl.find(prefix, rspfKeywordNames::ELLIPSE_CODE_KW); bool foundCode = false; if(lookup) { const rspfEllipsoid* ellipse = rspfEllipsoidFactory::instance()->create(rspfString(lookup)); if(ellipse) { foundCode = true; *this = *ellipse; } } lookup = kwl.find(prefix, rspfKeywordNames::ELLIPSE_EPSG_CODE_KW); if (lookup) { theEpsgCode = rspfString(lookup).toUInt32(); } if(!foundCode) { const char* majorAxis = kwl.find(prefix, rspfKeywordNames::MAJOR_AXIS_KW); const char* minorAxis = kwl.find(prefix, rspfKeywordNames::MAJOR_AXIS_KW); theName = ""; theCode = ""; if(majorAxis && minorAxis) { theA = rspfString(majorAxis).toDouble(); theB = rspfString(minorAxis).toDouble(); computeFlattening(); theA_squared = theA*theA; theB_squared = theB*theB; } else { const rspfEllipsoid* ellipse = rspfEllipsoidFactory::instance()->wgs84(); *this = *ellipse; } } return true; }
void EBLevelTransport:: divergeF(LevelData<EBCellFAB>& a_divergeF, LevelData<BaseIVFAB<Real> >& a_massDiff, EBFluxRegister& a_fineFluxRegister, EBFluxRegister& a_coarFluxRegister, LevelData<EBCellFAB>& a_consState, //not really changed LevelData<EBCellFAB>& a_normalVel, const LevelData<EBFluxFAB>& a_advVel, const LayoutData< Vector <BaseIVFAB<Real> * > >& a_coveredAdvVelMinu, const LayoutData< Vector <BaseIVFAB<Real> * > >& a_coveredAdvVelPlus, const LevelData<EBCellFAB>& a_source, const LevelData<EBCellFAB>& a_consStateCoarseOld, const LevelData<EBCellFAB>& a_consStateCoarseNew, const LevelData<EBCellFAB>& a_normalVelCoarseOld, const LevelData<EBCellFAB>& a_normalVelCoarseNew, const Real& a_time, const Real& a_coarTimeOld, const Real& a_coarTimeNew, const Real& a_dt) { Interval consInterv(0, m_nCons-1); Interval fluxInterv(0, m_nFlux-1); CH_assert(isDefined()); CH_assert(a_consState.disjointBoxLayout() == m_thisGrids); //fill a_consState with data interpolated between constate and coarser data fillCons(a_consState, a_normalVel, a_consStateCoarseOld, a_consStateCoarseNew, a_normalVelCoarseOld, a_normalVelCoarseNew, a_time, a_coarTimeOld, a_coarTimeNew); // clear flux registers with fine level //remember this level is the coarse level to the fine FR if(m_hasFiner) { a_fineFluxRegister.setToZero(); } //compute flattening coefficients. this saves a ghost cell. woo hoo. computeFlattening(a_consState, a_time, a_dt); //this includes copying flux into flux interpolant and updating //regular grids and incrementing flux registers. doRegularUpdate(a_divergeF, a_consState, a_normalVel, a_advVel, a_coveredAdvVelMinu, a_coveredAdvVelPlus, a_fineFluxRegister, a_coarFluxRegister, a_source, a_time, a_dt); //this does irregular update and deals with flux registers. //also computes the mass increment doIrregularUpdate(a_divergeF, a_consState, a_fineFluxRegister, a_coarFluxRegister, a_massDiff, a_time, a_dt); }
//***************************************************************************** // CONSTRUCTOR: rspfEllipsoid #2 // //***************************************************************************** rspfEllipsoid::rspfEllipsoid(const rspfString &name, const rspfString &code, const double &a, const double &b, rspf_uint32 epsg_code) : theName(name), theCode(code), theEpsgCode(epsg_code), theA(a), theB(b), theA_squared(a*a), theB_squared(b*b) { if (theEpsgCode == 0) theEpsgCode = rspfEllipsoidFactory::instance()->findEpsgCode(theCode); computeFlattening(); theEccentricitySquared = 2*theFlattening - theFlattening*theFlattening; }
//***************************************************************************** // CONSTRUCTOR: rspfEllipsoid #3 // //***************************************************************************** rspfEllipsoid::rspfEllipsoid(const double &a, const double &b) : theName(""), // initialize to empty theCode(""), theEpsgCode(0), theA(a), theB(b), theA_squared(a*a), theB_squared(b*b) { // First check if this is just WGS84: const rspfEllipsoid* wgs84 = rspfEllipsoidFactory::instance()->wgs84(); if ((theA == wgs84->theA) && (theB == wgs84->theB)) { *this = *wgs84; } else { computeFlattening(); theEccentricitySquared = 2*theFlattening - theFlattening*theFlattening; } }