From bf3dc102dcb27e12a38e0949e2332a7b10dfa459 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 14 Jul 2013 06:56:23 +0000 Subject: [PATCH] pp --- contrib/HighOrderMeshOptimizer/ParamCoord.h | 63 +++++++++------------ 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/contrib/HighOrderMeshOptimizer/ParamCoord.h b/contrib/HighOrderMeshOptimizer/ParamCoord.h index 1927505508..5f8fb7ecb1 100644 --- a/contrib/HighOrderMeshOptimizer/ParamCoord.h +++ b/contrib/HighOrderMeshOptimizer/ParamCoord.h @@ -1,83 +1,76 @@ #ifndef _PARAMCOORD_H_ #define _PARAMCOORD_H_ - - class ParamCoord { - public: - virtual void exportParamCoord(MVertex *v, const SPoint3 &uvw) {}; - virtual int nCoord(MVertex* vert) = 0; // Number of parametric coordinates for vertex - virtual SPoint3 getUvw(MVertex* vert) = 0; // Get parametric coordinates of vertex - virtual SPoint3 uvw2Xyz(MVertex* vert, const SPoint3 &uvw) = 0; // Calculate physical coordinates from parametric coordinates of vertex - virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const SPoint3 &gXyz, SPoint3 &gUvw) = 0; // Calculate derivatives w.r.t parametric coordinates - virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const std::vector<SPoint3> &gXyz, std::vector<SPoint3> &gUvw) = 0; // Calculate derivatives w.r.t parametric coordinates + // Number of parametric coordinates for vertex + virtual int nCoord(MVertex* vert) = 0; + // Get parametric coordinates of vertex + virtual SPoint3 getUvw(MVertex* vert) = 0; + // Calculate physical coordinates from parametric coordinates of vertex + virtual SPoint3 uvw2Xyz(MVertex* vert, const SPoint3 &uvw) = 0; + // Calculate derivatives w.r.t parametric coordinates + virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, + const SPoint3 &gXyz, SPoint3 &gUvw) = 0; + // Calculate derivatives w.r.t parametric coordinates + virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, + const std::vector<SPoint3> &gXyz, std::vector<SPoint3> &gUvw) = 0; virtual ~ParamCoord() {} - }; - - class ParamCoordPhys3D : public ParamCoord { - public: - int nCoord(MVertex* vert) { return 3; } virtual SPoint3 getUvw(MVertex* vert) { return vert->point(); } virtual SPoint3 uvw2Xyz(MVertex* vert, const SPoint3 &uvw) { return uvw; } - virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const SPoint3 &gXyz, SPoint3 &gUvw) { gUvw = gXyz; } - virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const std::vector<SPoint3> &gXyz, std::vector<SPoint3> &gUvw) + virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const SPoint3 &gXyz, + SPoint3 &gUvw){ gUvw = gXyz; } + virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, + const std::vector<SPoint3> &gXyz, std::vector<SPoint3> &gUvw) { std::vector<SPoint3>::iterator itUvw=gUvw.begin(); - for (std::vector<SPoint3>::const_iterator itXyz=gXyz.begin(); itXyz != gXyz.end(); itXyz++) { + for (std::vector<SPoint3>::const_iterator itXyz=gXyz.begin(); itXyz != gXyz.end(); + itXyz++) { *itUvw = *itXyz; itUvw++; } } - }; - - class ParamCoordPhys2D : public ParamCoord { - public: - int nCoord(MVertex* vert) { return 2; } virtual SPoint3 getUvw(MVertex* vert) { return vert->point(); } virtual SPoint3 uvw2Xyz(MVertex* vert, const SPoint3 &uvw) { return uvw; } - virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const SPoint3 &gXyz, SPoint3 &gUvw) { gUvw = gXyz; } - virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const std::vector<SPoint3> &gXyz, std::vector<SPoint3> &gUvw) + virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const SPoint3 &gXyz, + SPoint3 &gUvw) { gUvw = gXyz; } + virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, + const std::vector<SPoint3> &gXyz, std::vector<SPoint3> &gUvw) { std::vector<SPoint3>::iterator itUvw=gUvw.begin(); - for (std::vector<SPoint3>::const_iterator itXyz=gXyz.begin(); itXyz != gXyz.end(); itXyz++) { + for (std::vector<SPoint3>::const_iterator itXyz=gXyz.begin(); itXyz != gXyz.end(); + itXyz++) { *itUvw = *itXyz; itUvw++; } } - }; - - class ParamCoordParent : public ParamCoord { - public: - int nCoord(MVertex* vert) { return vert->onWhat()->dim(); } virtual void exportParamCoord(MVertex *v, const SPoint3 &uvw); virtual SPoint3 getUvw(MVertex* vert); virtual SPoint3 uvw2Xyz(MVertex* vert, const SPoint3 &uvw); - virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const SPoint3 &gXyz, SPoint3 &gUvw); - virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const std::vector<SPoint3> &gXyz, std::vector<SPoint3> &gUvw); - + virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const SPoint3 &gXyz, + SPoint3 &gUvw); + virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, + const std::vector<SPoint3> &gXyz, std::vector<SPoint3> &gUvw); }; - - #endif -- GitLab