X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FGaussPoints%2FInterpKernelGaussCoords.cxx;h=42ef1a89d3dcf1ac6282e1eeace1936673141037;hb=1123dccd6613b2e8abba35182759d5c4a11ecc8d;hp=82278ad732f272bbff899798a2dc7a92efa02dcd;hpb=97cb0a4204e5575274deeea485cb8cdb4c3d96d3;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx index 82278ad73..42ef1a89d 100644 --- a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx +++ b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2014 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 // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -187,13 +187,51 @@ bool GaussInfo::isSatisfy() return anIsSatisfy; } +std::vector GaussInfo::NormalizeCoordinatesIfNecessary(NormalizedCellType ct, int inputDim, const std::vector& inputArray) +{ + std::size_t sz(inputArray.size()),dim((std::size_t)inputDim); + if(dim==0) + throw INTERP_KERNEL::Exception("GaussInfo::NormalizeCoordinatesIfNecessary : invalid dimension ! Must be !=0 !"); + if(sz%dim!=0) + throw INTERP_KERNEL::Exception("GaussInfo::NormalizeCoordinatesIfNecessary : invalid input array ! Inconsistent with the given dimension !"); + const CellModel& cm(CellModel::GetCellModel(ct)); + std::size_t baseDim((std::size_t)cm.getDimension()); + if(baseDim==dim) + return inputArray; + std::size_t nbOfItems(sz/dim); + std::vector ret(nbOfItems*baseDim); + if(baseDim>dim) + { + for(std::size_t i=0;i