// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE // // 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. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : MED_GaussDef.hxx // Author : Edward AGAPOV (eap) // #include "MED_GaussDef.hxx" #include "MED_Utilities.hxx" #include "MED_GaussUtils.hxx" namespace MED { using namespace std; using namespace MED; //--------------------------------------------------------------- void TGaussDef::add(const double x, const double weight) { if ( dim() != 1 ) EXCEPTION( logic_error,"dim() != 1"); if ( myWeights.capacity() == myWeights.size() ) EXCEPTION( logic_error,"Extra gauss point"); myCoords.push_back( x ); myWeights.push_back( weight ); } void TGaussDef::add(const double x, const double y, const double weight) { if ( dim() != 2 ) EXCEPTION( logic_error,"dim() != 2"); if ( myWeights.capacity() == myWeights.size() ) EXCEPTION( logic_error,"Extra gauss point"); myCoords.push_back( x ); myCoords.push_back( y ); myWeights.push_back( weight ); } void TGaussDef::add(const double x, const double y, const double z, const double weight) { if ( dim() != 3 ) EXCEPTION( logic_error,"dim() != 3"); if ( myWeights.capacity() == myWeights.size() ) EXCEPTION( logic_error,"Extra gauss point"); myCoords.push_back( x ); myCoords.push_back( y ); myCoords.push_back( z ); myWeights.push_back( weight ); } void TGaussDef::setRefCoords(const TShapeFun& aShapeFun) { myRefCoords.reserve( aShapeFun.myRefCoord.size() ); myRefCoords.assign( aShapeFun.myRefCoord.begin(), aShapeFun.myRefCoord.end() ); } //--------------------------------------------------------------- /*! * \brief Fill definition of gauss points family */ //--------------------------------------------------------------- TGaussDef::TGaussDef(const int geom, const int nbGauss, const int variant) { myType = geom; myCoords .reserve( nbGauss * dim() ); myWeights.reserve( nbGauss ); switch ( geom ) { case eSEG2: case eSEG3: if (geom == eSEG2) setRefCoords( TSeg2a() ); else setRefCoords( TSeg3a() ); switch ( nbGauss ) { case 1: { add( 0.0, 2.0 ); break; } case 2: { const double a = 0.577350269189626; add( a, 1.0 ); add( -a, 1.0 ); break; } case 3: { const double a = 0.774596669241; const double P1 = 1./1.8; const double P2 = 1./1.125; add( -a, P1 ); add( 0, P2 ); add( a, P1 ); break; } case 4: { const double a = 0.339981043584856, b = 0.861136311594053; const double P1 = 0.652145154862546, P2 = 0.347854845137454 ; add( a, P1 ); add( -a, P1 ); add( b, P2 ); add( -b, P2 ); break; } default: EXCEPTION( logic_error,"Invalid nb of gauss points for SEG"< alfa const double a = (6 + sqrt(15.))/21.; const double b = (6 - sqrt(15.))/21.; const double P1 = (155 + sqrt(15.))/2400.; const double P2 = (155 - sqrt(15.))/2400.; //___ add( -d, 1/3., 1/3., c1*9/80. );//___ add( -d, a, a, c1*P1 ); add( -d, 1-2*a, a, c1*P1 ); add( -d, a, 1-2*a, c1*P1 );//___ add( -d, b, b, c1*P2 ); add( -d, 1-2*b, b, c1*P2 ); add( -d, b, 1-2*b, c1*P2 );//___ add( 0., 1/3., 1/3., c2*9/80. );//___ add( 0., a, a, c2*P1 ); add( 0., 1-2*a, a, c2*P1 ); add( 0., a, 1-2*a, c2*P1 );//___ add( 0., b, b, c2*P2 ); add( 0., 1-2*b, b, c2*P2 ); add( 0., b, 1-2*b, c2*P2 );//___ add( d, 1/3., 1/3., c1*9/80. );//___ add( d, a, a, c1*P1 ); add( d, 1-2*a, a, c1*P1 ); add( d, a, 1-2*a, c1*P1 );//___ add( d, b, b, c1*P2 ); add( d, 1-2*b, b, c1*P2 ); add( d, b, 1-2*b, c1*P2 );//___ break; } default: EXCEPTION( logic_error,"Invalid nb of gauss points for PENTA: " <