1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "COORDINATEClient.hxx"
25 #include "UtilClient.hxx"
26 #include "Utils_CorbaException.hxx"
28 #include "ReceiverFactory.hxx"
30 using namespace MEDMEM;
31 using namespace MED_EN;
33 //=============================================================================
37 //=============================================================================
39 COORDINATEClient::COORDINATEClient(const SALOME_MED::MESH_ptr m,
41 COORDINATE(m->getSpaceDimension(), 1, Mode),
43 IOR_Mesh(SALOME_MED::MESH::_duplicate(m))
47 //=============================================================================
49 * Remplit les informations générales
51 //=============================================================================
52 void COORDINATEClient::blankCopy()
56 SALOME_MED::GMESH::coordinateInfos_var all;
59 all = IOR_Mesh->getCoordGlobal();
61 catch (const exception & ex)
63 MESSAGE("Unable to acces Global information");
64 THROW_SALOME_CORBA_EXCEPTION(ex.what() ,SALOME::INTERNAL_ERROR);
67 //convertCorbaArray(tA, nA, IOR_Mesh->getCoordinatesNames());
68 convertCorbaArray(tA, nA, &all->coordNames);
69 ASSERT(nA == getSpaceDimension());
70 setCoordinatesNames(tA);
73 //convertCorbaArray(tA, nA, IOR_Mesh->getCoordinatesUnits());
74 convertCorbaArray(tA, nA, &all->coordUnits);
75 ASSERT(nA == getSpaceDimension());
76 setCoordinatesUnits(tA);
80 setCoordinatesSystem( all->coordSystem.in());
84 //=============================================================================
86 * Remplit les coordonnées
88 //=============================================================================
90 void COORDINATEClient::fillCopy()
92 //PN ?? Est-ce qu on peut pas mettre une variable dans COORDINATEClient
93 // qu on remplirait dans blankCopy ??
94 long nN = IOR_Mesh->getNumberOfNodes();
98 SALOME::SenderDouble_var senderForCoords=IOR_Mesh->getSenderForCoordinates(MED_FULL_INTERLACE);
99 tC=ReceiverFactory::getValue(senderForCoords,nC);
101 ASSERT(nC == (getSpaceDimension() * nN));
103 MEDARRAY<double> mC(tC, getSpaceDimension(), nN,MED_FULL_INTERLACE,true);
104 setCoordinates(&mC,true);
109 //=============================================================================
111 * Retourne les coordonnées
113 //=============================================================================
115 const double * COORDINATEClient::getCoordinates(medModeSwitch Mode)
117 if (!_complete) fillCopy();
118 const double * c = COORDINATE::getCoordinates(Mode);
122 //=============================================================================
124 * Retourne une coordonnée
126 //=============================================================================
128 double COORDINATEClient::getCoordinate(int Number,int Axis)
130 if (!_complete) fillCopy();
131 double d = COORDINATE::getCoordinate(Number, Axis);
135 //=============================================================================
139 //=============================================================================
140 const double * COORDINATEClient::getCoordinateAxis(int Axis)
142 if (!_complete) fillCopy();
143 const double *c = COORDINATE::getCoordinateAxis(Axis);
147 //=============================================================================
149 * Retourne le nombre de noeuds
151 //=============================================================================
152 const int* COORDINATEClient::getNodesNumbers() const
154 if (!_complete) (const_cast < COORDINATEClient * >(this))->fillCopy();
156 MESSAGE("NON IMPLEMENTE DANS L'API CORBA");