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 #ifndef ABSTRACTFEASSEMBLERCOMMON_HPP_
00030 #define ABSTRACTFEASSEMBLERCOMMON_HPP_
00031
00032 #include "AbstractFeAssemblerInterface.hpp"
00033 #include "ReplicatableVector.hpp"
00034 #include "DistributedVector.hpp"
00035 #include "HeartEventHandler.hpp"
00036 #include "LinearBasisFunction.hpp"
00037 #include "PetscTools.hpp"
00038 #include "AbstractTetrahedralMesh.hpp"
00039
00049 typedef enum InterpolationLevel_
00050 {
00051 CARDIAC = 0,
00052 NORMAL,
00053 NONLINEAR
00054 } InterpolationLevel;
00055
00056
00057
00067 template <unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX, InterpolationLevel INTERPOLATION_LEVEL>
00068 class AbstractFeAssemblerCommon : public AbstractFeAssemblerInterface<CAN_ASSEMBLE_VECTOR,CAN_ASSEMBLE_MATRIX>
00069 {
00070 protected:
00075 ReplicatableVector mCurrentSolutionOrGuessReplicated;
00076
00083 virtual double GetCurrentSolutionOrGuessValue(unsigned nodeIndex, unsigned indexOfUnknown)
00084 {
00085 return mCurrentSolutionOrGuessReplicated[ PROBLEM_DIM*nodeIndex + indexOfUnknown];
00086 }
00087
00093 virtual void ResetInterpolatedQuantities()
00094 {}
00095
00104 virtual void IncrementInterpolatedQuantities(double phiI, const Node<SPACE_DIM>* pNode)
00105 {}
00106 public:
00107
00111 AbstractFeAssemblerCommon();
00112
00119 void SetCurrentSolution(Vec currentSolution);
00120
00124 virtual ~AbstractFeAssemblerCommon()
00125 {
00126 }
00127 };
00128
00129 template <unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX, InterpolationLevel INTERPOLATION_LEVEL>
00130 AbstractFeAssemblerCommon<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL>::AbstractFeAssemblerCommon()
00131 : AbstractFeAssemblerInterface<CAN_ASSEMBLE_VECTOR,CAN_ASSEMBLE_MATRIX>()
00132 {
00133 }
00134
00135 template <unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX, InterpolationLevel INTERPOLATION_LEVEL>
00136 void AbstractFeAssemblerCommon<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL>::SetCurrentSolution(Vec currentSolution)
00137 {
00138 assert(currentSolution != NULL);
00139
00140
00141 HeartEventHandler::BeginEvent(HeartEventHandler::COMMUNICATION);
00142 mCurrentSolutionOrGuessReplicated.ReplicatePetscVector(currentSolution);
00143 HeartEventHandler::EndEvent(HeartEventHandler::COMMUNICATION);
00144
00145
00146
00147
00148 assert(mCurrentSolutionOrGuessReplicated.GetSize() > 0);
00149 }
00150
00151
00152 #endif