本文整理汇总了C++中typenameAbstractMesh::rGetLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ typenameAbstractMesh::rGetLocation方法的具体用法?C++ typenameAbstractMesh::rGetLocation怎么用?C++ typenameAbstractMesh::rGetLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类typenameAbstractMesh
的用法示例。
在下文中一共展示了typenameAbstractMesh::rGetLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drdt
void NodeBasedCellPopulationWithParticles<DIM>::UpdateParticlePositions(double dt)
{
// Initialise vector of forces on particles
std::vector<c_vector<double, DIM> > drdt(this->GetNumNodes());
for (unsigned i=0; i<drdt.size(); i++)
{
drdt[i] = zero_vector<double>(DIM);
}
// Calculate forces on particles
double damping_constant = this->GetDampingConstantNormal();
for (unsigned i=0; i<drdt.size(); i++)
{
drdt[i] = this->GetNode(i)->rGetAppliedForce()/damping_constant;
}
for (typename AbstractMesh<DIM,DIM>::NodeIterator node_iter = this->mrMesh.GetNodeIteratorBegin();
node_iter != this->mrMesh.GetNodeIteratorEnd();
++node_iter)
{
if (node_iter->IsParticle())
{
ChastePoint<DIM> new_point(node_iter->rGetLocation() + dt*drdt[node_iter->GetIndex()]);
node_iter->SetPoint(new_point);
}
}
}
示例2: EXCEPTION
void VertexCryptBoundaryForce<DIM>::AddForceContribution(AbstractCellPopulation<DIM>& rCellPopulation)
{
// Helper variable that is a static cast of the cell population
VertexBasedCellPopulation<DIM>* p_cell_population = static_cast<VertexBasedCellPopulation<DIM>*>(&rCellPopulation);
// Throw an exception message if not using a VertexBasedCellPopulation
if (dynamic_cast<VertexBasedCellPopulation<DIM>*>(&rCellPopulation) == nullptr)
{
EXCEPTION("VertexCryptBoundaryForce is to be used with VertexBasedCellPopulations only");
}
// Iterate over nodes
for (typename AbstractMesh<DIM,DIM>::NodeIterator node_iter = p_cell_population->rGetMesh().GetNodeIteratorBegin();
node_iter != p_cell_population->rGetMesh().GetNodeIteratorEnd();
++node_iter)
{
double y = node_iter->rGetLocation()[1]; // y-coordinate of node
// If the node lies below the line y=0, then add the boundary force contribution to the node forces
if (y < 0.0)
{
c_vector<double, DIM> boundary_force = zero_vector<double>(DIM);
boundary_force[1] = mForceStrength*SmallPow(y, 2);
node_iter->AddAppliedForceContribution(boundary_force);
}
}
}
示例3:
void ForwardEulerNumericalMethod<ELEMENT_DIM,SPACE_DIM>::UpdateAllNodePositions(double dt)
{
if (!this->mUseUpdateNodeLocation)
{
// Apply forces to each cell, and save a vector of net forces F
std::vector<c_vector<double, SPACE_DIM> > forces = this->ComputeForcesIncludingDamping();
unsigned index = 0;
for (typename AbstractMesh<ELEMENT_DIM, SPACE_DIM>::NodeIterator node_iter = this->mpCellPopulation->rGetMesh().GetNodeIteratorBegin();
node_iter != this->mpCellPopulation->rGetMesh().GetNodeIteratorEnd();
++node_iter, ++index)
{
// Get the current node location and calculate the new location according to the forward Euler method
const c_vector<double, SPACE_DIM>& r_old_location = node_iter->rGetLocation();
c_vector<double, SPACE_DIM> displacement = dt * forces[index];
// In the vertex-based case, the displacement may be scaled if the cell rearrangement threshold is exceeded
this->DetectStepSizeExceptions(node_iter->GetIndex(), displacement, dt);
c_vector<double, SPACE_DIM> new_location = r_old_location + displacement;
this->SafeNodePositionUpdate(node_iter->GetIndex(), new_location);
}
}
else
{
/*
* If this type of cell population does not support the new numerical methods, delegate
* updating node positions to the population itself.
*
* This only applies to NodeBasedCellPopulationWithBuskeUpdates.
*/
this->mpCellPopulation->UpdateNodeLocations(dt);
}
}