Page MenuHomec4science

arlequin_template_tmpl.cc
No OneTemporary

File Metadata

Created
Sat, Aug 10, 23:14

arlequin_template_tmpl.cc

#include "arlequin_template.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template <typename ContA>
void ArlequinTemplate::buildAtomsRHS(ContA &pointList) {
UInt at_index = 0;
constexpr UInt Dim = ContA::Dim;
for (auto &&at : pointList) {
VectorView<Dim>(&rhs[Dim * at_index]) -= at.velocity();
++at_index;
}
}
/* -------------------------------------------------------------------------- */
template <typename DomainA, typename DomainC>
void ArlequinTemplate::solveConstraint() {
constexpr UInt Dim = DomainA::ContainerPoints::Dim;
LM_ASSERT(size_constraint <= A.size(),
"overflow detected" << size_constraint << " > " << A.size());
LM_ASSERT(size_constraint * Dim <= rhs.size(), "overflow detected "
<< size_constraint * Dim
<< " > " << rhs.size());
for (UInt i = 0; i < size_constraint; ++i) {
rhs(i) /= A[i];
}
}
/* -------------------------------------------------------------------------- */
template <typename ContA>
void ArlequinTemplate::applyAtomsCorrection(ContA &pointList) {
constexpr UInt Dim = ContA::Dim;
// auto &bridging_zone = this->bridging_zone->cast<DomainA, DomainC>();
LM_ASSERT(size_constraint == pointList.size(), "something bad is happening "
<< size_constraint << " "
<< pointList.size());
LM_ASSERT(pointList.size() == lambdasA.size(),
"overflow detected " << pointList.size()
<< " != " << lambdasA.size());
LM_ASSERT(pointList.size() * Dim == rhs.size(), "overflowdetected "
<< pointList.size() * Dim
<< " != " << rhs.size());
UInt i = 0;
for (auto &&at : pointList) {
LM_ASSERT(lambdasA[i],
"weight associated with atom " << i << " is zero : abort");
at.velocity() += rhs(i) / lambdasA[i];
++i;
}
}
/* --------------------------------------------------------------------------*/
template <typename ContC>
void ArlequinTemplate::computeContinuumWeights(ContC &mesh) {
this->weightFE.buildManual(mesh);
}
/* -------------------------------------------------------------------------- */
template <typename ContC>
void ArlequinTemplate::correctContinuumWeights(ContC &meshList) {
lambdasC.assign(weightFE.getArray().size(), 0);
UInt j = 0;
for (auto &&n : meshList.getContainerNodes()) {
lambdasC[j] = weightFE.getArray()[j] * n.mass();
++j;
}
}
/* -------------------------------------------------------------------------- */
template <typename ContA>
void ArlequinTemplate::computeAtomWeights(ContA &atoms) {
this->weightMD.buildManual(atoms);
}
/* -------------------------------------------------------------------------- */
template <typename ContA>
void ArlequinTemplate::correctAtomWeights(ContA &pointList) {
lambdasA.assign(weightMD.getArray().size(), 0);
this->bridging_zone.attachVector(lambdasA);
LM_ASSERT(pointList.size() == lambdasA.size(), "overflow detected");
LM_ASSERT(pointList.size() == weightMD.getArray().size(),
"overflow detected");
UInt at_index = 0;
for (auto &&at : pointList) {
lambdasA[at_index] = weightMD.getArray()[at_index] * at.mass();
++at_index;
}
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__

Event Timeline