1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "MEDCouplingSkyLineArray.hxx"
24 using namespace MEDCoupling;
26 MEDCouplingSkyLineArray::MEDCouplingSkyLineArray():
27 _index( DataArrayInt::New() ), _value( DataArrayInt::New() )
31 MEDCouplingSkyLineArray::MEDCouplingSkyLineArray(const MEDCouplingSkyLineArray &myArray)
33 _index=myArray._index;
34 _value=myArray._value;
37 MEDCouplingSkyLineArray::~MEDCouplingSkyLineArray()
41 MEDCouplingSkyLineArray::MEDCouplingSkyLineArray(DataArrayInt* index, DataArrayInt* value)
46 MEDCouplingSkyLineArray::MEDCouplingSkyLineArray( const std::vector<int>& index,
47 const std::vector<int>& value ):
48 _index( DataArrayInt::New() ), _value( DataArrayInt::New() )
50 _index->reserve( index.size() );
51 _index->insertAtTheEnd( index.begin(), index.end() );
52 _value->reserve( value.size() );
53 _value->insertAtTheEnd( value.begin(), value.end() );
56 void MEDCouplingSkyLineArray::set( DataArrayInt* index, DataArrayInt* value )
60 if ( (DataArrayInt*)_index ) _index->incrRef();
61 else _index = DataArrayInt::New();
62 if ( (DataArrayInt*)_value ) _value->incrRef();
63 else _value = DataArrayInt::New();
66 DataArrayInt* MEDCouplingSkyLineArray::getIndexArray() const
68 return ((MEDCouplingSkyLineArray*)this)->_index;
71 DataArrayInt* MEDCouplingSkyLineArray::getValueArray() const
73 return ((MEDCouplingSkyLineArray*)this)->_value;
76 std::string MEDCouplingSkyLineArray::simpleRepr() const
78 std::ostringstream oss;
79 oss << "MEDCouplingSkyLineArray" << std::endl;
80 oss << " Nb of items: " << getNumberOf() << std::endl;
81 oss << " Nb of values: " << getLength() << std::endl;
82 oss << " Index:" << std::endl;
84 const int * i = _index->begin();
85 for ( ; i != _index->end(); ++i )
88 oss << " Value:" << std::endl;
90 const int * v = _value->begin();
92 for ( i = _index->begin(); v != _value->end(); ++v, ++cnt )