Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

InvCellJacobian.h

Go to the documentation of this file.
00001 #ifndef INVCELLJACOBIAN_H
00002 #define INVCELLJACOBIAN_H
00003 
00004 #include "SundanceDefs.h"
00005 
00006 #include "TSFError.h"
00007 #include <string>
00008 
00009 
00010 namespace Sundance
00011 {
00012 
00013   using namespace TSF;
00014   using std::string;
00015 
00016   using std::ostream;
00017 
00018   /** \ingroup LowLevelGeometry
00019    * Inverse jacobian of the physical-reference coordinate transformation
00020    * on a cell.
00021    */
00022 
00023   class InvCellJacobian
00024     {
00025     public:
00026       inline InvCellJacobian();
00027       inline InvCellJacobian(const double& Jux);
00028       inline InvCellJacobian(const double& Jux, const double& Jvx,
00029                              const double& Juy, const double& Jvy);
00030       inline InvCellJacobian(const double& Jux, const double& Jvx,
00031                              const double& Jwx,
00032                              const double& Juy, const double& Jvy,
00033                              const double& Jwy,
00034                              const double& Juz, const double& Jvz,
00035                              const double& Jwz);
00036       inline InvCellJacobian(const InvCellJacobian& other);
00037       inline InvCellJacobian& operator=(const InvCellJacobian& other);
00038 
00039       inline const double& operator()(int ref, int phys) const ;
00040       inline int dim() const {return dim_;}
00041 
00042       static bool unitTest() ;
00043     private:
00044       inline void boundsCheck(int ref, int phys) const ;
00045       double J_[9];
00046       int dim_;
00047     };
00048 
00049   ostream& operator<<(ostream& os, InvCellJacobian& J);
00050 
00051   inline InvCellJacobian::InvCellJacobian()
00052     : dim_(0)
00053     {
00054       ;
00055     }
00056 
00057   inline InvCellJacobian::InvCellJacobian(const double& Jux)
00058     : dim_(1)
00059     {
00060       J_[0] = Jux;
00061     }
00062 
00063 
00064   inline InvCellJacobian::InvCellJacobian(const double& Jux, const double& Jvx,
00065                                           const double& Juy, const double& Jvy)
00066     : dim_(2)
00067     {
00068       J_[0] = Jux;
00069       J_[1] = Jvx;
00070       J_[2] = Juy;
00071       J_[3] = Jvy;
00072     }
00073 
00074 
00075   inline InvCellJacobian::InvCellJacobian(const double& Jux, const double& Jvx,
00076                                           const double& Jwx,
00077                                           const double& Juy, const double& Jvy,
00078                                           const double& Jwy,
00079                                           const double& Juz, const double& Jvz,
00080                                           const double& Jwz)
00081     : dim_(3)
00082     {
00083       J_[0] = Jux;
00084       J_[1] = Jvx;
00085       J_[2] = Jwx;
00086       J_[3] = Juy;
00087       J_[4] = Jvy;
00088       J_[5] = Jwy;
00089       J_[6] = Juz;
00090       J_[7] = Jvz;
00091       J_[8] = Jwz;
00092     }
00093 
00094   inline InvCellJacobian::InvCellJacobian(const InvCellJacobian& other)
00095     : dim_(other.dim_)
00096     {
00097       int n = dim_*dim_;
00098       for (int i=0; i<n; i++) J_[i] = other.J_[i];
00099     }
00100 
00101   inline InvCellJacobian& InvCellJacobian::operator=(const InvCellJacobian& other)
00102     {
00103       if (this == &other) return *this;
00104 
00105       dim_ = other.dim_;
00106 
00107       int n = dim_*dim_;
00108       for (int i=0; i<n; i++) J_[i] = other.J_[i];
00109 
00110       return *this;
00111     }
00112 
00113   inline void InvCellJacobian::boundsCheck(int ref, int phys) const
00114     {
00115       if (phys >= dim_) TSFError::raise("InvCellJacobian::boundsCheck");
00116       if (ref >= dim_) TSFError::raise("InvCellJacobian::boundsCheck");
00117     }
00118 
00119   inline const double& InvCellJacobian::operator()(int ref, int phys) const
00120     {
00121 #ifndef NOBOUNDSCHECK
00122       boundsCheck(ref, phys);
00123 #endif
00124       return J_[ref*dim_ + phys];
00125     }
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 }
00134 #endif

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by