_OBJECT-ORIENTED FINITE-ELEMENT SOFTWARE_ by Al Vermeulen [LISTING ONE] class Func { public: virtual ~Func() {}; virtual double evaluate(double x) const =0; virtual double evaluate(double x, int d) const; double operator()(double x) const {return evaluate(x);} double operator()(double x,int d) const {return evaluate(x,d);} virtual DoubleVec operator()(const DoubleVec& x) const; virtual DoubleVec operator()(const DoubleVec& x, const IntVec& d) const; virtual DoubleVec operator()(double x, const IntVec& d) const; }; [LISTING TWO] void plot(const Func& f, double a, double b, double step) { moveto(a,f(a)); for(double x=a+inc; x<=b; x+=step) { drawto(x,f(x)); } drawto(b,f(b)); } [LISTING THREE] FuncHandle dudx = diff(u,x); FuncHandle dwdx = diff(w,x); FuncHandle dNidx = diff(Ni,x); FuncHandle integrand = EA*(dudx+dwdx*dwdx/2)*dNidx; double fi = I(integrand); // I is an instance of the GQuad class [LISTING FOUR] class NLSys { public: virtual DoubleVec value(const DoubleVec& x) =0; // Calculate K(x). virtual int setKt(const DoubleVec& x) =0; // Evaluate the tangent stiffness matrix at the point "x". // Subsequent calls to solveTangentSystem should use the // tangent stiffness matrix as set here. If the tangent // stiffness matrix is singular at this point then return a // 0 and do nothing, otherwise return a 1. virtual DoubleVec solveTangentSystem(const DoubleVec& b) =0; // Solve the system Ku=b for u where K is the last calculated // tangent stiffness matrix. u and b are increments. };