Salome HOME
projects
/
tools
/
medcoupling.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[EDF26877] : management of computation of measure field on field on Gauss Point in...
[tools/medcoupling.git]
/
src
/
MEDCoupling
/
MEDCouplingPartDefinition.cxx
diff --git
a/src/MEDCoupling/MEDCouplingPartDefinition.cxx
b/src/MEDCoupling/MEDCouplingPartDefinition.cxx
index 86b07eb8249e89effb6064ea98220279939addeb..2835ec3c30146c55ec5eed9f5471aa68af8b2b52 100644
(file)
--- a/
src/MEDCoupling/MEDCouplingPartDefinition.cxx
+++ b/
src/MEDCoupling/MEDCouplingPartDefinition.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-20
15
CEA/DEN, EDF R&D
+// Copyright (C) 2007-20
22
CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-20,19
+20,22
@@
#include "MEDCouplingPartDefinition.hxx"
#include "MEDCouplingPartDefinition.hxx"
+#include <functional>
+#include <sstream>
+
using namespace MEDCoupling;
using namespace MEDCoupling;
-PartDefinition *PartDefinition::New(
int start, int stop, int
step)
+PartDefinition *PartDefinition::New(
mcIdType start, mcIdType stop, mcIdType
step)
{
return SlicePartDefinition::New(start,stop,step);
}
{
return SlicePartDefinition::New(start,stop,step);
}
-PartDefinition *PartDefinition::New(DataArrayI
nt
*listOfIds)
+PartDefinition *PartDefinition::New(DataArrayI
dType
*listOfIds)
{
return DataArrayPartDefinition::New(listOfIds);
}
{
return DataArrayPartDefinition::New(listOfIds);
}
-PartDefinition *PartDefinition::Unserialize(std::vector<
int>& tinyInt, std::vector< MCAuto<DataArrayInt
> >& bigArraysI)
+PartDefinition *PartDefinition::Unserialize(std::vector<
mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType
> >& bigArraysI)
{
if(tinyInt.empty())
{
{
if(tinyInt.empty())
{
@@
-54,7
+57,7
@@
PartDefinition::~PartDefinition()
{
}
{
}
-DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayI
nt
*listOfIds)
+DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayI
dType
*listOfIds)
{
return new DataArrayPartDefinition(listOfIds);
}
{
return new DataArrayPartDefinition(listOfIds);
}
@@
-72,7
+75,7
@@
bool DataArrayPartDefinition::isEqual(const PartDefinition *other, std::string&
what="DataArrayPartDefinition::isEqual : other is not DataArrayPartDefinition !";
return false;
}
what="DataArrayPartDefinition::isEqual : other is not DataArrayPartDefinition !";
return false;
}
- const DataArrayI
nt
*arr0(_arr),*arr1(otherC->_arr);
+ const DataArrayI
dType
*arr0(_arr),*arr1(otherC->_arr);
if(!arr0 && !arr1)
return true;
if((arr0 && !arr1) || (!arr0 && arr1))
if(!arr0 && !arr1)
return true;
if((arr0 && !arr1) || (!arr0 && arr1))
@@
-92,13
+95,13
@@
bool DataArrayPartDefinition::isEqual(const PartDefinition *other, std::string&
DataArrayPartDefinition *DataArrayPartDefinition::deepCopy() const
{
DataArrayPartDefinition *DataArrayPartDefinition::deepCopy() const
{
- const DataArrayI
nt
*arr(_arr);
+ const DataArrayI
dType
*arr(_arr);
if(!arr)
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::deepCopy : array is null !");
if(!arr)
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::deepCopy : array is null !");
- return DataArrayPartDefinition::New(const_cast<DataArrayI
nt
*>(arr));
+ return DataArrayPartDefinition::New(const_cast<DataArrayI
dType
*>(arr));
}
}
-
int
DataArrayPartDefinition::getNumberOfElems() const
+
mcIdType
DataArrayPartDefinition::getNumberOfElems() const
{
checkInternalArrayOK();
return _arr->getNumberOfTuples();
{
checkInternalArrayOK();
return _arr->getNumberOfTuples();
@@
-121,7
+124,7
@@
PartDefinition *DataArrayPartDefinition::operator+(const PartDefinition& other)
std::string DataArrayPartDefinition::getRepr() const
{
std::ostringstream oss; oss << "DataArray Part : ";
std::string DataArrayPartDefinition::getRepr() const
{
std::ostringstream oss; oss << "DataArray Part : ";
- const DataArrayI
nt
*arr(_arr);
+ const DataArrayI
dType
*arr(_arr);
if(arr)
arr->reprQuickOverview(oss);
else
if(arr)
arr->reprQuickOverview(oss);
else
@@
-142,19
+145,19
@@
PartDefinition *DataArrayPartDefinition::composeWith(const PartDefinition *other
const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(other));
if(spd)
{//special case for optim
const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(other));
if(spd)
{//special case for optim
-
int
a(0),b(0),c(0);
+
mcIdType
a(0),b(0),c(0);
spd->getSlice(a,b,c);
if(c==1)
{
spd->getSlice(a,b,c);
if(c==1)
{
- MCAuto<DataArrayI
nt> arr(DataArrayInt
::New());
+ MCAuto<DataArrayI
dType> arr(DataArrayIdType
::New());
arr->alloc(_arr->getNumberOfTuples(),1);
arr->alloc(_arr->getNumberOfTuples(),1);
- std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind
2nd(std::plus<int>()
,a));
+ std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind
(std::plus<mcIdType>(),std::placeholders::_1
,a));
return DataArrayPartDefinition::New(arr);
}
}
//
return DataArrayPartDefinition::New(arr);
}
}
//
- MCAuto<DataArrayI
nt
> arr1(other->toDAI());
- MCAuto<DataArrayI
nt
> arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end()));
+ MCAuto<DataArrayI
dType
> arr1(other->toDAI());
+ MCAuto<DataArrayI
dType
> arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end()));
return DataArrayPartDefinition::New(arr2);
}
return DataArrayPartDefinition::New(arr2);
}
@@
-171,7
+174,7
@@
void DataArrayPartDefinition::checkConsistencyLight() const
PartDefinition *DataArrayPartDefinition::tryToSimplify() const
{
checkConsistencyLight();
PartDefinition *DataArrayPartDefinition::tryToSimplify() const
{
checkConsistencyLight();
-
int
a(0),b(0),c(0);
+
mcIdType
a(0),b(0),c(0);
if(_arr->isRange(a,b,c))
{
return SlicePartDefinition::New(a,b,c);
if(_arr->isRange(a,b,c))
{
return SlicePartDefinition::New(a,b,c);
@@
-184,21
+187,21
@@
PartDefinition *DataArrayPartDefinition::tryToSimplify() const
}
}
}
}
-void DataArrayPartDefinition::serialize(std::vector<
int>& tinyInt, std::vector< MCAuto<DataArrayInt
> >& bigArraysI) const
+void DataArrayPartDefinition::serialize(std::vector<
mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType
> >& bigArraysI) const
{
bigArraysI.push_back(_arr);
}
{
bigArraysI.push_back(_arr);
}
-DataArrayI
nt
*DataArrayPartDefinition::toDAI() const
+DataArrayI
dType
*DataArrayPartDefinition::toDAI() const
{
checkInternalArrayOK();
{
checkInternalArrayOK();
- const DataArrayI
nt
*arr(_arr);
- DataArrayI
nt *arr2(const_cast<DataArrayInt
*>(arr));
+ const DataArrayI
dType
*arr(_arr);
+ DataArrayI
dType *arr2(const_cast<DataArrayIdType
*>(arr));
arr2->incrRef();
return arr2;
}
arr2->incrRef();
return arr2;
}
-DataArrayPartDefinition::DataArrayPartDefinition(DataArrayI
nt
*listOfIds)
+DataArrayPartDefinition::DataArrayPartDefinition(DataArrayI
dType
*listOfIds)
{
CheckInternalArrayOK(listOfIds);
_arr=listOfIds;
{
CheckInternalArrayOK(listOfIds);
_arr=listOfIds;
@@
-210,7
+213,7
@@
void DataArrayPartDefinition::checkInternalArrayOK() const
CheckInternalArrayOK(_arr);
}
CheckInternalArrayOK(_arr);
}
-void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayI
nt
*listOfIds)
+void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayI
dType
*listOfIds)
{
if(!listOfIds || !listOfIds->isAllocated() || listOfIds->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::CheckInternalArrayOK : Input list must be not null allocated and with one components !");
{
if(!listOfIds || !listOfIds->isAllocated() || listOfIds->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::CheckInternalArrayOK : Input list must be not null allocated and with one components !");
@@
-218,7
+221,7
@@
void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayInt *listOfIds
void DataArrayPartDefinition::updateTime() const
{
void DataArrayPartDefinition::updateTime() const
{
- if((const DataArrayI
nt
*)_arr)
+ if((const DataArrayI
dType
*)_arr)
updateTimeWith(*_arr);
}
updateTimeWith(*_arr);
}
@@
-229,22
+232,22
@@
std::size_t DataArrayPartDefinition::getHeapMemorySizeWithoutChildren() const
std::vector<const BigMemoryObject *> DataArrayPartDefinition::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> DataArrayPartDefinition::getDirectChildrenWithNull() const
{
- std::vector<const BigMemoryObject *> ret(1,(const DataArrayI
nt
*)_arr);
+ std::vector<const BigMemoryObject *> ret(1,(const DataArrayI
dType
*)_arr);
return ret;
}
DataArrayPartDefinition *DataArrayPartDefinition::add1(const DataArrayPartDefinition *other) const
{
return ret;
}
DataArrayPartDefinition *DataArrayPartDefinition::add1(const DataArrayPartDefinition *other) const
{
- MCAuto<DataArrayI
nt
> a1(toDAI()),a2(other->toDAI());
- MCAuto<DataArrayI
nt> a3(DataArrayInt
::Aggregate(a1,a2,0));
+ MCAuto<DataArrayI
dType
> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayI
dType> a3(DataArrayIdType
::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
DataArrayPartDefinition *DataArrayPartDefinition::add2(const SlicePartDefinition *other) const
{
a3->sort();
return DataArrayPartDefinition::New(a3);
}
DataArrayPartDefinition *DataArrayPartDefinition::add2(const SlicePartDefinition *other) const
{
- MCAuto<DataArrayI
nt
> a1(toDAI()),a2(other->toDAI());
- MCAuto<DataArrayI
nt> a3(DataArrayInt
::Aggregate(a1,a2,0));
+ MCAuto<DataArrayI
dType
> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayI
dType> a3(DataArrayIdType
::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
a3->sort();
return DataArrayPartDefinition::New(a3);
}
@@
-253,7
+256,7
@@
DataArrayPartDefinition::~DataArrayPartDefinition()
{
}
{
}
-SlicePartDefinition *SlicePartDefinition::New(
int start, int stop, int
step)
+SlicePartDefinition *SlicePartDefinition::New(
mcIdType start, mcIdType stop, mcIdType
step)
{
return new SlicePartDefinition(start,stop,step);
}
{
return new SlicePartDefinition(start,stop,step);
}
@@
-285,12
+288,12
@@
SlicePartDefinition *SlicePartDefinition::deepCopy() const
return SlicePartDefinition::New(_start,_stop,_step);
}
return SlicePartDefinition::New(_start,_stop,_step);
}
-DataArrayI
nt
*SlicePartDefinition::toDAI() const
+DataArrayI
dType
*SlicePartDefinition::toDAI() const
{
{
- return DataArrayI
nt
::Range(_start,_stop,_step);
+ return DataArrayI
dType
::Range(_start,_stop,_step);
}
}
-
int
SlicePartDefinition::getNumberOfElems() const
+
mcIdType
SlicePartDefinition::getNumberOfElems() const
{
return DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getNumberOfElems");
}
{
return DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getNumberOfElems");
}
@@
-319,8
+322,8
@@
PartDefinition *SlicePartDefinition::composeWith(const PartDefinition *other) co
throw INTERP_KERNEL::Exception("SlicePartDefinition::composeWith : input PartDef must be not NULL !");
checkConsistencyLight();
other->checkConsistencyLight();
throw INTERP_KERNEL::Exception("SlicePartDefinition::composeWith : input PartDef must be not NULL !");
checkConsistencyLight();
other->checkConsistencyLight();
- MCAuto<DataArrayI
nt
> arr(other->toDAI());
- MCAuto<DataArrayI
nt
> arr1(arr->selectByTupleIdSafeSlice(_start,_stop,_step));
+ MCAuto<DataArrayI
dType
> arr(other->toDAI());
+ MCAuto<DataArrayI
dType
> arr1(arr->selectByTupleIdSafeSlice(_start,_stop,_step));
return DataArrayPartDefinition::New(arr1);
}
return DataArrayPartDefinition::New(arr1);
}
@@
-343,7
+346,7
@@
PartDefinition *SlicePartDefinition::tryToSimplify() const
return ret;
}
return ret;
}
-void SlicePartDefinition::serialize(std::vector<
int>& tinyInt, std::vector< MCAuto<DataArrayInt
> >& bigArraysI) const
+void SlicePartDefinition::serialize(std::vector<
mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType
> >& bigArraysI) const
{
tinyInt.push_back(_start);
tinyInt.push_back(_stop);
{
tinyInt.push_back(_start);
tinyInt.push_back(_stop);
@@
-357,20
+360,20
@@
std::string SlicePartDefinition::getRepr() const
return oss.str();
}
return oss.str();
}
-
int
SlicePartDefinition::getEffectiveStop() const
+
mcIdType
SlicePartDefinition::getEffectiveStop() const
{
{
-
int
nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop"));
+
mcIdType
nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop"));
return _start+nbElems*_step;
}
return _start+nbElems*_step;
}
-void SlicePartDefinition::getSlice(
int& start, int& stop, int
& step) const
+void SlicePartDefinition::getSlice(
mcIdType& start, mcIdType& stop, mcIdType
& step) const
{
start=_start;
stop=_stop;
step=_step;
}
{
start=_start;
stop=_stop;
step=_step;
}
-SlicePartDefinition::SlicePartDefinition(
int start, int stop, int
step):_start(start),_stop(stop),_step(step)
+SlicePartDefinition::SlicePartDefinition(
mcIdType start, mcIdType stop, mcIdType
step):_start(start),_stop(stop),_step(step)
{
}
{
}
@@
-393,8
+396,8
@@
std::vector<const BigMemoryObject *> SlicePartDefinition::getDirectChildrenWithN
DataArrayPartDefinition *SlicePartDefinition::add1(const DataArrayPartDefinition *other) const
{
DataArrayPartDefinition *SlicePartDefinition::add1(const DataArrayPartDefinition *other) const
{
- MCAuto<DataArrayI
nt
> a1(toDAI()),a2(other->toDAI());
- MCAuto<DataArrayI
nt> a3(DataArrayInt
::Aggregate(a1,a2,0));
+ MCAuto<DataArrayI
dType
> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayI
dType> a3(DataArrayIdType
::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
a3->sort();
return DataArrayPartDefinition::New(a3);
}
@@
-407,8
+410,8
@@
PartDefinition *SlicePartDefinition::add2(const SlicePartDefinition *other) cons
}
else
{
}
else
{
- MCAuto<DataArrayI
nt
> a1(toDAI()),a2(other->toDAI());
- MCAuto<DataArrayI
nt> a3(DataArrayInt
::Aggregate(a1,a2,0));
+ MCAuto<DataArrayI
dType
> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayI
dType> a3(DataArrayIdType
::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
a3->sort();
return DataArrayPartDefinition::New(a3);
}