MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / interpolate

Method interpolate

SRC/element/PFEMElement/BackgroundMesh.cpp:3643–3815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3641}
3642
3643int BackgroundMesh::interpolate(
3644 Particle* pt, const VVInt& index, const VVDouble& vels,
3645 const VVDouble& dvns, const VDouble& pns, const VDouble& dpns,
3646 const VVDouble& crds, const std::vector<BackgroundType>& types,
3647 const VVInt& ndtags, double dt) {
3648 int ndm = OPS_GetNDM();
3649 Domain* domain = OPS_GetDomain();
3650 if (domain == 0) return 0;
3651
3652 // check
3653 if (ndm == 2) {
3654 if (index.size() != 4) return 0;
3655 if (vels.size() != 4) return 0;
3656 if (pns.size() != 4) return 0;
3657 if (dpns.size() != 4) return 0;
3658 if (crds.size() != 4) return 0;
3659 if (types.size() != 4) return 0;
3660 } else if (ndm == 3) {
3661 if (index.size() != 8) return 0;
3662 if (vels.size() != 8) return 0;
3663 if (pns.size() != 8) return 0;
3664 if (dpns.size() != 8) return 0;
3665 if (crds.size() != 8) return 0;
3666 if (types.size() != 8) return 0;
3667 }
3668
3669 const VDouble& pcrds = pt->getCrds();
3670 if ((int)pcrds.size() != ndm) {
3671 opserr << "WARNING: pcrds.size() != ndm -- "
3672 "BgMesh::interpolate\n";
3673 return -1;
3674 }
3675
3676 // get shape functions for pt
3677 VDouble N;
3678 if (ndm == 2) {
3679 double hx = (crds[1][0] + crds[2][0]) / 2.0 - crds[0][0];
3680 double hy = (crds[2][1] + crds[3][1]) / 2.0 - crds[0][1];
3681 getNForRect(crds[0][0], crds[0][1], hx, hy, pcrds[0],
3682 pcrds[1], N);
3683 } else if (ndm == 3) {
3684 double hx = (crds[1][0] + crds[2][0]) / 2.0 - crds[0][0];
3685 double hy = (crds[2][1] + crds[3][1]) / 2.0 - crds[0][1];
3686 double hz =
3687 (crds[4][2] + crds[5][2] + crds[6][2] + crds[7][2]) /
3688 4.0 -
3689 crds[0][2];
3690 getNForRect(crds[0][0], crds[0][1], crds[0][2], hx, hy, hz,
3691 pcrds[0], pcrds[1], pcrds[2], N);
3692 }
3693
3694 // particle velocity
3695 VDouble pvel(ndm);
3696 VDouble pdvn(ndm);
3697 double ppre = 0.0, pdp = 0.0;
3698 double Nvsum = 0.0, Npsum = 0.0;
3699 for (int j = 0; j < (int)vels.size(); ++j) {
3700 // no vel at this corner

Callers

nothing calls this directly

Calls 15

getCornersFunction · 0.85
getCrdsMethod · 0.80
emptyMethod · 0.80
isUpdatedMethod · 0.80
moveToMethod · 0.80
OPS_GetNDMFunction · 0.70
OPS_GetDomainFunction · 0.50
sizeMethod · 0.45
endMethod · 0.45
getTypeMethod · 0.45
getVelMethod · 0.45
getAccelMethod · 0.45

Tested by

no test coverage detected