00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _IFSLICERIMPLEM_H_
00012 #define _IFSLICERIMPLEM_H_
00013
00014 #include <iostream>
00015
00016 #include "NamespaceHeader.H"
00017
00018
00019 template <int dim> IFSlicer<dim>::IFSlicer()
00020 {
00021
00022 m_IFSlicer = NULL;
00023 m_fixedComp = LARGEINTVAL;
00024 m_fixedValue = LARGEREALVAL;
00025 }
00026
00027
00028 template <int dim >IFSlicer<dim>::IFSlicer(const IFSlicer<dim> & a_IFSlicer)
00029 {
00030 setParams(a_IFSlicer.m_IFSlicer,
00031 a_IFSlicer.m_fixedComp,
00032 a_IFSlicer.m_fixedValue);
00033 }
00034
00035 template <int dim> IFSlicer<dim>::IFSlicer(IFSlicer<dim+1> const * a_IFSlicer,
00036 const int & a_fixedComp,
00037 const Real & a_fixedValue)
00038 {
00039 setParams(a_IFSlicer,
00040 a_fixedComp,
00041 a_fixedValue);
00042 }
00043
00044 template <int dim> void IFSlicer<dim>::setParams(IFSlicer<dim+1> const * a_IFSlicer,
00045 const int & a_fixedComp,
00046 const Real & a_fixedValue)
00047 {
00048
00049 m_IFSlicer = a_IFSlicer;
00050 m_fixedComp = a_fixedComp;
00051 m_fixedValue = a_fixedValue;
00052 }
00053
00054
00055 template <int dim> IFSlicer<dim>::~IFSlicer()
00056 {
00057
00058 }
00059
00060 template<int dim >Real IFSlicer<dim>::value(const IndexTM<int, dim> & a_partialDerivative,
00061 const IndexTM<Real,dim> & a_point) const
00062 {
00063 Real retval = LARGEREALVAL;
00064
00065
00066 IndexTM<int, dim + 1> partialDerivative;
00067 IndexTM<Real,dim + 1> point;
00068 for (int idir = 0; idir < dim +1; ++idir)
00069 {
00070 if (idir < m_fixedComp)
00071 {
00072 partialDerivative[idir] = a_partialDerivative[idir];
00073 point [idir] = a_point [idir];
00074 }
00075 else if (idir > m_fixedComp)
00076 {
00077 partialDerivative[idir] = a_partialDerivative[idir - 1];
00078 point [idir] = a_point [idir - 1];
00079 }
00080 else
00081 {
00082 partialDerivative[m_fixedComp] = 0;
00083 point [m_fixedComp] = m_fixedValue;
00084 }
00085 }
00086
00087
00088 retval = m_IFSlicer->value(partialDerivative,point);
00089
00090 return retval;
00091 }
00092
00093 template <int dim> void IFSlicer<dim>::print(ostream& a_out) const
00094 {
00095 a_out << "fixed component = " << m_fixedComp << "\n";
00096 a_out << "fixed value = " << m_fixedValue << "\n";
00097 a_out << "At one dimension higher: " << dim + 1 << "\n";
00098 this->m_IFSlicer.print(a_out);
00099 }
00100
00101 template <int dim> ostream& operator<<(ostream & a_out,
00102 const IFSlicer<dim> & a_IFSlicer)
00103 {
00104 a_IFSlicer.print(a_out);
00105 return a_out;
00106 }
00107
00108 #include "NamespaceFooter.H"
00109
00110 #endif