Skip to content

Commit

Permalink
release 0.8.1 remove unused function CPhysics::ReadFile which generat…
Browse files Browse the repository at this point in the history
…es compiler warnings
  • Loading branch information
JamesMcCrae committed Dec 8, 2024
1 parent b4900b9 commit f12f23b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 104 deletions.
1 change: 0 additions & 1 deletion include/physics.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ class CPhysics

// Setting A example Problem
void SetExample();
void ReadFile(const char* fname);
void CutSlit();

// solving methods
Expand Down
103 changes: 0 additions & 103 deletions src/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,109 +127,6 @@ void CPhysics::ClearProblem()
aPlate.clear();
}

void CPhysics::ReadFile(const char* fname)
{
const double rho = 1;
FILE* fp = fopen(fname, "r");
char buff[256];
int nr;
fscanf(fp, "%s %d", buff, &nr);
std::cout << "nrigid: " << nr << std::endl;
aRigidBody.clear();
aPlate.clear();
aJoint.clear();
aRigidBody.resize(nr);
aPlate.resize(nr);
for (int ir = 0; ir < nr; ir++) {
CRigidBody& rb = aRigidBody[ir];
CPlate& plt = aPlate[ir];
int tmp1;
double d1, d2, d3;
fscanf(fp, "%s %d", buff, &tmp1);
fscanf(fp, "%s %lf %lf %lf", buff, &d1, &d2, &d3); // PlaneP
plt.p = CVector3D(d1, d2, d3);
fscanf(fp, "%s %lf %lf %lf", buff, &d1, &d2, &d3); // PlaneT
plt.t = CVector3D(d1, d2, d3);
fscanf(fp, "%s %lf %lf %lf", buff, &d1, &d2, &d3); // PlaneN
plt.n = CVector3D(d1, d2, d3);
fscanf(fp, "%s %lf %lf %lf", buff, &d1, &d2, &d3); // PlaneB
plt.b = CVector3D(d1, d2, d3);
fscanf(fp, "%s %lf %lf %lf", buff, &d1, &d2, &d3); // CenterofMass3D
rb.cg = CVector3D(d1, d2, d3);
double area, thickness;
fscanf(fp, "%s %lf", buff, &area); // PlaneArea
fscanf(fp, "%s %lf", buff, &thickness); // PlaneThickness
plt.thickness = thickness;
plt.rho = rho;
rb.m = area * thickness * rho;
int ncnt;
fscanf(fp, "%s %d", buff, &ncnt); // PlaneContactPoints
rb.aCP.resize(ncnt);
for (int icnt = 0; icnt < ncnt; icnt++) {
fscanf(fp, "%lf %lf %lf", &d1, &d2, &d3);
rb.aCP[icnt] = CVector3D(d1, d2, d3);
}
int np;
fscanf(fp, "%s %d", buff, &np); // PlaneBoundary2D
plt.aXY.resize(np * 2);
std::cout << "npoint section2d: " << np << std::endl;
for (int ip = 0; ip < np; ip++) {
fscanf(fp, "%lf %lf", &d1, &d2);
plt.aXY[ip * 2 + 0] = d1;
plt.aXY[ip * 2 + 1] = d2;
}
rb.R.SetIdentity();
rb.u = CVector3D(0, 0, 0);
rb.aCForce.resize(rb.aCP.size());
}
//////////////////////////////////////////////////////////////////////////////////////////
int nj;
fscanf(fp, "%s %d", buff, &nj); // Joints
aJoint.resize(nj);
for (int ij = 0; ij < nj; ij++) {
CJoint& j = aJoint[ij];
int tmp1, tmp2;
double d1, d2, d3, d4;
fscanf(fp, "%s %d %d", buff, &tmp1, &tmp2); // JointPlaneIndexes
j.irb0 = tmp1;
j.irb1 = tmp2;
fscanf(fp, "%s %lf %lf %lf", buff, &d1, &d2, &d3); // JointCentre3D
j.p = CVector3D(d1, d2, d3);
fscanf(fp, "%s %lf %lf %lf", buff, &d1, &d2, &d3); // JointAxis3D
fscanf(fp, "%s %lf %lf %lf %lf", buff, &d1, &d2, &d3,
&d4); // JointPlane1SlitEndpoints2D
j.jp0[0] = d1;
j.jp0[1] = d2;
j.jp0[2] = d3;
j.jp0[3] = d4;
std::cout << d1 << " " << d2 << " " << d3 << " " << d4 << std::endl;
fscanf(fp, "%s %lf %lf %lf %lf", buff, &d1, &d2, &d3,
&d4); // JointPlane1SlitEndpoints2D
j.jp1[0] = d1;
j.jp1[1] = d2;
j.jp1[2] = d3;
j.jp1[3] = d4;
std::cout << d1 << " " << d2 << " " << d3 << " " << d4 << std::endl;
}
//////////////////////////////////////////////////////////////////////////////////////////
int nexf;
fscanf(fp, "%s %d", buff, &nexf); // ExternalForces
for (int iexf = 0; iexf < nexf; iexf++) {
int irb;
double x0, y0, z0;
double x1, y1, z1;
fscanf(fp, "%d %lf%lf%lf %lf%lf%lf", &irb, &x0, &y0, &z0, &x1, &y1,
&z1);
assert(irb < int(aRigidBody.size()));
int irb_exf = (int)aRigidBody[irb].aExForce.size();
aRigidBody[irb].aExForce.resize(irb_exf + 1);
aRigidBody[irb].aExForce[irb_exf].first = CVector3D(x0, y0, z0);
aRigidBody[irb].aExForce[irb_exf].second = CVector3D(x1, y1, z1);
}

fclose(fp);
}

void CPhysics::Solve_InsidePlane()
{
if (aPlate.size() != aRigidBody.size()) return;
Expand Down

0 comments on commit f12f23b

Please sign in to comment.