]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/MEDLoader/MEDFileStructureElement.cxx
Salome HOME
After meshsupport the struture elements...
[tools/medcoupling.git] / src / MEDLoader / MEDFileStructureElement.cxx
1 // Copyright (C) 2007-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (EDF R&D)
20
21 #include "MEDFileStructureElement.hxx"
22 #include "MEDLoaderBase.hxx"
23 #include "MEDFileMeshLL.hxx"
24 #include "MEDFileSafeCaller.txx"
25
26 #include "InterpKernelAutoPtr.hxx"
27
28 using namespace MEDCoupling;
29
30 MEDFileStructureElement *MEDFileStructureElement::New(med_idt fid, int idSE)
31 {
32   return new MEDFileStructureElement(fid,idSE);
33 }
34
35 MEDFileStructureElement::MEDFileStructureElement(med_idt fid, int idSE)
36 {
37   INTERP_KERNEL::AutoPtr<char> modelName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),supportMeshName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
38   med_geometry_type sgeoType;
39   med_entity_type entiyType;
40   int nConsAttr(0),nVarAttr(0);
41   {
42     med_bool anyPfl;
43     int nnode(0),ncell(0);
44     MEDstructElementInfo(fid,idSE+1,modelName,&_id_type,&_dim,supportMeshName,&entiyType,&nnode,&ncell,&sgeoType,&nConsAttr,&anyPfl,&nVarAttr);
45   }
46   _model_name=MEDLoaderBase::buildStringFromFortran(modelName,MED_NAME_SIZE);
47   _geo_type=MEDFileMesh::ConvertFromMEDFile(sgeoType);
48 }
49
50 MEDFileStructureElements *MEDFileStructureElements::New(med_idt fid)
51 {
52   return new MEDFileStructureElements(fid);
53 }
54
55 MEDFileStructureElements *MEDFileStructureElements::New()
56 {
57   return new MEDFileStructureElements;
58 }
59
60 std::vector<const BigMemoryObject *> MEDFileStructureElements::getDirectChildrenWithNull() const
61 {
62   std::vector<const BigMemoryObject *> ret;
63   for(std::vector< MCAuto<MEDFileStructureElement> >::const_iterator it=_elems.begin();it!=_elems.end();it++)
64     ret.push_back(*it);
65   return ret;
66 }
67
68 std::size_t MEDFileStructureElements::getHeapMemorySizeWithoutChildren() const
69 {
70   return _elems.capacity()*sizeof(MEDFileStructureElement);
71 }
72
73 void MEDFileStructureElements::writeLL(med_idt fid) const
74 {
75 }
76
77 MEDFileStructureElements::MEDFileStructureElements(med_idt fid)
78 {
79   int nbSE(MEDnStructElement(fid));
80   _elems.resize(nbSE);
81   for(int i=0;i<nbSE;i++)
82     _elems[i]=MEDFileStructureElement::New(fid,i);
83 }
84
85 MEDFileStructureElements::MEDFileStructureElements()
86 {
87 }
88
89 MEDFileStructureElements::~MEDFileStructureElements()
90 {
91 }
92