Skip to content

Commit

Permalink
Merge pull request #452 from zhuminjie/particle
Browse files Browse the repository at this point in the history
ParticleGroup: fix -pointlist option
  • Loading branch information
zhuminjie committed Oct 13, 2020
2 parents 4d4abdf + 3c1e8d8 commit dbe8195
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion SRC/element/PFEMElement/ParticleGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ int OPS_ParticleGroup() {
}
} else if (strcmp(geotype, "pointlist") == 0) {
int numdata = OPS_GetNumRemainingInputArgs();
if (numdata < ndm) {
if (numdata < 1) {
group->pointlist(pointdata);
numdata = (int) pointdata.size();
if (OPS_SetDoubleOutput(&numdata, &pointdata[0], false) < 0) {
Expand All @@ -209,6 +209,23 @@ int OPS_ParticleGroup() {
return 0;
}

// number of points
int num_point = 0;
numdata = 1;
if (OPS_GetIntInput(&numdata, &num_point) < 0) {
opserr << "WARNING: failed to get number of points\n";
return -1;
}

// check input
numdata = num_point * (4 * ndm + 1);
if (OPS_GetNumRemainingInputArgs() < numdata) {
opserr << "WARNING: insufficient input for "
<< num_point << " points: [x1n, y1, <z1n>, x1, y1, <z1> "
<< "vx1, vy1, <vz1>, ax1, ay1, <az1>, p1, x2n, ...]\n";
return -1;
}

// node coord
pointdata.resize(numdata);
if (OPS_GetDoubleInput(&numdata, &pointdata[0]) < 0) {
Expand Down

0 comments on commit dbe8195

Please sign in to comment.