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

Method tri

SRC/element/PFEMElement/ParticleGroup.cpp:544–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542}
543
544int ParticleGroup::tri(const VDouble &p1, const VDouble &p2, const VDouble &p3,
545 int m, int n, const VDouble &vel0, double p0) {
546
547 if (m <= 0 || n <= 0)
548 return 0;
549 if (p1.size() != p2.size())
550 return -1;
551 if (p3.size() != p1.size())
552 return -1;
553
554 // the mesh size along edge 1-2 and 1-3
555 double h1 = 1.0 / m;
556 double h2 = 1.0 / n;
557
558 // initial vel and pressure
559 VDouble vel(p1.size());
560 for (int i = 0; i < (int) vel.size(); i++) {
561 if (i < (int) vel0.size()) {
562 vel[i] = vel0[i];
563 }
564 }
565
566 // using area coordinates to generate particles' coordinates
567 VDouble crds;
568 VDouble temp;
569 for (int i = 0; i < m; i++) {
570 double L1 = (i + 0.5) * h1;
571 for (int j = 0; j < n; j++) {
572 double L2 = (j + 0.5) * h2;
573 double L3 = 1.0 - L1 - L2;
574 if (L3 < -1e-6)
575 continue;
576
577 crds = p1;
578 crds *= L1;
579
580 temp = p2;
581 temp *= L2;
582 crds += temp;
583
584 temp = p3;
585 temp *= L3;
586 crds += temp;
587
588 this->addParticle(crds, vel, p0);
589 }
590 }
591
592 return 0;
593}
594
595int
596ParticleGroup::cube(const VVDouble &pts, const VInt &num,

Callers 1

OPS_ParticleGroupFunction · 0.80

Calls 2

addParticleMethod · 0.95
sizeMethod · 0.45

Tested by

no test coverage detected