From f12f23b6cb5615322ffcd35d48b282e747c107fa Mon Sep 17 00:00:00 2001 From: JamesMcCrae Date: Sun, 8 Dec 2024 01:10:48 -0500 Subject: [PATCH] release 0.8.1 remove unused function CPhysics::ReadFile which generates compiler warnings --- include/physics.h | 1 - src/physics.cpp | 103 ---------------------------------------------- 2 files changed, 104 deletions(-) diff --git a/include/physics.h b/include/physics.h index d031a4d..dbc0854 100644 --- a/include/physics.h +++ b/include/physics.h @@ -177,7 +177,6 @@ class CPhysics // Setting A example Problem void SetExample(); - void ReadFile(const char* fname); void CutSlit(); // solving methods diff --git a/src/physics.cpp b/src/physics.cpp index f62c66b..dc1d40c 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -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;