AbstractFeAssemblerCommon.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
00031
00032
00033
00034
00035
00036 #ifndef ABSTRACTFEASSEMBLERCOMMON_HPP_
00037 #define ABSTRACTFEASSEMBLERCOMMON_HPP_
00038
00039 #include "AbstractFeAssemblerInterface.hpp"
00040 #include "ReplicatableVector.hpp"
00041 #include "DistributedVector.hpp"
00042 #include "HeartEventHandler.hpp"
00043 #include "LinearBasisFunction.hpp"
00044 #include "PetscTools.hpp"
00045 #include "AbstractTetrahedralMesh.hpp"
00046
00056 typedef enum InterpolationLevel_
00057 {
00058 CARDIAC = 0,
00059 NORMAL,
00060 NONLINEAR
00061 } InterpolationLevel;
00062
00063
00064
00074 template <unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX, InterpolationLevel INTERPOLATION_LEVEL>
00075 class AbstractFeAssemblerCommon : public AbstractFeAssemblerInterface<CAN_ASSEMBLE_VECTOR,CAN_ASSEMBLE_MATRIX>
00076 {
00077 protected:
00082 ReplicatableVector mCurrentSolutionOrGuessReplicated;
00083
00090 virtual double GetCurrentSolutionOrGuessValue(unsigned nodeIndex, unsigned indexOfUnknown)
00091 {
00092 return mCurrentSolutionOrGuessReplicated[ PROBLEM_DIM*nodeIndex + indexOfUnknown];
00093 }
00094
00100 virtual void ResetInterpolatedQuantities()
00101 {}
00102
00113 virtual void IncrementInterpolatedQuantities(double phiI, const Node<SPACE_DIM>* pNode)
00114 {}
00115
00135 virtual void IncrementInterpolatedGradientQuantities(const c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rGradPhi, unsigned phiIndex, const Node<SPACE_DIM>* pNode)
00136 {}
00137 public:
00138
00142 AbstractFeAssemblerCommon();
00143
00150 void SetCurrentSolution(Vec currentSolution);
00151
00155 virtual ~AbstractFeAssemblerCommon()
00156 {
00157 }
00158 };
00159
00160 template <unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX, InterpolationLevel INTERPOLATION_LEVEL>
00161 AbstractFeAssemblerCommon<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL>::AbstractFeAssemblerCommon()
00162 : AbstractFeAssemblerInterface<CAN_ASSEMBLE_VECTOR,CAN_ASSEMBLE_MATRIX>()
00163 {
00164 }
00165
00166 template <unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX, InterpolationLevel INTERPOLATION_LEVEL>
00167 void AbstractFeAssemblerCommon<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL>::SetCurrentSolution(Vec currentSolution)
00168 {
00169 assert(currentSolution != NULL);
00170
00171
00172 HeartEventHandler::BeginEvent(HeartEventHandler::COMMUNICATION);
00173 mCurrentSolutionOrGuessReplicated.ReplicatePetscVector(currentSolution);
00174 HeartEventHandler::EndEvent(HeartEventHandler::COMMUNICATION);
00175
00176
00177
00178
00179 assert(mCurrentSolutionOrGuessReplicated.GetSize() > 0);
00180 }
00181
00182
00183 #endif