36 #include "AbstractGrowingDomainPdeModifier.hpp"
37 #include "VertexBasedCellPopulation.hpp"
38 #include "MeshBasedCellPopulation.hpp"
39 #include "CaBasedCellPopulation.hpp"
40 #include "NodeBasedCellPopulation.hpp"
41 #include "ReplicatableVector.hpp"
42 #include "LinearBasisFunction.hpp"
44 template <
unsigned DIM>
47 bool isNeumannBoundaryCondition,
51 isNeumannBoundaryCondition,
56 template<
unsigned DIM>
61 template<
unsigned DIM>
64 if (this->mDeleteFeMesh)
67 assert(this->mpFeMesh !=
nullptr);
68 delete this->mpFeMesh;
79 this->mpFeMesh =
nullptr;
83 template<
unsigned DIM>
90 unsigned cell_index = 0;
92 unsigned index_in_solution_repl = 0;
94 cell_iter != rCellPopulation.
End();
108 tet_node_index = cell_index;
113 tet_node_index = index_in_solution_repl;
114 index_in_solution_repl++;
117 double solution_at_node = solution_repl[tet_node_index];
119 cell_iter->GetCellData()->SetItem(this->mDependentVariableName, solution_at_node);
121 if (this->mOutputGradient)
124 c_vector<double, DIM> solution_gradient = zero_vector<double>(DIM);
126 Node<DIM>* p_tet_node = this->mpFeMesh->GetNode(tet_node_index);
130 element_iter != p_tet_node->ContainingElementsEnd();
134 c_matrix<double, DIM, DIM> jacobian, inverse_jacobian;
136 this->mpFeMesh->GetInverseJacobianForElement(*element_iter, jacobian, jacobian_det, inverse_jacobian);
138 c_matrix<double, DIM, DIM+1> grad_phi;
142 for (
unsigned node_index=0; node_index<DIM+1; node_index++)
144 double nodal_value = solution_repl[this->mpFeMesh->GetElement(*element_iter)->GetNodeGlobalIndex(node_index)];
146 for (
unsigned j=0; j<DIM; j++)
148 solution_gradient(j) += nodal_value* grad_phi(j, node_index);
154 solution_gradient /= p_tet_node->GetNumContainingElements();
159 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_x", solution_gradient(0));
162 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_x", solution_gradient(0));
163 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_y", solution_gradient(1));
166 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_x", solution_gradient(0));
167 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_y", solution_gradient(1));
168 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_z", solution_gradient(2));
177 template<
unsigned DIM>
AbstractGrowingDomainPdeModifier(boost::shared_ptr< AbstractLinearPde< DIM, DIM > > pPde=boost::shared_ptr< AbstractLinearPde< DIM, DIM > >(), boost::shared_ptr< AbstractBoundaryCondition< DIM > > pBoundaryCondition=boost::shared_ptr< AbstractBoundaryCondition< DIM > >(), bool isNeumannBoundaryCondition=true, Vec solution=nullptr)
unsigned GetLocationIndexUsingCell(CellPtr pCell)
void UpdateCellData(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
void OutputSimulationModifierParameters(out_stream &rParamsFile)
static void ComputeTransformedBasisFunctionDerivatives(const ChastePoint< ELEMENT_DIM > &rPoint, const c_matrix< double, ELEMENT_DIM, ELEMENT_DIM > &rInverseJacobian, c_matrix< double, ELEMENT_DIM, ELEMENT_DIM+1 > &rReturnValue)
void OutputSimulationModifierParameters(out_stream &rParamsFile)
void GenerateFeMesh(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
virtual ~AbstractGrowingDomainPdeModifier()
virtual TetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * GetTetrahedralMeshForPdeModifier()=0
virtual unsigned GetNumNodes()=0