52 unsigned num_nodes = pCellPopulation->
GetNumNodes();
53 mGradients.resize(num_nodes, zero_vector<double>(DIM));
56 std::vector<c_vector<double, DIM> > gradients_on_elements;
58 gradients_on_elements.resize(num_elements, zero_vector<double>(DIM));
61 std::vector<unsigned> num_real_elems_for_node(num_nodes, 0);
63 for (
unsigned elem_index=0; elem_index<num_elements; elem_index++)
68 c_matrix<double, DIM, DIM> jacobian, inverse_jacobian;
72 c_matrix<double, DIM, DIM+1> grad_phi;
75 bool is_ghost_element =
false;
77 for (
unsigned node_index=0; node_index<DIM+1; node_index++)
82 assert(pCellPopulation->
IsGhostNode(node_global_index) ==
false);
92 double pde_solution = p_cell->GetCellData()->GetItem(rItemName);
95 for (
unsigned i=0; i<DIM; i++)
97 gradients_on_elements[elem_index](i) += pde_solution* grad_phi(i, node_index);
102 if (!is_ghost_element)
104 for (
unsigned node_index=0; node_index<DIM+1; node_index++)
107 mGradients[node_global_index] += gradients_on_elements[elem_index];
108 num_real_elems_for_node[node_global_index]++;
115 cell_iter != pCellPopulation->
End();
120 if (!(num_real_elems_for_node[node_global_index] > 0))
178 mGradients[node_global_index] /= num_real_elems_for_node[node_global_index];
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)
virtual void GetInverseJacobianForElement(unsigned elementIndex, c_matrix< double, SPACE_DIM, ELEMENT_DIM > &rJacobian, double &rJacobianDeterminant, c_matrix< double, ELEMENT_DIM, SPACE_DIM > &rInverseJacobian) const