本文整理汇总了C++中typenameAbstractMesh::ClearAppliedForce方法的典型用法代码示例。如果您正苦于以下问题:C++ typenameAbstractMesh::ClearAppliedForce方法的具体用法?C++ typenameAbstractMesh::ClearAppliedForce怎么用?C++ typenameAbstractMesh::ClearAppliedForce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类typenameAbstractMesh
的用法示例。
在下文中一共展示了typenameAbstractMesh::ClearAppliedForce方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateNodePositions
void OffLatticeSimulation<ELEMENT_DIM,SPACE_DIM>::UpdateCellLocationsAndTopology()
{
// Calculate forces
CellBasedEventHandler::BeginEvent(CellBasedEventHandler::FORCE);
// Clear all forces
for (typename AbstractMesh<ELEMENT_DIM, SPACE_DIM>::NodeIterator node_iter = this->mrCellPopulation.rGetMesh().GetNodeIteratorBegin();
node_iter != this->mrCellPopulation.rGetMesh().GetNodeIteratorEnd();
++node_iter)
{
node_iter->ClearAppliedForce();
}
// Now add force contributions from each AbstractForce
for (typename std::vector<boost::shared_ptr<AbstractForce<ELEMENT_DIM, SPACE_DIM> > >::iterator iter = mForceCollection.begin();
iter != mForceCollection.end();
++iter)
{
(*iter)->AddForceContribution(this->mrCellPopulation);
}
CellBasedEventHandler::EndEvent(CellBasedEventHandler::FORCE);
// Update node positions
CellBasedEventHandler::BeginEvent(CellBasedEventHandler::POSITION);
UpdateNodePositions();
CellBasedEventHandler::EndEvent(CellBasedEventHandler::POSITION);
}
示例2: mpVoronoiTessellation
MeshBasedCellPopulation<ELEMENT_DIM,SPACE_DIM>::MeshBasedCellPopulation(MutableMesh<ELEMENT_DIM,SPACE_DIM>& rMesh,
std::vector<CellPtr>& rCells,
const std::vector<unsigned> locationIndices,
bool deleteMesh,
bool validate)
: AbstractCentreBasedCellPopulation<ELEMENT_DIM,SPACE_DIM>(rMesh, rCells, locationIndices),
mpVoronoiTessellation(NULL),
mDeleteMesh(deleteMesh),
mUseAreaBasedDampingConstant(false),
mAreaBasedDampingConstantParameter(0.1),
mWriteVtkAsPoints(false),
mOutputMeshInVtk(false),
mHasVariableRestLength(false)
{
mpMutableMesh = static_cast<MutableMesh<ELEMENT_DIM,SPACE_DIM>* >(&(this->mrMesh));
assert(this->mCells.size() <= this->mrMesh.GetNumNodes());
if (validate)
{
Validate();
}
// Initialise the applied force at each node to zero
for (typename AbstractMesh<ELEMENT_DIM, SPACE_DIM>::NodeIterator node_iter = this->rGetMesh().GetNodeIteratorBegin();
node_iter != this->rGetMesh().GetNodeIteratorEnd();
++node_iter)
{
node_iter->ClearAppliedForce();
}
}
示例3:
void OffLatticeSimulation<ELEMENT_DIM,SPACE_DIM>::SetupSolve()
{
// Clear all forces
for (typename AbstractMesh<ELEMENT_DIM, SPACE_DIM>::NodeIterator node_iter = this->mrCellPopulation.rGetMesh().GetNodeIteratorBegin();
node_iter != this->mrCellPopulation.rGetMesh().GetNodeIteratorEnd();
++node_iter)
{
node_iter->ClearAppliedForce();
}
}
示例4: drdt
void MeshBasedCellPopulationWithGhostNodes<DIM>::ApplyGhostForces(){
// Initialise vector of forces on ghost nodes
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 ghost nodes
for (typename MutableMesh<DIM, DIM>::EdgeIterator edge_iterator = static_cast<MutableMesh<DIM, DIM>&>((this->mrMesh)).EdgesBegin();
edge_iterator != static_cast<MutableMesh<DIM, DIM>&>((this->mrMesh)).EdgesEnd();
++edge_iterator)
{
unsigned nodeA_global_index = edge_iterator.GetNodeA()->GetIndex();
unsigned nodeB_global_index = edge_iterator.GetNodeB()->GetIndex();
c_vector<double, DIM> force = CalculateForceBetweenGhostNodes(nodeA_global_index, nodeB_global_index);
if (!this->mIsGhostNode[nodeA_global_index])
{
drdt[nodeB_global_index] -= force;
}
else
{
drdt[nodeA_global_index] += force;
if (this->mIsGhostNode[nodeB_global_index])
{
drdt[nodeB_global_index] -= force;
}
}
}
for (typename AbstractMesh<DIM,DIM>::NodeIterator node_iter = this->mrMesh.GetNodeIteratorBegin();
node_iter != this->mrMesh.GetNodeIteratorEnd();
++node_iter)
{
unsigned node_index = node_iter->GetIndex();
if (this->mIsGhostNode[node_index])
{
node_iter->ClearAppliedForce();
node_iter->AddAppliedForceContribution(drdt[node_index]);
}
}
};
示例5:
void OffLatticeSimulation<ELEMENT_DIM,SPACE_DIM>::SetupSolve()
{
// Clear all forces
for (typename AbstractMesh<ELEMENT_DIM, SPACE_DIM>::NodeIterator node_iter = this->mrCellPopulation.rGetMesh().GetNodeIteratorBegin();
node_iter != this->mrCellPopulation.rGetMesh().GetNodeIteratorEnd();
++node_iter)
{
node_iter->ClearAppliedForce();
}
// Use a forward Euler method by default, unless a numerical method has been specified already
if (mpNumericalMethod == nullptr)
{
mpNumericalMethod = boost::make_shared<ForwardEulerNumericalMethod<ELEMENT_DIM, SPACE_DIM> >();
}
mpNumericalMethod->SetCellPopulation(dynamic_cast<AbstractOffLatticeCellPopulation<ELEMENT_DIM,SPACE_DIM>*>(&(this->mrCellPopulation)));
mpNumericalMethod->SetForceCollection(&mForceCollection);
}