// This file is part of the Herezh++ application. // // The finite element software Herezh++ is dedicated to the field // of mechanics for large transformations of solid structures. // It is developed by Gérard Rio (APP: IDDN.FR.010.0106078.000.R.P.2006.035.20600) // INSTITUT DE RECHERCHE DUPUY DE LÔME (IRDL) . // // Herezh++ is distributed under GPL 3 license ou ultérieure. // // Copyright (C) 1997-2022 Université Bretagne Sud (France) // AUTHOR : Gérard Rio // E-MAIL : gerardrio56@free.fr // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, // or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // For more information, please consult: . //#include "debug.h" #include "Base3D3.h" #ifndef BASE3D3_H_deja_inclus //=============================================================== // Les base covariantes et absolus //=============================================================== // CONSTRUCTEURS : // par defaut, defini une Base de coordonnŕes nulles #ifndef MISE_AU_POINT inline #endif Base3D3B::Base3D3B () : v1(),v2(),v3() { v[0] = & v1;v[1] = & v1;v[2] = & v1; }; // defini une Base unitaire en dimension 3 :100,010,001 #ifndef MISE_AU_POINT inline #endif Base3D3B::Base3D3B (bool ): v1(),v2(),v3() { v1(1) = 1.; v2(2) = 1.;v3(3) = 1.; v[0] = & v1;v[1] = & v1;v[2] = & v1; }; // defini une Base donnŕe a partir d'un tableau #ifndef MISE_AU_POINT inline #endif Base3D3B::Base3D3B ( const Tableau & vv) : v1(vv(1)),v2(vv(2)),v3(vv(3)) {v[0] = & v1;v[1] = & v1;v[2] = & v1;}; // defini une Base donnŕe a partir de trois vecteur #ifndef MISE_AU_POINT inline #endif Base3D3B::Base3D3B ( const Coordonnee3B& vv1,const Coordonnee3B& vv2,const Coordonnee3B& vv3) : v1(vv1),v2(vv2),v3(vv3) {v[0] = & v1;v[1] = & v1;v[2] = & v1;}; // constructeur de copie #ifndef MISE_AU_POINT inline #endif Base3D3B::Base3D3B (const Base3D3B & aB) : v1(aB.v1),v2(aB.v2),v3(aB.v3) {v[0] = & v1;v[1] = & v1;v[2] = & v1;}; // DESTRUCTEUR : #ifndef MISE_AU_POINT inline #endif Base3D3B::~Base3D3B () { }; // surcharge de l'affectation #ifndef MISE_AU_POINT inline #endif Base3D3B & Base3D3B::operator = (const Base3D3B & aB) { v1 = aB.v1; v2 = aB.v2;v3 = aB.v3; v[0] = & v1;v[1] = & v1;v[2] = & v1; return *this; }; // retourne le i ieme Coordonnee3s en I/O #ifndef MISE_AU_POINT inline #endif Coordonnee3B & Base3D3B::operator () (int i) { #ifdef MISE_AU_POINT if ((i < 1) || (i > 3)) { cout << "\nErreur : vecteur inexistant !\n"; cout << " i = " << i << '\n'; cout << "Base3D3B::OPERATOR() (int ) \n"; Sortie(1); }; #endif return *(v[i-1]); }; // retourne le i ieme Coordonnee3s en lecture only #ifndef MISE_AU_POINT inline #endif Coordonnee3B Base3D3B::operator () (int i) const { #ifdef MISE_AU_POINT if ((i < 1) || (i > 3)) { cout << "\nErreur : vecteur inexistant !\n"; cout << " i = " << i << '\n'; cout << "Base3D3B::OPERATOR() (int ) const \n"; Sortie(1); }; #endif return *(v[i-1]); }; // retourne la j ieme composante du i ieme vecteur en I/O #ifndef MISE_AU_POINT inline #endif double & Base3D3B::operator () (int i,int j) { #ifdef MISE_AU_POINT if ((i < 1) || (i > 3)) { cout << "\nErreur : vecteur inexistant !\n"; cout << " i = " << i << '\n'; cout << " Base3D3B::operator () (int i,int j)\n"; Sortie(1); }; if ((j < 1) || (j > 3)) { cout << "\nErreur : composante inexistante !\n"; cout << " j = " << j << '\n'; cout << " Base3D3B::operator () (int i,int j)\n"; Sortie(1); }; #endif return (*(v[i-1]))(j); }; // retourne la j ieme composante du i ieme vecteur en lecture only #ifndef MISE_AU_POINT inline #endif double Base3D3B::operator () (int i,int j) const { #ifdef MISE_AU_POINT if ((i < 1) || (i > 3)) { cout << "\nErreur : vecteur inexistant !\n"; cout << " i = " << i << '\n'; cout << " Base3D3B::operator () (int i,int j)\n"; Sortie(1); }; if ((j < 1) || (j > 3)) { cout << "\nErreur : composante inexistante !\n"; cout << " j = " << j << '\n'; cout << " Base3D3B::operator () (int i,int j)\n"; Sortie(1); }; #endif return (*(v[i-1]))(j); }; // surcharge de l'operateur de lecture #ifndef MISE_AU_POINT inline #endif istream & operator >> ( istream & ent, Base3D3B & ba) { // lecture du type et vŕrification string nomtype; ent >> nomtype; if (nomtype != "Base3D3B") { Sortie(1); return ent; } // lecture des data ent >> ba.v1 >> ba.v2 >> ba.v3; return ent; }; // surcharge de l'operateur d'ecriture #ifndef MISE_AU_POINT inline #endif ostream & operator << ( ostream & sort,const Base3D3B & ba) { // ŕcriture du type sort << "Base3D3B " ; // les data sort << ba.v1 << ba.v2 << ba.v3 << "\n"; return sort; }; //=============================================================== // Les base duales //=============================================================== // CONSTRUCTEURS : // par defaut, defini une Base de coordonnŕes nulles #ifndef MISE_AU_POINT inline #endif Base3D3H::Base3D3H () : v1(),v2(),v3() { v[0] = & v1;v[1] = & v1;v[2] = & v1; }; // defini une Base unitaire en dimension 3 :100,010,001 #ifndef MISE_AU_POINT inline #endif Base3D3H::Base3D3H (bool ): v1(),v2(),v3() { v1(1) = 1.; v2(2) = 1.;v3(3) = 1.; v[0] = & v1;v[1] = & v1;v[2] = & v1; }; // defini une Base donnŕe a partir d'un tableau #ifndef MISE_AU_POINT inline #endif Base3D3H::Base3D3H ( const Tableau & vv) : v1(vv(1)),v2(vv(2)),v3(vv(3)) {v[0] = & v1;v[1] = & v1;v[2] = & v1;}; // defini une Base donnŕe a partir de trois vecteur #ifndef MISE_AU_POINT inline #endif Base3D3H::Base3D3H ( const Coordonnee3H& vv1,const Coordonnee3H& vv2,const Coordonnee3H& vv3) : v1(vv1),v2(vv2),v3(vv3) {v[0] = & v1;v[1] = & v1;v[2] = & v1;}; // constructeur de copie #ifndef MISE_AU_POINT inline #endif Base3D3H::Base3D3H (const Base3D3H & aB) : v1(aB.v1),v2(aB.v2),v3(aB.v3) {v[0] = & v1;v[1] = & v1;v[2] = & v1;}; // DESTRUCTEUR : #ifndef MISE_AU_POINT inline #endif Base3D3H::~Base3D3H () { }; // surcharge de l'affectation #ifndef MISE_AU_POINT inline #endif Base3D3H & Base3D3H::operator = (const Base3D3H & aH) { v1 = aH.v1; v2 = aH.v2;v3 = aH.v3; v[0] = & v1;v[1] = & v1;v[2] = & v1; return *this; }; // retourne le i ieme Coordonnee3s en I/O #ifndef MISE_AU_POINT inline #endif Coordonnee3H & Base3D3H::operator () (int i) { #ifdef MISE_AU_POINT if ((i < 1) || (i > 3)) { cout << "\nErreur : vecteur inexistant !\n"; cout << " i = " << i << '\n'; cout << "Base3D3H::OPERATOR() (int ) \n"; Sortie(1); }; #endif return *(v[i-1]); }; // retourne le i ieme Coordonnee3s en lecture only #ifndef MISE_AU_POINT inline #endif Coordonnee3H Base3D3H::operator () (int i) const { #ifdef MISE_AU_POINT if ((i < 1) || (i > 3)) { cout << "\nErreur : vecteur inexistant !\n"; cout << " i = " << i << '\n'; cout << "Base3D3H::OPERATOR() (int ) const \n"; Sortie(1); }; #endif return *(v[i-1]); }; // retourne la j ieme composante du i ieme vecteur en I/O #ifndef MISE_AU_POINT inline #endif double & Base3D3H::operator () (int i,int j) { #ifdef MISE_AU_POINT if ((i < 1) || (i > 3)) { cout << "\nErreur : vecteur inexistant !\n"; cout << " i = " << i << '\n'; cout << " Base3D3H::operator () (int i,int j)\n"; Sortie(1); }; if ((j < 1) || (j > 3)) { cout << "\nErreur : composante inexistante !\n"; cout << " j = " << j << '\n'; cout << " Base3D3H::operator () (int i,int j)\n"; Sortie(1); }; #endif return (*(v[i-1]))(j); }; // retourne la j ieme composante du i ieme vecteur en lecture only #ifndef MISE_AU_POINT inline #endif double Base3D3H::operator () (int i,int j) const { #ifdef MISE_AU_POINT if ((i < 1) || (i > 3)) { cout << "\nErreur : vecteur inexistant !\n"; cout << " i = " << i << '\n'; cout << " Base3D3H::operator () (int i,int j)\n"; Sortie(1); }; if ((j < 1) || (j > 3)) { cout << "\nErreur : composante inexistante !\n"; cout << " j = " << j << '\n'; cout << " Base3D3H::operator () (int i,int j)\n"; Sortie(1); }; #endif return (*(v[i-1]))(j); }; // surcharge de l'operateur de lecture #ifndef MISE_AU_POINT inline #endif istream & operator >> ( istream & ent, Base3D3H & ba) { // lecture du type et vŕrification string nomtype; ent >> nomtype; if (nomtype != "Base3D3H") { Sortie(1); return ent; } // lecture des data ent >> ba.v1 >> ba.v2 >> ba.v3; return ent; }; // surcharge de l'operateur d'ecriture #ifndef MISE_AU_POINT inline #endif ostream & operator << ( ostream & sort,const Base3D3H & ba) { // ŕcriture du type sort << "Base3D3H " ; // les data sort << ba.v1 << ba.v2 << ba.v3 << "\n"; return sort; }; #endif