// class : Les vecteurs
-// Copyright (C) 2009-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2024 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
BEGIN_NAMESPACE_HEXA
-class Vector : public EltBase
+class HexaExport Vector : public EltBase
{
public:
double getDx () { return v_dx ; }
double getNorm () { return sqrt (v_dx*v_dx + v_dy*v_dy + v_dz*v_dz); }
double getAngleX ();
-
-public:
Vector (Document* doc, double dx=0, double dy=0, double dz=0);
+#ifndef SWIG
+public:
Vector (Vector* lautre);
virtual ~Vector () {}
virtual void dump ();
double getCoord (int dir);
double* getCoord (double coord[]);
+ int getUnitVector (double coord[]);
virtual void saveXml (XmlWriter* xml);
int renormer ();
double v_dx;
double v_dy;
double v_dz;
+#endif
};
-// ------------------------------------------- Inlining
-// ===================================================== getCoord
-inline double Vector::getCoord (int dir)
-{
- double val = 0;
- switch (dir)
- {
- case dir_x : val = v_dx;
- break;
- case dir_y : val = v_dy;
- break;
- case dir_z : val = v_dz;
- break;
- }
- return val;
-}
-// ===================================================== renormer
-inline int Vector::renormer()
-{
- double dn = getNorm ();
- if (dn < 1e-30)
- return HERR;
-
- v_dx /= dn;
- v_dy /= dn;
- v_dz /= dn;
-
- return HOK;
-}
-// ===================================================== vectoriel
-inline void Vector::vectoriel (Vector* a, Vector*b)
-{
- v_dx = a->v_dy * b->v_dz - b->v_dy * a->v_dz;
- v_dy = a->v_dz * b->v_dx - b->v_dz * a->v_dx;
- v_dz = a->v_dx * b->v_dy - b->v_dx * a->v_dy;
-}
-
-// ===================================================== getCoord
-inline double* Vector::getCoord (double coord[])
-{
- coord [dir_x] = v_dx;
- coord [dir_y] = v_dy;
- coord [dir_z] = v_dz;
- return coord;
-}
-// ===================================================== multiplier
-inline void Vector::multiplier (double scalaire)
-{
- v_dx *= scalaire;
- v_dy *= scalaire;
- v_dz *= scalaire;
-}
-// ===================================================== dump
-inline void Vector::dump ()
-{
- printf ("Vector ");
- printName (" = ");
- if (NOT isHere ())
- {
- printf ("(*** deleted ***)\n");
- return;
- }
-
- printf ("(%g, %g, %g)\n", v_dx,v_dy,v_dz);
-}
-
END_NAMESPACE_HEXA
#endif