AbstractAssemblerSolverHybrid.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef ABSTRACTASSEMBLERSOLVERHYBRID_HPP_
00031 #define ABSTRACTASSEMBLERSOLVERHYBRID_HPP_
00032
00033 #include "AbstractFeVolumeIntegralAssembler.hpp"
00034 #include "AbstractLinearPdeSolver.hpp"
00035 #include "NaturalNeumannSurfaceTermAssembler.hpp"
00036
00047 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM, InterpolationLevel INTERPOLATION_LEVEL>
00048 class AbstractAssemblerSolverHybrid
00049 : public AbstractFeVolumeIntegralAssembler<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, true, true, INTERPOLATION_LEVEL>
00050 {
00051 protected:
00052
00057 NaturalNeumannSurfaceTermAssembler<ELEMENT_DIM,SPACE_DIM,PROBLEM_DIM> mNaturalNeumannSurfaceTermAssembler;
00058
00060 BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,PROBLEM_DIM>* mpBoundaryConditions;
00061
00062
00063 public:
00064
00072 AbstractAssemblerSolverHybrid(AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00073 BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,PROBLEM_DIM>* pBoundaryConditions,
00074 unsigned numQuadPoints=2)
00075 : AbstractFeVolumeIntegralAssembler<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, true, true, INTERPOLATION_LEVEL>(pMesh,numQuadPoints),
00076 mNaturalNeumannSurfaceTermAssembler(pMesh,pBoundaryConditions),
00077 mpBoundaryConditions(pBoundaryConditions)
00078 {
00079 assert(pMesh);
00080 assert(pBoundaryConditions);
00081 }
00082
00086 virtual ~AbstractAssemblerSolverHybrid()
00087 {
00088 }
00089
00102 void SetupGivenLinearSystem(Vec currentSolution, bool computeMatrix, LinearSystem* pLinearSystem);
00103 };
00104
00105 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM, InterpolationLevel INTERPOLATION_LEVEL>
00106 void AbstractAssemblerSolverHybrid<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, INTERPOLATION_LEVEL>::SetupGivenLinearSystem(Vec currentSolution,
00107 bool computeMatrix,
00108 LinearSystem* pLinearSystem)
00109 {
00110 assert(pLinearSystem->rGetLhsMatrix() != NULL);
00111 assert(pLinearSystem->rGetRhsVector() != NULL);
00112
00113
00114 this->SetMatrixToAssemble(pLinearSystem->rGetLhsMatrix());
00115 this->SetVectorToAssemble(pLinearSystem->rGetRhsVector(), true);
00116
00117 if (currentSolution != NULL)
00118 {
00119 this->SetCurrentSolution(currentSolution);
00120 }
00121
00122 if (computeMatrix)
00123 {
00124 this->Assemble();
00125 }
00126 else
00127 {
00128 this->AssembleVector();
00129 }
00130
00131
00132
00133 mNaturalNeumannSurfaceTermAssembler.SetVectorToAssemble(pLinearSystem->rGetRhsVector(), false);
00134 mNaturalNeumannSurfaceTermAssembler.Assemble();
00135
00136 pLinearSystem->FinaliseRhsVector();
00137 pLinearSystem->SwitchWriteModeLhsMatrix();
00138
00139
00140 mpBoundaryConditions->ApplyDirichletToLinearProblem(*pLinearSystem, true);
00141
00142 pLinearSystem->FinaliseRhsVector();
00143 pLinearSystem->FinaliseLhsMatrix();
00144 }
00145
00146 #endif