00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _COORDINATESYSTEM_H_ 00012 #define _COORDINATESYSTEM_H_ 00013 00014 #if defined(CH_Darwin) && defined(__GNUC__) && ( __GNUC__ == 3 ) 00015 // deal with the broken isnan()/isinf() in GCC on MacOS 00016 #include <unistd.h> 00017 #define _GLIBCPP_USE_C99 1 00018 #endif 00019 00020 00021 #include <map> 00022 using std::map; 00023 #include "Vector.H" 00024 #include "REAL.H" 00025 #include "IndexTM.H" 00026 00027 #include "Notation.H" 00028 #include "IFSlicer.H" 00029 00030 using std::endl; 00031 using std::cerr; 00032 #include "NamespaceHeader.H" 00033 00034 template <int dim> class CoordinateSystem 00035 { 00036 public: 00037 // data types for vector of int and Real in dimension "dim" 00038 typedef IndexTM<int,dim> IvDim; 00039 typedef IndexTM<Real,dim> RvDim; 00040 00041 // member data 00042 RvDim m_origin; 00043 RvDim m_dx; 00044 00045 // empty constructor 00046 CoordinateSystem(); 00047 00048 // copy constructor 00049 CoordinateSystem(const CoordinateSystem<dim>& a_info); 00050 00051 // makes an CoordinateSystem from a origin and dx 00052 CoordinateSystem(const RvDim & a_origin, 00053 const RvDim & a_dx); 00054 00055 // makes a reduced CoordinateSystem 00056 CoordinateSystem(const CoordinateSystem<dim+1> & a_hISystem, 00057 const int & a_idir); 00058 00059 // destructor 00060 ~CoordinateSystem(); 00061 00062 // convert "a_point" in coordinate system "a_system" to a point in the 00063 // current coordinate system. 00064 RvDim convert(const RvDim & a_point, 00065 const CoordinateSystem<dim> & a_system) const; 00066 00067 // convert "a_coord" in direction "a_dir" in coordinate system "a_system" 00068 // to a value in "a_dir" in the current coordinate system. 00069 Real convertDir(const Real & a_coord, 00070 const CoordinateSystem<dim> & a_system, 00071 const int & a_dir) const; 00072 00073 // output functions 00074 void print(ostream& out) const; 00075 00076 // operators 00077 void operator=(const CoordinateSystem<dim> & a_coordinateSystem); 00078 }; 00079 00080 #include "NamespaceFooter.H" 00081 00082 #include "CoordinateSystemImplem.H" 00083 00084 #endif