00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef BOUNDARY_CONDITION_DISCRETIZATION_SPECTRAL_CONFORM_HPP
00021 #define BOUNDARY_CONDITION_DISCRETIZATION_SPECTRAL_CONFORM_HPP
00022
00023 #include <Problem.hpp>
00024 #include <DegreeOfFreedomSet.hpp>
00025
00026 #include <BoundaryConditionDiscretization.hpp>
00027
00028 #include <DiscretizationType.hpp>
00029
00030 #include <Discretization.hpp>
00031 #include <ScalarDiscretizationTypeSpectral.hpp>
00032
00033 #include <SpectralMesh.hpp>
00034 #include <Interval.hpp>
00035
00036 #include <GaussLobattoManager.hpp>
00037
00038 #include <LegendreBasis.hpp>
00039 #include <SpectralConformTransformation.hpp>
00040
00041 #include <BaseMatrix.hpp>
00042 #include <BaseVector.hpp>
00043
00044 class BoundaryConditionDiscretizationSpectralConform
00045 : public BoundaryConditionDiscretization
00046 {
00047 private:
00048 const DegreeOfFreedomSet& __degreeOfFreedomSet;
00049 const SpectralMesh& __mesh;
00050
00051 Vector<TinyVector<3,size_t> > __dofShape;
00052
00053 TinyVector<3, ConstReferenceCounting<Interval> > __interval;
00054 Vector<TinyVector<3, ConstReferenceCounting<Interval> > > __intervalU;
00055 TinyVector<3, ConstReferenceCounting<SpectralConformTransformation> > __transform;
00056 Vector<TinyVector<3, ConstReferenceCounting<SpectralConformTransformation> > > __transformU;
00057 TinyVector<3, ConstReferenceCounting<GaussLobatto> > __gaussLobatto;
00058 Vector<TinyVector<3, ConstReferenceCounting<LegendreBasis> > > __basisU;
00059
00060
00061 public:
00062 void getDiagonal(BaseVector& X) const;
00063
00064 void setMatrix(ReferenceCounting<BaseMatrix> A,
00065 ReferenceCounting<BaseVector> b) const;
00066
00067 void setSecondMember(ReferenceCounting<BaseMatrix> A,
00068 ReferenceCounting<BaseVector> b) const;
00069
00070 void timesX(const BaseVector& X, BaseVector& Z) const;
00071
00072 void transposedTimesX(const BaseVector& X, BaseVector& Z) const;
00073
00074
00075 BoundaryConditionDiscretizationSpectralConform(const Problem& problem,
00076 const SpectralMesh& mesh,
00077 const DegreeOfFreedomSet& dof,
00078 const DiscretizationType& discretizationType)
00079 : BoundaryConditionDiscretization(problem,dof),
00080 __degreeOfFreedomSet(dof),
00081 __mesh(mesh),
00082 __dofShape(this->problem().numberOfUnknown()),
00083 __interval(new Interval(__mesh.shape().a()[0],__mesh.shape().b()[0]),
00084 new Interval(__mesh.shape().a()[1],__mesh.shape().b()[1]),
00085 new Interval(__mesh.shape().a()[2],__mesh.shape().b()[2])),
00086
00087 __intervalU(this->problem().numberOfUnknown()),
00088 __transform(new SpectralConformTransformation(*__interval[0]),
00089 new SpectralConformTransformation(*__interval[1]),
00090 new SpectralConformTransformation(*__interval[2])),
00091
00092 __transformU(this->problem().numberOfUnknown()),
00093
00094 __gaussLobatto(GaussLobattoManager::instance().getReference(__mesh.degree(0)+1),
00095 GaussLobattoManager::instance().getReference(__mesh.degree(1)+1),
00096 GaussLobattoManager::instance().getReference(__mesh.degree(2)+1)),
00097 __basisU(this->problem().numberOfUnknown())
00098 {
00099 for (size_t i=0; i < this->problem().numberOfUnknown(); i++) {
00100 if (discretizationType[i].type() != ScalarDiscretizationTypeBase::spectralLegendre) {
00101 throw ErrorHandler(__FILE__,__LINE__,
00102 "discretization '"
00103 +ScalarDiscretizationTypeBase::name(discretizationType[i])
00104 +"' is incompatible with spectral method",
00105 ErrorHandler::unexpected);
00106 }
00107 const ScalarDiscretizationTypeSpectral& discretization
00108 = dynamic_cast<const ScalarDiscretizationTypeSpectral&>(discretizationType[i]);
00109
00110 __dofShape[i] = discretization.degrees()+TinyVector<3,size_t>(1,1,1);
00111
00112 __intervalU[i][0]= new Interval(discretization.a()[0],discretization.b()[0]);
00113 __intervalU[i][1]= new Interval(discretization.a()[1],discretization.b()[1]);
00114 __intervalU[i][2]= new Interval(discretization.a()[2],discretization.b()[2]);
00115 __transformU[i][0] = new SpectralConformTransformation(*__intervalU[i][0]);
00116 __transformU[i][1] = new SpectralConformTransformation(*__intervalU[i][1]);
00117 __transformU[i][2] = new SpectralConformTransformation(*__intervalU[i][2]);
00118 __basisU[i][0]= new LegendreBasis(discretization.degrees()[0]);
00119 __basisU[i][1]= new LegendreBasis(discretization.degrees()[1]);
00120 __basisU[i][2]= new LegendreBasis(discretization.degrees()[2]);
00121 }
00122
00123 }
00124
00125 ~BoundaryConditionDiscretizationSpectralConform()
00126 {
00127 ;
00128 }
00129 };
00130
00131 #endif // BOUNDARY_CONDITION_DISCRETIZATION_SPECTRAL_CONFORM_HPP