+++ /dev/null
----
-Checks: -*,clang-diagnostic-*,-clang-diagnostic-sign-conversion,clang-analyzer-*,modernize-use-override,modernize-use-nullptr,modernize-use-default-member-init,modernize-loop-convert,modernize-use-auto,modernize-redundant-void-arg,modernize-type-traits,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,misc-const-correctness,misc-unused-parameters,misc-definitions-in-headers,misc-header-include-cycle,misc-redundant-expression,misc-static-assert
-WarningsAsErrors: ''
-HeaderFileExtensions:
- - ''
- - h
- - hh
- - hpp
- - hxx
- - txx
-ImplementationFileExtensions:
- - c
- - cc
- - cpp
- - cxx
-HeaderFilterRegex: ''
-FormatStyle: none
-CheckOptions:
- cert-dcl16-c.NewSuffixes: L;LL;LU;LLU
- cert-err33-c.AllowCastToVoid: 'true'
- cert-err33-c.CheckedFunctions: ::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;
- cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
- cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
- cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true'
- google-readability-braces-around-statements.ShortStatementLines: '1'
- google-readability-function-size.StatementThreshold: '800'
- google-readability-namespace-comments.ShortNamespaceLines: '10'
- google-readability-namespace-comments.SpacesBeforeComments: '2'
- llvm-else-after-return.WarnOnConditionVariables: 'false'
- llvm-else-after-return.WarnOnUnfixable: 'false'
- llvm-qualified-auto.AddConstToQualified: 'false'
-SystemHeaders: false
namespace ICoCo
{
- MEDDoubleField::MEDDoubleField() : _field(nullptr) {}
+ MEDDoubleField::MEDDoubleField() : _field(0) {}
MEDDoubleField::MEDDoubleField(MEDCoupling::MEDCouplingFieldDouble *field):_field(field)
{
#define ICoCoMEDDoubleField_included
#include "ICoCoField.hxx"
-#include "ICoCo_DeclSpec.hxx"
namespace MEDCoupling
{
/*! @brief Destructor.
*/
- ~MEDDoubleField() override;
+ virtual ~MEDDoubleField();
/*! @brief Get the internal MEDCoupling field object.
* @return a pointer to the MEDCouplingField object detained by this instance. Note that the corresponding
//
#include "ICoCoMEDIntField.h"
-#include "ICoCoMEDIntField.hxx"
#include "MEDCouplingFieldInt32.hxx"
namespace ICoCo
{
- MEDIntField::MEDIntField() : _field(nullptr) {}
+ MEDIntField::MEDIntField() : _field(0) {}
/*! Constructor directly attaching a MEDCouplingFieldInt
the object does not take the control the objects pointed by
#define ICoCoMEDIntField_included
#include "ICoCoField.hxx"
-#include "ICoCo_DeclSpec.hxx"
namespace MEDCoupling
{
/*! @brief Destructor.
*/
- ~MEDIntField() override;
+ virtual ~MEDIntField();
/*! @brief Get the internal MEDCoupling field object.
* @return a pointer to the MEDCouplingField object detained by this instance. Note that the corresponding
#include <vector>
#include <algorithm>
+#include <iostream>
#include <memory>
#include <limits>
#include <cmath>
#ifndef __BBTREEDST_TXX__
#define __BBTREEDST_TXX__
-#include <algorithm>
#include <vector>
+#include <algorithm>
+#include <iostream>
#include <limits>
#include <cmath>
-#include "MCIdType.hxx"
-
template <int dim>
class BBTreeDst
{
double _min_right;
const double *_bb;
std::vector<mcIdType> _elems;
- double *_terminal{nullptr};
+ double *_terminal;
mcIdType _nbelems;
static const int MIN_NB_ELEMS=15;
static const int MAX_LEVEL=20;
public:
BBTreeDst(const double* bbs, mcIdType* elems, int level, mcIdType nbelems):
- _left(0),_right(0),_level(level),_bb(bbs),_nbelems(nbelems)
+ _left(0),_right(0),_level(level),_bb(bbs),_terminal(0),_nbelems(nbelems)
{
if((nbelems < MIN_NB_ELEMS || level> MAX_LEVEL))
_terminal=new double[2*dim];
fillBBoxTerminal(bbs);
return ;
}
- auto *nodes=new double[nbelems];
+ double *nodes=new double[nbelems];
for (mcIdType i=0; i<nbelems; i++)
nodes[i]=bbs[_elems[i]*dim*2+(level%dim)*2];
std::nth_element<double*>(nodes, nodes+nbelems/2, nodes+nbelems);
- double const median = *(nodes+nbelems/2);
+ double median = *(nodes+nbelems/2);
delete [] nodes;
std::vector<mcIdType> new_elems_left;
std::vector<mcIdType> new_elems_right;
for(mcIdType i=0; i<nbelems;i++)
{
mcIdType elem;
- if (elems!=nullptr)
+ if (elems!=0)
elem= elems[i];
else
elem=i;
_max_left=max_left;
_min_right=min_right;
mcIdType *tmp;
- tmp=nullptr;
+ tmp=0;
if(!new_elems_left.empty())
tmp=&(new_elems_left[0]);
_left=new BBTreeDst(bbs, tmp, level+1, ToIdType(new_elems_left.size()));
- tmp=nullptr;
+ tmp=0;
if(!new_elems_right.empty())
tmp=&(new_elems_right[0]);
_right=new BBTreeDst(bbs, tmp, level+1, ToIdType(new_elems_right.size()));
}
else
{
- double const minOfMaxDsts=sqrt(minOfMaxDstsSq);
+ double minOfMaxDsts=sqrt(minOfMaxDstsSq);
if(_min_right-pt[_level%dim]>minOfMaxDsts)
{ _left->getElemsWhoseMinDistanceToPtSmallerThan(pt,minOfMaxDstsSq,elems); return ; }
if(pt[_level%dim]-_max_left>minOfMaxDsts)
}
else
{
- double const minOfMaxDsts=sqrt(minOfMaxDstsSq);
+ double minOfMaxDsts=sqrt(minOfMaxDstsSq);
if(_min_right-pt[_level%dim]>minOfMaxDsts)
{ _left->getMinDistanceOfMax(pt,minOfMaxDstsSq); return ; }
if(pt[_level%dim]-_max_left>minOfMaxDsts)
for (int idim=0; idim<dim; idim++)
{
double val1=pt[idim]-bbox[idim*2],val2=pt[idim]-bbox[idim*2+1];
- double const x=std::max(fabs(val1),fabs(val2));
+ double x=std::max(fabs(val1),fabs(val2));
zeRes+=x*x;
}
return zeRes;
for (int idim=0; idim<dim; idim++)
{
double val1=pt[idim]-bbox[idim*2],val2=pt[idim]-bbox[idim*2+1];
- char const pos=static_cast<char>((( (0.<val1)-(val1<0.) )+( (0.<val2)-(val2<0.) ))/2);// sign(val) = (0.<val)-(val<0.)
+ char pos=static_cast<char>((( (0.<val1)-(val1<0.) )+( (0.<val2)-(val2<0.) ))/2);// sign(val) = (0.<val)-(val<0.)
if(pos!=0)
{
- double const x=pos==1?val2:val1;
+ double x=pos==1?val2:val1;
zeRes+=x*x;
}
}
#include <vector>
#include <algorithm>
+#include <iostream>
#include <limits>
#include <cmath>
BBTreePts(const double *pts, const ConnType *elems, int level, ConnType nbelems, double epsilon=1e-12):
_left(0),_right(0),_level(level),_pts(pts),_terminal(nbelems < MIN_NB_ELEMS || level> MAX_LEVEL),_nbelems(nbelems),_epsilon(std::abs(epsilon))
{
- auto *nodes=new double[nbelems];
+ double *nodes=new double[nbelems];
_elems.resize(nbelems);
for (ConnType i=0;i<nbelems;i++)
{
#include "BBTree.txx"
#include <memory>
-#include <utility>
-#include <vector>
/*!
* Wrapper over BBTree to deal with ownership of bbox double array.
#include "Intersector3DP1P1.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
Barycentric3DIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, double precision);
#include "Barycentric3DIntersectorP1P1.hxx"
#include "Intersector3DP1P1.txx"
-#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
-#include <vector>
-#include <cstddef>
-#include "NormalizedGeometricTypes"
-#include <cmath>
-#include "CellModel.hxx"
-#include "PointLocatorAlgos.txx"
+#include "MeshUtils.hxx"
namespace INTERP_KERNEL
{
template<class MyMeshType, class MyMatrix>
Barycentric3DIntersectorP1P1<MyMeshType,MyMatrix>::~Barycentric3DIntersectorP1P1()
- = default;
+ {
+ }
/**
* @param targetCell in C mode.
#ifndef __INTERPKERNELASSERT_HXX__
#define __INTERPKERNELASSERT_HXX__
+#include "InterpKernelException.hxx"
+#include <sstream>
#define IKAssert(a) { bool verdict(a); \
if(!verdict) { std::ostringstream osszz; osszz << "Assertion \"" << #a << "\" failed into " << __FILE__ << " at line " << __LINE__ << " !"; throw INTERP_KERNEL::Exception(osszz.str()); } }
{
}
-INTERP_KERNEL::Exception::Exception(const char *reason, const char * /*file*/, int /*line*/):_reason(reason)
+INTERP_KERNEL::Exception::Exception(const char *reason, const char *file, int line):_reason(reason)
{
}
INTERP_KERNEL::Exception::~Exception() noexcept(true)
-= default;
+{
+}
const char *INTERP_KERNEL::Exception::what() const noexcept(true)
{
INTERPKERNEL_EXPORT Exception(const char *reason);
INTERPKERNEL_EXPORT Exception(const std::string& reason);
INTERPKERNEL_EXPORT Exception(const char *reason, const char *file, int line);
- INTERPKERNEL_EXPORT ~Exception() noexcept(true) override;
- INTERPKERNEL_EXPORT const char *what() const noexcept(true) override;
+ INTERPKERNEL_EXPORT ~Exception() noexcept(true);
+ INTERPKERNEL_EXPORT const char *what() const noexcept(true);
protected:
std::string _reason;
};
#ifndef __INTERPKERNELHASHMAP__
#define __INTERPKERNELHASHMAP__
-#include "InterpKernelHashFun.hxx"
#include "InterpKernelStlExt.hxx"
#include "InterpKernelHashTable.hxx"
-#include <functional>
-#include <memory>
-#include <utility>
-#include <iterator>
namespace INTERP_KERNEL
{
class HashMap
{
private:
- using _Ht = hashtable<std::pair<const _Key, _Tp>, _Key, _HashFn, STLEXT::Select1st<std::pair<const _Key, _Tp>>, _EqualKey, _Alloc>;
+ typedef hashtable<std::pair<const _Key, _Tp>,_Key, _HashFn,
+ STLEXT::Select1st<std::pair<const _Key, _Tp> >,
+ _EqualKey, _Alloc> _Ht;
_Ht _M_ht;
public:
- using key_type = typename _Ht::key_type;
- using data_type = _Tp;
- using mapped_type = _Tp;
- using value_type = typename _Ht::value_type;
- using hasher = typename _Ht::hasher;
- using key_equal = typename _Ht::key_equal;
-
- using size_type = typename _Ht::size_type;
- using difference_type = typename _Ht::difference_type;
- using pointer = typename _Ht::pointer;
- using const_pointer = typename _Ht::const_pointer;
- using reference = typename _Ht::reference;
- using const_reference = typename _Ht::const_reference;
-
- using iterator = typename _Ht::iterator;
- using const_iterator = typename _Ht::const_iterator;
-
- using allocator_type = typename _Ht::allocator_type;
+ typedef typename _Ht::key_type key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
hasher hash_funct() const { return _M_ht.hash_funct(); }
class HashMultiMap
{
private:
- using _Ht = hashtable<std::pair<const _Key, _Tp>, _Key, _HashFn, STLEXT::Select1st<std::pair<const _Key, _Tp>>, _EqualKey, _Alloc>;
+ typedef hashtable<std::pair<const _Key, _Tp>, _Key, _HashFn,
+ STLEXT::Select1st<std::pair<const _Key, _Tp> >, _EqualKey, _Alloc>
+ _Ht;
_Ht _M_ht;
public:
- using key_type = typename _Ht::key_type;
- using data_type = _Tp;
- using mapped_type = _Tp;
- using value_type = typename _Ht::value_type;
- using hasher = typename _Ht::hasher;
- using key_equal = typename _Ht::key_equal;
-
- using size_type = typename _Ht::size_type;
- using difference_type = typename _Ht::difference_type;
- using pointer = typename _Ht::pointer;
- using const_pointer = typename _Ht::const_pointer;
- using reference = typename _Ht::reference;
- using const_reference = typename _Ht::const_reference;
-
- using iterator = typename _Ht::iterator;
- using const_iterator = typename _Ht::const_iterator;
-
- using allocator_type = typename _Ht::allocator_type;
+ typedef typename _Ht::key_type key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
hasher hash_funct() const { return _M_ht.hash_funct(); }
_EqKey, _Alloc> >
{
protected:
- using _Container = INTERP_KERNEL::HashMap<_Key, _Tp, _HashFn, _EqKey, _Alloc>;
+ typedef INTERP_KERNEL::HashMap<_Key, _Tp, _HashFn, _EqKey, _Alloc>
+ _Container;
_Container* container;
public:
- using container_type = _Container;
- using iterator_category = output_iterator_tag;
- using value_type = void;
- using difference_type = void;
- using pointer = void;
- using reference = void;
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
insert_iterator(_Container& __x) : container(&__x) {}
_EqKey, _Alloc> >
{
protected:
- using _Container = INTERP_KERNEL::HashMultiMap<_Key, _Tp, _HashFn, _EqKey, _Alloc>;
+ typedef INTERP_KERNEL::HashMultiMap<_Key, _Tp, _HashFn, _EqKey, _Alloc>
+ _Container;
_Container* container;
typename _Container::iterator iter;
public:
- using container_type = _Container;
- using iterator_category = output_iterator_tag;
- using value_type = void;
- using difference_type = void;
- using pointer = void;
- using reference = void;
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
insert_iterator(_Container& __x) : container(&__x) {}
#ifndef __INTERPKERNELHASHTABLE_HXX__
#define __INTERPKERNELHASHTABLE_HXX__
+#include "InterpKernelStlExt.hxx"
+#include "InterpKernelHashFun.hxx"
-#include <memory>
-#include <cstddef>
-#include <utility>
#include <vector>
#include <iterator>
#include <algorithm>
+#include <functional>
namespace INTERP_KERNEL
{
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_iterator
{
- using _Hashtable = hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
- using iterator = _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
- using const_iterator = _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
- using _Node = _Hashtable_node<_Val>;
- using iterator_category = std::forward_iterator_tag;
- using value_type = _Val;
- using difference_type = std::ptrdiff_t;
- using size_type = std::size_t;
- using reference = _Val &;
- using pointer = _Val *;
+ typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
+ _Hashtable;
+ typedef _Hashtable_iterator<_Val, _Key, _HashFcn,
+ _ExtractKey, _EqualKey, _Alloc>
+ iterator;
+ typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
+ _ExtractKey, _EqualKey, _Alloc>
+ const_iterator;
+ typedef _Hashtable_node<_Val> _Node;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef _Val value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef _Val& reference;
+ typedef _Val* pointer;
_Node* _M_cur;
_Hashtable* _M_ht;
_Hashtable_iterator(_Node* __n, _Hashtable* __tab)
: _M_cur(__n), _M_ht(__tab) { }
- _Hashtable_iterator() = default;
+ _Hashtable_iterator() { }
reference
operator*() const
class _ExtractKey, class _EqualKey, class _Alloc>
struct _Hashtable_const_iterator
{
- using _Hashtable = hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
- using iterator = _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
- using const_iterator = _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
- using _Node = _Hashtable_node<_Val>;
-
- using iterator_category = std::forward_iterator_tag;
- using value_type = _Val;
- using difference_type = std::ptrdiff_t;
- using size_type = std::size_t;
- using reference = const _Val &;
- using pointer = const _Val *;
+ typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
+ _Hashtable;
+ typedef _Hashtable_iterator<_Val,_Key,_HashFcn,
+ _ExtractKey,_EqualKey,_Alloc>
+ iterator;
+ typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
+ _ExtractKey, _EqualKey, _Alloc>
+ const_iterator;
+ typedef _Hashtable_node<_Val> _Node;
+
+ typedef std::forward_iterator_tag iterator_category;
+ typedef _Val value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef const _Val& reference;
+ typedef const _Val* pointer;
const _Node* _M_cur;
const _Hashtable* _M_ht;
_Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
: _M_cur(__n), _M_ht(__tab) { }
- _Hashtable_const_iterator() = default;
+ _Hashtable_const_iterator() { }
_Hashtable_const_iterator(const iterator& __it)
: _M_cur(__it._M_cur), _M_ht(__it._M_ht) { }
class hashtable
{
public:
- using key_type = _Key;
- using value_type = _Val;
- using hasher = _HashFcn;
- using key_equal = _EqualKey;
-
- using size_type = std::size_t;
- using difference_type = std::ptrdiff_t;
- using pointer = value_type *;
- using const_pointer = const value_type *;
- using reference = value_type &;
- using const_reference = const value_type &;
+ typedef _Key key_type;
+ typedef _Val value_type;
+ typedef _HashFcn hasher;
+ typedef _EqualKey key_equal;
+
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
hasher hash_funct() const { return _M_hash; }
key_equal key_eq() const { return _M_equals; }
private:
- using _Node = _Hashtable_node<_Val>;
+ typedef _Hashtable_node<_Val> _Node;
public:
- using allocator_type = typename _Alloc::template rebind<value_type>::other;
+ typedef typename _Alloc::template rebind<value_type>::other allocator_type;
allocator_type get_allocator() const { return _M_node_allocator; }
private:
- using _Node_Alloc = typename _Alloc::template rebind<_Node>::other;
- using _Nodeptr_Alloc = typename _Alloc::template rebind<_Node *>::other;
- using _Vector_type = std::vector<_Node *, _Nodeptr_Alloc>;
+ typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc;
+ typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc;
+ typedef std::vector<_Node*, _Nodeptr_Alloc> _Vector_type;
_Node_Alloc _M_node_allocator;
size_type _M_num_elements;
public:
- using iterator = _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
- using const_iterator = _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
+ typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey,
+ _EqualKey, _Alloc>
+ iterator;
+ typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,
+ _EqualKey, _Alloc>
+ const_iterator;
friend struct
_Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
#ifndef __INTERPKERNELSTLEXT_HXX__
#define __INTERPKERNELSTLEXT_HXX__
+#include <functional>
namespace INTERP_KERNEL
{
#ifndef __NORMALIZEDUNSTRUCTUREDMESH_HXX__
#define __NORMALIZEDUNSTRUCTUREDMESH_HXX__
+#include "NormalizedGeometricTypes"
namespace INTERP_KERNEL
{
/// Enumeration representing the six coordinates that define the bounding box
enum BoxCoord { XMIN = 0, YMIN = 1, ZMIN = 2, XMAX = 3, YMAX = 4, ZMAX = 5 };
- BoundingBox() = default;
+ BoundingBox() { }
BoundingBox(const double** pts, const unsigned numPts);
BoundingBox(const BoundingBox& box1, const BoundingBox& box2);
- ~BoundingBox() = default;
+ ~BoundingBox() { }
void fillInXMinXmaxYminYmaxZminZmaxFormat(double data[6]) const;
#include "BoxSplittingOptions.hxx"
-#include <ostream>
#include <sstream>
-#include <string>
const double INTERP_KERNEL::BoxSplittingOptions::DFT_EFFICIENCY_GOAL=0.5;
#include "InterpKernelException.hxx"
#include "DiameterCalculator.hxx"
-#include "NormalizedGeometricTypes"
-#include "MCIdType.hxx"
#include "OrientationInverter.hxx"
#include <algorithm>
-#include <map>
-#include <cstddef>
-#include <iterator>
#include <sstream>
-#include <utility>
#include <vector>
#include <limits>
*/
unsigned CellModel::getNumberOfMicroEdges() const
{
- unsigned const mul(isQuadratic()?2:1);
+ unsigned mul(isQuadratic()?2:1);
if(!isDynamic())
{
switch(getDimension())
*/
unsigned CellModel::fillSonCellNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn) const
{
- unsigned const nbOfTurnLoop=_nb_of_sons_con[sonId];
+ unsigned nbOfTurnLoop=_nb_of_sons_con[sonId];
const unsigned *sonConn=_sons_con[sonId];
for(unsigned i=0;i<nbOfTurnLoop;i++)
sonNodalConn[i]=nodalConn[sonConn[i]];
return fillSonCellNodalConnectivity2(sonId,nodalConn,lgth,sonNodalConn,typeOfSon);
}
- unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType /*lgth*/, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
+ unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
{
if(!isDynamic())
{
{
int edgeId(sonId/2),subEdgeId(sonId%2);
typeOfSon=NORM_SEG2;
- const unsigned *sonConn(nullptr);
+ const unsigned *sonConn(0);
switch(getDimension())
{
case 2:
}
else
{
- unsigned int const sz2(sz/2);
+ unsigned int sz2(sz/2);
std::vector<mcIdType> tmp0(sz2-1),tmp1(sz2);
std::copy(nodalConn+1,nodalConn+sz2,tmp0.rbegin());
std::copy(nodalConn+sz2,nodalConn+sz,tmp1.rbegin());
if(!_quadratic)
{
std::vector<mcIdType> tmp(2*lgth);
- auto it=std::copy(conn1,conn1+lgth,tmp.begin());
+ std::vector<mcIdType>::iterator it=std::copy(conn1,conn1+lgth,tmp.begin());
std::copy(conn1,conn1+lgth,it);
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth);
if(it==tmp.begin())
return true;
if(it!=tmp.end())
return _dim!=1;
- auto const it2=std::search(tmp.rbegin(),tmp.rend(),conn2,conn2+lgth);
+ std::vector<mcIdType>::reverse_iterator it2=std::search(tmp.rbegin(),tmp.rend(),conn2,conn2+lgth);
if(it2!=tmp.rend())
return false;
throw INTERP_KERNEL::Exception("CellModel::getOrientationStatus : Request of orientation status of non equal connectively cells !");
if(_dim!=1)
{
std::vector<mcIdType> tmp(lgth);
- auto it=std::copy(conn1,conn1+lgth/2,tmp.begin());
+ std::vector<mcIdType>::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin());
std::copy(conn1,conn1+lgth/2,it);
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth/2);
- std::size_t const d=std::distance(tmp.begin(),it);
+ std::size_t d=std::distance(tmp.begin(),it);
if(it==tmp.end())
return false;
it=std::copy(conn1+lgth/2,conn1+lgth,tmp.begin());
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth);
if(it==tmp.end())
return false;
- std::size_t const d2=std::distance(tmp.begin(),it);
+ std::size_t d2=std::distance(tmp.begin(),it);
return d==d2;
}
else
{
- mcIdType const p=(lgth+1)/2;
+ mcIdType p=(lgth+1)/2;
std::vector<mcIdType> tmp(2*p);
- auto it=std::copy(conn1,conn1+p,tmp.begin());
+ std::vector<mcIdType>::iterator it=std::copy(conn1,conn1+p,tmp.begin());
std::copy(conn1,conn1+p,it);
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+p);
- std::size_t const d=std::distance(tmp.begin(),it);
+ std::size_t d=std::distance(tmp.begin(),it);
if(it==tmp.end())
return false;
tmp.resize(2*p-2);
it=std::search(tmp.begin(),tmp.end(),conn2+p,conn2+lgth);
if(it==tmp.end())
return false;
- std::size_t const d2=std::distance(tmp.begin(),it);
+ std::size_t d2=std::distance(tmp.begin(),it);
return d==d2;
}
}
#include "INTERPKERNELDefines.hxx"
-#include "NormalizedGeometricTypes"
+#include "NormalizedUnstructuredMesh.hxx"
#include "MCIdType.hxx"
#include <map>
#ifndef __CONVEXINTERSECTOR_HXX__
#define __CONVEXINTERSECTOR_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
+#include "PlanarIntersectorP0P0.hxx"
+#include "PlanarIntersectorP0P1.hxx"
+#include "PlanarIntersectorP1P0.hxx"
+#include "PlanarIntersectorP1P1.hxx"
+#include "PlanarIntersectorP1P0Bary.hxx"
+#include "PlanarIntersectorP0P1Bary.hxx"
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
ConvexIntersector(const MyMeshType& meshT, const MyMeshType& meshS,
#define __CONVEXINTERSECTOR_TXX__
#include "ConvexIntersector.hxx"
-#include "PlanarIntersector.txx"
#include "PlanarIntersectorP0P0.txx"
#include "PlanarIntersectorP0P1.txx"
#include "PlanarIntersectorP1P0.txx"
#include "PlanarIntersectorP0P1Bary.txx"
#include "PolygonAlgorithms.txx"
-#include "InterpolationUtils.hxx"
-#include <deque>
#include <iostream>
-#include <vector>
-#include <limits>
#define CONVINTERSECTOR_TEMPLATE template<class MyMeshType, class MyMatrix, template <class MeshType, class TheMatrix, class ThisIntersector> class InterpType>
#define CONVEX_INTERSECTOR_ ConvexIntersector<MyMeshType,MyMatrix,InterpType>
CONVINTERSECTOR_TEMPLATE
double CONVEX_INTERSECTOR_::intersectGeometryWithQuadrangle(const double * quadrangle,
const std::vector<double>& sourceCoords,
- bool /*isSourceQuad*/)
+ bool isSourceQuad)
{
double result = 0;
int nbOfNodesS=int(sourceCoords.size())/SPACEDIM;
CONVINTERSECTOR_TEMPLATE
double CONVEX_INTERSECTOR_::intersectGeoBary(const std::vector<double>& targetCell,
- bool /*targetCellQuadratic*/,
+ bool targetCellQuadratic,
const double * sourceTria,
std::vector<double>& res)
{
#include "TargetIntersector.txx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#include "CurveIntersector.hxx"
#include "InterpolationUtils.hxx"
-#include "MCIdType.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "NormalizedGeometricTypes"
#include "PointLocatorAlgos.txx"
-#include <algorithm>
-#include <cmath>
#include <limits>
-#include <vector>
-#include <utility>
namespace INTERP_KERNEL
{
template<class MyMeshType, class MyMatrix>
CurveIntersector<MyMeshType,MyMatrix>::~CurveIntersector()
- = default;
+ {
+ }
//================================================================================
/*!
::coo2C(conn[OTT<ConnType,numPol>::conn2C(conn_index[icell]+j)]);
for(int idim=0; idim<SPACEDIM; idim++)
{
- double const x = *(coord_node+idim);
+ double x = *(coord_node+idim);
bbox[ibox*2*SPACEDIM + 2*idim] =
( bbox[ibox*2*SPACEDIM + 2*idim] < x ) ? bbox[ibox*2*SPACEDIM + 2*idim] : x;
bbox[ibox*2*SPACEDIM + 2*idim+1] =
SPACEDIM*(OTT<ConnType,numPol>::coo2C(conn[OTT<ConnType,numPol>::conn2C(conn_index[OTT<ConnType,numPol>::ind2C(iP)]+i)]));
for(int idim=0; idim<SPACEDIM; idim++)
{
- double const x = *(coord_node+idim);
+ double x = *(coord_node+idim);
bb[2*idim ] = (x<bb[2*idim ]) ? x : bb[2*idim ];
bb[2*idim+1] = (x>bb[2*idim+1]) ? x : bb[2*idim+1];
}
template<class MyMeshType, class MyMatrix>
void CurveIntersector<MyMeshType,MyMatrix>::ComputeBaryCoordsOf(double startOfSeg, double endOfSeg, double pt, double& startPos, double& endPos)
{
- double const deno(endOfSeg-startOfSeg);
+ double deno(endOfSeg-startOfSeg);
startPos = (endOfSeg-pt)/deno;
startPos = std::max(startPos,0.); startPos = std::min(startPos,1.);
endPos=1.-startPos;
double t0s1[2] = { s1[X]-t0[X], s1[Y]-t0[Y] };
double nt01_x_t0s0 = t0s0[X] * t01[Y] - t0s0[Y] * t01[X]; // t0s0 dot norm of t01
double nt01_x_t0s1 = t0s1[X] * t01[Y] - t0s1[Y] * t01[X]; // t0s1 dot norm of t01
- double const dist_ts0 = fabs( nt01_x_t0s0 ); // dist from tgt seg to s0
- double const dist_ts1 = fabs( nt01_x_t0s1 ); // dist from tgt seg to s1
+ double dist_ts0 = fabs( nt01_x_t0s0 ); // dist from tgt seg to s0
+ double dist_ts1 = fabs( nt01_x_t0s1 ); // dist from tgt seg to s1
bool s0_out_of_tol = ( dist_ts0 > _tolerance );
bool s1_out_of_tol = ( dist_ts1 > _tolerance );
if ( nt01_x_t0s0 * nt01_x_t0s1 > 0 && ( s0_out_of_tol || s1_out_of_tol ))
if ( xt0 > xt1 ) std::swap( xt0, xt1 );
if ( xs0 > xs1 ) std::swap( xs0, xs1 );
- double const x0 = std::max( xt0, xs0 );
- double const x1 = std::min( xt1, xs1 );
+ double x0 = std::max( xt0, xs0 );
+ double x1 = std::min( xt1, xs1 );
return ( x0 < x1 ) ? ( x1 - x0 ) : 0.;
}
public:
static const int MY_SPACEDIM=1;
static const int MY_MESHDIM=8;
- using MyConnType = mcIdType;
+ typedef mcIdType MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=MyMeshType::My_numPol;
// begin
// useless, but for windows compilation ...
#define __CURVEINTERSECTORP0P0_HXX__
#include "CurveIntersector.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
CurveIntersectorP0P0(const MyMeshType& meshT, const MyMeshType& meshS,
#ifndef __CURVEINTERSECTORP0P0_TXX__
#define __CURVEINTERSECTORP0P0_TXX__
-#include "CurveIntersector.hxx"
#include "CurveIntersectorP0P0.hxx"
-#include <vector>
-#include "InterpolationUtils.hxx"
+#include "CurveIntersector.txx"
#define BASE_INTERSECTOR CurveIntersector<MyMeshType,MyMatrix>
#define __CURVEINTERSECTORP0P1_HXX__
#include "CurveIntersector.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
CurveIntersectorP0P1(const MyMeshType& meshT, const MyMeshType& meshS,
#ifndef __CurveIntersectorP0P1_TXX__
#define __CurveIntersectorP0P1_TXX__
-#include "CurveIntersector.hxx"
#include "CurveIntersectorP0P1.hxx"
-#include <vector>
-#include "InterpolationUtils.hxx"
+#include "CurveIntersector.txx"
#define BASE_INTERSECTOR CurveIntersector<MyMeshType,MyMatrix>
#define __CURVEINTERSECTORP1P0_HXX__
#include "CurveIntersector.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
CurveIntersectorP1P0(const MyMeshType& meshT, const MyMeshType& meshS,
#ifndef __CurveIntersectorP1P0_TXX__
#define __CurveIntersectorP1P0_TXX__
-#include "CurveIntersector.hxx"
#include "CurveIntersectorP1P0.hxx"
-#include <vector>
-#include "InterpolationUtils.hxx"
+#include "CurveIntersector.txx"
#define BASE_INTERSECTOR CurveIntersector<MyMeshType,MyMatrix>
#define __CURVEINTERSECTORP1P1_HXX__
#include "CurveIntersector.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
CurveIntersectorP1P1(const MyMeshType& meshT, const MyMeshType& meshS,
#ifndef __CurveIntersectorP1P1_TXX__
#define __CurveIntersectorP1P1_TXX__
-#include "CurveIntersector.hxx"
#include "CurveIntersectorP1P1.hxx"
-#include <vector>
-#include "InterpolationUtils.hxx"
+#include "CurveIntersector.txx"
#define BASE_INTERSECTOR CurveIntersector<MyMeshType,MyMatrix>
#define __CURVEINTERSECTORP1P1PL_HXX__
#include "CurveIntersector.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
CurveIntersectorP1P1PL(const MyMeshType& meshT, const MyMeshType& meshS,
#pragma once
-#include "CurveIntersector.hxx"
#include "CurveIntersectorP1P1PL.hxx"
-#include "InterpolationUtils.hxx"
-#include "MCIdType.hxx"
+#include "CurveIntersector.txx"
#include <cassert>
-#include <cstdlib>
-#include <vector>
namespace INTERP_KERNEL
{
#include "DiameterCalculator.hxx"
#include "InterpKernelException.hxx"
#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
-#include "MCIdType.hxx"
#include <algorithm>
-#include <iterator>
#include <sstream>
#include <cmath>
void ComputeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr)
{
Evaluator evtor;
- NormalizedCellType const ct(Evaluator::TYPE);
- int const cti((int) ct);
+ NormalizedCellType ct(Evaluator::TYPE);
+ int cti((int) ct);
for(const mcIdType *it=bgIds;it!=endIds;it++)
{
- mcIdType const offset(indPtr[*it]);
+ mcIdType offset(indPtr[*it]);
if(connPtr[offset]==cti)
resPtr[*it]=evtor.ComputeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[(*it)+1],coordsPtr);
else
void ComputeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr)
{
Evaluator evtor;
- NormalizedCellType const ct(Evaluator::TYPE);
- int const cti((int) ct);
+ NormalizedCellType ct(Evaluator::TYPE);
+ int cti((int) ct);
for(mcIdType it=bgId;it<endId;it++)
{
- mcIdType const offset(indPtr[it]);
+ mcIdType offset(indPtr[it]);
if(connPtr[offset]==cti)
resPtr[it]=evtor.ComputeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[it+1],coordsPtr);
else
void ComputeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr)
{
Evaluator evtor;
- NormalizedCellType const ct(Evaluator::TYPE);
+ NormalizedCellType ct(Evaluator::TYPE);
const CellModel& cm(CellModel::GetCellModel(ct));
- unsigned const nbNodes(cm.getNumberOfNodes());
+ unsigned nbNodes(cm.getNumberOfNodes());
const mcIdType *ptr(connPtr);
for(mcIdType i=0;i<nbOfCells;i++,ptr+=nbNodes,resPtr++)
*resPtr=evtor.ComputeForOneCellInternal(ptr,ptr+nbNodes,coordsPtr);
class DiameterCalculator
{
public:
- INTERPKERNEL_EXPORT virtual ~DiameterCalculator() = default;
+ INTERPKERNEL_EXPORT virtual ~DiameterCalculator() { }
INTERPKERNEL_EXPORT virtual NormalizedCellType getType() const = 0;
INTERPKERNEL_EXPORT virtual double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const = 0;
INTERPKERNEL_EXPORT virtual void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const = 0;
class DiameterCalulatorTRI3S2 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorTRI3S3 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorTRI6S2 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorTRI6S3 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorTRI7S2 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorTRI7S3 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorQUAD4S2 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorQUAD4S3 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorQUAD8S2 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorQUAD8S3 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorQUAD9S2 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorQUAD9S3 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorTETRA4 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorTETRA10 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorHEXA8 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorHEXA20 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorHEXA27 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorPENTA6 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorPENTA15 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorPYRA5 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
class DiameterCalulatorPYRA13 : public DiameterCalculator
{
public:
- NormalizedCellType getType() const override { return TYPE; }
- double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const override { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
+ NormalizedCellType getType() const { return TYPE; }
+ double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); }
static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr);
- void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
- void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const override;
+ void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
+ void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const;
public:
static NormalizedCellType TYPE;
};
#include "DirectedBoundingBox.hxx"
#include "InterpolationUtils.hxx"
-#include <vector>
-#include <cmath>
-#include <cstdlib>
-#include <limits>
-#include <cstddef>
#define __TENSOR(i,j) tensor[(i)*_dim+(j)]
#define __AXIS(i) (&_axes[(i)*_dim])
// Rotate to make __TENSOR(k,l) == 0
- double const diff = __TENSOR(l,l) - __TENSOR(k,k);
+ double diff = __TENSOR(l,l) - __TENSOR(k,k);
double t; // tangent of rotation angle
if ( fabs(__TENSOR(k,l)) < abs(diff)*1.0e-36)
{
}
else
{
- double const phi = diff/(2.0*__TENSOR(k,l));
+ double phi = diff/(2.0*__TENSOR(k,l));
t = 1.0/(abs(phi) + sqrt(phi*phi + 1.0));
if ( phi < 0.0) t = -t;
}
- double const c = 1.0/sqrt(t*t + 1.0); // cosine of rotation angle
- double const s = t*c; // sine of rotation angle
- double const tau = s/(1.0 + c);
+ double c = 1.0/sqrt(t*t + 1.0); // cosine of rotation angle
+ double s = t*c; // sine of rotation angle
+ double tau = s/(1.0 + c);
__TENSOR(k,k) -= t*__TENSOR(k,l);
__TENSOR(l,l) += t*__TENSOR(k,l);
__TENSOR(k,l) = 0.0;
// find minmax of cornerBox in the CS of axisBox
- DirectedBoundingBox mmBox((double*)nullptr,0,_dim); //!< empty box with CS == axisBox->_axes
+ DirectedBoundingBox mmBox((double*)0,0,_dim); //!< empty box with CS == axisBox->_axes
mmBox._axes = axisBox->_axes;
vector<double> corners;
{
vector<double> cornersOther;
getCorners( cornersOther, box );
- DirectedBoundingBox mmBox((double*)nullptr,0,_dim); //!< empty box with CS == this->_axes
+ DirectedBoundingBox mmBox((double*)0,0,_dim); //!< empty box with CS == this->_axes
mmBox._axes = this->_axes;
for ( std::size_t iC = 0, nC = cornersOther.size()/_dim; iC < nC; ++iC)
mmBox.addPointToBox( &cornersOther[iC*_dim] );
{
vector<double> cornersThis;
getCorners( cornersThis, &_minmax[0] );
- DirectedBoundingBox mmBox((double*)nullptr,0,_dim); //!< initailized _minmax
+ DirectedBoundingBox mmBox((double*)0,0,_dim); //!< initailized _minmax
double globCorner[3];
for ( std::size_t iC = 0, nC = cornersThis.size()/_dim; iC < nC; ++iC)
{
double pLoc[3];
toLocalCS( point, pLoc );
- bool const out = isLocalOut( pLoc );
+ bool out = isLocalOut( pLoc );
#ifdef _DEBUG_
switch (_dim)
{
// Author : Anthony Geay (CEA/DEN)
#include "InterpKernelAsmX86.hxx"
-#include "InterpKernelException.hxx"//"
#include <cstring>
#include <sstream>
#include <algorithm>
-#include <vector>
-#include <string>
#ifdef _POSIX_MAPPED_FILES
#include <sys/mman.h>
std::vector<char> INTERP_KERNEL::AsmX86::convertIntoMachineLangage(const std::vector<std::string>& asmb) const
{
std::vector<char> ret;
- for(const auto & iter : asmb)
- convertOneInstructionInML(iter,ret);
+ for(std::vector<std::string>::const_iterator iter=asmb.begin();iter!=asmb.end();iter++)
+ convertOneInstructionInML(*iter,ret);
return ret;
}
-char *INTERP_KERNEL::AsmX86::copyToExecMemZone(const std::vector<char>& ml, unsigned& /*offset*/) const
+char *INTERP_KERNEL::AsmX86::copyToExecMemZone(const std::vector<char>& ml, unsigned& offset) const
{
- char *ret=nullptr;
- std::size_t const lgth=ml.size();
+ char *ret=0;
+ std::size_t lgth=ml.size();
#ifdef _POSIX_MAPPED_FILES
# ifdef __APPLE__
ret=(char *)mmap(0,lgth,PROT_EXEC | PROT_WRITE,MAP_ANON | MAP_PRIVATE,-1,0);
# else
- ret=(char *)mmap(nullptr,lgth,PROT_EXEC | PROT_WRITE,MAP_ANONYMOUS | MAP_PRIVATE,-1,0);
+ ret=(char *)mmap(0,lgth,PROT_EXEC | PROT_WRITE,MAP_ANONYMOUS | MAP_PRIVATE,-1,0);
# endif
#else
#ifdef WIN32
void INTERP_KERNEL::AsmX86::convertOneInstructionInML(const std::string& inst, std::vector<char>& ml) const
{
- std::string::size_type const pos=inst.find_first_of(' ');
+ std::string::size_type pos=inst.find_first_of(' ');
std::string op;
std::string param;
if(pos!=std::string::npos)
int id=0;
for(const char **it=OPS;it!=OPS+NB_OF_OPS;it++,id++)
{
- std::string const tmp(*it);
+ std::string tmp(*it);
if(op==tmp)
break;
}
std::ostringstream oss; oss << "not recognized instruction mov : " << inst;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::string const inst2=inst.substr(pos+1);
+ std::string inst2=inst.substr(pos+1);
pos=inst2.find_first_of(',');
if(pos==std::string::npos)
{
std::ostringstream oss; oss << "not recognized instruction mov : " << inst;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::string const inst3=inst2.substr(0,pos);
- std::string const inst4=inst2.substr(pos+1);
+ std::string inst3=inst2.substr(0,pos);
+ std::string inst4=inst2.substr(pos+1);
convertMovToEsp(inst3,inst4,ml);
}
{//mov dword [esp+4],0x3ff3c0ca
const unsigned char ML2[3]={0xc7,0x44,0x24};
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
- std::string::size_type const pos=inst1bis.find_first_of(']');
- std::string const inst1_1=inst1bis.substr(4,pos-4-1);
+ std::string::size_type pos=inst1bis.find_first_of(']');
+ std::string inst1_1=inst1bis.substr(4,pos-4-1);
appendAddress(inst1_1,1,ml);
appendAddress(inst2,4,ml);
return;
{//mov dword [rsp+4],0x3ff3c0ca
const unsigned char ML2[3]={0xc7,0x44,0x24};
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
- std::string::size_type const pos=inst1bis.find_first_of(']');
- std::string const inst1_1=inst1bis.substr(4,pos-4-1);
+ std::string::size_type pos=inst1bis.find_first_of(']');
+ std::string inst1_1=inst1bis.substr(4,pos-4-1);
appendAddress(inst1_1,1,ml);
appendAddress(inst2,4,ml);
return;
void INTERP_KERNEL::AsmX86::convertPush(const std::string& inst, std::vector<char>& ml)
{
- std::string::size_type const pos=inst.find_first_of(' ');
- std::string const inst2=inst.substr(pos+1);
+ std::string::size_type pos=inst.find_first_of(' ');
+ std::string inst2=inst.substr(pos+1);
const char ASM1[]="ebp";
const unsigned char ML1[1]={0x55};
if(inst2==ASM1)
void INTERP_KERNEL::AsmX86::convertPop(const std::string& inst, std::vector<char>& ml)
{
- std::string::size_type const pos=inst.find_first_of(' ');
- std::string const inst2=inst.substr(pos+1);
+ std::string::size_type pos=inst.find_first_of(' ');
+ std::string inst2=inst.substr(pos+1);
const char ASM1[]="ebp";
const unsigned char ML1[1]={0x5d};
if(inst2==ASM1)
void INTERP_KERNEL::AsmX86::convertFld(const std::string& inst, std::vector<char>& ml)
{
std::string::size_type pos=inst.find_first_of(' ');
- std::string const params=inst.substr(pos+1);
- std::string const params2=params.substr(1,params.length()-2);
+ std::string params=inst.substr(pos+1);
+ std::string params2=params.substr(1,params.length()-2);
if(params2.substr(0,3)=="esp")
{
const unsigned char ML1[3]={0xdd,0x04,0x24};
if(pos!=std::string::npos)
{//fld qword [esp+@]
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
- std::string const params3=params2.substr(pos+1);
+ std::string params3=params2.substr(pos+1);
appendAddress(params3,1,ml);
return ;
}
if(pos!=std::string::npos)
{//fld qword [esp+@]
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
- std::string const params3=params2.substr(pos+1);
+ std::string params3=params2.substr(pos+1);
appendAddress(params3,1,ml);
return ;
}
throw INTERP_KERNEL::Exception("Unrecognized fld instruction");
}
-void INTERP_KERNEL::AsmX86::convertFaddp(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertFaddp(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML1[2]={0xde,0xc1};
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
}
-void INTERP_KERNEL::AsmX86::convertFsubp(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertFsubp(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML1[2]={0xde,0xe9};
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
}
-void INTERP_KERNEL::AsmX86::convertFmulp(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertFmulp(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML1[2]={0xde,0xc9};
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
}
-void INTERP_KERNEL::AsmX86::convertFdivp(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertFdivp(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML1[2]={0xde,0xf9};
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
}
-void INTERP_KERNEL::AsmX86::convertFcos(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertFcos(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML[2]={0xd9,0xff};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
-void INTERP_KERNEL::AsmX86::convertFsin(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertFsin(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML[2]={0xd9,0xfe};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
-void INTERP_KERNEL::AsmX86::convertFabs(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertFabs(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML[2]={0xd9,0xe1};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
-void INTERP_KERNEL::AsmX86::convertFchs(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertFchs(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML[2]={0xd9,0xe0};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
-void INTERP_KERNEL::AsmX86::convertFsqrt(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertFsqrt(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML[2]={0xd9,0xfa};
ml.insert(ml.end(),ML,ML+sizeof(ML));
{
const unsigned char ML[2]={0x81,0xec};
ml.insert(ml.end(),ML,ML+sizeof(ML));
- std::string const inst2=inst.substr(4);
+ std::string inst2=inst.substr(4);
appendAddress(inst2,4,ml);
return;
}
{
const unsigned char ML[2]={0x81,0xc4};
ml.insert(ml.end(),ML,ML+sizeof(ML));
- std::string const inst2=inst.substr(4);
+ std::string inst2=inst.substr(4);
appendAddress(inst2,4,ml);
return;
}
throw INTERP_KERNEL::Exception("Not recognized add instruction.");
}
-void INTERP_KERNEL::AsmX86::convertRet(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertRet(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML[1]={0xc3};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
-void INTERP_KERNEL::AsmX86::convertLeave(const std::string& /*inst*/, std::vector<char>& ml)
+void INTERP_KERNEL::AsmX86::convertLeave(const std::string& inst, std::vector<char>& ml)
{
const unsigned char ML[1]={0xc9};
ml.insert(ml.end(),ML,ML+sizeof(ML));
#ifndef __INTERPKERNELASMX86_HXX__
#define __INTERPKERNELASMX86_HXX__
+#include "INTERPKERNELDefines.hxx"
+#include "InterpKernelException.hxx"
#include <vector>
#include <string>
// Author : Anthony Geay (CEA/DEN)
#include "InterpKernelExprParser.hxx"
-#include "InterpKernelFunction.hxx"
-#include "InterpKernelUnit.hxx"
#include "InterpKernelValue.hxx"
#include "InterpKernelAsmX86.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "InterpKernelException.hxx"
#include <cctype>
-#include <cstddef>
-#include <set>
#include <sstream>
#include <limits>
-#include <string>
-#include <utility>
#include <vector>
#include <iterator>
#include <iostream>
}
LeafExpr::~LeafExpr()
-= default;
+{
+}
LeafExprVal::LeafExprVal(double value):_value(value)
{
}
LeafExprVal::~LeafExprVal()
-= default;
+{
+}
void LeafExprVal::fillValue(Value *val) const
{
void LeafExprVal::replaceValues(const std::vector<double>& valuesInExpr)
{
- int const pos=(int)_value;
- int const lgth=(int)valuesInExpr.size();
+ int pos=(int)_value;
+ int lgth=(int)valuesInExpr.size();
if(pos>=lgth || pos<0)
throw INTERP_KERNEL::Exception("LeafExprVal::replaceValues : Big Problem detected! Send a mail to Salome support with expression.");
_value=valuesInExpr[pos];
return new LeafExprVal(*this);
}
-LeafExprVar::LeafExprVar(const std::string& var):_fast_pos(-1),_var_name(var),_val(nullptr)
+LeafExprVar::LeafExprVar(const std::string& var):_fast_pos(-1),_var_name(var),_val(0)
{
}
void LeafExprVar::prepareExprEvaluation(const std::vector<std::string>& vars, int nbOfCompo, int targetNbOfCompo) const
{
- auto const iter=std::find(vars.begin(),vars.end(),_var_name);
+ std::vector<std::string>::const_iterator iter=std::find(vars.begin(),vars.end(),_var_name);
if(iter==vars.end())
{
if(!isRecognizedKeyVar(_var_name,_fast_pos))
}
else
{
- int const relPos=-7-_fast_pos;
+ int relPos=-7-_fast_pos;
if(relPos>=targetNbOfCompo)
{
std::ostringstream oss; oss << "LeafExprVar::prepareExprEvaluation : Found recognized unitary vector \"" << _var_name << "\" which implies that component #" << relPos;
{
if(var.length()!=sizeof(END_OF_RECOGNIZED_VAR))
return false;
- std::string const end=var.substr(1);
+ std::string end=var.substr(1);
if(end!=END_OF_RECOGNIZED_VAR)
return false;
- char const first=var[0];
+ char first=var[0];
if(first<'I' || first>'Z')
return false;
pos=-7-(first-'I');
}
LeafExprVar::~LeafExprVar()
-= default;
+{
+}
void ExprParserOfEval::clearSortedMemory()
{
delete _leaf;
- for(auto & _sub_part : _sub_parts)
- _sub_part.clearSortedMemory();
- for(auto & _func : _funcs)
- delete _func;
+ for(std::vector<ExprParserOfEval>::iterator it=_sub_parts.begin();it!=_sub_parts.end();it++)
+ (*it).clearSortedMemory();
+ for(std::vector<Function *>::iterator it=_funcs.begin();it!=_funcs.end();it++)
+ delete *it;
}
void ExprParserOfEval::sortMemory()
{
- for(auto & _sub_part : _sub_parts)
- _sub_part.sortMemory();
+ for(std::vector<ExprParserOfEval>::iterator it=_sub_parts.begin();it!=_sub_parts.end();it++)
+ (*it).sortMemory();
if(_leaf)
_leaf=_leaf->deepCopy();
- for(auto & _func : _funcs)
- if(_func)
- _func=_func->deepCopy();
+ for(std::vector<Function *>::iterator it=_funcs.begin();it!=_funcs.end();it++)
+ if(*it)
+ *it=(*it)->deepCopy();
}
-ExprParser::ExprParser(const std::string& expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(nullptr),_is_parsing_ok(false),_expr(expr)
+ExprParser::ExprParser(const std::string& expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false),_expr(expr)
{
_expr=deleteWhiteSpaces(_expr);
}
//! For \b NOT null terminated strings coming from FORTRAN.
-ExprParser::ExprParser(const char *expr, int lgth, ExprParser *father):_father(father),_is_parsed(false),_leaf(nullptr),_is_parsing_ok(false)
+ExprParser::ExprParser(const char *expr, int lgth, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false)
{
_expr=buildStringFromFortran(expr,lgth);
_expr=deleteWhiteSpaces(_expr);
int level=0;
for(std::size_t iter=0;iter<posOfCloseBracket;iter++)
{
- std::size_t const iter2=posOfCloseBracket-1-iter;
+ std::size_t iter2=posOfCloseBracket-1-iter;
if(expr[iter2]==')')
level++;
else if(expr[iter2]=='(')
std::string ExprParser::buildStringFromFortran(const char *expr, int lgth)
{
std::string ret(expr,lgth);
- std::string const whiteSpaces(WHITE_SPACES);
- std::size_t const found=ret.find_last_not_of(whiteSpaces);
+ std::string whiteSpaces(WHITE_SPACES);
+ std::size_t found=ret.find_last_not_of(whiteSpaces);
if (found!=std::string::npos)
ret.erase(found+1);
else
std::string ExprParser::deleteWhiteSpaces(const std::string& expr)
{
std::string ret(expr);
- std::string const whiteSpaces(WHITE_SPACES);
+ std::string whiteSpaces(WHITE_SPACES);
std::size_t where1=0,where2=0;
while(where2!=std::string::npos && where1!=std::string::npos)
{
releaseFunctions();
if(!_expr.empty())
{
- std::string const tmp(_expr);
+ std::string tmp(_expr);
std::vector<double> valuesInExpr;
fillValuesInExpr(valuesInExpr);
checkBracketsParity();
DecompositionInUnitBase ExprParser::evaluateUnit() const
{
Value *gen=new ValueUnit;
- ValueUnit *res=nullptr;
+ ValueUnit *res=0;
try
{
res=(ValueUnit *)evaluateLowLev(gen);
{
if(_leaf)
{
- auto *leafC=dynamic_cast<LeafExprVar *>(_leaf);
+ LeafExprVar *leafC=dynamic_cast<LeafExprVar *>(_leaf);
if(leafC)
leafC->prepareExprEvaluation(vars,nbOfCompo,targetNbOfCompo);
}
else
- for(const auto & iter : _sub_expr)
- iter.prepareExprEvaluation(vars,nbOfCompo,targetNbOfCompo);
+ for(std::vector<ExprParser>::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ (*iter).prepareExprEvaluation(vars,nbOfCompo,targetNbOfCompo);
}
/*!
throw INTERP_KERNEL::Exception("ExprParser::prepareExprEvaluationDouble : size of input vector must be equal to the input vector !");
if(_leaf)
{
- auto *leafC=dynamic_cast<LeafExprVar *>(_leaf);
+ LeafExprVar *leafC=dynamic_cast<LeafExprVar *>(_leaf);
if(leafC)
leafC->prepareExprEvaluationDouble(vars,nbOfCompo,targetNbOfCompo,refPos,ptOfInputStart,ptOfInputEnd);
}
else
- for(const auto & iter : _sub_expr)
- iter.prepareExprEvaluationDouble(vars,nbOfCompo,targetNbOfCompo,refPos,ptOfInputStart,ptOfInputEnd);
+ for(std::vector<ExprParser>::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ (*iter).prepareExprEvaluationDouble(vars,nbOfCompo,targetNbOfCompo,refPos,ptOfInputStart,ptOfInputEnd);
}
void ExprParser::prepareFastEvaluator() const
{
if(_leaf)
{
- auto *leafC=dynamic_cast<LeafExprVar *>(_leaf);
+ LeafExprVar *leafC=dynamic_cast<LeafExprVar *>(_leaf);
if(leafC)
leafC->prepareExprEvaluationVec();
}
else
- for(const auto & iter : _sub_expr)
- iter.prepareExprEvaluationVecLowLev();
+ for(std::vector<ExprParser>::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ (*iter).prepareExprEvaluationVecLowLev();
}
Value *ExprParser::evaluateLowLev(Value *valGen) const
else
{
stackOfVal.resize(_sub_expr.size());
- auto iter2=stackOfVal.begin();
- for(auto iter=_sub_expr.begin();iter!=_sub_expr.end();iter++,iter2++)
+ std::vector<Value *>::iterator iter2=stackOfVal.begin();
+ for(std::vector<ExprParser>::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++,iter2++)
*iter2=(*iter).evaluateLowLev(valGen);
}
- for(auto iter3 : _func_btw_sub_expr)
- iter3->operate(stackOfVal);
+ for(std::vector<Function *>::const_iterator iter3=_func_btw_sub_expr.begin();iter3!=_func_btw_sub_expr.end();iter3++)
+ (*iter3)->operate(stackOfVal);
}
catch(INTERP_KERNEL::Exception& e)
{
- for(auto & iter4 : stackOfVal)
- delete iter4;
+ for(std::vector<Value *>::iterator iter4=stackOfVal.begin();iter4!=stackOfVal.end();iter4++)
+ delete *iter4;
throw e;
}
return stackOfVal.back();
ExprParser::ExprParser(ExprParser&& other):_father(other._father),_leaf(other._leaf),_is_parsing_ok(std::move(other._is_parsing_ok)),_expr(std::move(other._expr)),_sub_expr(std::move(other._sub_expr)),_func_btw_sub_expr(std::move(other._func_btw_sub_expr))
{
- other._leaf=nullptr;
+ other._leaf=0;
}
ExprParser& ExprParser::operator=(ExprParser&& other)
_sub_expr=std::move(other._sub_expr);
_func_btw_sub_expr=std::move(other._func_btw_sub_expr);
other._leaf=other._leaf;
- other._leaf=nullptr;
+ other._leaf=0;
return *this;
}
{
if(_leaf)
return ;
- for(auto & iter : _sub_expr)
- iter.reverseThis();
- std::size_t const sz(_sub_expr.size());
- std::size_t const nbOfTurn(sz/2);
+ for(std::vector<ExprParser>::iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ (*iter).reverseThis();
+ std::size_t sz(_sub_expr.size());
+ std::size_t nbOfTurn(sz/2);
for(std::size_t i=0;i<nbOfTurn;i++)
std::swap(_sub_expr[i],_sub_expr[sz-i-1]);
}
ExprParserOfEval ExprParser::convertMeTo() const
{
- std::size_t const sz(_sub_expr.size());
+ std::size_t sz(_sub_expr.size());
std::vector<ExprParserOfEval> subExpr(sz);
for(std::size_t i=0;i<sz;i++)
subExpr[i]=_sub_expr[i].convertMeTo();
{
if(_leaf)
{
- auto *leafC=dynamic_cast<LeafExprVar *>(_leaf);
+ LeafExprVar *leafC=dynamic_cast<LeafExprVar *>(_leaf);
if(leafC)
vars.insert(leafC->getVar());
}
else
- for(const auto & iter : _sub_expr)
- iter.getSetOfVars(vars);
+ for(std::vector<ExprParser>::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ (*iter).getSetOfVars(vars);
}
void ExprParser::getTrueSetOfVars(std::set<std::string>& trueVars) const
std::set<std::string> vars;
getSetOfVars(vars);
trueVars.clear();
- for(const auto & var : vars)
+ for(std::set<std::string>::const_iterator iter=vars.begin();iter!=vars.end();iter++)
{
int tmp;
- if(!LeafExprVar::isRecognizedKeyVar(var,tmp))
- trueVars.insert(var);
+ if(!LeafExprVar::isRecognizedKeyVar(*iter,tmp))
+ trueVars.insert(*iter);
}
}
void ExprParser::parseDeeper()
{
- for(auto & iter : _sub_expr)
- if(!iter.simplify())
- iter.parseDeeper();
+ for(std::vector<ExprParser>::iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ if(!(*iter).simplify())
+ (*iter).parseDeeper();
}
/*!
if(_expr[_expr.length()-1]!=')')
return ;
//at this level of code _expr
- std::size_t const pos1=_expr.find_first_of('(');
- std::size_t const pos4=FindCorrespondingOpenBracket(_expr,_expr.length()-1);
+ std::size_t pos1=_expr.find_first_of('(');
+ std::size_t pos4=FindCorrespondingOpenBracket(_expr,_expr.length()-1);
if(pos4!=pos1)
return ;
std::string funcName=_expr.substr(0,pos1);
- std::size_t const pos2=funcName.find_first_of("+-*/^><",0,7);
- std::size_t const pos3=funcName.find_first_not_of("+-*/^><",0,7);
+ std::size_t pos2=funcName.find_first_of("+-*/^><",0,7);
+ std::size_t pos3=funcName.find_first_not_of("+-*/^><",0,7);
if(pos2!=std::string::npos && pos3!=std::string::npos)
return ;//Bracket group is not alone, can't conclude not recursively.
std::string newExp2=_expr.substr(pos1+1,_expr.length()-pos1-2);
- std::size_t const nbOfParamsInFunc=std::count(newExp2.begin(),newExp2.end(),',')+1;
+ std::size_t nbOfParamsInFunc=std::count(newExp2.begin(),newExp2.end(),',')+1;
if(pos3!=std::string::npos)
_func_btw_sub_expr.push_back(FunctionsFactory::buildFuncFromString(funcName.c_str(),(int)nbOfParamsInFunc));
else
{
- std::size_t const lgth=funcName.length();
+ std::size_t lgth=funcName.length();
char tmp[2]; tmp[1]='\0';
for(std::size_t i=0;i<lgth;i++)
{
std::size_t pos6=0;
for(std::size_t i=0;i<nbOfParamsInFunc;i++)
{
- std::size_t const pos5=newExp2.find_first_of(',',pos6);
+ std::size_t pos5=newExp2.find_first_of(',',pos6);
std::size_t len=std::string::npos;
if(pos5!=std::string::npos)
len=pos5-pos6;
- std::string const newExp3=newExp2.substr(pos6,len);
+ std::string newExp3=newExp2.substr(pos6,len);
_sub_expr.push_back(ExprParser(newExp3.c_str(),this));
pos6=pos5+1;
}
*/
bool ExprParser::tryToInterpALeaf()
{
- std::size_t const pos=_expr.find_first_not_of("+-",0,2);
- std::string const minimizedExpr=_expr.substr(pos);
- std::size_t const pos2=minimizedExpr.find_first_of("+-*/^()<>",0,9);
+ std::size_t pos=_expr.find_first_not_of("+-",0,2);
+ std::string minimizedExpr=_expr.substr(pos);
+ std::size_t pos2=minimizedExpr.find_first_of("+-*/^()<>",0,9);
if(pos2!=std::string::npos)
return false;
delete _leaf;
std::ostringstream errMsg;
char MSGTYP1[]="Error non unary function for '";
errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1 << *iter << "'";
- std::string const tmp=_expr.substr(iter-_expr.begin());
+ std::string tmp=_expr.substr(iter-_expr.begin());
LocateError(errMsg,tmp,0);
throw INTERP_KERNEL::Exception(errMsg.str().c_str());
}
{
if(!curPart.empty())
{
- std::string::reverse_iterator const accessor=curPart.rbegin();
+ std::string::reverse_iterator accessor=curPart.rbegin();
if(*accessor!='*' && *accessor!='/' && *accessor!='^')
{
isParsingSucceed=true;
std::ostringstream errMsg;
char MSGTYP1[]="Error non unary function for '";
errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1 << *iter << "'";
- std::string const tmp=_expr.substr(iter-_expr.begin());
+ std::string tmp=_expr.substr(iter-_expr.begin());
LocateError(errMsg,tmp,0);
throw INTERP_KERNEL::Exception(errMsg.str().c_str());
}
std::ostringstream errMsg;
char MSGTYP1[]="Error non unary function for '";
errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1 << *iter << "'";
- std::string const tmp=_expr.substr(iter-_expr.begin());
+ std::string tmp=_expr.substr(iter-_expr.begin());
LocateError(errMsg,tmp,0);curPart+=*iter;
throw INTERP_KERNEL::Exception(errMsg.str().c_str());
}
void ExprParser::releaseFunctions()
{
- for(auto & iter : _func_btw_sub_expr)
- delete iter;
+ for(std::vector<Function *>::iterator iter=_func_btw_sub_expr.begin();iter!=_func_btw_sub_expr.end();iter++)
+ delete *iter;
_func_btw_sub_expr.clear();
}
static const char MSG[]="Internal error : A string expected to be a float is not one ! Bug to signal !";
std::istringstream stream;
std::ostringstream oss;
- std::size_t const end2=end!=std::string::npos?end-bg:end;
- std::string const tmp=expr.substr(bg,end2);
+ std::size_t end2=end!=std::string::npos?end-bg:end;
+ std::string tmp=expr.substr(bg,end2);
stream.str(tmp);
double ret=std::numeric_limits<double>::max();
stream >> ret;
if(!stream.eof())
throw INTERP_KERNEL::Exception(MSG);
oss << id;
- std::string const tmp2(oss.str());
- std::size_t const l1=tmp.length();
+ std::string tmp2(oss.str());
+ std::size_t l1=tmp.length();
delta=(int)tmp2.length()-(int)l1;
expr.replace(bg,l1,tmp2);
return ret;
{
const char FIGURES[]="0123456789";
const std::string other("+-*^/(<>,");
- std::size_t const lgth=_expr.length();
+ std::size_t lgth=_expr.length();
int id=0,delta;
for(std::size_t pos=0;pos!=std::string::npos;id++)
{
- std::size_t const pos2=_expr.find_first_of(FIGURES,pos,10);
+ std::size_t pos2=_expr.find_first_of(FIGURES,pos,10);
if(pos2==std::string::npos)
break;
if(pos2>0)
std::ostringstream oss; oss << "Invalid expr : float number at the end of expr is invalid lacking number after exponential and sign ! -> \"" << _expr.substr(pos2) << "\"";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::size_t const pos5=_expr.find_first_not_of(FIGURES,pos4,10);
+ std::size_t pos5=_expr.find_first_not_of(FIGURES,pos4,10);
if(pos4==pos5)
{//"x+1223334.223e+x" or "1223334.223E-y"
std::ostringstream oss; oss << "Invalid expr : float number in expr is invalid lacking number after exponential ! -> \"" << _expr.substr(pos2,pos4-pos2) << "\"";
_leaf->replaceValues(valuesInExpr);
else
{
- for(auto & iter : _sub_expr)
- iter.replaceValues(valuesInExpr);
+ for(std::vector<ExprParser>::iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ (*iter).replaceValues(valuesInExpr);
}
}
ass.push_back("pop ebp");
ass.push_back("ret");
std::cout << std::endl;
- for(const auto & as : ass)
- std::cout << " " << as << std::endl;
- AsmX86 const asmb;
- std::vector<char> const output=asmb.convertIntoMachineLangage(ass);
- for(char const iter : output)
- std::cout << std::hex << (int)((unsigned char)iter) << " ";
+ for(std::vector<std::string>::const_iterator iter=ass.begin();iter!=ass.end();iter++)
+ std::cout << " " << *iter << std::endl;
+ AsmX86 asmb;
+ std::vector<char> output=asmb.convertIntoMachineLangage(ass);
+ for(std::vector<char>::const_iterator iter=output.begin();iter!=output.end();iter++)
+ std::cout << std::hex << (int)((unsigned char)(*iter)) << " ";
std::cout << std::endl;
unsigned offset;
return asmb.copyToExecMemZone(output,offset);
ass.push_back("leave");
ass.push_back("ret");
std::cout << std::endl;
- for(const auto & as : ass)
- std::cout << " " << as << std::endl;
- AsmX86 const asmb;
- std::vector<char> const output=asmb.convertIntoMachineLangage(ass);
- for(char const iter : output)
- std::cout << std::hex << (int)((unsigned char)iter) << " ";
+ for(std::vector<std::string>::const_iterator iter=ass.begin();iter!=ass.end();iter++)
+ std::cout << " " << *iter << std::endl;
+ AsmX86 asmb;
+ std::vector<char> output=asmb.convertIntoMachineLangage(ass);
+ for(std::vector<char>::const_iterator iter=output.begin();iter!=output.end();iter++)
+ std::cout << std::hex << (int)((unsigned char)(*iter)) << " ";
std::cout << std::endl;
unsigned offset;
return asmb.copyToExecMemZone(output,offset);
_leaf->compileX86(ass);
else
{
- for(const auto & iter : _sub_expr)
- iter.compileX86LowLev(ass);
+ for(std::vector<ExprParser>::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ (*iter).compileX86LowLev(ass);
}
- for(auto iter2 : _func_btw_sub_expr)
- iter2->operateX86(ass);
+ for(std::vector<Function *>::const_iterator iter2=_func_btw_sub_expr.begin();iter2!=_func_btw_sub_expr.end();iter2++)
+ (*iter2)->operateX86(ass);
}
void ExprParser::compileX86_64LowLev(std::vector<std::string>& ass) const
_leaf->compileX86_64(ass);
else
{
- for(const auto & iter : _sub_expr)
- iter.compileX86_64LowLev(ass);
+ for(std::vector<ExprParser>::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ (*iter).compileX86_64LowLev(ass);
}
- for(auto iter2 : _func_btw_sub_expr)
- iter2->operateX86(ass);
+ for(std::vector<Function *>::const_iterator iter2=_func_btw_sub_expr.begin();iter2!=_func_btw_sub_expr.end();iter2++)
+ (*iter2)->operateX86(ass);
}
double LeafExprVal::getDoubleValue() const
return _val[_fast_pos];
else
{
- int const pos(-7-_fast_pos);
+ int pos(-7-_fast_pos);
return pos==_ref_pos?1.:0.;
}
}
{
if(asker)
{
- int const sz=_father->getStackSizeToPlayX86(this);
+ int sz=_father->getStackSizeToPlayX86(this);
int i=0;
- for(auto iter=_sub_expr.rbegin();iter!=_sub_expr.rend();iter++,i++)
+ for(std::vector<ExprParser>::const_reverse_iterator iter=_sub_expr.rbegin();iter!=_sub_expr.rend();iter++,i++)
{
const ExprParser& obj=(*iter);
const ExprParser *pt=&obj;
#include "INTERPKERNELDefines.hxx"
#include "InterpKernelUnit.hxx"
+#include "InterpKernelException.hxx"
#include "InterpKernelFunction.hxx"
-#include <cstddef>
-#include <ostream>
#include <string>
+#include <list>
+#include <map>
#include <set>
-#include <vector>
namespace INTERP_KERNEL
{
{
public:
INTERPKERNEL_EXPORT LeafExprVal(double value);
- INTERPKERNEL_EXPORT ~LeafExprVal() override;
- INTERPKERNEL_EXPORT double getDoubleValue() const override;
- INTERPKERNEL_EXPORT void compileX86(std::vector<std::string>& ass) const override;
- INTERPKERNEL_EXPORT void compileX86_64(std::vector<std::string>& ass) const override;
- INTERPKERNEL_EXPORT void fillValue(Value *val) const override;
- INTERPKERNEL_EXPORT void replaceValues(const std::vector<double>& valuesInExpr) override;
- INTERPKERNEL_EXPORT LeafExprVal *deepCopy() const override;
+ INTERPKERNEL_EXPORT ~LeafExprVal();
+ INTERPKERNEL_EXPORT double getDoubleValue() const;
+ INTERPKERNEL_EXPORT void compileX86(std::vector<std::string>& ass) const;
+ INTERPKERNEL_EXPORT void compileX86_64(std::vector<std::string>& ass) const;
+ INTERPKERNEL_EXPORT void fillValue(Value *val) const;
+ INTERPKERNEL_EXPORT void replaceValues(const std::vector<double>& valuesInExpr);
+ INTERPKERNEL_EXPORT LeafExprVal *deepCopy() const;
private:
double _value;
};
public:
INTERPKERNEL_EXPORT LeafExprVar(const LeafExprVar& other):_fast_pos(other._fast_pos),_ref_pos(other._ref_pos),_var_name(other._var_name),_val(other._val) { }
INTERPKERNEL_EXPORT LeafExprVar(const std::string& var);
- INTERPKERNEL_EXPORT ~LeafExprVar() override;
- INTERPKERNEL_EXPORT double getDoubleValue() const override;
- INTERPKERNEL_EXPORT void compileX86(std::vector<std::string>& ass) const override;
- INTERPKERNEL_EXPORT void compileX86_64(std::vector<std::string>& ass) const override;
- INTERPKERNEL_EXPORT void fillValue(Value *val) const override;
+ INTERPKERNEL_EXPORT ~LeafExprVar();
+ INTERPKERNEL_EXPORT double getDoubleValue() const;
+ INTERPKERNEL_EXPORT void compileX86(std::vector<std::string>& ass) const;
+ INTERPKERNEL_EXPORT void compileX86_64(std::vector<std::string>& ass) const;
+ INTERPKERNEL_EXPORT void fillValue(Value *val) const;
INTERPKERNEL_EXPORT std::string getVar() const { return _var_name; }
INTERPKERNEL_EXPORT void prepareExprEvaluation(const std::vector<std::string>& vars, int nbOfCompo, int targetNbOfCompo) const;
INTERPKERNEL_EXPORT void prepareExprEvaluationDouble(const std::vector<std::string>& vars, int nbOfCompo, int targetNbOfCompo, int refPos, const double *ptOfInputStart, const double *ptOfInputEnd) const;
INTERPKERNEL_EXPORT void prepareExprEvaluationVec() const;
- INTERPKERNEL_EXPORT void replaceValues(const std::vector<double>& valuesInExpr) override;
+ INTERPKERNEL_EXPORT void replaceValues(const std::vector<double>& valuesInExpr);
INTERPKERNEL_EXPORT static bool isRecognizedKeyVar(const std::string& var, int& pos);
- INTERPKERNEL_EXPORT LeafExprVar *deepCopy() const override;
+ INTERPKERNEL_EXPORT LeafExprVar *deepCopy() const;
public:
static const char END_OF_RECOGNIZED_VAR[];
private:
class ExprParserOfEval
{
public:
- ExprParserOfEval():_leaf(nullptr) { }
+ ExprParserOfEval():_leaf(0) { }
ExprParserOfEval(LeafExpr *leaf, const std::vector<ExprParserOfEval>& subParts, const std::vector<Function *>& funcs):_leaf(leaf),_sub_parts(subParts),_funcs(funcs) { }
void evaluateDoubleInternal(std::vector<double>& stck) const
{
if(_leaf)
stck.push_back(_leaf->getDoubleValue());
else
- for(const auto & _sub_part : _sub_parts)
- _sub_part.evaluateDoubleInternal(stck);
- for(auto _func : _funcs)
- _func->operateStackOfDouble(stck);
+ for(std::vector<ExprParserOfEval>::const_iterator iter=_sub_parts.begin();iter!=_sub_parts.end();iter++)
+ (*iter).evaluateDoubleInternal(stck);
+ for(std::vector<Function *>::const_iterator iter3=_funcs.begin();iter3!=_funcs.end();iter3++)
+ (*iter3)->operateStackOfDouble(stck);
}
void evaluateDoubleInternalSafe(std::vector<double>& stck) const
{
if(_leaf)
stck.push_back(_leaf->getDoubleValue());
else
- for(const auto & _sub_part : _sub_parts)
- _sub_part.evaluateDoubleInternalSafe(stck);
- for(auto _func : _funcs)
- _func->operateStackOfDoubleSafe(stck);
+ for(std::vector<ExprParserOfEval>::const_iterator iter=_sub_parts.begin();iter!=_sub_parts.end();iter++)
+ (*iter).evaluateDoubleInternalSafe(stck);
+ for(std::vector<Function *>::const_iterator iter3=_funcs.begin();iter3!=_funcs.end();iter3++)
+ (*iter3)->operateStackOfDoubleSafe(stck);
}
void clearSortedMemory();
void sortMemory();
public:
INTERPKERNEL_EXPORT ExprParser(ExprParser&& other);
INTERPKERNEL_EXPORT ExprParser& operator=(ExprParser&& other);
- INTERPKERNEL_EXPORT ExprParser(const std::string& expr, ExprParser *father=nullptr);
- INTERPKERNEL_EXPORT ExprParser(const char *expr, int lgth, ExprParser *father=nullptr);
+ INTERPKERNEL_EXPORT ExprParser(const std::string& expr, ExprParser *father=0);
+ INTERPKERNEL_EXPORT ExprParser(const char *expr, int lgth, ExprParser *father=0);
INTERPKERNEL_EXPORT ~ExprParser();
INTERPKERNEL_EXPORT void parse();
INTERPKERNEL_EXPORT bool isParsingSuccessfull() const { return _is_parsing_ok; }
#include "InterpKernelFunction.hxx"
#include "InterpKernelValue.hxx"
-#include "InterpKernelException.hxx"
#include <algorithm>
#include <cmath>
#include <limits>
-#include <string>
-#include <vector>
using namespace INTERP_KERNEL;
Function *FunctionsFactory::buildUnaryFuncFromString(const char *type)
{
- std::string const tmp(type);
+ std::string tmp(type);
if(tmp.empty())
return new IdentityFunction;
if(tmp==CosFunction::REPR)
Function *FunctionsFactory::buildBinaryFuncFromString(const char *type)
{
- std::string const tmp(type);
+ std::string tmp(type);
if(tmp==PositiveFunction::REPR)
return new PlusFunction;
if(tmp==NegateFunction::REPR)
Function *FunctionsFactory::buildTernaryFuncFromString(const char *type)
{
- std::string const tmp(type);
+ std::string tmp(type);
if(tmp==IfFunction::REPR)
return new IfFunction();
std::string msg("Invalid ternary function detected : \"");
}
Function::~Function()
-= default;
+{
+}
IdentityFunction::~IdentityFunction()
-= default;
+{
+}
void IdentityFunction::operate(std::vector<Value *>& stck) const
{
}
PositiveFunction::~PositiveFunction()
-= default;
+{
+}
int UnaryFunction::getNbInputParams() const
{
}
NegateFunction::~NegateFunction()
-= default;
+{
+}
void NegateFunction::operate(std::vector<Value *>& stck) const
{
void NegateFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=-v;
}
}
CosFunction::~CosFunction()
-= default;
+{
+}
void CosFunction::operate(std::vector<Value *>& stck) const
{
void CosFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=cos(v);
}
}
SinFunction::~SinFunction()
-= default;
+{
+}
void SinFunction::operate(std::vector<Value *>& stck) const
{
void SinFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=sin(v);
}
}
TanFunction::~TanFunction()
-= default;
+{
+}
void TanFunction::operate(std::vector<Value *>& stck) const
{
val->tan();
}
-void TanFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void TanFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void TanFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=tan(v);
}
}
ACosFunction::~ACosFunction()
-= default;
+{
+}
void ACosFunction::operate(std::vector<Value *>& stck) const
{
val->acos();
}
-void ACosFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void ACosFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void ACosFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=acos(v);
}
void ACosFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
if(fabs(v)>1.)
throw INTERP_KERNEL::Exception("acos on a value which absolute is > 1 !");
stck.back()=acos(v);
}
ASinFunction::~ASinFunction()
-= default;
+{
+}
void ASinFunction::operate(std::vector<Value *>& stck) const
{
val->asin();
}
-void ASinFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void ASinFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void ASinFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=asin(v);
}
void ASinFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
if(fabs(v)>1.)
throw INTERP_KERNEL::Exception("asin on a value which absolute is > 1 !");
stck.back()=asin(v);
}
ATanFunction::~ATanFunction()
-= default;
+{
+}
void ATanFunction::operate(std::vector<Value *>& stck) const
{
val->atan();
}
-void ATanFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void ATanFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void ATanFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=atan(v);
}
}
CoshFunction::~CoshFunction()
-= default;
+{
+}
void CoshFunction::operate(std::vector<Value *>& stck) const
{
val->cosh();
}
-void CoshFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void CoshFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void CoshFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=cosh(v);
}
}
SinhFunction::~SinhFunction()
-= default;
+{
+}
void SinhFunction::operate(std::vector<Value *>& stck) const
{
val->sinh();
}
-void SinhFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void SinhFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void SinhFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=sinh(v);
}
}
TanhFunction::~TanhFunction()
-= default;
+{
+}
void TanhFunction::operate(std::vector<Value *>& stck) const
{
val->tanh();
}
-void TanhFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void TanhFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void TanhFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=tanh(v);
}
}
SqrtFunction::~SqrtFunction()
-= default;
+{
+}
void SqrtFunction::operate(std::vector<Value *>& stck) const
{
void SqrtFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=sqrt(v);
}
void SqrtFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
if(v<0.)
throw INTERP_KERNEL::Exception("sqrt on a value < 0. !");
stck.back()=sqrt(v);
}
AbsFunction::~AbsFunction()
-= default;
+{
+}
void AbsFunction::operate(std::vector<Value *>& stck) const
{
void AbsFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=fabs(v);
}
val->exp();
}
-void ExpFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void ExpFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void ExpFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=std::exp(v);
}
}
LnFunction::~LnFunction()
-= default;
+{
+}
void LnFunction::operate(std::vector<Value *>& stck) const
{
val->ln();
}
-void LnFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void LnFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void LnFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=std::log(v);
}
void LnFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
if(v<0.)
throw INTERP_KERNEL::Exception("ln on a value < 0. !");
stck.back()=std::log(v);
}
LogFunction::~LogFunction()
-= default;
+{
+}
void LogFunction::operate(std::vector<Value *>& stck) const
{
val->ln();
}
-void LogFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void LogFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !");
}
void LogFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=std::log(v);
}
void LogFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
if(v<0.)
throw INTERP_KERNEL::Exception("log on a value < 0. !");
stck.back()=std::log(v);
}
Log10Function::~Log10Function()
-= default;
+{
+}
void Log10Function::operate(std::vector<Value *>& stck) const
{
val->log10();
}
-void Log10Function::operateX86(std::vector<std::string>& /*asmb*/) const
+void Log10Function::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !");
}
void Log10Function::operateStackOfDouble(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
stck.back()=std::log10(v);
}
void Log10Function::operateStackOfDoubleSafe(std::vector<double>& stck) const
{
- double const v(stck.back());
+ double v(stck.back());
if(v<0.)
throw INTERP_KERNEL::Exception("log10 on a value < 0. !");
stck.back()=std::log10(v);
}
PlusFunction::~PlusFunction()
-= default;
+{
+}
void PlusFunction::operate(std::vector<Value *>& stck) const
{
void PlusFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
stck.back()=a+stck.back();
}
}
MinusFunction::~MinusFunction()
-= default;
+{
+}
void MinusFunction::operate(std::vector<Value *>& stck) const
{
void MinusFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
stck.back()=a-stck.back();
}
}
MultFunction::~MultFunction()
-= default;
+{
+}
void MultFunction::operate(std::vector<Value *>& stck) const
{
void MultFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
stck.back()=a*stck.back();
}
}
DivFunction::~DivFunction()
-= default;
+{
+}
void DivFunction::operate(std::vector<Value *>& stck) const
{
void DivFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
stck.back()=a/stck.back();
}
void DivFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
if(stck.back()==0.)
throw INTERP_KERNEL::Exception("division by 0. !");
}
PowFunction::~PowFunction()
-= default;
+{
+}
void PowFunction::operate(std::vector<Value *>& stck) const
{
val2=val3;
}
-void PowFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void PowFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void PowFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
stck.back()=std::pow(a,stck.back());
}
void PowFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
- double const b(stck.back());
+ double b(stck.back());
if(a<0.)
throw INTERP_KERNEL::Exception("pow with val < 0. !");
stck.back()=std::pow(a,b);
}
ExpFunction::~ExpFunction()
-= default;
+{
+}
MaxFunction::~MaxFunction()
-= default;
+{
+}
void MaxFunction::operate(std::vector<Value *>& stck) const
{
val2=val3;
}
-void MaxFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void MaxFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void MaxFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
stck.back()=std::max(stck.back(),a);
}
}
MinFunction::~MinFunction()
-= default;
+{
+}
void MinFunction::operate(std::vector<Value *>& stck) const
{
val2=val3;
}
-void MinFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void MinFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void MinFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
stck.back()=std::min(stck.back(),a);
}
}
GreaterThanFunction::~GreaterThanFunction()
-= default;
+{
+}
void GreaterThanFunction::operate(std::vector<Value *>& stck) const
{
val2=val3;
}
-void GreaterThanFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void GreaterThanFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void GreaterThanFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
- double const b(stck.back());
+ double b(stck.back());
stck.back()=a>b?std::numeric_limits<double>::max():-std::numeric_limits<double>::max();
}
}
LowerThanFunction::~LowerThanFunction()
-= default;
+{
+}
void LowerThanFunction::operate(std::vector<Value *>& stck) const
{
val2=val3;
}
-void LowerThanFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void LowerThanFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void LowerThanFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const a(stck.back());
+ double a(stck.back());
stck.pop_back();
- double const b(stck.back());
+ double b(stck.back());
stck.back()=a<b?std::numeric_limits<double>::max():-std::numeric_limits<double>::max();
}
}
IfFunction::~IfFunction()
-= default;
+{
+}
void IfFunction::operate(std::vector<Value *>& stck) const
{
val3=val4;
}
-void IfFunction::operateX86(std::vector<std::string>& /*asmb*/) const
+void IfFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
void IfFunction::operateStackOfDouble(std::vector<double>& stck) const
{
- double const cond(stck.back());
+ double cond(stck.back());
stck.pop_back();
- double const the(stck.back());
+ double the(stck.back());
stck.pop_back();
if(cond==std::numeric_limits<double>::max())
stck.back()=the;
void IfFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
{
- double const cond(stck.back());
+ double cond(stck.back());
stck.pop_back();
- double const the(stck.back());
+ double the(stck.back());
stck.pop_back();
if(cond!=std::numeric_limits<double>::max() && cond!=-std::numeric_limits<double>::max())
throw INTERP_KERNEL::Exception("ifFunc : first parameter of ternary func is NOT a consequence of a boolean op !");
#define __INTERPKERNELFUNCTION_HXX__
#include "INTERPKERNELDefines.hxx"
+#include "InterpKernelException.hxx"
-#include <string>
#include <vector>
namespace INTERP_KERNEL
class INTERPKERNEL_EXPORT UnaryFunction : public Function
{
public:
- int getNbInputParams() const override;
+ int getNbInputParams() const;
};
class INTERPKERNEL_EXPORT IdentityFunction : public UnaryFunction
{
public:
- ~IdentityFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- IdentityFunction *deepCopy() const override { return new IdentityFunction; }
+ ~IdentityFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ IdentityFunction *deepCopy() const { return new IdentityFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT PositiveFunction : public UnaryFunction
{
public:
- ~PositiveFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- PositiveFunction *deepCopy() const override { return new PositiveFunction; }
+ ~PositiveFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ PositiveFunction *deepCopy() const { return new PositiveFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT NegateFunction : public UnaryFunction
{
public:
- ~NegateFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- NegateFunction *deepCopy() const override { return new NegateFunction; }
+ ~NegateFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ NegateFunction *deepCopy() const { return new NegateFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT CosFunction : public UnaryFunction
{
public:
- ~CosFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- CosFunction *deepCopy() const override { return new CosFunction; }
+ ~CosFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ CosFunction *deepCopy() const { return new CosFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT SinFunction : public UnaryFunction
{
public:
- ~SinFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- SinFunction *deepCopy() const override { return new SinFunction; }
+ ~SinFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ SinFunction *deepCopy() const { return new SinFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT TanFunction : public UnaryFunction
{
public:
- ~TanFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- TanFunction *deepCopy() const override { return new TanFunction; }
+ ~TanFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ TanFunction *deepCopy() const { return new TanFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT ACosFunction : public UnaryFunction
{
public:
- ~ACosFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- void operateStackOfDoubleSafe(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- ACosFunction *deepCopy() const override { return new ACosFunction; }
+ ~ACosFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ ACosFunction *deepCopy() const { return new ACosFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT ASinFunction : public UnaryFunction
{
public:
- ~ASinFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- void operateStackOfDoubleSafe(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- ASinFunction *deepCopy() const override { return new ASinFunction; }
+ ~ASinFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ ASinFunction *deepCopy() const { return new ASinFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT ATanFunction : public UnaryFunction
{
public:
- ~ATanFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- ATanFunction *deepCopy() const override { return new ATanFunction; }
+ ~ATanFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ ATanFunction *deepCopy() const { return new ATanFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT CoshFunction : public UnaryFunction
{
public:
- ~CoshFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- CoshFunction *deepCopy() const override { return new CoshFunction; }
+ ~CoshFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ CoshFunction *deepCopy() const { return new CoshFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT SinhFunction : public UnaryFunction
{
public:
- ~SinhFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- SinhFunction *deepCopy() const override { return new SinhFunction; }
+ ~SinhFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ SinhFunction *deepCopy() const { return new SinhFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT TanhFunction : public UnaryFunction
{
public:
- ~TanhFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- TanhFunction *deepCopy() const override { return new TanhFunction; }
+ ~TanhFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ TanhFunction *deepCopy() const { return new TanhFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT SqrtFunction : public UnaryFunction
{
public:
- ~SqrtFunction() override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operate(std::vector<Value *>& stck) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- void operateStackOfDoubleSafe(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- SqrtFunction *deepCopy() const override { return new SqrtFunction; }
+ ~SqrtFunction();
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operate(std::vector<Value *>& stck) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ SqrtFunction *deepCopy() const { return new SqrtFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT AbsFunction : public UnaryFunction
{
public:
- ~AbsFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- AbsFunction *deepCopy() const override { return new AbsFunction; }
+ ~AbsFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ AbsFunction *deepCopy() const { return new AbsFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT ExpFunction : public UnaryFunction
{
public:
- ~ExpFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- ExpFunction *deepCopy() const override { return new ExpFunction; }
+ ~ExpFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ ExpFunction *deepCopy() const { return new ExpFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT LnFunction : public UnaryFunction
{
public:
- ~LnFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- void operateStackOfDoubleSafe(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- LnFunction *deepCopy() const override { return new LnFunction; }
+ ~LnFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ LnFunction *deepCopy() const { return new LnFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT LogFunction : public UnaryFunction
{
public:
- ~LogFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- void operateStackOfDoubleSafe(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- LogFunction *deepCopy() const override { return new LogFunction; }
+ ~LogFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ LogFunction *deepCopy() const { return new LogFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT Log10Function : public UnaryFunction
{
public:
- ~Log10Function() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- void operateStackOfDoubleSafe(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- Log10Function *deepCopy() const override { return new Log10Function; }
+ ~Log10Function();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ Log10Function *deepCopy() const { return new Log10Function; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT BinaryFunction : public Function
{
public:
- int getNbInputParams() const override;
+ int getNbInputParams() const;
};
class PlusFunction : public BinaryFunction
{
public:
- ~PlusFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- PlusFunction *deepCopy() const override { return new PlusFunction; }
+ ~PlusFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ PlusFunction *deepCopy() const { return new PlusFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT MinusFunction : public BinaryFunction
{
public:
- ~MinusFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- MinusFunction *deepCopy() const override { return new MinusFunction; }
+ ~MinusFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ MinusFunction *deepCopy() const { return new MinusFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT MultFunction : public BinaryFunction
{
public:
- ~MultFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- MultFunction *deepCopy() const override { return new MultFunction; }
+ ~MultFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ MultFunction *deepCopy() const { return new MultFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT DivFunction : public BinaryFunction
{
public:
- ~DivFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- void operateStackOfDoubleSafe(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- DivFunction *deepCopy() const override { return new DivFunction; }
+ ~DivFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ DivFunction *deepCopy() const { return new DivFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT PowFunction : public BinaryFunction
{
public:
- ~PowFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- void operateStackOfDoubleSafe(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- PowFunction *deepCopy() const override { return new PowFunction; }
+ ~PowFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ PowFunction *deepCopy() const { return new PowFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT MaxFunction : public BinaryFunction
{
public:
- ~MaxFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- MaxFunction *deepCopy() const override { return new MaxFunction; }
+ ~MaxFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ MaxFunction *deepCopy() const { return new MaxFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT MinFunction : public BinaryFunction
{
public:
- ~MinFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- MinFunction *deepCopy() const override { return new MinFunction; }
+ ~MinFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ MinFunction *deepCopy() const { return new MinFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT GreaterThanFunction : public BinaryFunction
{
public:
- ~GreaterThanFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- GreaterThanFunction *deepCopy() const override { return new GreaterThanFunction; }
+ ~GreaterThanFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ GreaterThanFunction *deepCopy() const { return new GreaterThanFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT LowerThanFunction : public BinaryFunction
{
public:
- ~LowerThanFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- LowerThanFunction *deepCopy() const override { return new LowerThanFunction; }
+ ~LowerThanFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ LowerThanFunction *deepCopy() const { return new LowerThanFunction; }
public:
static const char REPR[];
};
class INTERPKERNEL_EXPORT TernaryFunction : public Function
{
public:
- int getNbInputParams() const override;
+ int getNbInputParams() const;
};
class INTERPKERNEL_EXPORT IfFunction : public TernaryFunction
{
public:
- ~IfFunction() override;
- void operate(std::vector<Value *>& stck) const override;
- void operateX86(std::vector<std::string>& asmb) const override;
- void operateStackOfDouble(std::vector<double>& stck) const override;
- void operateStackOfDoubleSafe(std::vector<double>& stck) const override;
- const char *getRepr() const override;
- bool isACall() const override;
- IfFunction *deepCopy() const override { return new IfFunction; }
+ ~IfFunction();
+ void operate(std::vector<Value *>& stck) const;
+ void operateX86(std::vector<std::string>& asmb) const;
+ void operateStackOfDouble(std::vector<double>& stck) const;
+ void operateStackOfDoubleSafe(std::vector<double>& stck) const;
+ const char *getRepr() const;
+ bool isACall() const;
+ IfFunction *deepCopy() const { return new IfFunction; }
public:
static const char REPR[];
};
#include "InterpKernelUnit.hxx"
#include "InterpKernelExprParser.hxx"
-#include "InterpKernelException.hxx"
#include <algorithm>
#include <cmath>
-#include <cstddef>
-#include <map>
#include <sstream>
#include <iomanip>
#include <limits>
-#include <string>
using namespace INTERP_KERNEL;
const UnitDataBase& UnitDataBase::GetUniqueMapForExpr()
{
- static UnitDataBase const db;
+ static UnitDataBase db;
return db;
}
const short *UnitDataBase::getInfoForUnit(const std::string& unit, double& addFact, double& mFact) const
{
- std::size_t const lgth=unit.length();
+ std::size_t lgth=unit.length();
std::string work,work2;
- const short *ret=nullptr;
+ const short *ret=0;
for(std::size_t i=0;i<lgth && !ret;i++)
{
work=unit.substr(i);
- auto const iter=_units_semantic.find(work);
+ std::map<std::string,const short *>::const_iterator iter=_units_semantic.find(work);
if(iter!=_units_semantic.end())
{
ret=(*iter).second;
- auto const iter2=_units_add.find(work);
+ std::map<std::string,double>::const_iterator iter2=_units_add.find(work);
addFact=(*iter2).second;
- auto const iter3=_units_mul.find(work);
+ std::map<std::string,double>::const_iterator iter3=_units_mul.find(work);
mFact=(*iter3).second;
work2=unit.substr(0,i);
}
}
if(!work2.empty())
{
- auto const iter4=_prefix_pow_10.find(work2);
+ std::map<std::string,double>::const_iterator iter4=_prefix_pow_10.find(work2);
if(iter4==_prefix_pow_10.end())
{
std::ostringstream os;
bool DecompositionInUnitBase::isEqual(short mass, short lgth, short time, short intensity, short temp, double add, double mult)
{
- bool const ret1=mass==_value[0];
- bool const ret2=lgth==_value[1];
- bool const ret3=time==_value[2];
- bool const ret4=intensity==_value[3];
- bool const ret5=temp==_value[4];
- bool const ret6=areDoubleEquals(add,_add_to_base);
- bool const ret7=areDoubleEquals(mult,_mult_fact_to_base);
+ bool ret1=mass==_value[0];
+ bool ret2=lgth==_value[1];
+ bool ret3=time==_value[2];
+ bool ret4=intensity==_value[3];
+ bool ret5=temp==_value[4];
+ bool ret6=areDoubleEquals(add,_add_to_base);
+ bool ret7=areDoubleEquals(mult,_mult_fact_to_base);
return ret1 && ret2 && ret3 && ret4 && ret5 && ret6 && ret7;
}
void DecompositionInUnitBase::tryToConvertInUnit(double val)
{
- int const valI=(int)val;
+ int valI=(int)val;
if((val-(double)valI)!=0.)
{
std::ostringstream os;
{
if(!other.isAdimensional())
throw INTERP_KERNEL::Exception("Trying to execute operator ^ with a second member not adimensionnal");
- int const exp=couldItBeConsideredAsInt(other._mult_fact_to_base);
+ int exp=couldItBeConsideredAsInt(other._mult_fact_to_base);
// *= causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]'
_value[0]=(short)(_value[0]*exp); _value[1]=(short)(_value[1]*exp); _value[2]=(short)(_value[2]*exp); _value[3]=(short)(_value[3]*exp); _value[4]=(short)(_value[4]*exp);
_mult_fact_to_base=powInt(_mult_fact_to_base,exp);
work*=val;
else
{
- int const tmp=-exp;
+ int tmp=-exp;
for(int i=0;i<tmp;i++)
work*=1/val;
}
{
if(a==0. || b==0.)
return a==b;
- double const ref=std::max(a,b);
+ double ref=std::max(a,b);
return fabs((a-b)/ref)<1e-7;
}
int DecompositionInUnitBase::couldItBeConsideredAsInt(double val)
{
- int const ret=(int)val;
- auto const valT=(double) ret;
+ int ret=(int)val;
+ double valT=(double) ret;
if(valT==val)
return ret;
else
tryToInterprate();
}
-Unit::Unit(const char *reprFortran, int sizeOfRepr, bool /*tryToInterp*/):_coarse_repr(ExprParser::buildStringFromFortran(reprFortran,sizeOfRepr)),
+Unit::Unit(const char *reprFortran, int sizeOfRepr, bool tryToInterp):_coarse_repr(ExprParser::buildStringFromFortran(reprFortran,sizeOfRepr)),
_is_interpreted(false),
_is_interpretation_ok(false)
{
#define __INTERPKERNELUNIT_HXX__
#include "INTERPKERNELDefines.hxx"
+#include "InterpKernelException.hxx"
#include <map>
-#include <string>
+#include <sstream>
namespace INTERP_KERNEL
{
#include "InterpKernelValue.hxx"
#include "InterpKernelFunction.hxx"
-#include "InterpKernelUnit.hxx"
-#include "InterpKernelException.hxx"
#include <cmath>
#include <limits>
#include <algorithm>
#include <functional>
-#include <string>
using namespace INTERP_KERNEL;
_data=val;
}
-void ValueDouble::setVarname(int /*fastPos*/, const std::string& var)
+void ValueDouble::setVarname(int fastPos, const std::string& var)
{
std::string msg("Error var : "); msg+=var; msg+=" not numeric : use another expression evaluator !";
throw INTERP_KERNEL::Exception(msg.c_str());
const ValueDouble *ValueDouble::checkSameType(const Value *val)
{
- const auto *valC=dynamic_cast<const ValueDouble *>(val);
+ const ValueDouble *valC=dynamic_cast<const ValueDouble *>(val);
if(!valC)
throw INTERP_KERNEL::Exception("Trying to operate on non homogeneous Values (double with other type) !");
return valC;
}
ValueUnit::ValueUnit()
-= default;
+{
+}
Value *ValueUnit::newInstance() const
{
_data.tryToConvertInUnit(val);
}
-void ValueUnit::setVarname(int /*fastPos*/, const std::string& var)
+void ValueUnit::setVarname(int fastPos, const std::string& var)
{
double add,mul;
const short *projInBase=UnitDataBase::GetUniqueMapForExpr().getInfoForUnit(var,add,mul);
unsupportedOp(Log10Function::REPR);
}
-Value *ValueUnit::plus(const Value * /*other*/) const
+Value *ValueUnit::plus(const Value *other) const
{
unsupportedOp(PlusFunction::REPR);
- return nullptr;
+ return 0;
}
-Value *ValueUnit::minus(const Value * /*other*/) const
+Value *ValueUnit::minus(const Value *other) const
{
unsupportedOp(MinusFunction::REPR);
- return nullptr;
+ return 0;
}
-Value *ValueUnit::greaterThan(const Value * /*other*/) const
+Value *ValueUnit::greaterThan(const Value *other) const
{
unsupportedOp(GreaterThanFunction::REPR);
- return nullptr;
+ return 0;
}
-Value *ValueUnit::lowerThan(const Value * /*other*/) const
+Value *ValueUnit::lowerThan(const Value *other) const
{
unsupportedOp(LowerThanFunction::REPR);
- return nullptr;
+ return 0;
}
-Value *ValueUnit::ifFunc(const Value * /*the*/, const Value * /*els*/) const
+Value *ValueUnit::ifFunc(const Value *the, const Value *els) const
{
unsupportedOp(IfFunction::REPR);
- return nullptr;
+ return 0;
}
Value *ValueUnit::mult(const Value *other) const
return new ValueUnit(tmp);
}
-Value *ValueUnit::max(const Value * /*other*/) const
+Value *ValueUnit::max(const Value *other) const
{
unsupportedOp(MaxFunction::REPR);
- return nullptr;
+ return 0;
}
-Value *ValueUnit::min(const Value * /*other*/) const
+Value *ValueUnit::min(const Value *other) const
{
unsupportedOp(MinFunction::REPR);
- return nullptr;
+ return 0;
}
const ValueUnit *ValueUnit::checkSameType(const Value *val)
{
- const auto *valC=dynamic_cast<const ValueUnit *>(val);
+ const ValueUnit *valC=dynamic_cast<const ValueUnit *>(val);
if(!valC)
throw INTERP_KERNEL::Exception("Trying to operate on non homogeneous Values (Units with other type) !");
return valC;
std::fill(_dest_data,_dest_data+_sz_dest_data,val);
}
-void ValueDoubleExpr::setVarname(int fastPos, const std::string& /*var*/)
+void ValueDoubleExpr::setVarname(int fastPos, const std::string& var)
{
if(fastPos==-2)
std::copy(_src_data,_src_data+_sz_dest_data,_dest_data);
Value *ValueDoubleExpr::plus(const Value *other) const
{
- const auto *otherC=static_cast<const ValueDoubleExpr *>(other);
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::plus<double>());
return ret;
}
Value *ValueDoubleExpr::minus(const Value *other) const
{
- const auto *otherC=static_cast<const ValueDoubleExpr *>(other);
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::minus<double>());
return ret;
}
Value *ValueDoubleExpr::mult(const Value *other) const
{
- const auto *otherC=static_cast<const ValueDoubleExpr *>(other);
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::multiplies<double>());
return ret;
}
Value *ValueDoubleExpr::div(const Value *other) const
{
- const auto *otherC=static_cast<const ValueDoubleExpr *>(other);
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
double *it=std::find(otherC->getData(),otherC->getData()+_sz_dest_data,0.);
if(it!=otherC->getData()+_sz_dest_data)
throw INTERP_KERNEL::Exception("Trying to operate division by 0. !");
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::divides<double>());
return ret;
}
Value *ValueDoubleExpr::pow(const Value *other) const
{
- const auto *otherC=static_cast<const ValueDoubleExpr *>(other);
- double const p=otherC->getData()[0];
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ double p=otherC->getData()[0];
double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::less<double>(),std::placeholders::_1,0.));
if(it!=_dest_data+_sz_dest_data)
throw INTERP_KERNEL::Exception("Trying to operate pow(a,b) with a<0. !");
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
std::transform(_dest_data,_dest_data+_sz_dest_data,ret->getData(),std::bind([](double x, double y){return std::pow(x,y);},std::placeholders::_1,p));
return ret;
}
Value *ValueDoubleExpr::max(const Value *other) const
{
- const auto *otherC=static_cast<const ValueDoubleExpr *>(other);
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),[](const double& x, const double& y){return std::max(x,y);});
return ret;
}
Value *ValueDoubleExpr::min(const Value *other) const
{
- const auto *otherC=static_cast<const ValueDoubleExpr *>(other);
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),[](const double& x, const double& y){return std::min(x,y);});
return ret;
}
Value *ValueDoubleExpr::greaterThan(const Value *other) const
{
- const auto *otherC=static_cast<const ValueDoubleExpr *>(other);
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
for(int i=0;i<_sz_dest_data;i++)
if(_dest_data[i]<=otherC->getData()[i])
{
Value *ValueDoubleExpr::lowerThan(const Value *other) const
{
- const auto *otherC=static_cast<const ValueDoubleExpr *>(other);
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
for(int i=0;i<_sz_dest_data;i++)
if(_dest_data[i]>=otherC->getData()[i])
{
Value *ValueDoubleExpr::ifFunc(const Value *the, const Value *els) const
{
- const auto *theC=static_cast<const ValueDoubleExpr *>(the);
- const auto *elsC=static_cast<const ValueDoubleExpr *>(els);
- auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ const ValueDoubleExpr *theC=static_cast<const ValueDoubleExpr *>(the);
+ const ValueDoubleExpr *elsC=static_cast<const ValueDoubleExpr *>(els);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
bool okmax=true;
bool okmin=true;
for(int i=0;i<_sz_dest_data && (okmax || okmin);i++)
#define __INTERPKERNELVALUE_HXX__
#include "INTERPKERNELDefines.hxx"
+#include "InterpKernelException.hxx"
#include "InterpKernelUnit.hxx"
-#include <string>
namespace INTERP_KERNEL
{
{
public:
virtual Value *newInstance() const = 0;
- virtual ~Value() = default;
+ virtual ~Value() { }
virtual void setDouble(double val) = 0;
virtual void setVarname(int fastPos, const std::string& var) = 0;
//unary
{
public:
ValueDouble();
- Value *newInstance() const override;
- void setDouble(double val) override;
- void setVarname(int fastPos, const std::string& var) override;
+ Value *newInstance() const;
+ void setDouble(double val);
+ void setVarname(int fastPos, const std::string& var);
//
double getData() const { return _data; }
- void positive() override;
- void negate() override;
- void sqrt() override;
- void cos() override;
- void sin() override;
- void tan() override;
- void acos() override;
- void asin() override;
- void atan() override;
- void cosh() override;
- void sinh() override;
- void tanh() override;
- void abs() override;
- void exp() override;
- void ln() override;
- void log10() override;
+ void positive();
+ void negate();
+ void sqrt();
+ void cos();
+ void sin();
+ void tan();
+ void acos();
+ void asin();
+ void atan();
+ void cosh();
+ void sinh();
+ void tanh();
+ void abs();
+ void exp();
+ void ln();
+ void log10();
//
- Value *plus(const Value *other) const override;
- Value *minus(const Value *other) const override;
- Value *mult(const Value *other) const override;
- Value *div(const Value *other) const override;
- Value *pow(const Value *other) const override;
- Value *max(const Value *other) const override;
- Value *min(const Value *other) const override;
- Value *greaterThan(const Value *other) const override;
- Value *lowerThan(const Value *other) const override;
+ Value *plus(const Value *other) const;
+ Value *minus(const Value *other) const;
+ Value *mult(const Value *other) const;
+ Value *div(const Value *other) const;
+ Value *pow(const Value *other) const;
+ Value *max(const Value *other) const;
+ Value *min(const Value *other) const;
+ Value *greaterThan(const Value *other) const;
+ Value *lowerThan(const Value *other) const;
//
- Value *ifFunc(const Value *the, const Value *els) const override;
+ Value *ifFunc(const Value *the, const Value *els) const;
private:
ValueDouble(double val);
static const ValueDouble *checkSameType(const Value *val);
{
public:
INTERPKERNEL_EXPORT ValueUnit();
- INTERPKERNEL_EXPORT Value *newInstance() const override;
- INTERPKERNEL_EXPORT void setDouble(double val) override;
- INTERPKERNEL_EXPORT void setVarname(int fastPos, const std::string& var) override;
+ INTERPKERNEL_EXPORT Value *newInstance() const;
+ INTERPKERNEL_EXPORT void setDouble(double val);
+ INTERPKERNEL_EXPORT void setVarname(int fastPos, const std::string& var);
//
INTERPKERNEL_EXPORT DecompositionInUnitBase getData() const { return _data; }
- INTERPKERNEL_EXPORT void positive() override;
- INTERPKERNEL_EXPORT void negate() override;
- INTERPKERNEL_EXPORT void sqrt() override;
- INTERPKERNEL_EXPORT void cos() override;
- INTERPKERNEL_EXPORT void sin() override;
- INTERPKERNEL_EXPORT void tan() override;
- INTERPKERNEL_EXPORT void acos() override;
- INTERPKERNEL_EXPORT void asin() override;
- INTERPKERNEL_EXPORT void atan() override;
- INTERPKERNEL_EXPORT void cosh() override;
- INTERPKERNEL_EXPORT void sinh() override;
- INTERPKERNEL_EXPORT void tanh() override;
- INTERPKERNEL_EXPORT void abs() override;
- INTERPKERNEL_EXPORT void exp() override;
- INTERPKERNEL_EXPORT void ln() override;
- INTERPKERNEL_EXPORT void log10() override;
+ INTERPKERNEL_EXPORT void positive();
+ INTERPKERNEL_EXPORT void negate();
+ INTERPKERNEL_EXPORT void sqrt();
+ INTERPKERNEL_EXPORT void cos();
+ INTERPKERNEL_EXPORT void sin();
+ INTERPKERNEL_EXPORT void tan();
+ INTERPKERNEL_EXPORT void acos();
+ INTERPKERNEL_EXPORT void asin();
+ INTERPKERNEL_EXPORT void atan();
+ INTERPKERNEL_EXPORT void cosh();
+ INTERPKERNEL_EXPORT void sinh();
+ INTERPKERNEL_EXPORT void tanh();
+ INTERPKERNEL_EXPORT void abs();
+ INTERPKERNEL_EXPORT void exp();
+ INTERPKERNEL_EXPORT void ln();
+ INTERPKERNEL_EXPORT void log10();
//
- INTERPKERNEL_EXPORT Value *plus(const Value *other) const override;
- INTERPKERNEL_EXPORT Value *minus(const Value *other) const override;
- INTERPKERNEL_EXPORT Value *mult(const Value *other) const override;
- INTERPKERNEL_EXPORT Value *div(const Value *other) const override;
- INTERPKERNEL_EXPORT Value *pow(const Value *other) const override;
- INTERPKERNEL_EXPORT Value *max(const Value *other) const override;
- INTERPKERNEL_EXPORT Value *min(const Value *other) const override;
- INTERPKERNEL_EXPORT Value *greaterThan(const Value *other) const override;
- INTERPKERNEL_EXPORT Value *lowerThan(const Value *other) const override;
+ INTERPKERNEL_EXPORT Value *plus(const Value *other) const;
+ INTERPKERNEL_EXPORT Value *minus(const Value *other) const;
+ INTERPKERNEL_EXPORT Value *mult(const Value *other) const;
+ INTERPKERNEL_EXPORT Value *div(const Value *other) const;
+ INTERPKERNEL_EXPORT Value *pow(const Value *other) const;
+ INTERPKERNEL_EXPORT Value *max(const Value *other) const;
+ INTERPKERNEL_EXPORT Value *min(const Value *other) const;
+ INTERPKERNEL_EXPORT Value *greaterThan(const Value *other) const;
+ INTERPKERNEL_EXPORT Value *lowerThan(const Value *other) const;
//
- INTERPKERNEL_EXPORT Value *ifFunc(const Value *the, const Value *els) const override;
+ INTERPKERNEL_EXPORT Value *ifFunc(const Value *the, const Value *els) const;
private:
ValueUnit(const DecompositionInUnitBase& unit);
static void unsupportedOp(const char *type);
{
public:
ValueDoubleExpr(int szDestData, const double *srcData);
- ~ValueDoubleExpr() override;
+ ~ValueDoubleExpr();
double *getData() const { return _dest_data; }
- Value *newInstance() const override;
- void setDouble(double val) override;
- void setVarname(int fastPos, const std::string& var) override;
+ Value *newInstance() const;
+ void setDouble(double val);
+ void setVarname(int fastPos, const std::string& var);
//
- void positive() override;
- void negate() override;
- void sqrt() override;
- void cos() override;
- void sin() override;
- void tan() override;
- void acos() override;
- void asin() override;
- void atan() override;
- void cosh() override;
- void sinh() override;
- void tanh() override;
- void abs() override;
- void exp() override;
- void ln() override;
- void log10() override;
+ void positive();
+ void negate();
+ void sqrt();
+ void cos();
+ void sin();
+ void tan();
+ void acos();
+ void asin();
+ void atan();
+ void cosh();
+ void sinh();
+ void tanh();
+ void abs();
+ void exp();
+ void ln();
+ void log10();
//
- Value *plus(const Value *other) const override;
- Value *minus(const Value *other) const override;
- Value *mult(const Value *other) const override;
- Value *div(const Value *other) const override;
- Value *pow(const Value *other) const override;
- Value *max(const Value *other) const override;
- Value *min(const Value *other) const override;
- Value *greaterThan(const Value *other) const override;
- Value *lowerThan(const Value *other) const override;
+ Value *plus(const Value *other) const;
+ Value *minus(const Value *other) const;
+ Value *mult(const Value *other) const;
+ Value *div(const Value *other) const;
+ Value *pow(const Value *other) const;
+ Value *max(const Value *other) const;
+ Value *min(const Value *other) const;
+ Value *greaterThan(const Value *other) const;
+ Value *lowerThan(const Value *other) const;
//
- Value *ifFunc(const Value *the, const Value *els) const override;
+ Value *ifFunc(const Value *the, const Value *els) const;
private:
int _sz_dest_data;
double *_dest_data;
//Local includes
#include "InterpKernelGaussCoords.hxx"
#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
-#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
//STL includes
-#include <cstddef>
#include <math.h>
#include <algorithm>
#include <sstream>
#include <cmath>
-#include <vector>
using namespace INTERP_KERNEL;
//---------------------------------------------------------------
static bool IsEqual(double theLeft, double theRight)
{
- static double const EPS = 1.0E-3;
+ static double EPS = 1.0E-3;
if(fabs(theLeft) + fabs(theRight) > EPS)
return fabs(theLeft-theRight)/(fabs(theLeft)+fabs(theRight)) < EPS;
return true;
* Destructor
*/
GaussInfo::~GaussInfo()
-= default;
+{
+}
/*!
* Return dimension of the gauss coordinates
{
case NORM_SEG3:
{
- std::vector<double> const a(SEG3_REF,SEG3_REF+3);
+ std::vector<double> a(SEG3_REF,SEG3_REF+3);
if(IsSatisfy(a,_my_reference_coord))
{
- std::vector<double> const c(SEG2A_REF,SEG2A_REF+2);
+ std::vector<double> c(SEG2A_REF,SEG2A_REF+2);
return GaussInfo(NORM_SEG2,_my_gauss_coord,getNbGauss(),c,2);
}
throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for SEG3 !");
std::vector<double> a(TRIA6A_REF,TRIA6A_REF+12),b(TRIA6B_REF,TRIA6B_REF+12);
if(IsSatisfy(a,_my_reference_coord))
{
- std::vector<double> const c(TRIA3A_REF,TRIA3A_REF+6);
+ std::vector<double> c(TRIA3A_REF,TRIA3A_REF+6);
return GaussInfo(NORM_TRI3,_my_gauss_coord,getNbGauss(),c,3);
}
if(IsSatisfy(b,_my_reference_coord))
{
- std::vector<double> const c(TRIA3B_REF,TRIA3B_REF+6);
+ std::vector<double> c(TRIA3B_REF,TRIA3B_REF+6);
return GaussInfo(NORM_TRI3,_my_gauss_coord,getNbGauss(),c,3);
}
throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for TRI6 !");
}
case NORM_TRI7:
{
- std::vector<double> const a(TRIA7A_REF,TRIA7A_REF+14);
+ std::vector<double> a(TRIA7A_REF,TRIA7A_REF+14);
if(IsSatisfy(a,_my_reference_coord))
{
- std::vector<double> const c(TRIA3B_REF,TRIA3B_REF+6);
+ std::vector<double> c(TRIA3B_REF,TRIA3B_REF+6);
return GaussInfo(NORM_TRI3,_my_gauss_coord,getNbGauss(),c,3);
}
throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for TRI7 !");
std::vector<double> a(QUAD8A_REF,QUAD8A_REF+16),b(QUAD8B_REF,QUAD8B_REF+16);
if(IsSatisfy(a,_my_reference_coord))
{
- std::vector<double> const c(QUAD4A_REF,QUAD4A_REF+8);
+ std::vector<double> c(QUAD4A_REF,QUAD4A_REF+8);
return GaussInfo(NORM_QUAD4,_my_gauss_coord,getNbGauss(),c,4);
}
if(IsSatisfy(b,_my_reference_coord))
{
- std::vector<double> const c(QUAD4B_REF,QUAD4B_REF+8);
+ std::vector<double> c(QUAD4B_REF,QUAD4B_REF+8);
return GaussInfo(NORM_QUAD4,_my_gauss_coord,getNbGauss(),c,4);
}
throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for QUAD8 !");
}
case NORM_QUAD9:
{
- std::vector<double> const a(QUAD9A_REF,QUAD9A_REF+18);
+ std::vector<double> a(QUAD9A_REF,QUAD9A_REF+18);
if(IsSatisfy(a,_my_reference_coord))
{
- std::vector<double> const c(QUAD4B_REF,QUAD4B_REF+8);
+ std::vector<double> c(QUAD4B_REF,QUAD4B_REF+8);
return GaussInfo(NORM_QUAD4,_my_gauss_coord,getNbGauss(),c,4);
}
throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for QUAD9 !");
std::vector<double> a(TETRA10A_REF,TETRA10A_REF+30),b(TETRA10B_REF,TETRA10B_REF+30);
if(IsSatisfy(a,_my_reference_coord))
{
- std::vector<double> const c(TETRA4A_REF,TETRA4A_REF+12);
+ std::vector<double> c(TETRA4A_REF,TETRA4A_REF+12);
return GaussInfo(NORM_TETRA4,_my_gauss_coord,getNbGauss(),c,4);
}
if(IsSatisfy(b,_my_reference_coord))
bool GaussInfo::isSatisfy()
{
- bool const anIsSatisfy = ((_my_local_nb_ref == _my_nb_ref) && (_my_local_ref_dim == getReferenceCoordDim()));
+ bool anIsSatisfy = ((_my_local_nb_ref == _my_nb_ref) && (_my_local_ref_dim == getReferenceCoordDim()));
//Check coordinates
if(anIsSatisfy)
{
if(sz%dim!=0)
throw INTERP_KERNEL::Exception("GaussInfo::NormalizeCoordinatesIfNecessary : invalid input array ! Inconsistent with the given dimension !");
const CellModel& cm(CellModel::GetCellModel(ct));
- auto const baseDim((std::size_t)cm.getDimension());
+ std::size_t baseDim((std::size_t)cm.getDimension());
if(baseDim==dim)
return inputArray;
- std::size_t const nbOfItems(sz/dim);
+ std::size_t nbOfItems(sz/dim);
std::vector<double> ret(nbOfItems*baseDim);
if(baseDim>dim)
{
}
}
-using MapToShapeFunction = void (*)(GaussInfo &);
+typedef void (*MapToShapeFunction)(GaussInfo& obj);
/*!
* Initialize the internal vectors
_my_local_ref_dim = 2;
_my_local_nb_ref = 4;
MapToShapeFunction QUAD4PTR[]={Quad4aInit,Quad4bInit,Quad4cInit,Quad4DegSeg2Init};
- std::size_t const NB_OF_QUAD4PTR(sizeof(QUAD4PTR)/sizeof(MapToShapeFunction));
+ std::size_t NB_OF_QUAD4PTR(sizeof(QUAD4PTR)/sizeof(MapToShapeFunction));
for(std::size_t i=0;i<NB_OF_QUAD4PTR && !aSatify;i++)
{
(QUAD4PTR[i])(*this);
_my_local_ref_dim = 3;
_my_local_nb_ref = 6;
MapToShapeFunction PENTA6PTR[]={Penta6aInit,Penta6bInit,Penta6DegTria3aInit,Penta6DegTria3bInit};
- std::size_t const NB_OF_PENTA6PTR(sizeof(PENTA6PTR)/sizeof(MapToShapeFunction));
+ std::size_t NB_OF_PENTA6PTR(sizeof(PENTA6PTR)/sizeof(MapToShapeFunction));
for(std::size_t i=0;i<NB_OF_PENTA6PTR && !aSatify;i++)
{
(PENTA6PTR[i])(*this);
_my_local_ref_dim = 3;
_my_local_nb_ref = 15;
MapToShapeFunction PENTA15PTR[]={Penta15aInit,Penta15bInit};
- std::size_t const NB_OF_PENTA15PTR(sizeof(PENTA15PTR)/sizeof(MapToShapeFunction));
+ std::size_t NB_OF_PENTA15PTR(sizeof(PENTA15PTR)/sizeof(MapToShapeFunction));
for(std::size_t i=0;i<NB_OF_PENTA15PTR && !aSatify;i++)
{
(PENTA15PTR[i])(*this);
_my_local_ref_dim = 3;
_my_local_nb_ref = 18;
MapToShapeFunction PENTA18PTR[]={Penta18aInit,Penta18bInit};
- std::size_t const NB_OF_PENTA18PTR(sizeof(PENTA18PTR)/sizeof(MapToShapeFunction));
+ std::size_t NB_OF_PENTA18PTR(sizeof(PENTA18PTR)/sizeof(MapToShapeFunction));
for(std::size_t i=0;i<NB_OF_PENTA18PTR && !aSatify;i++)
{
(PENTA18PTR[i])(*this);
_my_local_ref_dim = 3;
_my_local_nb_ref = 8;
MapToShapeFunction HEXA8PTR[]={Hexa8aInit,Hexa8bInit,Hexa8DegQuad4aInit,Hexa8DegQuad4bInit,Hexa8DegQuad4cInit};
- std::size_t const NB_OF_HEXA8PTR(sizeof(HEXA8PTR)/sizeof(MapToShapeFunction));
+ std::size_t NB_OF_HEXA8PTR(sizeof(HEXA8PTR)/sizeof(MapToShapeFunction));
for(std::size_t i=0;i<NB_OF_HEXA8PTR && !aSatify;i++)
{
(HEXA8PTR[i])(*this);
* Constructor
*/
GaussCoords::GaussCoords()
-= default;
+{
+}
/*!
* Destructor
aReferenceCoord.push_back(theReferenceCoord[i]);
- auto* info = new GaussInfo( theGeometry, aGaussCoord, FromIdType<int>(theNbGauss), aReferenceCoord, FromIdType<int>(theNbRef));
+ GaussInfo* info = new GaussInfo( theGeometry, aGaussCoord, FromIdType<int>(theNbGauss), aReferenceCoord, FromIdType<int>(theNbRef));
info->initLocalInfo();
//If info with cell type doesn't exist add it
const mcIdType *theIndex)
{
const GaussInfo *info = getInfoGivenCellType(theGeometry);
- int const nbCoords = theSpaceDim * info->getNbGauss();
- auto *aCoords = new double[nbCoords];
+ int nbCoords = theSpaceDim * info->getNbGauss();
+ double *aCoords = new double[nbCoords];
calculateCoordsAlg(info,theNodeCoords,theSpaceDim,theIndex,aCoords);
return aCoords;
}
void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result)
{
- int const aConn = info->getNbRef();
+ int aConn = info->getNbRef();
- int const nbCoords = theSpaceDim * info->getNbGauss();
+ int nbCoords = theSpaceDim * info->getNbGauss();
std::fill(result,result+nbCoords,0.);
for( int gaussId = 0; gaussId < info->getNbGauss(); gaussId++ )
#define __INTERPKERNELGAUSSCOORDS_HXX__
#include "INTERPKERNELDefines.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelException.hxx"
#include "MCIdType.hxx"
-#include "NormalizedGeometricTypes"
#include <vector>
namespace INTERP_KERNEL
{
- using DataVector = std::vector<double>;
- using IndexVector = std::vector<int>;
+ typedef std::vector<double> DataVector;
+ typedef std::vector<int> IndexVector;
//Class to store Gauss Points information
class GaussInfo
void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex,
double *result);
private:
- using GaussInfoVector = std::vector<GaussInfo *>;
+ typedef std::vector<GaussInfo*> GaussInfoVector;
GaussInfoVector _my_gauss_info;
};
}
#ifndef __GENMATHFORMULAE_HXX__
#define __GENMATHFORMULAE_HXX__
+#include "InterpKernelException.hxx"
#include <cmath>
-#include <math.h>
namespace INTERP_KERNEL
{
*/
void computeEigenValues6(const double *matrix, double *eigenVals)
{
- double const tr=(matrix[0]+matrix[1]+matrix[2])/3.;
- double const K[6]={matrix[0]-tr,matrix[1]-tr,matrix[2]-tr,matrix[3],matrix[4],matrix[5]};
- double const q=(K[0]*K[1]*K[2]+2.*K[4]*K[5]*K[3]-K[0]*K[4]*K[4]-K[2]*K[3]*K[3]-K[1]*K[5]*K[5])/2.;
+ double tr=(matrix[0]+matrix[1]+matrix[2])/3.;
+ double K[6]={matrix[0]-tr,matrix[1]-tr,matrix[2]-tr,matrix[3],matrix[4],matrix[5]};
+ double q=(K[0]*K[1]*K[2]+2.*K[4]*K[5]*K[3]-K[0]*K[4]*K[4]-K[2]*K[3]*K[3]-K[1]*K[5]*K[5])/2.;
double p=K[0]*K[0]+K[1]*K[1]+K[2]*K[2]+2*(K[3]*K[3]+K[4]*K[4]+K[5]*K[5]);
p/=6.;
- double const sqp=sqrt(p);
- double const tmp=p*sqp;
+ double sqp=sqrt(p);
+ double tmp=p*sqp;
double phi;
if(fabs(q)<=fabs(tmp))
if(tmp !=0)
const double m9[9]={matrix[0]-eigenVal,matrix[3],matrix[5],matrix[3],matrix[1]-eigenVal,matrix[4],matrix[5],matrix[4],matrix[2]-eigenVal};
for(int i=0;i<3;i++)
{
- double const w[9]={m9[0+3*i],m9[1+3*i],m9[2+3*i],m9[0+(3*(i+1))%6],m9[1+(3*(i+1))%6],m9[2+(3*(i+1))%6],1.,1.,1.};
- double const det=w[0]*w[4]*w[8]+w[1]*w[5]*w[6]+w[2]*w[3]*w[7]-w[0]*w[5]*w[7]-w[1]*w[3]*w[8]-w[2]*w[4]*w[6];
+ double w[9]={m9[0+3*i],m9[1+3*i],m9[2+3*i],m9[0+(3*(i+1))%6],m9[1+(3*(i+1))%6],m9[2+(3*(i+1))%6],1.,1.,1.};
+ double det=w[0]*w[4]*w[8]+w[1]*w[5]*w[6]+w[2]*w[3]*w[7]-w[0]*w[5]*w[7]-w[1]*w[3]*w[8]-w[2]*w[4]*w[6];
if(fabs(det)>eps)
{
eigenVector[0]=(w[1]*w[5]-w[4]*w[2])/det;
eigenVector[1]=(w[2]*w[3]-w[0]*w[5])/det;
eigenVector[2]=(w[0]*w[4]-w[1]*w[3])/det;
- double const norm=sqrt(eigenVector[0]*eigenVector[0]+eigenVector[1]*eigenVector[1]+eigenVector[2]*eigenVector[2]);
+ double norm=sqrt(eigenVector[0]*eigenVector[0]+eigenVector[1]*eigenVector[1]+eigenVector[2]*eigenVector[2]);
eigenVector[0]/=norm;
eigenVector[1]/=norm;
eigenVector[2]/=norm;
#include "InterpKernelGeo2DAbstractEdge.hxx"
#include "InterpKernelGeo2DComposedEdge.hxx"
-#include "InterpKernelGeo2DEdge.hxx"
#include "InterpKernelGeo2DElementaryEdge.hxx"
-#include <list>
-#include <cstddef>
using namespace INTERP_KERNEL;
-IteratorOnComposedEdge::IteratorOnComposedEdge():_list_handle(nullptr)
+IteratorOnComposedEdge::IteratorOnComposedEdge():_list_handle(0)
{
}
void IteratorOnComposedEdge::assignMySelfToAllElems(ComposedEdge *elems)
{
std::list<ElementaryEdge *> *myList=elems->getListBehind();
- for(auto & iter : *myList)
- iter->getIterator()=(*this);
+ for(std::list<ElementaryEdge *>::iterator iter=myList->begin();iter!=myList->end();iter++)
+ (*iter)->getIterator()=(*this);
}
void IteratorOnComposedEdge::insertElemEdges(ComposedEdge *elems, bool changeMySelf)
{
std::list<ElementaryEdge *> *myListToInsert=elems->getListBehind();
- auto iter=myListToInsert->begin();
+ std::list<ElementaryEdge *>::iterator iter=myListToInsert->begin();
*_deep_it=*iter;
_deep_it++;
iter++;
- std::size_t const sizeOfMyList=myListToInsert->size();
+ std::size_t sizeOfMyList=myListToInsert->size();
_list_handle->insert(_deep_it,iter,myListToInsert->end());
if(!changeMySelf)
{
#include "INTERPKERNELDefines.hxx"
+#include <set>
#include <list>
+#include <fstream>
namespace INTERP_KERNEL
{
public:
INTERPKERNEL_EXPORT IteratorOnComposedEdge();
INTERPKERNEL_EXPORT IteratorOnComposedEdge(ComposedEdge *compEdges);
- INTERPKERNEL_EXPORT bool isValid() const { return _list_handle!=nullptr; }
+ INTERPKERNEL_EXPORT bool isValid() const { return _list_handle!=0; }
INTERPKERNEL_EXPORT void operator=(const IteratorOnComposedEdge& other);
INTERPKERNEL_EXPORT void first() { _deep_it=_list_handle->begin(); }
INTERPKERNEL_EXPORT void next() { _deep_it++; }
#include "InterpKernelException.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DNode.hxx"
-#include <cmath>
-#include <algorithm>
-#include "InterpKernelGeo2DPrecision.hxx"
using namespace INTERP_KERNEL;
double Bounds::getDiagonal() const
{
- double const a=_x_max-_x_min;
- double const b=_y_max-_y_min;
+ double a=_x_max-_x_min;
+ double b=_y_max-_y_min;
return sqrt(a*a+b*b);
}
*/
void Bounds::getInterceptedArc(const double *center, double radius, double& intrcptArcAngle0, double& intrcptArcDelta) const
{
- double const diag=getDiagonal();
+ double diag=getDiagonal();
if(diag<2.*radius)
{
double v1[2],v2[2],w1[2],w2[2];
v1[0]=_x_min-center[0]; v1[1]=_y_max-center[1]; v2[0]=_x_max-center[0]; v2[1]=_y_min-center[1];
w1[0]=v1[0]; w1[1]=_y_min-center[1]; w2[0]=v2[0]; w2[1]=_y_max-center[1];
- double const delta1=EdgeArcCircle::SafeAsin(v1[0]*v2[1]-v1[1]*v2[0]);
- double const delta2=EdgeArcCircle::SafeAsin(w1[0]*w2[1]-w1[1]*w2[0]);
+ double delta1=EdgeArcCircle::SafeAsin(v1[0]*v2[1]-v1[1]*v2[0]);
+ double delta2=EdgeArcCircle::SafeAsin(w1[0]*w2[1]-w1[1]*w2[0]);
double tmp;
if(fabs(delta1)>fabs(delta2))
{
double Bounds::fitXForXFigD(double val, int res) const
{
double delta=std::max(_x_max-_x_min,_y_max-_y_min)/2.;
- double const ret=val-(_x_max+_x_min)/2.+delta;
+ double ret=val-(_x_max+_x_min)/2.+delta;
delta=11.1375*res/(2.*delta);
return ret*delta;
}
double Bounds::fitYForXFigD(double val, int res) const
{
double delta=std::max(_x_max-_x_min,_y_max-_y_min)/2.;
- double const ret=(_y_max+_y_min)/2.-val+delta;
+ double ret=(_y_max+_y_min)/2.-val+delta;
delta=11.1375*res/(2.*delta);
return ret*delta;
}
Bounds *Bounds::nearlyAmIIntersectingWith(const Bounds& other) const
{
- double const eps = QuadraticPlanarPrecision::getPrecision();
+ double eps = QuadraticPlanarPrecision::getPrecision();
if( (other._x_min > _x_max+eps) || (other._x_max < _x_min-eps) || (other._y_min > _y_max+eps)
|| (other._y_max < _y_min-eps) )
- return nullptr;
+ return 0;
if( (other._x_min >= _x_max ) || (other._x_max <= _x_min) || (other._y_min >= _y_max) || (other._y_max <= _y_min) )
{
return new Bounds(std::max(_x_min-eps,other._x_min),
Bounds *Bounds::amIIntersectingWith(const Bounds& other) const
{
if( (other._x_min > _x_max) || (other._x_max < _x_min) || (other._y_min > _y_max) || (other._y_max < _y_min) )
- return nullptr;
+ return 0;
return new Bounds(std::max(_x_min,other._x_min),std::min(_x_max,other._x_max),std::max(_y_min,other._y_min),std::min(_y_max,other._y_max));
}
Position Bounds::nearlyWhere(double x, double y) const
{
- bool const thinX=Node::areDoubleEquals(_x_min,_x_max);
- bool const thinY=Node::areDoubleEquals(_y_min,_y_max);
+ bool thinX=Node::areDoubleEquals(_x_min,_x_max);
+ bool thinY=Node::areDoubleEquals(_y_min,_y_max);
if(!thinX)
{
if((Node::areDoubleEquals(x,_x_min) || Node::areDoubleEquals(x,_x_max)) && ((y<_y_max+QuadraticPlanarPrecision::getPrecision()) && (y>_y_min-QuadraticPlanarPrecision::getPrecision())))
void getBarycenter(double& xBary, double& yBary) const;
void applySimilarity(double xBary, double yBary, double dimChar);
void unApplySimilarity(double xBary, double yBary, double dimChar);
- Bounds& operator=(const Bounds& other) = default;
+ Bounds& operator=(const Bounds& other) { _x_min=other._x_min; _x_max=other._x_max; _y_min=other._y_min; _y_max=other._y_max; return *this; }
Bounds(double xMin, double xMax, double yMin, double yMax):_x_min(xMin),_x_max(xMax),_y_min(yMin),_y_max(yMax) { }
void setValues(double xMin, double xMax, double yMin, double yMax) { _x_min=xMin; _x_max=xMax; _y_min=yMin; _y_max=yMax; }
void prepareForAggregation();
// Author : Anthony Geay (CEA/DEN)
#include "InterpKernelGeo2DComposedEdge.hxx"
-#include "InterpKernelGeo2DEdge.hxx"
-#include "InterpKernelGeo2DBounds.hxx"
#include "InterpKernelGeo2DElementaryEdge.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DEdgeInfLin.hxx"
#include "InterpKernelException.hxx"
-#include "InterpKernelGeo2DNode.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
#include <algorithm>
-#include <list>
-#include <cmath>
-#include <map>
-#include <iostream>
-#include <math.h>
-#include <functional>
-#include <cstddef>
#include <memory>
#include <iterator>
-#include <ostream>
#include <set>
-#include <vector>
using namespace INTERP_KERNEL;
ComposedEdge::ComposedEdge(const ComposedEdge& other)
{
- for(auto _sub_edge : other._sub_edges)
- _sub_edges.push_back(_sub_edge->clone());
+ for(std::list<ElementaryEdge *>::const_iterator iter=other._sub_edges.begin();iter!=other._sub_edges.end();iter++)
+ _sub_edges.push_back((*iter)->clone());
}
ComposedEdge::~ComposedEdge()
void ComposedEdge::setValueAt(int i, Edge *e, bool direction)
{
- auto it=_sub_edges.begin();
+ std::list<ElementaryEdge*>::iterator it=_sub_edges.begin();
for(int j=0;j<i;j++)
it++;
delete *it;
double ComposedEdge::getCommonLengthWith(const ComposedEdge& other) const
{
double ret=0.;
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- if(find_if(other._sub_edges.begin(),other._sub_edges.end(),AbsEdgeCmp(_sub_edge))!=other._sub_edges.end())
+ if(find_if(other._sub_edges.begin(),other._sub_edges.end(),AbsEdgeCmp(*iter))!=other._sub_edges.end())
{
- const auto *tmp=static_cast<const ElementaryEdge *>(_sub_edge);
+ const ElementaryEdge *tmp=static_cast<const ElementaryEdge *>(*iter);
ret+=tmp->getCurveLength();
}
}
ElementaryEdge *ComposedEdge::operator[](int i) const
{
- auto iter=_sub_edges.begin();
+ std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();
for(int ii=0;ii<i;ii++)
iter++;
return *iter;
void ComposedEdge::reverse()
{
_sub_edges.reverse();
- for(auto & _sub_edge : _sub_edges)
- _sub_edge->reverse();
+ for(std::list<ElementaryEdge *>::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->reverse();
}
bool ComposedEdge::presenceOfOn() const
{
bool ret=false;
- for(auto iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++)
ret=((*iter)->getLoc()==FULL_ON_1);
return ret;
}
bool ComposedEdge::presenceOfQuadraticEdge() const
{
bool ret=false;
- for(auto iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++)
{
Edge *e=(*iter)->getPtr();
if(e)
- ret=dynamic_cast<EdgeArcCircle*>(e)!=nullptr;
+ ret=dynamic_cast<EdgeArcCircle*>(e)!=0;
}
return ret;
}
void ComposedEdge::initLocations() const
{
- for(auto _sub_edge : _sub_edges)
- _sub_edge->initLocations();
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->initLocations();
}
/**
void ComposedEdge::InitLocationsWithOther(const ComposedEdge& first, const ComposedEdge& other)
{
std::set<Edge *> s1,s2;
- for(auto _sub_edge : first._sub_edges)
- s1.insert(_sub_edge->getPtr());
- for(auto _sub_edge : other._sub_edges)
- s2.insert(_sub_edge->getPtr());
+ for(std::list<ElementaryEdge *>::const_iterator it1=first._sub_edges.begin();it1!=first._sub_edges.end();it1++)
+ s1.insert((*it1)->getPtr());
+ for(std::list<ElementaryEdge *>::const_iterator it2=other._sub_edges.begin();it2!=other._sub_edges.end();it2++)
+ s2.insert((*it2)->getPtr());
first.initLocations();
other.initLocations();
std::vector<Edge *> s3;
std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector<Edge *> >(s3));
- for(auto it3 : s3)
- it3->declareOn();
+ for(std::vector<Edge *>::const_iterator it3=s3.begin();it3!=s3.end();it3++)
+ (*it3)->declareOn();
}
ComposedEdge *ComposedEdge::clone() const
bool ComposedEdge::isNodeIn(Node *n) const
{
bool ret=false;
- for(auto iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++)
ret=(*iter)->isNodeIn(n);
return ret;
}
double ComposedEdge::getArea() const
{
double ret=0.;
- for(auto _sub_edge : _sub_edges)
- ret+=_sub_edge->getAreaOfZone();
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ ret+=(*iter)->getAreaOfZone();
return ret;
}
double ComposedEdge::getPerimeter() const
{
double ret=0.;
- for(auto _sub_edge : _sub_edges)
- ret+=_sub_edge->getCurveLength();
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ ret+=(*iter)->getCurveLength();
return ret;
}
bary[0]=0.;
bary[1]=0.;
double area=0.;
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- _sub_edge->getBarycenterOfZone(bary);
- area+=_sub_edge->getAreaOfZone();
+ (*iter)->getBarycenterOfZone(bary);
+ area+=(*iter)->getAreaOfZone();
}
bary[0]/=area;
bary[1]/=area;
Bounds b;
b.prepareForAggregation();
fillBounds(b);
- double const dimChar=b.getCaracteristicDim();
+ double dimChar=b.getCaracteristicDim();
b.getBarycenter(xBary,yBary);
applyGlobalSimilarity(xBary,yBary,dimChar);
return dimChar;
b.prepareForAggregation();
fillBounds(b);
other->fillBounds(b);
- double const dimChar=b.getCaracteristicDim();
+ double dimChar=b.getCaracteristicDim();
b.getBarycenter(xBary,yBary);
applyGlobalSimilarity(xBary,yBary,dimChar);
other->applyGlobalSimilarity(xBary,yBary,dimChar);
b.prepareForAggregation();
fillBounds(b);
other->fillBounds(b);
- double const dimChar=b.getCaracteristicDim();
+ double dimChar=b.getCaracteristicDim();
b.getBarycenter(xBary,yBary);
applyGlobalSimilarity2(other,xBary,yBary,dimChar);
return dimChar;
void ComposedEdge::dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const
{
stream.precision(10);
- for(auto _sub_edge : _sub_edges)
- _sub_edge->dumpInXfigFile(stream,resolution,box);
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->dumpInXfigFile(stream,resolution,box);
}
void ComposedEdge::dumpToCout(const std::map<INTERP_KERNEL::Node *,int>& mapp) const
{
int i=0;
- for(auto iter=_sub_edges.begin();iter!=_sub_edges.end();iter++, i++)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++, i++)
(*iter)->dumpToCout(mapp, i);
std::cout << std::endl;
}
void ComposedEdge::fillBounds(Bounds& output) const
{
- for(auto _sub_edge : _sub_edges)
- _sub_edge->fillBounds(output);
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->fillBounds(output);
}
/*!
*/
void ComposedEdge::applySimilarity(double xBary, double yBary, double dimChar)
{
- for(auto & _sub_edge : _sub_edges)
- _sub_edge->applySimilarity(xBary,yBary,dimChar);
+ for(std::list<ElementaryEdge *>::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->applySimilarity(xBary,yBary,dimChar);
}
/*!
{
std::set<Node *> allNodes;
getAllNodes(allNodes);
- for(auto allNode : allNodes)
- allNode->applySimilarity(xBary,yBary,dimChar);
- for(auto & _sub_edge : _sub_edges)
- _sub_edge->applySimilarity(xBary,yBary,dimChar);
+ for(std::set<Node *>::iterator iter=allNodes.begin();iter!=allNodes.end();iter++)
+ (*iter)->applySimilarity(xBary,yBary,dimChar);
+ for(std::list<ElementaryEdge *>::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->applySimilarity(xBary,yBary,dimChar);
}
/*!
*/
void ComposedEdge::dispatchPerimeter(double& partConsidered) const
{
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- TypeOfEdgeLocInPolygon const loc=_sub_edge->getLoc();
+ TypeOfEdgeLocInPolygon loc=(*iter)->getLoc();
if(loc==FULL_IN_1 || loc==FULL_ON_1)
- partConsidered+=_sub_edge->getCurveLength();
+ partConsidered+=(*iter)->getCurveLength();
}
}
*/
void ComposedEdge::dispatchPerimeterExcl(double& partConsidered, double& commonPart) const
{
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- TypeOfEdgeLocInPolygon const loc=_sub_edge->getLoc();
+ TypeOfEdgeLocInPolygon loc=(*iter)->getLoc();
if(loc==FULL_IN_1)
- partConsidered+=_sub_edge->getCurveLength();
+ partConsidered+=(*iter)->getCurveLength();
if(loc==FULL_ON_1)
- commonPart+=_sub_edge->getCurveLength();
+ commonPart+=(*iter)->getCurveLength();
}
}
void ComposedEdge::getAllNodes(std::set<Node *>& output) const
{
- auto iter=_sub_edges.begin();
+ std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();
for(;iter!=_sub_edges.end();iter++)
(*iter)->getAllNodes(output);
}
void ComposedEdge::initNodeHitStatus() const
{
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- _sub_edge->getStartNode()->initHitStatus();
- _sub_edge->getEndNode()->initHitStatus();
+ (*iter)->getStartNode()->initHitStatus();
+ (*iter)->getEndNode()->initHitStatus();
}
}
void ComposedEdge::applySimilarityOnMyNodes(double xBary, double yBary, double dimChar) const
{
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- _sub_edge->getStartNode()->hitMeAlone(xBary,yBary,dimChar);
- _sub_edge->getEndNode()->hitMeAlone(xBary,yBary,dimChar);
+ (*iter)->getStartNode()->hitMeAlone(xBary,yBary,dimChar);
+ (*iter)->getEndNode()->hitMeAlone(xBary,yBary,dimChar);
}
}
void ComposedEdge::unApplySimilarityOnMyNodes(double xBary, double yBary, double dimChar) const
{
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- _sub_edge->getStartNode()->unHitMeAlone(xBary,yBary,dimChar);
- _sub_edge->getEndNode()->unHitMeAlone(xBary,yBary,dimChar);
+ (*iter)->getStartNode()->unHitMeAlone(xBary,yBary,dimChar);
+ (*iter)->getEndNode()->unHitMeAlone(xBary,yBary,dimChar);
}
}
void ComposedEdge::applySimilarityOnMyNodesIfNotAlreadyHit(double xBary, double yBary, double dimChar) const
{
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- _sub_edge->getStartNode()->hitMeAfter(xBary,yBary,dimChar);
- _sub_edge->getEndNode()->hitMeAfter(xBary,yBary,dimChar);
+ (*iter)->getStartNode()->hitMeAfter(xBary,yBary,dimChar);
+ (*iter)->getEndNode()->hitMeAfter(xBary,yBary,dimChar);
}
}
void ComposedEdge::unApplySimilarityOnMyNodesIfNotAlreadyHit(double xBary, double yBary, double dimChar) const
{
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- _sub_edge->getStartNode()->unHitMeAfter(xBary,yBary,dimChar);
- _sub_edge->getEndNode()->unHitMeAfter(xBary,yBary,dimChar);
+ (*iter)->getStartNode()->unHitMeAfter(xBary,yBary,dimChar);
+ (*iter)->getEndNode()->unHitMeAfter(xBary,yBary,dimChar);
}
}
void ComposedEdge::initEdgeHitStatus() const
{
- for(auto _sub_edge : _sub_edges)
- _sub_edge->getPtr()->initHitStatus();
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->getPtr()->initHitStatus();
}
void ComposedEdge::applySimilarityOnMyEdges(double xBary, double yBary, double dimChar) const
{
- for(auto _sub_edge : _sub_edges)
- _sub_edge->getPtr()->hitMeAlone(xBary,yBary,dimChar);
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->getPtr()->hitMeAlone(xBary,yBary,dimChar);
}
void ComposedEdge::unApplySimilarityOnMyEdges(double xBary, double yBary, double dimChar) const
{
- for(auto _sub_edge : _sub_edges)
- _sub_edge->getPtr()->unHitMeAlone(xBary,yBary,dimChar);
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->getPtr()->unHitMeAlone(xBary,yBary,dimChar);
}
void ComposedEdge::applySimilarityOnMyEdgesIfNotAlreadyHit(double xBary, double yBary, double dimChar) const
{
- for(auto _sub_edge : _sub_edges)
- _sub_edge->getPtr()->hitMeAfter(xBary,yBary,dimChar);
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->getPtr()->hitMeAfter(xBary,yBary,dimChar);
}
void ComposedEdge::unApplySimilarityOnMyEdgesIfNotAlreadyHit(double xBary, double yBary, double dimChar) const
{
- for(auto _sub_edge : _sub_edges)
- _sub_edge->getPtr()->unHitMeAfter(xBary,yBary,dimChar);
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->getPtr()->unHitMeAfter(xBary,yBary,dimChar);
}
void ComposedEdge::getBarycenter(double *bary, double& weigh) const
{
weigh=0.; bary[0]=0.; bary[1]=0.;
double tmp1,tmp2[2];
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
{
- _sub_edge->getBarycenter(tmp2,tmp1);
+ (*iter)->getBarycenter(tmp2,tmp1);
weigh+=tmp1;
bary[0]+=tmp1*tmp2[0];
bary[1]+=tmp1*tmp2[1];
std::set< IntersectElement > inOutSwitch;
std::set<Node *> nodes;
getAllNodes(nodes);
- double const ref(isInOrOutAlg(nodeToTest,nodes,inOutSwitch));
+ double ref(isInOrOutAlg(nodeToTest,nodes,inOutSwitch));
bool ret(false);
- for(const auto & iter4 : inOutSwitch)
+ for(std::set< IntersectElement >::iterator iter4=inOutSwitch.begin();iter4!=inOutSwitch.end();iter4++)
{
- if(iter4.getVal1()<ref)
+ if((*iter4).getVal1()<ref)
{
- if(iter4.getNodeOnly()->getLoc()==ON_1)
+ if((*iter4).getNodeOnly()->getLoc()==ON_1)
ret=!ret;
}
else
std::set< IntersectElement > inOutSwitch;
std::set<Node *> nodes;
getAllNodes(nodes);
- for(auto node : nodes)
- if(sqrt(node->distanceWithSq(*nodeToTest))<QuadraticPlanarPrecision::getPrecision())
+ for(std::set<Node *>::const_iterator iter=nodes.begin();iter!=nodes.end();iter++)
+ if(sqrt((*iter)->distanceWithSq(*nodeToTest))<QuadraticPlanarPrecision::getPrecision())
return true;
- double const ref(isInOrOutAlg(nodeToTest,nodes,inOutSwitch));
+ double ref(isInOrOutAlg(nodeToTest,nodes,inOutSwitch));
bool ret(false);
- for(const auto & iter4 : inOutSwitch)
+ for(std::set< IntersectElement >::iterator iter4=inOutSwitch.begin();iter4!=inOutSwitch.end();iter4++)
{
- double const val(iter4.getVal1());
+ double val((*iter4).getVal1());
if(fabs(val-ref)>=QuadraticPlanarPrecision::getPrecision())
{
if(val<ref)
{
- if(iter4.getNodeOnly()->getLoc()==ON_1)
+ if((*iter4).getNodeOnly()->getLoc()==ON_1)
ret=!ret;
}
else
radialDistrib2.back()=M_PI+radialDistrib.front();
std::vector<double> radialDistrib3(radialDistrib.size());
std::transform(radialDistrib2.begin(),radialDistrib2.end(),radialDistrib.begin(),radialDistrib3.begin(),std::minus<double>());
- auto const iter3=max_element(radialDistrib3.begin(),radialDistrib3.end());
- std::size_t const i=iter3-radialDistrib3.begin();
+ std::vector<double>::iterator iter3=max_element(radialDistrib3.begin(),radialDistrib3.end());
+ std::size_t i=iter3-radialDistrib3.begin();
// ok for e1 - Let's go.
- auto *e1=new EdgeInfLin(nodeToTest,radialDistrib[i]+radialDistrib3[i]/2.);
- double const ref=e1->getCharactValue(*nodeToTest);
- for(auto val : _sub_edges)
+ EdgeInfLin *e1=new EdgeInfLin(nodeToTest,radialDistrib[i]+radialDistrib3[i]/2.);
+ double ref=e1->getCharactValue(*nodeToTest);
+ for(std::list<ElementaryEdge *>::const_iterator iter4=_sub_edges.begin();iter4!=_sub_edges.end();iter4++)
{
+ ElementaryEdge *val=(*iter4);
if(val)
{
Edge *e=val->getPtr();
}
if(!areOverlapped)
{
- std::list< IntersectElement > const listOfIntesc=intersc->getIntersectionsCharacteristicVal();
- for(auto & iter2 : listOfIntesc)
- if(iter2.isIncludedByBoth())
- inOutSwitch.insert(iter2);
+ std::list< IntersectElement > listOfIntesc=intersc->getIntersectionsCharacteristicVal();
+ for(std::list< IntersectElement >::iterator iter2=listOfIntesc.begin();iter2!=listOfIntesc.end();iter2++)
+ if((*iter2).isIncludedByBoth())
+ inOutSwitch.insert(*iter2);
}
//if overlapped we can forget
}
void ComposedEdge::clearAll(std::list<ElementaryEdge *>::iterator startToDel)
{
- for(auto iter=startToDel;iter!=_sub_edges.end();iter++)
+ for(std::list<ElementaryEdge *>::iterator iter=startToDel;iter!=_sub_edges.end();iter++)
delete (*iter);
}
#include "INTERPKERNELDefines.hxx"
#include "InterpKernelGeo2DEdge.hxx"
-#include <map>
#include <set>
#include <list>
#include <vector>
{
friend class IteratorOnComposedEdge;
public:
- INTERPKERNEL_EXPORT ComposedEdge() = default;
+ INTERPKERNEL_EXPORT ComposedEdge() { }
INTERPKERNEL_EXPORT ComposedEdge(const ComposedEdge& other);
INTERPKERNEL_EXPORT ComposedEdge(int sz):_sub_edges(sz) { }
INTERPKERNEL_EXPORT static void Delete(ComposedEdge *pt) { delete pt; }
#include "InterpKernelGeo2DEdge.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
+#include "InterpKernelGeo2DEdgeInfLin.hxx"
//#include "EdgeParabol.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DComposedEdge.hxx"
#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
#include <algorithm>
-#include <cstddef>
#include <functional>
-#include <map>
-#include <vector>
-#include <list>
-#include <ostream>
-#include <istream>
-#include <iostream>
-#include <string>
-#include <ios>
-#include <utility>
-#include <iterator>
using namespace INTERP_KERNEL;
void MergePoints::start1Replaced()
{
- unsigned const nbOfAsso=getNumberOfAssociations();
+ unsigned nbOfAsso=getNumberOfAssociations();
if(nbOfAsso==0)
_ass1Start1=1;
else
void MergePoints::end1Replaced()
{
- unsigned const nbOfAsso=getNumberOfAssociations();
+ unsigned nbOfAsso=getNumberOfAssociations();
if(nbOfAsso==0)
_ass1End1=1;
else
void MergePoints::start1OnStart2()
{
- unsigned const nbOfAsso=getNumberOfAssociations();
+ unsigned nbOfAsso=getNumberOfAssociations();
if(nbOfAsso==0)
{
_ass1Start1=1;
void MergePoints::start1OnEnd2()
{
- unsigned const nbOfAsso=getNumberOfAssociations();
+ unsigned nbOfAsso=getNumberOfAssociations();
if(nbOfAsso==0)
{
_ass1Start1=1;
void MergePoints::end1OnStart2()
{
- unsigned const nbOfAsso=getNumberOfAssociations();
+ unsigned nbOfAsso=getNumberOfAssociations();
if(nbOfAsso==0)
{
_ass1End1=1;
void MergePoints::end1OnEnd2()
{
- unsigned const nbOfAsso=getNumberOfAssociations();
+ unsigned nbOfAsso=getNumberOfAssociations();
if(nbOfAsso==0)
{
_ass1End1=1;
iter=listOfIntesc.erase(iter);
continue;
}
- unsigned const tmp=(*iter).isOnExtrForAnEdgeAndInForOtherEdge();
+ unsigned tmp=(*iter).isOnExtrForAnEdgeAndInForOtherEdge();
if(tmp==IntersectElement::LIMIT_ALONE)
{
iter=listOfIntesc.erase(iter);
std::vector<IntersectElement> vecOfIntesc(listOfIntesc.begin(),listOfIntesc.end());
listOfIntesc.clear();
sort(vecOfIntesc.begin(),vecOfIntesc.end());
- for(auto & iterV : vecOfIntesc)
- newNodes.push_back(iterV.getNodeAndReleaseIt());
+ for(std::vector<IntersectElement>::iterator iterV=vecOfIntesc.begin();iterV!=vecOfIntesc.end();iterV++)
+ newNodes.push_back((*iterV).getNodeAndReleaseIt());
order=vecOfIntesc.front().isLowerOnOther(vecOfIntesc.back());
}
return true;
bool Edge::decrRef()
{
- bool const ret=(--_cnt==0);
+ bool ret=(--_cnt==0);
if(ret)
delete this;
return ret;
{
std::copy((const double *)(*_end),(const double *)(*_end)+2,vectOutput);
std::transform(vectOutput,vectOutput+2,(const double *)(*_start),vectOutput,std::minus<double>());
- double const norm=1./Node::norm(vectOutput);
+ double norm=1./Node::norm(vectOutput);
std::transform(vectOutput,vectOutput+2,vectOutput,bind(std::multiplies<double>(),std::placeholders::_1,norm));
- double const tmp=vectOutput[0];
+ double tmp=vectOutput[0];
vectOutput[0]=vectOutput[1];
vectOutput[1]=-tmp;
}
Edge *Edge::BuildEdgeFrom3Points(const double *start, const double *middle, const double *end)
{
Node *b(new Node(start[0],start[1])),*m(new Node(middle[0],middle[1])),*e(new Node(end[0],end[1]));
- auto *e1(new EdgeLin(b,m)),*e2(new EdgeLin(m,e));
- SegSegIntersector const inters(*e1,*e2); bool const colinearity=inters.areColinears(); delete e1; delete e2;
- Edge *ret=nullptr;
+ EdgeLin *e1(new EdgeLin(b,m)),*e2(new EdgeLin(m,e));
+ SegSegIntersector inters(*e1,*e2); bool colinearity=inters.areColinears(); delete e1; delete e2;
+ Edge *ret=0;
if(colinearity)
ret=new EdgeLin(b,e);
else
else
{
std::cerr << "Unknown line found...";
- return nullptr;
+ return 0;
}
}
if(!merge)
return false;
delete merge;
- merge=nullptr;
+ merge=0;
EdgeIntersector *intersector=BuildIntersectorWith(this,other);
ret=Intersect(this,other,intersector,commonNode,outVal1,outVal2);
delete intersector;
bool Edge::IntersectOverlapped(const Edge *f1, const Edge *f2, EdgeIntersector *intersector, MergePoints& commonNode,
ComposedEdge& outValForF1, ComposedEdge& outValForF2)
{
- bool const rev=intersector->haveTheySameDirection();
+ bool rev=intersector->haveTheySameDirection();
Node *f2Start=f2->getNode(rev?START:END);
Node *f2End=f2->getNode(rev?END:START);
TypeOfLocInEdge place1, place2;
intersector->getPlacements(f2Start,f2End,place1,place2,commonNode);
- int const codeForIntersectionCase=CombineCodes(place1,place2);
+ int codeForIntersectionCase=CombineCodes(place1,place2);
return SplitOverlappedEdges(f1,f2,f2Start,f2End,rev,codeForIntersectionCase,outValForF1,outValForF2);
}
*/
void Edge::Interpolate1DLin(const std::vector<double>& distrib1, const std::vector<double>& distrib2, std::map<int, std::map<int,double> >& result)
{
- std::size_t const nbOfV1=distrib1.size()-1;
- std::size_t const nbOfV2=distrib2.size()-1;
+ std::size_t nbOfV1=distrib1.size()-1;
+ std::size_t nbOfV2=distrib2.size()-1;
Node *n1=new Node(0.,0.); Node *n3=new Node(0.,0.);
Node *n2=new Node(0.,0.); Node *n4=new Node(0.,0.);
MergePoints commonNode;
for(unsigned int i=0;i<nbOfV1;i++)
{
- auto const iter=find_if(distrib2.begin()+1,distrib2.end(),bind(std::greater_equal<double>(),std::placeholders::_1,distrib1[i]));
+ std::vector<double>::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind(std::greater_equal<double>(),std::placeholders::_1,distrib1[i]));
if(iter!=distrib2.end())
{
for(unsigned int j=(unsigned)((iter-1)-distrib2.begin());j<nbOfV2;j++)
{
if(distrib2[j]<=distrib1[i+1])
{
- auto *e1=new EdgeLin(n1,n2); auto *e2=new EdgeLin(n3,n4);
+ EdgeLin *e1=new EdgeLin(n1,n2); EdgeLin *e2=new EdgeLin(n3,n4);
n1->setNewCoords(distrib1[i],0.); n2->setNewCoords(distrib1[i+1],0.);
n3->setNewCoords(distrib2[j],0.); n4->setNewCoords(distrib2[j+1],0.);
- auto *f1=new ComposedEdge;
- auto *f2=new ComposedEdge;
+ ComposedEdge *f1=new ComposedEdge;
+ ComposedEdge *f2=new ComposedEdge;
SegSegIntersector inters(*e1,*e2);
bool b1,b2;
inters.areOverlappedOrOnlyColinears(b1,b2);
EdgeIntersector *Edge::BuildIntersectorWith(const Edge *e1, const Edge *e2)
{
- EdgeIntersector *ret=nullptr;
- const EdgeLin *tmp1=nullptr;
- const EdgeArcCircle *tmp2=nullptr;
+ EdgeIntersector *ret=0;
+ const EdgeLin *tmp1=0;
+ const EdgeArcCircle *tmp2=0;
unsigned char type1=e1->getTypeOfFunc();
e1->dynCastFunction(tmp1,tmp2);
- unsigned char const type2=e2->getTypeOfFunc();
+ unsigned char type2=e2->getTypeOfFunc();
e2->dynCastFunction(tmp1,tmp2);
type1|=type2;
switch(type1)
{
if(newNodes.empty())
throw Exception("Internal error occurred - error in intersector implementation!");// This case should never happen
- auto const iter=newNodes.begin();
- auto iterR=newNodes.rbegin();
+ std::vector<Node *>::iterator iter=newNodes.begin();
+ std::vector<Node *>::reverse_iterator iterR=newNodes.rbegin();
f1->addSubEdgeInVector(f1->getStartNode(),*iter,outValForF1);
f2->addSubEdgeInVector(f2->getStartNode(),order?*iter:*iterR,outValForF2);
- for(auto iter2=newNodes.begin();iter2!=newNodes.end();iter2++,iterR++)
+ for(std::vector<Node *>::iterator iter2=newNodes.begin();iter2!=newNodes.end();iter2++,iterR++)
{
if((iter2+1)==newNodes.end())
{
b.prepareForAggregation();
b.aggregate(getBounds());
double xBary,yBary;
- double const dimChar(b.getCaracteristicDim());
+ double dimChar(b.getCaracteristicDim());
b.getBarycenter(xBary,yBary);
applySimilarity(xBary,yBary,dimChar);
_start->applySimilarity(xBary,yBary,dimChar);
bool ret(false);
for(i=0;i<sz;i++)
{
- mcIdType const id(m[an2[i].second]);
+ mcIdType id(m[an2[i].second]);
if(id!=subNodes[i])
{ subNodes[i]=id; ret=true; }
}
void Edge::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp1,
const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp2, std::vector<mcIdType>& edgesThis)
{
- mcIdType const startId=(*mapp1.find(_start)).second;
- mcIdType const endId=(*mapp1.find(_end)).second;
+ mcIdType startId=(*mapp1.find(_start)).second;
+ mcIdType endId=(*mapp1.find(_end)).second;
if (! addNodes.size()) // quick way out, no new node to add.
{
edgesThis.push_back(startId);
b.prepareForAggregation();
b.aggregate(getBounds());
double xBary,yBary;
- double const dimChar=b.getCaracteristicDim();
+ double dimChar=b.getCaracteristicDim();
b.getBarycenter(xBary,yBary);
- for(auto addNode : addNodes)
- addNode->applySimilarity(xBary,yBary,dimChar);
+ for(std::vector<Node *>::const_iterator iter=addNodes.begin();iter!=addNodes.end();iter++)
+ (*iter)->applySimilarity(xBary,yBary,dimChar);
applySimilarity(xBary,yBary,dimChar);
_start->applySimilarity(xBary,yBary,dimChar);
_end->applySimilarity(xBary,yBary,dimChar);
- std::size_t const sz=addNodes.size();
+ std::size_t sz=addNodes.size();
std::vector< std::pair<double,Node *> > an2(sz);
for(std::size_t i=0;i<sz;i++)
an2[i]=std::pair<double,Node *>(getCharactValueBtw0And1(*addNodes[i]),addNodes[i]);
std::sort(an2.begin(),an2.end());
std::vector<mcIdType> tmpp;
- for(const auto & it : an2)
+ for(std::vector< std::pair<double,Node *> >::const_iterator it=an2.begin();it!=an2.end();it++)
{
- mcIdType const idd=(*mapp2.find(it.second)).second;
+ mcIdType idd=(*mapp2.find((*it).second)).second;
tmpp.push_back(idd);
}
std::vector<mcIdType> tmpp2(tmpp.size()+2);
tmpp2[0]=startId;
std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1);
tmpp2[tmpp.size()+1]=endId;
- auto const itt=std::unique(tmpp2.begin(),tmpp2.end());
+ std::vector<mcIdType>::iterator itt=std::unique(tmpp2.begin(),tmpp2.end());
tmpp2.resize(std::distance(tmpp2.begin(),itt));
- std::size_t const nbOfEdges=tmpp2.size()-1;
+ std::size_t nbOfEdges=tmpp2.size()-1;
for(std::size_t i=0;i<nbOfEdges;i++)
{
edgesThis.push_back(tmpp2[i]);
void setNode(Node *node) const;
void performMerging(MergePoints& commonNode) const;
Node *getNodeOnly() const { return _node; }
- Node *getNodeAndReleaseIt() { Node *tmp=_node; _node=nullptr; return tmp; }
+ Node *getNodeAndReleaseIt() { Node *tmp=_node; _node=0; return tmp; }
~IntersectElement();
private:
bool _1S; // true if starting point of edge 1 is located exactly on edge 2 (not nearby)
{
protected:
//! All non symmetric methods are relative to 'e1'.
- EdgeIntersector(const Edge& e1, const Edge& e2):_e1(e1),_e2(e2) { }
+ EdgeIntersector(const Edge& e1, const Edge& e2):_e1(e1),_e2(e2), _earlyInter(0) { }
public:
virtual ~EdgeIntersector() { if(_earlyInter) delete(_earlyInter); }
virtual bool keepOrder() const = 0;
protected:
const Edge& _e1;
const Edge& _e2;
- IntersectElement *_earlyInter{nullptr}; // Non null if the intersection can be determined early -> see areOverlappedOrOnlyColinears()
+ IntersectElement *_earlyInter; // Non null if the intersection can be determined early -> see areOverlappedOrOnlyColinears()
};
class INTERPKERNEL_EXPORT SameTypeEdgeIntersector : public EdgeIntersector
{
protected:
SameTypeEdgeIntersector(const Edge& e1, const Edge& e2):EdgeIntersector(e1,e2) { }
- bool keepOrder() const override { return true; }
+ bool keepOrder() const { return true; }
};
class INTERPKERNEL_EXPORT CrossTypeEdgeIntersector : public EdgeIntersector
{
protected:
CrossTypeEdgeIntersector(const Edge& e1, const Edge& e2, bool reverse):EdgeIntersector(e1,e2),_reverse(reverse) { }
- bool keepOrder() const override { return _reverse; }
- bool haveTheySameDirection() const override { throw Exception("Cross type intersector is not supposed to deal with overlapped in cross type."); }
+ bool keepOrder() const { return _reverse; }
+ bool haveTheySameDirection() const { throw Exception("Cross type intersector is not supposed to deal with overlapped in cross type."); }
const Edge *myE1() { if(_reverse) return &_e1; else return &_e2; }
const Edge *myE2() { if(_reverse) return &_e2; else return &_e1; }
protected:
void unHitMeAfter(double xBary, double yBary, double dimChar) { if(!_hit) unHitMeAlone(xBary,yBary,dimChar); }
const Bounds& getBounds() const { return _bounds; }
void fillXfigStreamForLoc(std::ostream& stream) const;
- Node *getNode(TypeOfLocInEdge where) const { if(where==START) return _start; else if(where==END) return _end; else return nullptr; }
+ Node *getNode(TypeOfLocInEdge where) const { if(where==START) return _start; else if(where==END) return _end; else return 0; }
Node *getStartNode() const { return _start; }
Node *getEndNode() const { return _end; }
void setEndNodeWithoutChange(Node *newEnd);
std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const;
protected:
- Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(nullptr),_end(nullptr) { }
+ Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { }
virtual ~Edge();
static int CombineCodes(TypeOfLocInEdge code1, TypeOfLocInEdge code2);
static bool Intersect(const Edge *f1, const Edge *f2, EdgeIntersector *intersector, MergePoints& commonNode,
#ifndef __INTERPKERNELGEO2DEDGE_TXX__
#define __INTERPKERNELGEO2DEDGE_TXX__
-#include "InterpKernelGeo2DEdge.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
-#include "InterpKernelGeo2DNode.hxx"
template<INTERP_KERNEL::TypeOfMod4QuadEdge type>
INTERP_KERNEL::Edge *INTERP_KERNEL::Edge::BuildEdgeFrom(Node *start, Node *middle, Node *end)
// Author : Anthony Geay (CEA/DEN)
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
-#include "InterpKernelGeo2DEdge.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
#include "InterpKernelException.hxx"
#include "InterpKernelGeo2DNode.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
-#include "MCIdType.hxx"
-#include "NormalizedGeometricTypes"
-
-#include <cmath>
-#include <math.h>
-#include <list>
-#include <istream>
-#include <ostream>
+#include "NormalizedUnstructuredMesh.hxx"
+
+#include <sstream>
#include <algorithm>
#include <limits>
-#include <string>
-#include <vector>
using namespace INTERP_KERNEL;
obviousCaseForCurvAbscisse(end,whereEnd,commonNode,obvious2);
if(obvious1 && obvious2)
return ;
- double const angleInRadStart=getAngle(start);
- double const angleInRadEnd=getAngle(end);
+ double angleInRadStart=getAngle(start);
+ double angleInRadEnd=getAngle(end);
if(obvious1 || obvious2)
{
if(obvious1)
bool ArcCArcCIntersector::internalAreColinears(const EdgeArcCircle& a1, const EdgeArcCircle& a2, double& distBetweenCenters, double& cst,
double& radiusL, double centerL[2], double& radiusB, double centerB[2])
{
- double const lgth1=fabs(a1.getAngle()*a1.getRadius());
- double const lgth2=fabs(a2.getAngle()*a2.getRadius());
+ double lgth1=fabs(a1.getAngle()*a1.getRadius());
+ double lgth2=fabs(a2.getAngle()*a2.getRadius());
if(lgth1<lgth2)
{//a1 is the little one ('L') and a2 the big one ('B')
a1.getCenter(centerL); radiusL=a1.getRadius();
tmp=sqrt(tmp);
if(Node::areDoubleEqualsWPLeft(tmp,0.,10*std::max(radiusL,radiusB)))
return Node::areDoubleEquals(radiusL,radiusB);
- double const phi=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect((centerL[0]-centerB[0])/tmp,(centerL[1]-centerB[1])/tmp);
- double const cst2=2*radiusL*tmp/(radiusB*radiusB);
+ double phi=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect((centerL[0]-centerB[0])/tmp,(centerL[1]-centerB[1])/tmp);
+ double cst2=2*radiusL*tmp/(radiusB*radiusB);
double cmpContainer[4];
int sizeOfCmpContainer=2;
cmpContainer[0]=cst+cst2*cos(phi-angle0L);
void ArcCArcCIntersector::areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped)
{
_dist=Node::distanceBtw2Pt(getE1().getCenter(),getE2().getCenter());
- double const radius1=getE1().getRadius(); double const radius2=getE2().getRadius();
+ double radius1=getE1().getRadius(); double radius2=getE2().getRadius();
if(_dist>radius1+radius2+QuadraticPlanarPrecision::getPrecision() || _dist+std::min(radius1,radius2)+QuadraticPlanarPrecision::getPrecision()<std::max(radius1,radius2))
{
obviousNoIntersection=true;
std::list< IntersectElement > ret;
const double *center1=getE1().getCenter();
const double *center2=getE2().getCenter();
- double const radius1=getE1().getRadius(); double const radius2=getE2().getRadius();
- double const d1_1=(_dist*_dist-radius2*radius2+radius1*radius1)/(2.*_dist); // computation of 'x' on wolfram
+ double radius1=getE1().getRadius(); double radius2=getE2().getRadius();
+ double d1_1=(_dist*_dist-radius2*radius2+radius1*radius1)/(2.*_dist); // computation of 'x' on wolfram
double u[2];//u is normalized vector from center1 to center2.
u[0]=(center2[0]-center1[0])/_dist; u[1]=(center2[1]-center1[1])/_dist;
- double const d1_1y=EdgeArcCircle::SafeSqrt(radius1*radius1-d1_1*d1_1); // computation of 'y' on wolfram
- double const angleE1=EdgeArcCircle::NormalizeAngle(getE1().getAngle0()+getE1().getAngle());
- double const angleE2=EdgeArcCircle::NormalizeAngle(getE2().getAngle0()+getE2().getAngle());
+ double d1_1y=EdgeArcCircle::SafeSqrt(radius1*radius1-d1_1*d1_1); // computation of 'y' on wolfram
+ double angleE1=EdgeArcCircle::NormalizeAngle(getE1().getAngle0()+getE1().getAngle());
+ double angleE2=EdgeArcCircle::NormalizeAngle(getE2().getAngle0()+getE2().getAngle());
if(!Node::areDoubleEquals(d1_1y,0))
{
//2 intersections
v2[0]=u[0]*d1_1+u[1]*d1_1y; v2[1]=u[1]*d1_1-u[0]*d1_1y;
Node *node1=new Node(center1[0]+v1[0],center1[1]+v1[1]); node1->declareOn();
Node *node2=new Node(center1[0]+v2[0],center1[1]+v2[1]); node2->declareOn();
- double const angle1_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1);
- double const angle2_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius1,v2[1]/radius1);
+ double angle1_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1);
+ double angle2_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius1,v2[1]/radius1);
double v3[2],v4[2];
v3[0]=center1[0]-center2[0]+v1[0]; v3[1]=center1[1]-center2[1]+v1[1];
v4[0]=center1[0]-center2[0]+v2[0]; v4[1]=center1[1]-center2[1]+v2[1];
- double const angle1_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v3[0]/radius2,v3[1]/radius2);
- double const angle2_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v4[0]/radius2,v4[1]/radius2);
+ double angle1_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v3[0]/radius2,v3[1]/radius2);
+ double angle2_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v4[0]/radius2,v4[1]/radius2);
// Check whether intersection points are exactly ON the other arc or not
// -> the curvilinear distance (=radius*angle) must below eps
- bool const e1_1S=Node::areDoubleEqualsWPLeft(angle1_1,getE1().getAngle0(),radius1);
- bool const e1_1E=Node::areDoubleEqualsWPLeft(angle1_1,angleE1,radius1);
- bool const e1_2S=Node::areDoubleEqualsWPLeft(angle1_2,getE2().getAngle0(),radius1);
- bool const e1_2E=Node::areDoubleEqualsWPLeft(angle1_2,angleE2,radius1);
+ bool e1_1S=Node::areDoubleEqualsWPLeft(angle1_1,getE1().getAngle0(),radius1);
+ bool e1_1E=Node::areDoubleEqualsWPLeft(angle1_1,angleE1,radius1);
+ bool e1_2S=Node::areDoubleEqualsWPLeft(angle1_2,getE2().getAngle0(),radius1);
+ bool e1_2E=Node::areDoubleEqualsWPLeft(angle1_2,angleE2,radius1);
//
- bool const e2_1S=Node::areDoubleEqualsWPLeft(angle2_1,getE1().getAngle0(),radius2);
- bool const e2_1E=Node::areDoubleEqualsWPLeft(angle2_1,angleE1,radius2);
- bool const e2_2S=Node::areDoubleEqualsWPLeft(angle2_2,getE2().getAngle0(),radius2);
- bool const e2_2E=Node::areDoubleEqualsWPLeft(angle2_2,angleE2,radius2);
+ bool e2_1S=Node::areDoubleEqualsWPLeft(angle2_1,getE1().getAngle0(),radius2);
+ bool e2_1E=Node::areDoubleEqualsWPLeft(angle2_1,angleE1,radius2);
+ bool e2_2S=Node::areDoubleEqualsWPLeft(angle2_2,getE2().getAngle0(),radius2);
+ bool e2_2E=Node::areDoubleEqualsWPLeft(angle2_2,angleE2,radius2);
ret.push_back(IntersectElement(angle1_1,angle1_2,e1_1S,e1_1E,e1_2S,e1_2E,node1,_e1,_e2,keepOrder()));
ret.push_back(IntersectElement(angle2_1,angle2_2,e2_1S,e2_1E,e2_2S,e2_2E,node2,_e1,_e2,keepOrder()));
}
double v1[2],v2[2];
v1[0]=d1_1*u[0]; v1[1]=d1_1*u[1];
v2[0]=center1[0]-center2[0]+v1[0]; v2[1]=center1[1]-center2[1]+v1[1];
- double const angle0_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1);
- double const angle0_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius2,v2[1]/radius2);
- bool const e0_1S=Node::areDoubleEqualsWPLeft(angle0_1,getE1().getAngle0(),radius1);
- bool const e0_1E=Node::areDoubleEqualsWPLeft(angle0_1,angleE1,radius1);
- bool const e0_2S=Node::areDoubleEqualsWPLeft(angle0_2,getE2().getAngle0(),radius2);
- bool const e0_2E=Node::areDoubleEqualsWPLeft(angle0_2,angleE2,radius2);
+ double angle0_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1);
+ double angle0_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius2,v2[1]/radius2);
+ bool e0_1S=Node::areDoubleEqualsWPLeft(angle0_1,getE1().getAngle0(),radius1);
+ bool e0_1E=Node::areDoubleEqualsWPLeft(angle0_1,angleE1,radius1);
+ bool e0_2S=Node::areDoubleEqualsWPLeft(angle0_2,getE2().getAngle0(),radius2);
+ bool e0_2E=Node::areDoubleEqualsWPLeft(angle0_2,angleE2,radius2);
Node *node=new Node(center1[0]+d1_1*u[0],center1[1]+d1_1*u[1]); node->declareOnTangent();
ret.push_back(IntersectElement(angle0_1,angle0_2,e0_1S,e0_1E,e0_2S,e0_2E,node,_e1,_e2,keepOrder()));
}
// We need to compute d = R*R-_cross*_cross/_drSq
// In terms of numerical precision, this can trigger 'catastrophic cancellation' and is hence better expressed as:
- double const _dr = sqrt(_drSq);
+ double _dr = sqrt(_drSq);
double diff = (R-_cross/_dr), add=(R+_cross/_dr);
// Ah ah: we will be taking a square root later. If we want the user to be able to use an epsilon finer than 1.0e-8, then we need
// to prevent ourselves going below machine precision (typ. 1.0e-16 for double).
const double eps_machine = std::numeric_limits<double>::epsilon();
diff = fabs(diff/R) < eps_machine ? 0.0 : diff;
add = fabs(add/R) < eps_machine ? 0.0 : add;
- double const d = add*diff;
+ double d = add*diff;
// Compute deltaRoot_div_dr := sqrt(delta)/dr, where delta has the meaning of Wolfram.
// Then 2*deltaRoot_div_dr is the distance between the two intersection points of the line with the circle. This is what we compare to eps.
// We compute it in such a way that it can be used in boolean tests too (a very negative value means we're far apart from intersection)
return false;
}
-void ArcCSegIntersector::getPlacements(Node * /*start*/, Node * /*end*/, TypeOfLocInEdge& /*whereStart*/, TypeOfLocInEdge& /*whereEnd*/, MergePoints& /*commonNode*/) const
+void ArcCSegIntersector::getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const
{
throw Exception("Internal error. Should never been called : no overlapping possible between arc of circle and a segment.");
}
// There we can tell if the arc of circle is 'moving away' from the seg, or if it might intersect it twice
const Node &n(*_earlyInter->getNodeOnly());
- double const tang[2] = {-(n[1]-center[1]), n[0]-center[0]}; // (-y, x) is the tangent vector in the trigo direction with (x,y) = (center->node)
- bool const invSeg = _i1S2E || _i1E2E;
- double const linEdge[2] = {invSeg ? (-_dx) : _dx, invSeg ? (-_dy) : _dy};
+ double tang[2] = {-(n[1]-center[1]), n[0]-center[0]}; // (-y, x) is the tangent vector in the trigo direction with (x,y) = (center->node)
+ bool invSeg = _i1S2E || _i1E2E;
+ double linEdge[2] = {invSeg ? (-_dx) : _dx, invSeg ? (-_dy) : _dy};
if(tang[1]*linEdge[0]-tang[0]*linEdge[1] < 0)
{
ret.push_back(*_earlyInter);
}
}
- double const determinant=fabs(_deltaRoot_div_dr)/sqrt(_drSq);
- double const x1=(_cross*_dy/_drSq+Node::sign(_dy)*_dx*determinant)+center[0];
- double const y1=(-_cross*_dx/_drSq+fabs(_dy)*determinant)+center[1];
+ double determinant=fabs(_deltaRoot_div_dr)/sqrt(_drSq);
+ double x1=(_cross*_dy/_drSq+Node::sign(_dy)*_dx*determinant)+center[0];
+ double y1=(-_cross*_dx/_drSq+fabs(_dy)*determinant)+center[1];
Node *intersect1=new Node(x1,y1); intersect1->declareOn();
- double const x2=(_cross*_dy/_drSq-Node::sign(_dy)*_dx*determinant)+center[0];
- double const y2=(-_cross*_dx/_drSq-fabs(_dy)*determinant)+center[1];
+ double x2=(_cross*_dy/_drSq-Node::sign(_dy)*_dx*determinant)+center[0];
+ double y2=(-_cross*_dx/_drSq-fabs(_dy)*determinant)+center[1];
Node *intersect2=new Node(x2,y2); intersect2->declareOn();
bool isN1(false), isN2(false);
// Which node do we actually already found? Assume this is the closest ...
const Node &iN = *(_earlyInter->getNodeOnly());
const Node &n1(*intersect1), &n2(*intersect2);
- double const d1 = std::max(fabs(iN[0]-n1[0]), fabs(iN[1]-n1[1]));
- double const d2 = std::max(fabs(iN[0]-n2[0]), fabs(iN[1]-n2[1]));
+ double d1 = std::max(fabs(iN[0]-n1[0]), fabs(iN[1]-n1[1]));
+ double d2 = std::max(fabs(iN[0]-n2[0]), fabs(iN[1]-n2[1]));
isN1 = d1 < d2; isN2 = !isN1;
if (isN1) intersect1->decrRef();
if (isN2) intersect2->decrRef();
}
if (!isN1)
{
- bool const i1_1S=_e1.getStartNode()->isEqual(*intersect1);
- bool const i1_1E=_e1.getEndNode()->isEqual(*intersect1);
- bool const i1_2S=_e2.getStartNode()->isEqual(*intersect1);
- bool const i1_2E=_e2.getEndNode()->isEqual(*intersect1);
+ bool i1_1S=_e1.getStartNode()->isEqual(*intersect1);
+ bool i1_1E=_e1.getEndNode()->isEqual(*intersect1);
+ bool i1_2S=_e2.getStartNode()->isEqual(*intersect1);
+ bool i1_2E=_e2.getEndNode()->isEqual(*intersect1);
ret.push_back(IntersectElement(getE1().getCharactValue(*intersect1),getE2().getCharactValue(*intersect1),i1_1S,i1_1E,i1_2S,i1_2E,intersect1,_e1,_e2,keepOrder()));
}
if(!isN2)
{
- bool const i2_1S=_e1.getStartNode()->isEqual(*intersect2);
- bool const i2_1E=_e1.getEndNode()->isEqual(*intersect2);
- bool const i2_2S=_e2.getStartNode()->isEqual(*intersect2);
- bool const i2_2E=_e2.getEndNode()->isEqual(*intersect2);
+ bool i2_1S=_e1.getStartNode()->isEqual(*intersect2);
+ bool i2_1E=_e1.getEndNode()->isEqual(*intersect2);
+ bool i2_2S=_e2.getStartNode()->isEqual(*intersect2);
+ bool i2_2E=_e2.getEndNode()->isEqual(*intersect2);
ret.push_back(IntersectElement(getE1().getCharactValue(*intersect2),getE2().getCharactValue(*intersect2),i2_1S,i2_1E,i2_2S,i2_2E,intersect2,_e1,_e2,keepOrder()));
}
}
ret.push_back(*_earlyInter);
return ret;
}
- double const x=(_cross*_dy)/_drSq+center[0];
- double const y=(-_cross*_dx)/_drSq+center[1];
+ double x=(_cross*_dy)/_drSq+center[0];
+ double y=(-_cross*_dx)/_drSq+center[1];
Node *intersect3=new Node(x,y); intersect3->declareOnTangent();
- bool const i_1S=_e1.getStartNode()->isEqual(*intersect3);
- bool const i_1E=_e1.getEndNode()->isEqual(*intersect3);
- bool const i_2S=_e2.getStartNode()->isEqual(*intersect3);
- bool const i_2E=_e2.getEndNode()->isEqual(*intersect3);
+ bool i_1S=_e1.getStartNode()->isEqual(*intersect3);
+ bool i_1E=_e1.getEndNode()->isEqual(*intersect3);
+ bool i_2S=_e2.getStartNode()->isEqual(*intersect3);
+ bool i_2E=_e2.getEndNode()->isEqual(*intersect3);
ret.push_back(IntersectElement(_e1.getCharactValue(*intersect3),_e2.getCharactValue(*intersect3),i_1S,i_1E,i_2S,i_2E,intersect3,_e1,_e2,keepOrder()));
}
return ret;
Edge *EdgeArcCircle::buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const
{
- double const sx=((*start)[0]-_center[0])/_radius;
- double const sy=((*start)[1]-_center[1])/_radius;
- double const ex=((*end)[0]-_center[0])/_radius;
- double const ey=((*end)[1]-_center[1])/_radius;
- double const angle0=GetAbsoluteAngleOfNormalizedVect(direction?sx:ex,direction?sy:ey);
+ double sx=((*start)[0]-_center[0])/_radius;
+ double sy=((*start)[1]-_center[1])/_radius;
+ double ex=((*end)[0]-_center[0])/_radius;
+ double ey=((*end)[1]-_center[1])/_radius;
+ double angle0=GetAbsoluteAngleOfNormalizedVect(direction?sx:ex,direction?sy:ey);
double deltaAngle=GetAbsoluteAngleOfNormalizedVect(sx*ex+sy*ey,sx*ey-sy*ex);
if(deltaAngle>0. && _angle<0.)
deltaAngle-=2.*M_PI;
void EdgeArcCircle::tesselate(const mcIdType *conn, mcIdType offset, double eps, std::vector<mcIdType>& newConn, std::vector<double>& addCoo) const
{
newConn.push_back(INTERP_KERNEL::NORM_POLYL);
- int const nbOfSubDiv=(int)(fabs(_angle)/eps);
+ int nbOfSubDiv=(int)(fabs(_angle)/eps);
if(nbOfSubDiv<=2)
{
newConn.push_back(conn[0]); newConn.push_back(conn[2]); newConn.push_back(conn[1]);
return ;
}
- double const signOfAngle=_angle>0.?1.:-1.;
+ double signOfAngle=_angle>0.?1.:-1.;
mcIdType offset2=offset+(ToIdType(addCoo.size()))/2;
newConn.push_back(conn[0]);
for(int i=1;i<nbOfSubDiv;i++,offset2++)
{
- double const angle=_angle0+i*eps*signOfAngle;
+ double angle=_angle0+i*eps*signOfAngle;
newConn.push_back(offset2);
addCoo.push_back(_center[0]+_radius*cos(angle)); addCoo.push_back(_center[1]+_radius*sin(angle));
}
EdgeLin *e1,*e2;
e1=new EdgeLin(start,middle);
e2=new EdgeLin(middle,end);
- SegSegIntersector const inters(*e1,*e2);
- bool const colinearity=inters.areColinears();
+ SegSegIntersector inters(*e1,*e2);
+ bool colinearity=inters.areColinears();
delete e1; delete e2;
if(colinearity)
{
start->decrRef(); middle->decrRef(); end->decrRef();
- return nullptr;
+ return 0;
}
else
{
- auto *ret=new EdgeArcCircle(start,middle,end);
+ EdgeArcCircle *ret=new EdgeArcCircle(start,middle,end);
start->decrRef(); middle->decrRef(); end->decrRef();
return ret;
}
void EdgeArcCircle::GetArcOfCirclePassingThru(const double *start, const double *middle, const double *end,
double *center, double& radius, double& angleInRad, double& angleInRad0)
{
- double const delta=(middle[0]-start[0])*(end[1]-middle[1])-(end[0]-middle[0])*(middle[1]-start[1]);
- double const b1=(middle[1]*middle[1]+middle[0]*middle[0]-start[0]*start[0]-start[1]*start[1])/2;
- double const b2=(end[1]*end[1]+end[0]*end[0]-middle[0]*middle[0]-middle[1]*middle[1])/2;
+ double delta=(middle[0]-start[0])*(end[1]-middle[1])-(end[0]-middle[0])*(middle[1]-start[1]);
+ double b1=(middle[1]*middle[1]+middle[0]*middle[0]-start[0]*start[0]-start[1]*start[1])/2;
+ double b2=(end[1]*end[1]+end[0]*end[0]-middle[0]*middle[0]-middle[1]*middle[1])/2;
center[0]=((end[1]-middle[1])*b1+(start[1]-middle[1])*b2)/delta;
center[1]=((middle[0]-end[0])*b1+(middle[0]-start[0])*b2)/delta;
radius=SafeSqrt((start[0]-center[0])*(start[0]-center[0])+(start[1]-center[1])*(start[1]-center[1]));
angleInRad0=GetAbsoluteAngleOfNormalizedVect((start[0]-center[0])/radius,(start[1]-center[1])/radius);
- double const angleInRadM=GetAbsoluteAngleOfNormalizedVect((middle[0]-center[0])/radius,(middle[1]-center[1])/radius);
+ double angleInRadM=GetAbsoluteAngleOfNormalizedVect((middle[0]-center[0])/radius,(middle[1]-center[1])/radius);
angleInRad=GetAbsoluteAngleOfNormalizedVect(((start[0]-center[0])*(end[0]-center[0])+(start[1]-center[1])*(end[1]-center[1]))/(radius*radius),
((start[0]-center[0])*(end[1]-center[1])-(start[1]-center[1])*(end[0]-center[0]))/(radius*radius));
if(IsAngleNotIn(angleInRad0,angleInRad,angleInRadM))
*/
void EdgeArcCircle::getBarycenterOfZone(double *bary) const
{
- double const x0=_center[0];
- double const y0=_center[1];
- double const angle1=_angle0+_angle;
- double const tmp1=sin(angle1);
- double const tmp0=sin(_angle0);
- double const tmp2=_radius*_radius*_radius;
- double const tmp3=cos(angle1);
- double const tmp4=cos(_angle0);
+ double x0=_center[0];
+ double y0=_center[1];
+ double angle1=_angle0+_angle;
+ double tmp1=sin(angle1);
+ double tmp0=sin(_angle0);
+ double tmp2=_radius*_radius*_radius;
+ double tmp3=cos(angle1);
+ double tmp4=cos(_angle0);
bary[0]=_radius*x0*y0*(tmp4-tmp3)+_radius*_radius*(y0*(cos(2*_angle0)-cos(2*angle1))/4.+
x0*(_angle/2.+(sin(2.*_angle0)-sin(2.*angle1))/4.))
+tmp2*(tmp1*tmp1*tmp1-tmp0*tmp0*tmp0)/3.;
*/
double EdgeArcCircle::getCharactValue(const Node& node) const
{
- double const dx=(node[0]-_center[0])/_radius;
- double const dy=(node[1]-_center[1])/_radius;
+ double dx=(node[0]-_center[0])/_radius;
+ double dy=(node[1]-_center[1])/_radius;
return GetAbsoluteAngleOfNormalizedVect(dx,dy);
}
double EdgeArcCircle::getCharactValueBtw0And1(const Node& node) const
{
- double const dx=(node[0]-_center[0])/_radius;
- double const dy=(node[1]-_center[1])/_radius;
- double const angle=GetAbsoluteAngleOfNormalizedVect(dx,dy);
+ double dx=(node[0]-_center[0])/_radius;
+ double dy=(node[1]-_center[1])/_radius;
+ double angle=GetAbsoluteAngleOfNormalizedVect(dx,dy);
//
double myDelta=angle-_angle0;
if(_angle>0.)
double EdgeArcCircle::getDistanceToPoint(const double *pt) const
{
- double const angle=Node::computeAngle(_center,pt);
+ double angle=Node::computeAngle(_center,pt);
if(IsIn2Pi(_angle0,_angle,angle))
return fabs(Node::distanceBtw2Pt(_center,pt)-_radius);
else
{
- double const dist1=Node::distanceBtw2Pt(*_start,pt);
- double const dist2=Node::distanceBtw2Pt(*_end,pt);
+ double dist1=Node::distanceBtw2Pt(*_start,pt);
+ double dist2=Node::distanceBtw2Pt(*_end,pt);
return std::min(dist1,dist2);
}
}
bool EdgeArcCircle::isNodeLyingOn(const double *coordOfNode) const
{
- double const dist=Node::distanceBtw2Pt(_center,coordOfNode);
+ double dist=Node::distanceBtw2Pt(_center,coordOfNode);
if(Node::areDoubleEquals(dist,_radius))
{
- double const angle=Node::computeAngle(_center,coordOfNode);
+ double angle=Node::computeAngle(_center,coordOfNode);
return IsIn2Pi(_angle0,_angle,angle);
}
else
#define __INTERPKERNELGEO2DEDGEARCCIRCLE_HXX__
#include "INTERPKERNELDefines.hxx"
-#include "InterpKernelGeo2DBounds.hxx"
#include "InterpKernelGeo2DEdge.hxx"
-#include "InterpKernelGeo2DNode.hxx"
#include "MCIdType.hxx"
-#include <list>
-#include <istream>
-#include <ostream>
-#include <vector>
-#include <algorithm>
-#include <cmath>
-#include <math.h>
namespace INTERP_KERNEL
{
{
public:
ArcCArcCIntersector(const EdgeArcCircle& e1, const EdgeArcCircle& e2);
- bool haveTheySameDirection() const override;
- bool areColinears() const override;
- void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const override;
- void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped) override;
- std::list< IntersectElement > getIntersectionsCharacteristicVal() const override;
+ bool haveTheySameDirection() const;
+ bool areColinears() const;
+ void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const;
+ void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped);
+ std::list< IntersectElement > getIntersectionsCharacteristicVal() const;
private:
//! return angle in ]-Pi;Pi[ - 'node' must be on curve of '_e1'
double getAngle(Node *node) const;
public:
ArcCSegIntersector(const EdgeArcCircle& e1, const EdgeLin& e2, bool reverse=true);
//virtual overloading
- bool areColinears() const override;
- void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const override;
- void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped) override;
- std::list< IntersectElement > getIntersectionsCharacteristicVal() const override;
+ bool areColinears() const;
+ void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const;
+ void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped);
+ std::list< IntersectElement > getIntersectionsCharacteristicVal() const;
private:
const EdgeArcCircle& getE1() const { return (const EdgeArcCircle&)_e1; }
const EdgeLin& getE2() const { return (const EdgeLin&)_e2; }
EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction=true);
//! for tests
void changeMiddle(Node *newMiddle);
- void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const override;
- void update(Node *m) override;
- double getAreaOfZone() const override;
- double getCurveLength() const override;
- void getBarycenter(double *bary) const override;
- void getBarycenterOfZone(double *bary) const override;
- void getMiddleOfPoints(const double *p1, const double *p2, double *mid) const override;
- void getMiddleOfPointsOriented(const double *p1, const double *p2, double *mid) const override;
- bool isIn(double characterVal) const override;
- Node *buildRepresentantOfMySelf() const override;
- bool isLower(double val1, double val2) const override;
- double getCharactValue(const Node& node) const override;
- double getCharactValueBtw0And1(const Node& node) const override;
- double getDistanceToPoint(const double *pt) const override;
- bool isNodeLyingOn(const double *coordOfNode) const override;
- TypeOfFunction getTypeOfFunc() const override { return ARC_CIRCLE; }
- void dynCastFunction(const EdgeLin * & /*seg*/,
- const EdgeArcCircle * &arcSeg) const override { arcSeg=this; }
+ void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const;
+ void update(Node *m);
+ double getAreaOfZone() const;
+ double getCurveLength() const;
+ void getBarycenter(double *bary) const;
+ void getBarycenterOfZone(double *bary) const;
+ void getMiddleOfPoints(const double *p1, const double *p2, double *mid) const;
+ void getMiddleOfPointsOriented(const double *p1, const double *p2, double *mid) const;
+ bool isIn(double characterVal) const;
+ Node *buildRepresentantOfMySelf() const;
+ bool isLower(double val1, double val2) const;
+ double getCharactValue(const Node& node) const;
+ double getCharactValueBtw0And1(const Node& node) const;
+ double getDistanceToPoint(const double *pt) const;
+ bool isNodeLyingOn(const double *coordOfNode) const;
+ TypeOfFunction getTypeOfFunc() const { return ARC_CIRCLE; }
+ void dynCastFunction(const EdgeLin * &seg,
+ const EdgeArcCircle * &arcSeg) const { arcSeg=this; }
const double *getCenter() const { return _center; }
void getCenter(double *center) const { center[0]=_center[0]; center[1]=_center[1]; }
- bool doIHaveSameDirectionAs(const Edge& /*other*/) const { return false; }
- void applySimilarity(double xBary, double yBary, double dimChar) override;
- void unApplySimilarity(double xBary, double yBary, double dimChar) override;
+ bool doIHaveSameDirectionAs(const Edge& other) const { return false; }
+ void applySimilarity(double xBary, double yBary, double dimChar);
+ void unApplySimilarity(double xBary, double yBary, double dimChar);
double getAngle0() const { return _angle0; }
double getRadius() const { return _radius; }
double getAngle() const { return _angle; }
static void GetArcOfCirclePassingThru(const double *start, const double *middle, const double *end,
double *center, double& radius, double& angleInRad, double& angleInRad0);
//! To avoid in aggressive optimizations nan.
- static double SafeSqrt(double val) { double const ret=std::max(val,0.); return sqrt(ret); }
+ static double SafeSqrt(double val) { double ret=std::max(val,0.); return sqrt(ret); }
static double SafeAcos(double cosAngle) { double ret=std::min(cosAngle,1.); ret=std::max(ret,-1.); return acos(ret); }
static double SafeAsin(double sinAngle) { double ret=std::min(sinAngle,1.); ret=std::max(ret,-1.); return asin(ret); }
//! @param start and @param angleIn in ]-Pi;Pi] and @param delta in ]-2*Pi,2*Pi[
static double NormalizeAngle(double angle) { if(angle>M_PI) return angle-2.*M_PI; if(angle<-M_PI) return angle+2.*M_PI; return angle; }
protected:
void updateBounds();
- Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const override;
+ Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const;
protected:
//! Absolute angle where the arc starts. Value between -Pi and Pi
// Author : Anthony Geay (CEA/DEN)
#include "InterpKernelGeo2DEdgeInfLin.hxx"
-#include "InterpKernelGeo2DNode.hxx"
-#include <cmath>
using namespace INTERP_KERNEL;
#ifndef __INTERPKERNELGEO2DEDGEINFLIN_HXX__
#define __INTERPKERNELGEO2DEDGEINFLIN_HXX__
-#include "InterpKernelGeo2DEdge.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
-#include "InterpKernelGeo2DNode.hxx"
namespace INTERP_KERNEL
{
public:
EdgeInfLin(Node *start, Node *end):EdgeLin(start,end,true) { }
EdgeInfLin(Node *pointPassingThrough, double slope);
- bool isIn(double /*characterVal*/) const override { return true; }
+ bool isIn(double characterVal) const { return true; }
void dynCastFunction(const EdgeLin * &seg,
- const EdgeArcCircle * & /*arcSeg*/) const override { seg=this; }
+ const EdgeArcCircle * &arcSeg) const { seg=this; }
protected:
- ~EdgeInfLin() override = default;
+ ~EdgeInfLin() { }
};
}
// Author : Anthony Geay (CEA/DEN)
#include "InterpKernelGeo2DEdgeLin.hxx"
-#include "InterpKernelGeo2DEdge.hxx"
#include "InterpKernelGeo2DNode.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
-#include <cmath>
-#include <list>
-#include <algorithm>
-#include <istream>
-#include <ostream>
+#include "InterpKernelException.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
using namespace INTERP_KERNEL;
obviousCaseForCurvAbscisse(node,where,commonNode,obvious);
if(obvious)
return ;
- double const ret=((*node)[!_ind]-(*_e1.getStartNode())[!_ind])/((*_e1.getEndNode())[!_ind]-(*_e1.getStartNode())[!_ind]);
+ double ret=((*node)[!_ind]-(*_e1.getStartNode())[!_ind])/((*_e1.getEndNode())[!_ind]-(*_e1.getStartNode())[!_ind]);
if(ret>0. && ret <1.)
where=INSIDE;
else if(ret<0.)
return ret;
}
- double const x= (-_matrix[2]*_col[0]+_matrix[0]*_col[1]) / _determinant;
- double const y= (-_matrix[3]*_col[0]+_matrix[1]*_col[1]) / _determinant;
+ double x= (-_matrix[2]*_col[0]+_matrix[0]*_col[1]) / _determinant;
+ double y= (-_matrix[3]*_col[0]+_matrix[1]*_col[1]) / _determinant;
//Only one intersect point possible
Node *node=new Node(x,y);
node->declareOn();
- bool const i_1S=_e1.getStartNode()->isEqual(*node);
- bool const i_1E=_e1.getEndNode()->isEqual(*node);
- bool const i_2S=_e2.getStartNode()->isEqual(*node);
- bool const i_2E=_e2.getEndNode()->isEqual(*node);
+ bool i_1S=_e1.getStartNode()->isEqual(*node);
+ bool i_1E=_e1.getEndNode()->isEqual(*node);
+ bool i_2S=_e2.getStartNode()->isEqual(*node);
+ bool i_2E=_e2.getEndNode()->isEqual(*node);
ret.push_back(IntersectElement(_e1.getCharactValue(*node),
_e2.getCharactValue(*node),
i_1S,i_1E,i_2S,i_2E,node,_e1,_e2,keepOrder()));
else // Colinear vectors
{
// Compute vectors joining tips of e1 and e2
- double const xS=(*(_e1.getStartNode()))[0]-(*(_e2.getStartNode()))[0];
- double const yS=(*(_e1.getStartNode()))[1]-(*(_e2.getStartNode()))[1];
- double const xE=(*(_e1.getEndNode()))[0]-(*(_e2.getEndNode()))[0];
- double const yE=(*(_e1.getEndNode()))[1]-(*(_e2.getEndNode()))[1];
+ double xS=(*(_e1.getStartNode()))[0]-(*(_e2.getStartNode()))[0];
+ double yS=(*(_e1.getStartNode()))[1]-(*(_e2.getStartNode()))[1];
+ double xE=(*(_e1.getEndNode()))[0]-(*(_e2.getEndNode()))[0];
+ double yE=(*(_e1.getEndNode()))[1]-(*(_e2.getEndNode()))[1];
double maxDimS(std::max(fabs(xS),fabs(yS))), maxDimE(std::max(fabs(xE), fabs(yE)));
bool isS = (maxDimS > maxDimE), isE1 = (dimCharE1 >= dimCharE2);
- double const x = isS ? xS : xE;
- double const y = isS ? yS : yE;
- unsigned const shift = isE1 ? 0 : 2;
+ double x = isS ? xS : xE;
+ double y = isS ? yS : yE;
+ unsigned shift = isE1 ? 0 : 2;
// test colinearity of the greatest tip-joining vector and greatest vector among {e1, e2}
areOverlapped = fabs(x*_matrix[1+shift]-y*_matrix[0+shift]) < dimCharE1*dimCharE2*QuadraticPlanarPrecision::getPrecision();
// explanation: if areOverlapped is true, we don't know yet if there will be an intersection (see meaning of areOverlapped in method doxy above)
}
EdgeLin::~EdgeLin()
-= default;
+{
+}
/*!
* Characteristic for edges is relative position btw 0.;1.
double EdgeLin::getDistanceToPoint(const double *pt) const
{
- double const loc=getCharactValueEng(pt);
+ double loc=getCharactValueEng(pt);
if(loc>0. && loc<1.)
{
double tmp[2];
}
else
{
- double const dist1=Node::distanceBtw2Pt(*_start,pt);
- double const dist2=Node::distanceBtw2Pt(*_end,pt);
+ double dist1=Node::distanceBtw2Pt(*_start,pt);
+ double dist2=Node::distanceBtw2Pt(*_end,pt);
return std::min(dist1,dist2);
}
}
bool EdgeLin::isNodeLyingOn(const double *coordOfNode) const
{
- double const dBase=sqrt(_start->distanceWithSq(*_end));
+ double dBase=sqrt(_start->distanceWithSq(*_end));
double d1=Node::distanceBtw2Pt(*_start,coordOfNode);
d1+=Node::distanceBtw2Pt(*_end,coordOfNode);
return Node::areDoubleEquals(dBase,d1);
stream << std::endl;
}
-void EdgeLin::update(Node * /*m*/)
+void EdgeLin::update(Node *m)
{
updateBounds();
}
*/
void EdgeLin::getBarycenterOfZone(double *bary) const
{
- double const x1=(*_start)[0];
- double const y1=(*_start)[1];
- double const x2=(*_end)[0];
- double const y2=(*_end)[1];
+ double x1=(*_start)[0];
+ double y1=(*_start)[1];
+ double x2=(*_end)[0];
+ double y2=(*_end)[1];
bary[0]=(x1-x2)*(y1*(2.*x1+x2)+y2*(2.*x2+x1))/6.;
//bary[0]+=(y1-y2)*(x2*x2/3.-(x1*x2+x1*x1)/6.)+y1*(x1*x1-x2*x2)/2.;
//bary[0]+=(y1-y2)*((x2*x2+x1*x2+x1*x1)/3.-(x2+x1)*x1/2.)+y1*(x1*x1-x2*x2)/2.;
double EdgeLin::getCurveLength() const
{
- double const x=(*_start)[0]-(*_end)[0];
- double const y=(*_start)[1]-(*_end)[1];
+ double x=(*_start)[0]-(*_end)[0];
+ double y=(*_start)[1]-(*_end)[1];
return sqrt(x*x+y*y);
}
double EdgeLin::getCharactValueEng(const double *node) const
{
- double const car1_1x=node[0]-(*(_start))[0]; double const car1_2x=(*(_end))[0]-(*(_start))[0];
- double const car1_1y=node[1]-(*(_start))[1]; double const car1_2y=(*(_end))[1]-(*(_start))[1];
+ double car1_1x=node[0]-(*(_start))[0]; double car1_2x=(*(_end))[0]-(*(_start))[0];
+ double car1_1y=node[1]-(*(_start))[1]; double car1_2y=(*(_end))[1]-(*(_start))[1];
return (car1_1x*car1_2x+car1_1y*car1_2y)/(car1_2x*car1_2x+car1_2y*car1_2y);
}
#define __INTERPKERNELGEO2DEDGELIN_HXX__
#include "INTERPKERNELDefines.hxx"
-#include "InterpKernelGeo2DBounds.hxx"
#include "InterpKernelGeo2DEdge.hxx"
-#include "InterpKernelGeo2DNode.hxx"
-#include <list>
-#include <istream>
-#include <ostream>
namespace INTERP_KERNEL
{
friend class Edge;
public:
SegSegIntersector(const EdgeLin& e1, const EdgeLin& e2);
- bool areColinears() const override;
- bool haveTheySameDirection() const override;
- void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const override;
- void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped) override;
- std::list< IntersectElement > getIntersectionsCharacteristicVal() const override;
+ bool areColinears() const;
+ bool haveTheySameDirection() const;
+ void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const;
+ void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped);
+ std::list< IntersectElement > getIntersectionsCharacteristicVal() const;
private:
void getCurveAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode) const;
private:
EdgeLin(std::istream& lineInXfig);
EdgeLin(Node *start, Node *end, bool direction=true);
EdgeLin(double sX, double sY, double eX, double eY);
- ~EdgeLin() override;
- TypeOfFunction getTypeOfFunc() const override { return SEG; }
- void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const override;
- void update(Node *m) override;
+ ~EdgeLin();
+ TypeOfFunction getTypeOfFunc() const { return SEG; }
+ void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const;
+ void update(Node *m);
double getNormSq() const;
- double getAreaOfZone() const override;
- double getCurveLength() const override;
- void getBarycenter(double *bary) const override;
- void getBarycenterOfZone(double *bary) const override;
- void getMiddleOfPoints(const double *p1, const double *p2, double *mid) const override;
- bool isIn(double characterVal) const override;
- Node *buildRepresentantOfMySelf() const override;
- double getCharactValue(const Node& node) const override;
- double getCharactValueBtw0And1(const Node& node) const override;
- double getDistanceToPoint(const double *pt) const override;
- bool isNodeLyingOn(const double *coordOfNode) const override;
- bool isLower(double val1, double val2) const override { return val1<val2; }
+ double getAreaOfZone() const;
+ double getCurveLength() const;
+ void getBarycenter(double *bary) const;
+ void getBarycenterOfZone(double *bary) const;
+ void getMiddleOfPoints(const double *p1, const double *p2, double *mid) const;
+ bool isIn(double characterVal) const;
+ Node *buildRepresentantOfMySelf() const;
+ double getCharactValue(const Node& node) const;
+ double getCharactValueBtw0And1(const Node& node) const;
+ double getDistanceToPoint(const double *pt) const;
+ bool isNodeLyingOn(const double *coordOfNode) const;
+ bool isLower(double val1, double val2) const { return val1<val2; }
double getCharactValueEng(const double *node) const;
bool doIHaveSameDirectionAs(const Edge& other) const;
void dynCastFunction(const EdgeLin * &seg,
- const EdgeArcCircle * & /*arcSeg*/) const override { seg=this; }
+ const EdgeArcCircle * &arcSeg) const { seg=this; }
protected:
EdgeLin() { }
void updateBounds();
- Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const override;
+ Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const;
};
}
// Author : Anthony Geay (CEA/DEN)
#include "InterpKernelGeo2DElementaryEdge.hxx"
+#include "InterpKernelException.hxx"
#include "InterpKernelGeo2DEdge.hxx"
#include "InterpKernelGeo2DComposedEdge.hxx"
-#include <set>
-#include "InterpKernelGeo2DNode.hxx"
-#include <ostream>
-#include <map>
-#include "MCIdType.hxx"
-#include <vector>
using namespace INTERP_KERNEL;
#define __INTERPKERNELGEO2DELEMENTARYEDGE_HXX__
#include "INTERPKERNELDefines.hxx"
+#include "InterpKernelException.hxx"
#include "InterpKernelGeo2DAbstractEdge.hxx"
#include "InterpKernelGeo2DEdge.hxx"
-#include <set>
-#include <ostream>
-#include <map>
-#include "MCIdType.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
INTERPKERNEL_EXPORT Edge *getPtr() const { return _ptr; }
INTERPKERNEL_EXPORT void reverse() { _direction=(!_direction); }
INTERPKERNEL_EXPORT bool isNodeIn(Node *n) const;
- INTERPKERNEL_EXPORT double getAreaOfZone() const { double const ret=_ptr->getAreaOfZone(); return _direction?ret:-ret; }
+ INTERPKERNEL_EXPORT double getAreaOfZone() const { double ret=_ptr->getAreaOfZone(); return _direction?ret:-ret; }
INTERPKERNEL_EXPORT void getBarycenterOfZone(double *bary) const;
INTERPKERNEL_EXPORT void fillBounds(Bounds& output) const;
INTERPKERNEL_EXPORT void applySimilarity(double xBary, double yBary, double dimChar) { _ptr->applySimilarity(xBary,yBary,dimChar); }
#include "InterpKernelGeo2DNode.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
-#include <istream>
-#include <vector>
-#include <ostream>
-#include <cmath>
-#include <math.h>
-#include <map>
-#include "MCIdType.hxx"
-#include <cstddef>
-#include <algorithm>
using namespace INTERP_KERNEL;
}
Node::~Node()
-= default;
+{
+}
bool Node::decrRef()
{
- bool const ret=(--_cnt==0);
+ bool ret=(--_cnt==0);
if(ret)
delete this;
return ret;
*/
bool Node::isEqualAndKeepTrack(const Node& other, std::vector<Node *>& track) const
{
- bool const ret=isEqual(other);
+ bool ret=isEqual(other);
if(ret)
track.push_back(const_cast<Node *>(&other));
return ret;
*/
double Node::computeSlope(const double *pt1, const double *pt2)
{
- double const x=pt2[0]-pt1[0];
- double const y=pt2[1]-pt1[1];
- double const norm=sqrt(x*x+y*y);
- double const ret=EdgeArcCircle::SafeAcos(fabs(x)/norm);
+ double x=pt2[0]-pt1[0];
+ double y=pt2[1]-pt1[1];
+ double norm=sqrt(x*x+y*y);
+ double ret=EdgeArcCircle::SafeAcos(fabs(x)/norm);
if( (x>=0. && y>=0.) || (x<0. && y<0.) )
return ret;
else
*/
double Node::computeAngle(const double *pt1, const double *pt2)
{
- double const x=pt2[0]-pt1[0];
- double const y=pt2[1]-pt1[1];
- double const norm=sqrt(x*x+y*y);
+ double x=pt2[0]-pt1[0];
+ double y=pt2[1]-pt1[1];
+ double norm=sqrt(x*x+y*y);
return EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(x/norm,y/norm);
}
void Node::fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, mcIdType *nodeId) const
{
- auto it=mapOther.find(const_cast<Node *>(this));
+ std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator it=mapOther.find(const_cast<Node *>(this));
if(it!=mapOther.end()) // order matters, try in mapOther first.
{
*nodeId=(*it).second+offset1;
*nodeId=(*it).second;
return;
}
- int const id=(int)addCoo.size()/2;
+ int id=(int)addCoo.size()/2;
addCoo.push_back(fact*_coords[0]+baryX);
addCoo.push_back(fact*_coords[1]+baryY);
*nodeId=offset2+id;
std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, std::vector<mcIdType>& pointsOther) const
{
mcIdType tmp;
- std::size_t const sz1=addCoo.size();
+ std::size_t sz1=addCoo.size();
fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,&tmp);
if(sz1!=addCoo.size() // newly created point
|| (tmp >= offset2 // or previously created point merged with a neighbour
pointsOther.push_back(tmp);
return ;
}
- std::vector<mcIdType>::const_iterator const it=std::find(pointsOther.begin(),pointsOther.end(),tmp);
+ std::vector<mcIdType>::const_iterator it=std::find(pointsOther.begin(),pointsOther.end(),tmp);
if(it!=pointsOther.end())
return ;
pointsOther.push_back(tmp);
// Author : Anthony Geay (CEA/DEN)
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
-#include "InterpKernelGeo2DEdge.hxx"
#include "InterpKernelGeo2DElementaryEdge.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DAbstractEdge.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
#include "InterpKernelGeo2DBounds.hxx"
-#include "NormalizedGeometricTypes"
+#include "InterpKernelGeo2DEdge.txx"
-#include "MCIdType.hxx"
-#include "InterpKernelGeo2DNode.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
-#include <exception>
-#include <cmath>
-#include <cstdlib>
-#include <algorithm>
#include <fstream>
-#include <ios>
-#include <ostream>
-#include <list>
-#include <map>
-#include <iterator>
-#include <set>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <limits>
-#include <string>
-#include <vector>
-#include <utility>
using namespace INTERP_KERNEL;
newEdge->changeStartNodeWith(back()->getEndNode());
pushBack(newEdge);
}
- while(true);
+ while(1);
}
catch(const std::ifstream::failure&)
{
}
QuadraticPolygon::~QuadraticPolygon()
-= default;
+{
+}
QuadraticPolygon *QuadraticPolygon::BuildLinearPolygon(std::vector<Node *>& nodes)
{
- auto *ret(new QuadraticPolygon);
- std::size_t const size=nodes.size();
+ QuadraticPolygon *ret(new QuadraticPolygon);
+ std::size_t size=nodes.size();
for(std::size_t i=0;i<size;i++)
{
ret->pushBack(new EdgeLin(nodes[i],nodes[(i+1)%size]));
QuadraticPolygon *QuadraticPolygon::BuildArcCirclePolygon(std::vector<Node *>& nodes)
{
- auto *ret(new QuadraticPolygon);
- std::size_t const size=nodes.size();
+ QuadraticPolygon *ret(new QuadraticPolygon);
+ std::size_t size=nodes.size();
for(std::size_t i=0;i<size/2;i++)
{
EdgeLin *e1,*e2;
e1=new EdgeLin(nodes[i],nodes[i+size/2]);
e2=new EdgeLin(nodes[i+size/2],nodes[(i+1)%(size/2)]);
- SegSegIntersector const inters(*e1,*e2);
- bool const colinearity=inters.areColinears();
+ SegSegIntersector inters(*e1,*e2);
+ bool colinearity=inters.areColinears();
delete e1; delete e2;
if(colinearity)
ret->pushBack(new EdgeLin(nodes[i],nodes[(i+1)%(size/2)]));
{
if(nodes.size()!=3)
throw INTERP_KERNEL::Exception("QuadraticPolygon::BuildArcCircleEdge : input vector is expected to be of size 3 !");
- auto *e1(new EdgeLin(nodes[0],nodes[2])),*e2(new EdgeLin(nodes[2],nodes[1]));
- SegSegIntersector const inters(*e1,*e2);
- bool const colinearity=inters.areColinears();
+ EdgeLin *e1(new EdgeLin(nodes[0],nodes[2])),*e2(new EdgeLin(nodes[2],nodes[1]));
+ SegSegIntersector inters(*e1,*e2);
+ bool colinearity=inters.areColinears();
delete e1; delete e2;
- Edge *ret(nullptr);
+ Edge *ret(0);
if(colinearity)
ret=new EdgeLin(nodes[0],nodes[1]);
else
std::ofstream file(fileName);
file << std::setprecision(16);
file << " double coords[]=" << std::endl << " { ";
- for(auto iter=nodes.begin();iter!=nodes.end();iter++)
+ for(std::vector<Node *>::const_iterator iter=nodes.begin();iter!=nodes.end();iter++)
{
if(iter!=nodes.begin())
file << "," << std::endl << " ";
double xBary,yBary;
b.prepareForAggregation();
fillBounds(b);
- double const dimChar=b.getCaracteristicDim();
+ double dimChar=b.getCaracteristicDim();
b.getBarycenter(xBary,yBary);
applyGlobalSimilarity(xBary,yBary,dimChar);
//
bool QuadraticPolygon::isButterfly() const
{
- for(auto it=_sub_edges.begin();it!=_sub_edges.end();it++)
+ for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++)
{
Edge *e1=(*it)->getPtr();
- auto it2=it;
+ std::list<ElementaryEdge *>::const_iterator it2=it;
it2++;
for(;it2!=_sub_edges.end();it2++)
{
MergePoints commonNode;
- auto *outVal1=new ComposedEdge;
- auto *outVal2=new ComposedEdge;
+ ComposedEdge *outVal1=new ComposedEdge;
+ ComposedEdge *outVal2=new ComposedEdge;
Edge *e2=(*it2)->getPtr();
if(e1->intersectWith(e2,commonNode,*outVal1,*outVal2))
{
double QuadraticPolygon::intersectWithAbs(QuadraticPolygon& other)
{
double ret=0.,xBaryBB,yBaryBB;
- double const fact=normalize(&other,xBaryBB,yBaryBB);
- std::vector<QuadraticPolygon *> const polygs=intersectMySelfWith(other);
- for(auto & polyg : polygs)
+ double fact=normalize(&other,xBaryBB,yBaryBB);
+ std::vector<QuadraticPolygon *> polygs=intersectMySelfWith(other);
+ for(std::vector<QuadraticPolygon *>::iterator iter=polygs.begin();iter!=polygs.end();iter++)
{
- ret+=fabs(polyg->getArea());
- delete polyg;
+ ret+=fabs((*iter)->getArea());
+ delete *iter;
}
return ret*fact*fact;
}
std::vector<double>& addCoo, std::map<mcIdType,mcIdType>& mergedNodes)
{
double xBaryBB, yBaryBB;
- double const fact=normalizeExt(&other, xBaryBB, yBaryBB);
+ double fact=normalizeExt(&other, xBaryBB, yBaryBB);
//
IteratorOnComposedEdge itThis(this),itOther(&other); // other is (part of) the tool mesh
MergePoints merge;
- auto *cThis=new ComposedEdge;
- auto *cOther=new ComposedEdge;
+ ComposedEdge *cThis=new ComposedEdge;
+ ComposedEdge *cOther=new ComposedEdge;
int i=0;
std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo;
for(itOther.first();!itOther.finished();itOther.next(),i++)
ElementaryEdge* curThis=itThis.current();
merge.clear();
//
- auto thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())),
+ std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())),
otherStart(mapOther.find(curOtherTmp->getStartNode())),otherEnd(mapOther.find(curOtherTmp->getEndNode()));
mcIdType thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second), thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second),
otherStart2(otherStart==mapOther.end()?-1:(*otherStart).second+offset1),otherEnd2(otherEnd==mapOther.end()?-1:(*otherEnd).second+offset1);
std::size_t jj = 0, sz(otherTmp._sub_edges.size());
for(std::list<ElementaryEdge *>::const_iterator it=otherTmp._sub_edges.begin();it!=otherTmp._sub_edges.end();it++, jj++)
{
- short const skipStartOrEnd = jj == 0 ? -1 : (jj == sz-1 ? 1 : 0); // -1 means START, 1 means END, 0 other
+ short skipStartOrEnd = jj == 0 ? -1 : (jj == sz-1 ? 1 : 0); // -1 means START, 1 means END, 0 other
(*it)->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,
fact,xBaryBB,yBaryBB, skipStartOrEnd,
/*out*/ subDivOther[otherEdgeIds[i]],addCoo,mapAddCoo);
void QuadraticPolygon::buildFromCrudeDataArray(const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords,
const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges)
{
- std::size_t const nbOfSeg=std::distance(descBg,descEnd);
+ std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)
{
appendEdgeFromCrudeDataArray(i,mapp,isQuad,nodalBg,coords,descBg,descEnd,intersectEdges);
{
if(!isQuad)
{
- bool const direct=descBg[edgePos]>0;
- mcIdType const edgeId=std::abs(descBg[edgePos])-1; // back to C indexing mode
+ bool direct=descBg[edgePos]>0;
+ mcIdType edgeId=std::abs(descBg[edgePos])-1; // back to C indexing mode
const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
- std::size_t const nbOfSubEdges=subEdge.size()/2;
+ std::size_t nbOfSubEdges=subEdge.size()/2;
for(std::size_t j=0;j<nbOfSubEdges;j++)
- appendSubEdgeFromCrudeDataArray(nullptr,j,direct,edgeId,subEdge,mapp);
+ appendSubEdgeFromCrudeDataArray(0,j,direct,edgeId,subEdge,mapp);
}
else
{
- std::size_t const nbOfSeg=std::distance(descBg,descEnd);
+ std::size_t nbOfSeg=std::distance(descBg,descEnd);
const double *st=coords+2*(nodalBg[edgePos]);
- auto *st0=new INTERP_KERNEL::Node(st[0],st[1]);
+ INTERP_KERNEL::Node *st0=new INTERP_KERNEL::Node(st[0],st[1]);
const double *endd=coords+2*(nodalBg[(edgePos+1)%nbOfSeg]);
- auto *endd0=new INTERP_KERNEL::Node(endd[0],endd[1]);
+ INTERP_KERNEL::Node *endd0=new INTERP_KERNEL::Node(endd[0],endd[1]);
const double *middle=coords+2*(nodalBg[edgePos+nbOfSeg]);
- auto *middle0=new INTERP_KERNEL::Node(middle[0],middle[1]);
+ INTERP_KERNEL::Node *middle0=new INTERP_KERNEL::Node(middle[0],middle[1]);
EdgeLin *e1,*e2;
e1=new EdgeLin(st0,middle0);
e2=new EdgeLin(middle0,endd0);
- SegSegIntersector const inters(*e1,*e2);
- bool const colinearity=inters.areColinears();
+ SegSegIntersector inters(*e1,*e2);
+ bool colinearity=inters.areColinears();
delete e1; delete e2;
//
- bool const direct=descBg[edgePos]>0;
- mcIdType const edgeId=std::abs(descBg[edgePos])-1;
+ bool direct=descBg[edgePos]>0;
+ mcIdType edgeId=std::abs(descBg[edgePos])-1;
const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
- std::size_t const nbOfSubEdges=subEdge.size()/2;
+ std::size_t nbOfSubEdges=subEdge.size()/2;
if(colinearity)
{
for(std::size_t j=0;j<nbOfSubEdges;j++)
- appendSubEdgeFromCrudeDataArray(nullptr,j,direct,edgeId,subEdge,mapp);
+ appendSubEdgeFromCrudeDataArray(0,j,direct,edgeId,subEdge,mapp);
}
else
{
}
}
-void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType /*edgeId*/, const std::vector<mcIdType>& subEdge, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp)
+void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType edgeId, const std::vector<mcIdType>& subEdge, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp)
{
- std::size_t const nbOfSubEdges=subEdge.size()/2;
+ std::size_t nbOfSubEdges=subEdge.size()/2;
if(!baseEdge)
{//it is not a quadratic subedge
Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second;
Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second;
Node *end=(*mapp.find(direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2])).second;
Edge *ee=baseEdge->buildEdgeLyingOnMe(start,end);
- auto *eee=new ElementaryEdge(ee,true);
+ ElementaryEdge *eee=new ElementaryEdge(ee,true);
pushBack(eee);
}
}
const std::vector< std::vector<mcIdType> >& colinear1,
std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> >& alreadyExistingIn2)
{
- std::size_t const nbOfSeg=std::distance(descBg,descEnd);
+ std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
{
- bool const direct=descBg[i]>0;
- mcIdType const edgeId=std::abs(descBg[i])-1;//current edge id of pol2
+ bool direct=descBg[i]>0;
+ mcIdType edgeId=std::abs(descBg[i])-1;//current edge id of pol2
std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]);
if(it1!=alreadyExistingIn2.end() || it2!=alreadyExistingIn2.end())
{
- bool const sameDir=(it1!=alreadyExistingIn2.end());
+ bool sameDir=(it1!=alreadyExistingIn2.end());
const std::vector<INTERP_KERNEL::ElementaryEdge *>& edgesAlreadyBuilt=sameDir?(*it1).second:(*it2).second;
if(sameDir)
{
- for(auto it3 : edgesAlreadyBuilt)
+ for(std::vector<INTERP_KERNEL::ElementaryEdge *>::const_iterator it3=edgesAlreadyBuilt.begin();it3!=edgesAlreadyBuilt.end();it3++)
{
- Edge *ee=it3->getPtr(); ee->incrRef();
- pushBack(new ElementaryEdge(ee,it3->getDirection()));
+ Edge *ee=(*it3)->getPtr(); ee->incrRef();
+ pushBack(new ElementaryEdge(ee,(*it3)->getDirection()));
}
}
else
{
- for(auto it4=edgesAlreadyBuilt.rbegin();it4!=edgesAlreadyBuilt.rend();it4++)
+ for(std::vector<INTERP_KERNEL::ElementaryEdge *>::const_reverse_iterator it4=edgesAlreadyBuilt.rbegin();it4!=edgesAlreadyBuilt.rend();it4++)
{
Edge *ee=(*it4)->getPtr(); ee->incrRef();
pushBack(new ElementaryEdge(ee,!(*it4)->getDirection()));
if(!directos)
{// if the current edge of pol2 has one or more colinear edges part into pol1
const std::vector<mcIdType>& c=colinear1[edgeId];
- std::size_t const nbOfEdgesIn1=std::distance(descBg1,descEnd1);
+ std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1);
for(std::size_t j=0;j<nbOfEdgesIn1;j++)
{
- mcIdType const edgeId1=std::abs(descBg1[j])-1;
+ mcIdType edgeId1=std::abs(descBg1[j])-1;
if(std::find(c.begin(),c.end(),edgeId1)!=c.end())
{
idIns1.push_back(std::pair<mcIdType,std::pair<bool,mcIdType> >(edgeId1,std::pair<bool,mcIdType>(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2
}
if(directos)
{//no subpart of edge 'edgeId' of pol2 is in pol1 so let's operate the same thing that QuadraticPolygon::buildFromCrudeDataArray method
- std::size_t const oldSz=_sub_edges.size();
+ std::size_t oldSz=_sub_edges.size();
appendEdgeFromCrudeDataArray(i,mapp,isQuad,nodalBg,coords,descBg,descEnd,intersectEdges2);
- std::size_t const newSz=_sub_edges.size();
- std::size_t const zeSz=newSz-oldSz;
+ std::size_t newSz=_sub_edges.size();
+ std::size_t zeSz=newSz-oldSz;
alreadyExistingIn2[descBg[i]].resize(zeSz);
std::list<ElementaryEdge *>::const_reverse_iterator it5=_sub_edges.rbegin();
for(std::size_t p=0;p<zeSz;p++,it5++)
else
{//there is subpart of edge 'edgeId' of pol2 inside pol1
const std::vector<mcIdType>& subEdge=intersectEdges2[edgeId];
- std::size_t const nbOfSubEdges=subEdge.size()/2;
+ std::size_t nbOfSubEdges=subEdge.size()/2;
for(std::size_t j=0;j<nbOfSubEdges;j++)
{
- mcIdType const idBg=direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1];
- mcIdType const idEnd=direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2];
+ mcIdType idBg=direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1];
+ mcIdType idEnd=direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2];
bool direction11=false,found=false;
bool direct1=false;//store if needed the direction in 1
mcIdType offset2=0;
mcIdType nbOfSubEdges1=0;
for(std::vector<std::pair<mcIdType,std::pair<bool,mcIdType> > >::const_iterator it=idIns1.begin();it!=idIns1.end() && !found;it++)
{
- mcIdType const idIn1=(*it).first;//store if needed the cell id in 1
+ mcIdType idIn1=(*it).first;//store if needed the cell id in 1
direct1=(*it).second.first;
offset1=(*it).second.second;
const std::vector<mcIdType>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
ElementaryEdge *e=pol1[FromIdType<int>(offset1+(direct1?offset2:nbOfSubEdges1-offset2-1))];
Edge *ee=e->getPtr();
ee->incrRef();
- auto *e2=new ElementaryEdge(ee,!(direct1^direction11));
+ ElementaryEdge *e2=new ElementaryEdge(ee,!(direct1^direction11));
pushBack(e2);
alreadyExistingIn2[descBg[i]].push_back(e2);
}
const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1,
const std::vector<std::vector<mcIdType> >& intersectEdges1, const std::vector< std::vector<mcIdType> >& colinear1) const
{
- std::size_t const nbOfSeg=std::distance(descBg,descEnd);
+ std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
{
- bool const direct=descBg[i]>0;
- mcIdType const edgeId=std::abs(descBg[i])-1;//current edge id of pol2
+ bool direct=descBg[i]>0;
+ mcIdType edgeId=std::abs(descBg[i])-1;//current edge id of pol2
const std::vector<mcIdType>& c=colinear1[edgeId];
if(c.empty())
continue;
const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
- std::size_t const nbOfSubEdges=subEdge.size()/2;
+ std::size_t nbOfSubEdges=subEdge.size()/2;
//
- std::size_t const nbOfEdgesIn1=std::distance(descBg1,descEnd1);
+ std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1);
mcIdType offset1=0;
for(std::size_t j=0;j<nbOfEdgesIn1;j++)
{
- mcIdType const edgeId1=std::abs(descBg1[j])-1;
+ mcIdType edgeId1=std::abs(descBg1[j])-1;
if(std::find(c.begin(),c.end(),edgeId1)!=c.end())
{
for(std::size_t k=0;k<nbOfSubEdges;k++)
{
- mcIdType const idBg=direct?subEdge[2*k]:subEdge[2*nbOfSubEdges-2*k-1];
- mcIdType const idEnd=direct?subEdge[2*k+1]:subEdge[2*nbOfSubEdges-2*k-2];
- mcIdType const idIn1=edgeId1;
- bool const direct1=descBg1[j]>0;
+ mcIdType idBg=direct?subEdge[2*k]:subEdge[2*nbOfSubEdges-2*k-1];
+ mcIdType idEnd=direct?subEdge[2*k+1]:subEdge[2*nbOfSubEdges-2*k-2];
+ mcIdType idIn1=edgeId1;
+ bool direct1=descBg1[j]>0;
const std::vector<mcIdType>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
- mcIdType const nbOfSubEdges1=ToIdType(subEdge1PossiblyAlreadyIn1.size()/2);
+ mcIdType nbOfSubEdges1=ToIdType(subEdge1PossiblyAlreadyIn1.size()/2);
mcIdType offset2=0;
bool found=false;
for(mcIdType kk=0;kk<nbOfSubEdges1 && !found;kk++)
void QuadraticPolygon::appendCrudeData(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI) const
{
int nbOfNodesInPg=0;
- bool const presenceOfQuadratic=presenceOfQuadraticEdge();
+ bool presenceOfQuadratic=presenceOfQuadraticEdge();
conn.push_back(presenceOfQuadratic?NORM_QPOLYG:NORM_POLYGON);
- for(auto _sub_edge : _sub_edges)
+ for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++)
{
- Node *tmp=nullptr;
- tmp=_sub_edge->getStartNode();
- auto const it1=mapp.find(tmp);
+ Node *tmp=0;
+ tmp=(*it)->getStartNode();
+ std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator it1=mapp.find(tmp);
conn.push_back((*it1).second);
nbOfNodesInPg++;
}
if(presenceOfQuadratic)
{
int j=0;
- mcIdType const off=offset+ToIdType(addCoordsQuadratic.size())/2;
- for(auto it=_sub_edges.begin();it!=_sub_edges.end();it++,j++,nbOfNodesInPg++)
+ mcIdType off=offset+ToIdType(addCoordsQuadratic.size())/2;
+ for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++,j++,nbOfNodesInPg++)
{
INTERP_KERNEL::Node *node=(*it)->getPtr()->buildRepresentantOfMySelf();
node->unApplySimilarity(xBary,yBary,fact);
std::vector<mcIdType>& nbThis, std::vector<mcIdType>& nbOther)
{
double xBaryBB, yBaryBB;
- double const fact=normalizeExt(&other, xBaryBB, yBaryBB);
+ double fact=normalizeExt(&other, xBaryBB, yBaryBB);
//Locate \a this relative to \a other (edges of \a this, aka \a pol1 are marked as IN or OUT)
other.performLocatingOperationSlow(*this); // without any assumption
- std::vector<QuadraticPolygon *> const res=buildIntersectionPolygons(*this,other);
- for(auto & re : res)
+ std::vector<QuadraticPolygon *> res=buildIntersectionPolygons(*this,other);
+ for(std::vector<QuadraticPolygon *>::iterator it=res.begin();it!=res.end();it++)
{
- re->appendCrudeData(mapp,xBaryBB,yBaryBB,fact,offset,addCoordsQuadratic,conn,connI);
- INTERP_KERNEL::IteratorOnComposedEdge it1(re);
+ (*it)->appendCrudeData(mapp,xBaryBB,yBaryBB,fact,offset,addCoordsQuadratic,conn,connI);
+ INTERP_KERNEL::IteratorOnComposedEdge it1(*it);
for(it1.first();!it1.finished();it1.next())
{
Edge *e=it1.current()->getPtr();
}
nbThis.push_back(idThis);
nbOther.push_back(idOther);
- delete re;
+ delete *it;
}
unApplyGlobalSimilarityExt(other,xBaryBB,yBaryBB,fact);
}
void QuadraticPolygon::cleanDegeneratedConsecutiveEdges()
{
IteratorOnComposedEdge it(this);
- ElementaryEdge * prevEdge = nullptr;
+ ElementaryEdge * prevEdge = 0;
if (recursiveSize() > 2)
for(it.first();!it.finished();it.next())
{
double QuadraticPolygon::intersectWithAbs1D(QuadraticPolygon& other, bool& isColinear)
{
double ret = 0., xBaryBB, yBaryBB;
- double const fact = normalize(&other, xBaryBB, yBaryBB);
+ double fact = normalize(&other, xBaryBB, yBaryBB);
QuadraticPolygon cpyOfThis(*this);
QuadraticPolygon cpyOfOther(other);
{
double ret=0.,bary[2],area,xBaryBB,yBaryBB;
barycenter[0] = barycenter[1] = 0.;
- double const fact=normalize(&other,xBaryBB,yBaryBB);
- std::vector<QuadraticPolygon *> const polygs=intersectMySelfWith(other);
- for(auto & polyg : polygs)
+ double fact=normalize(&other,xBaryBB,yBaryBB);
+ std::vector<QuadraticPolygon *> polygs=intersectMySelfWith(other);
+ for(std::vector<QuadraticPolygon *>::iterator iter=polygs.begin();iter!=polygs.end();iter++)
{
- area=fabs(polyg->getArea());
- polyg->getBarycenter(bary);
- delete polyg;
+ area=fabs((*iter)->getArea());
+ (*iter)->getBarycenter(bary);
+ delete *iter;
ret+=area;
barycenter[0] += bary[0]*area;
barycenter[1] += bary[1]*area;
double QuadraticPolygon::intersectWith(const QuadraticPolygon& other) const
{
double ret=0.;
- std::vector<QuadraticPolygon *> const polygs=intersectMySelfWith(other);
- for(auto & polyg : polygs)
+ std::vector<QuadraticPolygon *> polygs=intersectMySelfWith(other);
+ for(std::vector<QuadraticPolygon *>::iterator iter=polygs.begin();iter!=polygs.end();iter++)
{
- ret+=fabs(polyg->getArea());
- delete polyg;
+ ret+=fabs((*iter)->getArea());
+ delete *iter;
}
return ret;
}
{
double ret=0., bary[2];
barycenter[0] = barycenter[1] = 0.;
- std::vector<QuadraticPolygon *> const polygs=intersectMySelfWith(other);
- for(auto & polyg : polygs)
+ std::vector<QuadraticPolygon *> polygs=intersectMySelfWith(other);
+ for(std::vector<QuadraticPolygon *>::iterator iter=polygs.begin();iter!=polygs.end();iter++)
{
- double const area = fabs(polyg->getArea());
- polyg->getBarycenter(bary);
- delete polyg;
+ double area = fabs((*iter)->getArea());
+ (*iter)->getBarycenter(bary);
+ delete *iter;
ret+=area;
barycenter[0] += bary[0]*area;
barycenter[1] += bary[1]*area;
{
IteratorOnComposedEdge it1(&pol1),it2(&pol2);
MergePoints merge;
- auto *c1=new ComposedEdge;
- auto *c2=new ComposedEdge;
+ ComposedEdge *c1=new ComposedEdge;
+ ComposedEdge *c2=new ComposedEdge;
for(it2.first();!it2.finished();it2.next())
{
ElementaryEdge* curE2=it2.current();
{
std::list<QuadraticPolygon *> ret;
IteratorOnComposedEdge it(const_cast<QuadraticPolygon *>(this));
- int const nbOfTurns=recursiveSize();
+ int nbOfTurns=recursiveSize();
int i=0;
if(!it.goToNextInOn(false,i,nbOfTurns))
return ret;
//
while(i<nbOfTurns)
{
- auto *tmp1=new QuadraticPolygon;
+ QuadraticPolygon *tmp1=new QuadraticPolygon;
TypeOfEdgeLocInPolygon loc=it.current()->getLoc();
while(loc!=FULL_OUT_1 && i<nbOfTurns)
{
bool directionKnownInPol2=false;
bool directionInPol2=false;
bool needCleaning = false;
- for(auto iter=pol1Zip.begin();iter!=pol1Zip.end();)
+ for(std::list<QuadraticPolygon *>::iterator iter=pol1Zip.begin();iter!=pol1Zip.end();)
{
// Build incrementally the full closed cells from the consecutive line parts already built in pol1Zip.
// At the end of the process the item currently iterated has been totally completed (start_node=end_node)
else
directionKnownInPol2=true;
}
- auto iter2=iter; iter2++;
+ std::list<QuadraticPolygon *>::iterator iter2=iter; iter2++;
// Fill as much as possible the current iterate (=a part of pol1) with consecutive pieces from pol2:
- auto const iter3=(*iter)->fillAsMuchAsPossibleWith(pol2,iter2,pol1Zip.end(),directionInPol2);
+ std::list<QuadraticPolygon *>::iterator iter3=(*iter)->fillAsMuchAsPossibleWith(pol2,iter2,pol1Zip.end(),directionInPol2);
// and now add a full connected piece from pol1Zip:
if(iter3!=pol1Zip.end())
{
it2.nextLoop();
cur=it2.current();
Node *repr=cur->getPtr()->buildRepresentantOfMySelf();
- bool const ret=pol1NotSplitted.isInOrOut(repr);
+ bool ret=pol1NotSplitted.isInOrOut(repr);
repr->decrRef();
direction = ret;
needCleaning = ret; // if true we are in tricky case 2 above, we know that we will produce two consecutive overlapping edges in result
else // here we don't need to go prev or next:
{
Node *repr=cur->getPtr()->buildRepresentantOfMySelf();
- bool const ret=pol1NotSplitted.isInOrOut(repr);
+ bool ret=pol1NotSplitted.isInOrOut(repr);
repr->decrRef();
direction = ret;
return ret;
std::list<QuadraticPolygon *>::iterator QuadraticPolygon::CheckInList(Node *n, std::list<QuadraticPolygon *>::iterator iStart,
std::list<QuadraticPolygon *>::iterator iEnd)
{
- for(auto iter=iStart;iter!=iEnd;iter++)
+ for(std::list<QuadraticPolygon *>::iterator iter=iStart;iter!=iEnd;iter++)
if((*iter)->isNodeIn(n))
return iter;
return iEnd;
{
// Initialise locations on pol1. Remember that edges found in 'notUsedInPol1' are also part of the edges forming pol1.
pol1.initLocations();
- for(auto it1 : notUsedInPol1)
- { it1->initLocs(); it1->declareOn(); }
- for(auto it2 : edgesInPol2OnBoundary)
- { it2->initLocs(); it2->declareIn(); }
+ for(std::set<Edge *>::const_iterator it1=notUsedInPol1.begin();it1!=notUsedInPol1.end();it1++)
+ { (*it1)->initLocs(); (*it1)->declareOn(); }
+ for(std::set<Edge *>::const_iterator it2=edgesInPol2OnBoundary.begin();it2!=edgesInPol2OnBoundary.end();it2++)
+ { (*it2)->initLocs(); (*it2)->declareIn(); }
////
std::set<Edge *> notUsedInPol1L(notUsedInPol1);
IteratorOnComposedEdge itPol1(const_cast<QuadraticPolygon *>(&pol1));
- int const sz=pol1.size();
+ int sz=pol1.size();
std::list<QuadraticPolygon *> pol1Zip;
// If none of the edges of pol1 was consumed by the rebuilding process, we can directly take pol1 as it is to form a cell:
if(pol1.size()==(int)notUsedInPol1.size() && edgesInPol2OnBoundary.empty())
itPol1.nextLoop();
if(itPol1.current()->getStartNode()->getLoc()!=IN_1 || itPol1.current()->getLoc()!=FULL_ON_1)
throw INTERP_KERNEL::Exception("Presence of a target polygon fully included in source polygon ! The partition of this leads to a non simply connex cell (with hole) ! Impossible ! Such resulting cell cannot be stored in MED cell format !");
- auto *tmp1=new QuadraticPolygon;
+ QuadraticPolygon *tmp1=new QuadraticPolygon;
do
{
Edge *ee=itPol1.current()->getPtr();
while(nbOfTurn<maxNbOfTurn) // the 'normal' way out of this loop is the break towards the end when pol1Zip is empty.
{
// retPolsUnderConstruction initially empty -> see if(!pol1Zip.empty()) below ...
- for(auto itConstr=retPolsUnderContruction.begin();itConstr!=retPolsUnderContruction.end();)
+ for(std::list<QuadraticPolygon *>::iterator itConstr=retPolsUnderContruction.begin();itConstr!=retPolsUnderContruction.end();)
{
Node *startN = (*itConstr)->getStartNode();
Node *curN = (*itConstr)->getEndNode();
bool smthHappened=false, doneEarly=false;
// Complete a partially reconstructed polygon with boundary edges of pol2 by matching nodes:
- for(auto it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();)
+ for(std::list<Edge *>::iterator it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();)
{
if(curN==(*it2)->getEndNode()) // only end node should be considered if orientation is correct for input meshes
// in the funny case of cells exactly included (see test case testIntersect2DMeshesTmp13) this is mandatory to take edges from pol2 in the right order.
// Be somewhat flexible and keep on supporting this case here (useful for voronisation notably):
if(!smthHappened)
{
- for(auto it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();)
+ for(std::list<Edge *>::iterator it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();)
{
if(curN==(*it2)->getStartNode())
{
if(smthHappened) // Now continue the construction by finding the next bit in pol1Zip. Not too sure what are the cases where the boolean if False ...
{
- for(auto itZip=pol1Zip.begin();itZip!=pol1Zip.end();)
+ for(std::list<QuadraticPolygon *>::iterator itZip=pol1Zip.begin();itZip!=pol1Zip.end();)
{
if(curN==(*itZip)->getStartNode()) // we found a matching piece to append in pol1Zip. Append all of it to the current polygon being reconstr
{
for(std::list<ElementaryEdge *>::const_iterator it4=(*itZip)->_sub_edges.begin();it4!=(*itZip)->_sub_edges.end();it4++)
- { (*it4)->getPtr()->incrRef(); bool const dir=(*it4)->getDirection(); (*itConstr)->pushBack(new ElementaryEdge((*it4)->getPtr(),dir)); }
+ { (*it4)->getPtr()->incrRef(); bool dir=(*it4)->getDirection(); (*itConstr)->pushBack(new ElementaryEdge((*it4)->getPtr(),dir)); }
pol1ZipConsumed[*itConstr].push_back(*itZip);
curN=(*itZip)->getEndNode();
itZip=pol1Zip.erase(itZip); // one zipped piece has been consumed
if(edgesInPol2OnBoundary.find(ee)!=edgesInPol2OnBoundary.end())
edgesInPol2OnBoundaryL.push_back(ee);
}
- for(auto & it6 : pol1ZipConsumed[*itConstr])
- pol1Zip.push_front(it6);
+ for(std::list<QuadraticPolygon *>::iterator it6=pol1ZipConsumed[*itConstr].begin();it6!=pol1ZipConsumed[*itConstr].end();it6++)
+ pol1Zip.push_front(*it6);
pol1ZipConsumed.erase(*itConstr);
delete *itConstr;
itConstr=retPolsUnderContruction.erase(itConstr);
}
if(!pol1Zip.empty()) // the filling process of retPolsUnderConstruction starts here
{
- auto *tmp=new QuadraticPolygon;
+ QuadraticPolygon *tmp=new QuadraticPolygon;
QuadraticPolygon *first=*(pol1Zip.begin());
for(std::list<ElementaryEdge *>::const_iterator it4=first->_sub_edges.begin();it4!=first->_sub_edges.end();it4++)
- { (*it4)->getPtr()->incrRef(); bool const dir=(*it4)->getDirection(); tmp->pushBack(new ElementaryEdge((*it4)->getPtr(),dir)); }
+ { (*it4)->getPtr()->incrRef(); bool dir=(*it4)->getDirection(); tmp->pushBack(new ElementaryEdge((*it4)->getPtr(),dir)); }
pol1ZipConsumed[tmp].push_back(first);
retPolsUnderContruction.push_back(tmp);
pol1Zip.erase(pol1Zip.begin());
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
// Convert to integer connectivity:
- for(auto & itConstr : retPolsUnderContruction)
+ for(std::list<QuadraticPolygon *>::iterator itConstr=retPolsUnderContruction.begin();itConstr!=retPolsUnderContruction.end();itConstr++)
{
- if(itConstr->getStartNode()==itConstr->getEndNode()) // take only fully closed reconstructed polygon
+ if((*itConstr)->getStartNode()==(*itConstr)->getEndNode()) // take only fully closed reconstructed polygon
{
- itConstr->cleanDegeneratedConsecutiveEdges();
- itConstr->appendCrudeData(mapp,0.,0.,1.,offset,addCoordsQuadratic,conn,connI); nb1.push_back(idThis); nb2.push_back(-1);
- for(auto & it6 : pol1ZipConsumed[itConstr])
- delete it6;
- delete itConstr;
+ (*itConstr)->cleanDegeneratedConsecutiveEdges();
+ (*itConstr)->appendCrudeData(mapp,0.,0.,1.,offset,addCoordsQuadratic,conn,connI); nb1.push_back(idThis); nb2.push_back(-1);
+ for(std::list<QuadraticPolygon *>::iterator it6=pol1ZipConsumed[*itConstr].begin();it6!=pol1ZipConsumed[*itConstr].end();it6++)
+ delete *it6;
+ delete *itConstr;
}
else
{
#include "InterpKernelGeo2DComposedEdge.hxx"
#include "InterpKernelGeo2DAbstractEdge.hxx"
#include "InterpKernelGeo2DElementaryEdge.hxx"
-#include "MCIdType.hxx"
-#include <cstddef>
#include <list>
-#include <utility>
-#include <map>
-#include <set>
-#include <ostream>
#include <vector>
namespace INTERP_KERNEL
class MergePoints;
enum NodeUsage { USAGE_UNKNOWN, USAGE_LINEAR, USAGE_QUADRATIC_ONLY };
- using NodeWithUsage = std::pair<INTERP_KERNEL::Node *, NodeUsage>;
+ typedef std::pair<INTERP_KERNEL::Node *,NodeUsage> NodeWithUsage;
/**
* A set of quadratic or linear edges, not necessarily connected to form a closed polygon.
class QuadraticPolygon : public ComposedEdge
{
public:
- INTERPKERNEL_EXPORT QuadraticPolygon() = default;
- INTERPKERNEL_EXPORT QuadraticPolygon(const QuadraticPolygon& other) = default;
+ INTERPKERNEL_EXPORT QuadraticPolygon() { }
+ INTERPKERNEL_EXPORT QuadraticPolygon(const QuadraticPolygon& other):ComposedEdge(other) { }
INTERPKERNEL_EXPORT QuadraticPolygon(const char *fileName);
INTERPKERNEL_EXPORT static QuadraticPolygon *BuildLinearPolygon(std::vector<Node *>& nodes);
INTERPKERNEL_EXPORT static QuadraticPolygon *BuildArcCirclePolygon(std::vector<Node *>& nodes);
namespace INTERP_KERNEL
{
template<class EDGES>
- void QuadraticPolygon::UpdateNeighbours(const MergePoints& /*merger*/, IteratorOnComposedEdge it1, IteratorOnComposedEdge it2,
+ void QuadraticPolygon::UpdateNeighbours(const MergePoints& merger, IteratorOnComposedEdge it1, IteratorOnComposedEdge it2,
const EDGES *e1, const EDGES *e2)
{
it1.previousLoop(); it2.previousLoop();
#ifndef __GEOMETRIC2DINTERSECTOR_HXX__
#define __GEOMETRIC2DINTERSECTOR_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include "InterpKernelGeo2DPrecision.hxx"
-#include <vector>
+#include "PlanarIntersectorP0P0.hxx"
+#include "PlanarIntersectorP0P1.hxx"
+#include "PlanarIntersectorP1P0.hxx"
+#include "PlanarIntersectorP1P1.hxx"
+#include "PlanarIntersectorP1P0Bary.hxx"
+#include "PlanarIntersectorP0P1Bary.hxx"
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
Geometric2DIntersector(const MyMeshType& meshT, const MyMeshType& meshS,
#define __GEOMETRIC2DINTERSECTOR_TXX__
#include "Geometric2DIntersector.hxx"
-#include "PlanarIntersector.txx"
#include "PlanarIntersectorP0P0.txx"
#include "Planar2D1DIntersectorP0P0.txx"
#include "PlanarIntersectorP0P1.txx"
#include "PlanarIntersectorP1P1.txx"
#include "PlanarIntersectorP1P0Bary.txx"
#include "PlanarIntersectorP0P1Bary.txx"
-#include "InterpolationUtils.hxx"
#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
#include "InterpKernelGeo2DNode.hxx"
-#include <vector>
-#include <cstddef>
-#include <limits>
-
-
#define GEO2D_INTERSECTOR Geometric2DIntersector<MyMeshType,MyMatrix,InterpType>
#define INTERSECTOR_TEMPLATE template<class MyMeshType, class MyMatrix, template <class MeshType, class TheMatrix, class ThisIntersector> class InterpType>
#ifndef __INTEGRALUNIFORMINTERSECTOR_HXX__
#define __INTEGRALUNIFORMINTERSECTOR_HXX__
-#include "TargetIntersector.hxx"
+#include "TargetIntersector.txx"
#include <cmath>
-#include <vector>
namespace INTERP_KERNEL
{
class IntegralUniformIntersector : public TargetIntersector<MyMeshType,MyMatrix>
{
public:
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
public:
IntegralUniformIntersector(const MyMeshType& mesh, bool isAbs);
double performNormalization(double val) const { if(_is_abs) return fabs(val); else return val; }
class IntegralUniformIntersectorP0 : public IntegralUniformIntersector<MyMeshType,MyMatrix>
{
public:
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
public:
IntegralUniformIntersectorP0(const MyMeshType& mesh, bool isAbs);
ConnType getNumberOfRowsOfResMatrix() const;
class IntegralUniformIntersectorP1 : public IntegralUniformIntersector<MyMeshType,MyMatrix>
{
public:
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
public:
IntegralUniformIntersectorP1(const MyMeshType& mesh, bool isAbs);
ConnType getNumberOfRowsOfResMatrix() const;
#define __INTEGRALUNIFORMINTERSECTOR_TXX__
#include "IntegralUniformIntersector.hxx"
-#include "NormalizedGeometricTypes"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "InterpolationUtils.hxx"
#include "VolSurfUser.txx"
-#include <vector>
namespace INTERP_KERNEL
{
}
template<class MyMeshType, class MyMatrix>
- void IntegralUniformIntersectorP0<MyMeshType,MyMatrix>::intersectCells(ConnType /*targetCell*/, const std::vector<ConnType>& /*srcCells*/, MyMatrix& res)
+ void IntegralUniformIntersectorP0<MyMeshType,MyMatrix>::intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res)
{
static const NumberingPolicy numPol=MyMeshType::My_numPol;
res.resize(getNumberOfRowsOfResMatrix());
}
template<class MyMeshType, class MyMatrix>
- void IntegralUniformIntersectorP1<MyMeshType,MyMatrix>::intersectCells(ConnType /*targetCell*/, const std::vector<ConnType>& /*srcCells*/, MyMatrix& res)
+ void IntegralUniformIntersectorP1<MyMeshType,MyMatrix>::intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res)
{
static const NumberingPolicy numPol=MyMeshType::My_numPol;
res.resize(getNumberOfRowsOfResMatrix());
#include "InterpKernelCellSimplify.hxx"
#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
-#include "MCIdType.hxx"
-#include "InterpKernelException.hxx"
#include <functional>
#include <algorithm>
#include <iterator>
+#include <sstream>
+#include <numeric>
#include <cstring>
-#include <utility>
+#include <limits>
#include <vector>
+#include <list>
#include <set>
using namespace INTERP_KERNEL;
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
std::set<mcIdType> c(conn,conn+lgth);
c.erase(-1);
- bool const isObviousNonDegeneratedCell=(ToIdType(c.size())==lgth);
+ bool isObviousNonDegeneratedCell=(ToIdType(c.size())==lgth);
if((cm.getDimension()==3 && cm.isQuadratic()) || isObviousNonDegeneratedCell)
{//quadratic 3D, do nothing for the moment.
retLgth=lgth;
- auto *tmp=new mcIdType[lgth];//no direct std::copy ! overlapping of conn and retConn !
+ mcIdType *tmp=new mcIdType[lgth];//no direct std::copy ! overlapping of conn and retConn !
std::copy(conn,conn+lgth,tmp);
std::copy(tmp,tmp+lgth,retConn);
delete [] tmp;
}
if(cm.getDimension()==2)
{
- auto *tmp=new mcIdType[lgth];
+ mcIdType *tmp=new mcIdType[lgth];
int newPos=0;
if(!cm.isQuadratic())
{
}
else
{
- mcIdType const quadOff = lgth/2;
- auto *tmpQuad = new mcIdType[quadOff];
+ mcIdType quadOff = lgth/2;
+ mcIdType *tmpQuad = new mcIdType[quadOff];
for(int i = 0; i < quadOff; i++)
if(conn[i] != conn[(i+1)%quadOff] || conn[i] != conn[i+quadOff]) // zip nul segments/arcs (quad point must match too)
{
delete [] tmpQuad;
newPos *= 2; // take in quad points in the final length
}
- INTERP_KERNEL::NormalizedCellType const ret=tryToUnPoly2D(cm.isQuadratic(),tmp,newPos,retConn,retLgth);
+ INTERP_KERNEL::NormalizedCellType ret=tryToUnPoly2D(cm.isQuadratic(),tmp,newPos,retConn,retLgth);
delete [] tmp;
return ret;
}
{
mcIdType nbOfFaces,lgthOfPolyhConn;
mcIdType *zipFullReprOfPolyh=getFullPolyh3DCell(type,conn,lgth,nbOfFaces,lgthOfPolyhConn);
- INTERP_KERNEL::NormalizedCellType const ret=tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,retConn,retLgth);
+ INTERP_KERNEL::NormalizedCellType ret=tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,retConn,retLgth);
delete [] zipFullReprOfPolyh;
return ret;
}
mcIdType& retNbOfFaces, mcIdType& retLgth)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
- unsigned const nbOfFaces=cm.getNumberOfSons2(conn,lgth);
- auto *tmp=new mcIdType[nbOfFaces*(lgth+1)];
+ unsigned nbOfFaces=cm.getNumberOfSons2(conn,lgth);
+ mcIdType *tmp=new mcIdType[nbOfFaces*(lgth+1)];
mcIdType *work=tmp;
std::vector<mcIdType> faces;
for(unsigned j=0;j<nbOfFaces;j++)
{
INTERP_KERNEL::NormalizedCellType type2;
- unsigned const offset=cm.fillSonCellNodalConnectivity2(j,conn,lgth,work,type2);
+ unsigned offset=cm.fillSonCellNodalConnectivity2(j,conn,lgth,work,type2);
//
- auto *tmp2=new mcIdType[offset];
+ mcIdType *tmp2=new mcIdType[offset];
tmp2[0]=work[0];
mcIdType newPos=1;
for(unsigned k=1;k<offset;k++)
{
std::set<mcIdType> nodes(conn,conn+lgth);
nodes.erase(-1);
- std::size_t const nbOfNodes=nodes.size();
- std::size_t const magicNumber=100*nbOfNodes+nbOfFaces;
+ std::size_t nbOfNodes=nodes.size();
+ std::size_t magicNumber=100*nbOfNodes+nbOfFaces;
switch(magicNumber)
{
case 806:
bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace)
{
std::vector<mcIdType> tmp2;
- std::set<mcIdType> const bases(baseFace,baseFace+lgthBaseFace);
- std::set<mcIdType> const sides(sideFace,sideFace+4);
+ std::set<mcIdType> bases(baseFace,baseFace+lgthBaseFace);
+ std::set<mcIdType> sides(sideFace,sideFace+4);
std::set_intersection(bases.begin(),bases.end(),sides.begin(),sides.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp2));
if(tmp2.size()!=2)
return false;
for(int i=0;i<4;i++)
sideEdges[i]=std::pair<mcIdType,mcIdType>(sideFace[i],sideFace[(i+1)%4]);
std::vector< std::pair<mcIdType,mcIdType> > tmp;
- std::set< std::pair<mcIdType,mcIdType> > const baseEdgesS(baseEdges.begin(),baseEdges.end());
- std::set< std::pair<mcIdType,mcIdType> > const sideEdgesS(sideEdges.begin(),sideEdges.end());
+ std::set< std::pair<mcIdType,mcIdType> > baseEdgesS(baseEdges.begin(),baseEdges.end());
+ std::set< std::pair<mcIdType,mcIdType> > sideEdgesS(sideEdges.begin(),sideEdges.end());
std::set_intersection(baseEdgesS.begin(),baseEdgesS.end(),sideEdgesS.begin(),sideEdgesS.end(),std::back_insert_iterator< std::vector< std::pair<mcIdType,mcIdType> > >(tmp));
if(tmp.empty())
{
//reverse sideFace
for(int i=0;i<4;i++)
{
- std::pair<mcIdType,mcIdType> const p=sideEdges[i];
- std::pair<mcIdType,mcIdType> const r(p.second,p.first);
+ std::pair<mcIdType,mcIdType> p=sideEdges[i];
+ std::pair<mcIdType,mcIdType> r(p.second,p.first);
sideEdges[i]=r;
}
//end reverse sideFace
- std::set< std::pair<mcIdType,mcIdType> > const baseEdgesS2(baseEdges.begin(),baseEdges.end());
- std::set< std::pair<mcIdType,mcIdType> > const sideEdgesS2(sideEdges.begin(),sideEdges.end());
+ std::set< std::pair<mcIdType,mcIdType> > baseEdgesS2(baseEdges.begin(),baseEdges.end());
+ std::set< std::pair<mcIdType,mcIdType> > sideEdgesS2(sideEdges.begin(),sideEdges.end());
std::set_intersection(baseEdgesS2.begin(),baseEdgesS2.end(),sideEdgesS2.begin(),sideEdgesS2.end(),std::back_insert_iterator< std::vector< std::pair<mcIdType,mcIdType> > >(tmp));
if(tmp.empty())
return false;
}
if(!found)
return false;
- int const pos=(int)std::distance(baseEdges.begin(),std::find(baseEdges.begin(),baseEdges.end(),tmp[0]));
- auto const it=std::find(oppEdges.begin(),oppEdges.end(),pInOpp);
+ int pos=(int)std::distance(baseEdges.begin(),std::find(baseEdges.begin(),baseEdges.end(),tmp[0]));
+ std::vector< std::pair<mcIdType,mcIdType> >::iterator it=std::find(oppEdges.begin(),oppEdges.end(),pInOpp);
if(it==oppEdges.end())//the opposite edge of side face is not found opposite face ... maybe problem of orientation of polyhedron
return false;
- mcIdType const pos2=ToIdType(std::distance(oppEdges.begin(),it));
+ mcIdType pos2=ToIdType(std::distance(oppEdges.begin(),it));
mcIdType offset=pos-pos2;
if(offset<0)
offset+=lgthBaseFace;
//this is the end copy the result
- auto *tmp3=new mcIdType[lgthBaseFace];
+ mcIdType *tmp3=new mcIdType[lgthBaseFace];
for(int i=0;i<lgthBaseFace;i++)
tmp3[(offset+i)%lgthBaseFace]=oppEdges[i].first;
std::copy(tmp3,tmp3+lgthBaseFace,retConn);
return true;
}
-bool CellSimplify::isWellOriented(const mcIdType * /*baseFace*/, mcIdType * /*retConn*/, const mcIdType * /*sideFace*/, mcIdType /*lgthBaseFace*/)
+bool CellSimplify::isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace)
{
return true;
}
if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind(std::not_equal_to<mcIdType>(),std::placeholders::_1,ToIdType(INTERP_KERNEL::NORM_QUAD4)))==conn+lgth+nbOfFaces)
{//6 faces are QUAD4.
int oppositeFace=-1;
- std::set<mcIdType> const conn1(conn,conn+4);
+ std::set<mcIdType> conn1(conn,conn+4);
for(int i=1;i<6 && oppositeFace<0;i++)
{
std::vector<mcIdType> tmp;
- std::set<mcIdType> const conn2(conn+5*i,conn+5*i+4);
+ std::set<mcIdType> conn2(conn+5*i,conn+5*i+4);
std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
if(tmp.empty())
oppositeFace=i;
INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::size_t const nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
- std::size_t const nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
+ std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
+ std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
if(nbOfQuad==6 && nbOfHexagon==2)
{
const mcIdType *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
- std::size_t const hexg0Id=std::distance(conn+lgth,hexag0);
+ std::size_t hexg0Id=std::distance(conn+lgth,hexag0);
const mcIdType *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
- std::size_t const hexg1Id=std::distance(conn+lgth,hexag1);
+ std::size_t hexg1Id=std::distance(conn+lgth,hexag1);
const mcIdType *connHexag0=conn+5*hexg0Id;
- std::size_t const lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1));
+ std::size_t lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1));
if(lgthH0==6)
{
const mcIdType *connHexag1=conn+5*hexg0Id+7+(hexg1Id-hexg0Id-1)*5;
- std::size_t const lgthH1=std::distance(connHexag1,std::find(connHexag1,conn+lgth,-1));
+ std::size_t lgthH1=std::distance(connHexag1,std::find(connHexag1,conn+lgth,-1));
if(lgthH1==6)
{
std::vector<mcIdType> tmp;
- std::set<mcIdType> const conn1(connHexag0,connHexag0+6);
- std::set<mcIdType> const conn2(connHexag1,connHexag1+6);
+ std::set<mcIdType> conn1(connHexag0,connHexag0+6);
+ std::set<mcIdType> conn2(connHexag1,connHexag1+6);
std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
if(tmp.empty())
{
*/
INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::size_t const nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3));
- std::size_t const nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
+ std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3));
+ std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
if(nbOfTriFace==2 && nbOfQuadFace==3)
{
- std::size_t const tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)));
- std::size_t const tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)));
- const mcIdType *tri_0=nullptr,*tri_1=nullptr;
+ std::size_t tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)));
+ std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)));
+ const mcIdType *tri_0=0,*tri_1=0;
const mcIdType *w=conn;
for(std::size_t i=0;i<5;i++)
{
w++;
}
std::vector<mcIdType> tmp;
- std::set<mcIdType> const conn1(tri_0,tri_0+3);
- std::set<mcIdType> const conn2(tri_1,tri_1+3);
+ std::set<mcIdType> conn1(tri_0,tri_0+3);
+ std::set<mcIdType> conn2(tri_1,tri_1+3);
std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
if(tmp.empty())
{
*/
INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::size_t const nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3));
- std::size_t const nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
+ std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3));
+ std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
if(nbOfTriFace==4 && nbOfQuadFace==1)
{
- std::size_t const quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)));
- const mcIdType *quad4=nullptr;
+ std::size_t quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)));
+ const mcIdType *quad4=0;
const mcIdType *w=conn;
- for(std::size_t i=0;i<5 && quad4==nullptr;i++)
+ for(std::size_t i=0;i<5 && quad4==0;i++)
{
if(i==quad4_pos)
quad4=w;
w=std::find(w,conn+lgth,-1);
w++;
}
- std::set<mcIdType> const quad4S(quad4,quad4+4);
+ std::set<mcIdType> quad4S(quad4,quad4+4);
w=conn;
bool ok=true;
mcIdType point=-1;
if(i!=quad4_pos)
{
std::vector<mcIdType> tmp;
- std::set<mcIdType> const conn2(w,w+3);
+ std::set<mcIdType> conn2(w,w+3);
std::set_intersection(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
ok=tmp.size()==2;
tmp.clear();
{
if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind(std::not_equal_to<mcIdType>(),std::placeholders::_1,ToIdType(INTERP_KERNEL::NORM_TRI3)))==conn+lgth+nbOfFaces)
{
- std::set<mcIdType> const tribase(conn,conn+3);
+ std::set<mcIdType> tribase(conn,conn+3);
mcIdType point=-1;
bool ok=true;
for(int i=1;i<4 && ok;i++)
{
std::vector<mcIdType> tmp;
- std::set<mcIdType> const conn2(conn+i*4,conn+4*i+3);
+ std::set<mcIdType> conn2(conn+i*4,conn+4*i+3);
std::set_intersection(conn2.begin(),conn2.end(),tribase.begin(),tribase.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
ok=tmp.size()==2;
tmp.clear();
#define __INTERPKERNELCELLSIMPLIFY_HXX__
#include "INTERPKERNELDefines.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelException.hxx"
#include "MCIdType.hxx"
-#include "NormalizedGeometricTypes"
namespace INTERP_KERNEL
{
#include "InterpKernelDenseMatrix.hxx"
#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
#include "VectorUtils.hxx"
#include <cmath>
//
#ifndef __INTERPKERNELMATRIX_HXX_
-#define __INTERPKERNELMATRIX_HXX_
+#define __INTERPKERNELMATRIX_HXX__
#include "InterpolationUtils.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include <utility>
#include <vector>
#include <iostream>
#include <ostream>
void erase(int elem) { std::vector< std::pair<int,T> >::erase(std::find_if(std::vector< std::pair<int,T> >::begin(),std::vector< std::pair<int,T> >::end(),KeyComparator(elem))); }
- void insert(const std::pair<int,T>& myPair) { std::vector<std::pair<int,T> >::push_back(myPair); }
+ void insert(const std::pair<int,T>& myPair) { vector<std::pair<int,T> >::push_back(myPair); }
};
private:
friend std::istream& operator>><>(std::istream& in, Matrix<T,type>& m);
bool _is_configured;
public:
- using value_type = Row;
+ typedef Row value_type;
public:
- Matrix():_coeffs(0), _cols(nullptr), _nb_rows(0), _is_configured(false)
+ Matrix():_coeffs(0), _cols(0), _nb_rows(0), _is_configured(false)
{ }
- Matrix(int nbrows):_coeffs(0), _cols(nullptr), _is_configured(false)
+ Matrix(int nbrows):_coeffs(0), _cols(0), _is_configured(false)
{ _nb_rows=nbrows; }
Matrix(std::vector<std::map<int,T> > & matrix) :
- _coeffs(0), _cols(nullptr), _is_configured(false)
+ _coeffs(0), _cols(0), _is_configured(false)
{
_nb_rows=matrix.size();
_auxiliary_matrix.resize(_nb_rows);
#include "InterpKernelMatrixTools.hxx"
#include "InterpKernelException.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "MCIdType.hxx"
#include <sstream>
#include <algorithm>
t=work[j];
daxpy(n,t,a+0+j*lda,1,a+0+k*lda,1);
}
- mcIdType const l=ipvt[k];
+ mcIdType l=ipvt[k];
if(l!=k-1)
dswap(n,a+0+k*lda,1,a+0+l*lda,1);
}
#include <cmath>
#include <limits>
+#include <numeric>
#include <algorithm>
double INTERP_KERNEL::quadSkew(const double *coo)
coo[7]+coo[10]-coo[1]-coo[4],
coo[8]+coo[11]-coo[2]-coo[5],
};
- double const l0=sqrt(pa0[0]*pa0[0]+pa0[1]*pa0[1]+pa0[2]*pa0[2]);
- double const l1=sqrt(pa1[0]*pa1[0]+pa1[1]*pa1[1]+pa1[2]*pa1[2]);
+ double l0=sqrt(pa0[0]*pa0[0]+pa0[1]*pa0[1]+pa0[2]*pa0[2]);
+ double l1=sqrt(pa1[0]*pa1[0]+pa1[1]*pa1[1]+pa1[2]*pa1[2]);
if(l0<1.e-15)
return 0.;
if(l1<1.e-15)
double INTERP_KERNEL::quadEdgeRatio(const double *coo)
{
- double const a2=(coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]);
- double const b2=(coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]);
- double const c2=(coo[9]-coo[6])*(coo[9]-coo[6])+(coo[10]-coo[7])*(coo[10]-coo[7])+(coo[11]-coo[8])*(coo[11]-coo[8]);
- double const d2=(coo[0]-coo[9])*(coo[0]-coo[9])+(coo[1]-coo[10])*(coo[1]-coo[10])+(coo[2]-coo[11])*(coo[2]-coo[11]);
- double const mab=a2<b2?a2:b2;
- double const Mab=a2<b2?b2:a2;
- double const mcd=c2<d2?c2:d2;
- double const Mcd=c2<d2?d2:c2;
- double const m2=mab<mcd?mab:mcd;
- double const M2=Mab>Mcd?Mab:Mcd;
+ double a2=(coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]);
+ double b2=(coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]);
+ double c2=(coo[9]-coo[6])*(coo[9]-coo[6])+(coo[10]-coo[7])*(coo[10]-coo[7])+(coo[11]-coo[8])*(coo[11]-coo[8]);
+ double d2=(coo[0]-coo[9])*(coo[0]-coo[9])+(coo[1]-coo[10])*(coo[1]-coo[10])+(coo[2]-coo[11])*(coo[2]-coo[11]);
+ double mab=a2<b2?a2:b2;
+ double Mab=a2<b2?b2:a2;
+ double mcd=c2<d2?c2:d2;
+ double Mcd=c2<d2?d2:c2;
+ double m2=mab<mcd?mab:mcd;
+ double M2=Mab>Mcd?Mab:Mcd;
if(m2>1.e-15)
return sqrt(M2/m2);
else
double INTERP_KERNEL::quadAspectRatio(const double *coo)
{
- double const a=sqrt((coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]));
- double const b=sqrt((coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]));
- double const c=sqrt((coo[9]-coo[6])*(coo[9]-coo[6])+(coo[10]-coo[7])*(coo[10]-coo[7])+(coo[11]-coo[8])*(coo[11]-coo[8]));
- double const d=sqrt((coo[0]-coo[9])*(coo[0]-coo[9])+(coo[1]-coo[10])*(coo[1]-coo[10])+(coo[2]-coo[11])*(coo[2]-coo[11]));
- double const ma=a>b?a:b;
- double const mb=c>d?c:d;
- double const hm=ma>mb?ma:mb;
- double const ab[3]={(coo[4]-coo[1])*(coo[8]-coo[5])-(coo[7]-coo[4])*(coo[5]-coo[2]),
+ double a=sqrt((coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]));
+ double b=sqrt((coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]));
+ double c=sqrt((coo[9]-coo[6])*(coo[9]-coo[6])+(coo[10]-coo[7])*(coo[10]-coo[7])+(coo[11]-coo[8])*(coo[11]-coo[8]));
+ double d=sqrt((coo[0]-coo[9])*(coo[0]-coo[9])+(coo[1]-coo[10])*(coo[1]-coo[10])+(coo[2]-coo[11])*(coo[2]-coo[11]));
+ double ma=a>b?a:b;
+ double mb=c>d?c:d;
+ double hm=ma>mb?ma:mb;
+ double ab[3]={(coo[4]-coo[1])*(coo[8]-coo[5])-(coo[7]-coo[4])*(coo[5]-coo[2]),
(coo[5]-coo[2])*(coo[6]-coo[3])-(coo[3]-coo[0])*(coo[8]-coo[5]),
(coo[3]-coo[0])*(coo[7]-coo[4])-(coo[4]-coo[1])*(coo[6]-coo[3])};
- double const cd[3]={(coo[10]-coo[7])*(coo[2]-coo[11])-(coo[1]-coo[10])*(coo[11]-coo[8]),
+ double cd[3]={(coo[10]-coo[7])*(coo[2]-coo[11])-(coo[1]-coo[10])*(coo[11]-coo[8]),
(coo[11]-coo[8])*(coo[0]-coo[9])-(coo[9]-coo[6])*(coo[2]-coo[11]),
(coo[9]-coo[6])*(coo[1]-coo[10])-(coo[10]-coo[7])*(coo[0]-coo[9])};
- double const e=sqrt(ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2])+sqrt(cd[0]*cd[0]+cd[1]*cd[1]+cd[2]*cd[2]);
+ double e=sqrt(ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2])+sqrt(cd[0]*cd[0]+cd[1]*cd[1]+cd[2]*cd[2]);
if(d>1e-15)
return 0.5*(a+b+c+d)*hm/e;
else
double INTERP_KERNEL::quadWarp(const double *coo)
{
- double const e0[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]};
- double const e1[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]};
- double const e2[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]};
- double const e3[3]={coo[0]-coo[9],coo[1]-coo[10],coo[2]-coo[11]};
+ double e0[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]};
+ double e1[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]};
+ double e2[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]};
+ double e3[3]={coo[0]-coo[9],coo[1]-coo[10],coo[2]-coo[11]};
- double const n0[3]={e3[1]*e0[2]-e3[2]*e0[1],e3[2]*e0[0]-e3[0]*e0[2],e3[0]*e0[1]-e3[1]*e0[0]};
- double const n1[3]={e0[1]*e1[2]-e0[2]*e1[1],e0[2]*e1[0]-e0[0]*e1[2],e0[0]*e1[1]-e0[1]*e1[0]};
- double const n2[3]={e1[1]*e2[2]-e1[2]*e2[1],e1[2]*e2[0]-e1[0]*e2[2],e1[0]*e2[1]-e1[1]*e2[0]};
- double const n3[3]={e2[1]*e3[2]-e2[2]*e3[1],e2[2]*e3[0]-e2[0]*e3[2],e2[0]*e3[1]-e2[1]*e3[0]};
+ double n0[3]={e3[1]*e0[2]-e3[2]*e0[1],e3[2]*e0[0]-e3[0]*e0[2],e3[0]*e0[1]-e3[1]*e0[0]};
+ double n1[3]={e0[1]*e1[2]-e0[2]*e1[1],e0[2]*e1[0]-e0[0]*e1[2],e0[0]*e1[1]-e0[1]*e1[0]};
+ double n2[3]={e1[1]*e2[2]-e1[2]*e2[1],e1[2]*e2[0]-e1[0]*e2[2],e1[0]*e2[1]-e1[1]*e2[0]};
+ double n3[3]={e2[1]*e3[2]-e2[2]*e3[1],e2[2]*e3[0]-e2[0]*e3[2],e2[0]*e3[1]-e2[1]*e3[0]};
- double const l0=sqrt(n0[0]*n0[0]+n0[1]*n0[1]+n0[2]*n0[2]);
- double const l1=sqrt(n1[0]*n1[0]+n1[1]*n1[1]+n1[2]*n1[2]);
- double const l2=sqrt(n2[0]*n2[0]+n2[1]*n2[1]+n2[2]*n2[2]);
- double const l3=sqrt(n3[0]*n3[0]+n3[1]*n3[1]+n3[2]*n3[2]);
+ double l0=sqrt(n0[0]*n0[0]+n0[1]*n0[1]+n0[2]*n0[2]);
+ double l1=sqrt(n1[0]*n1[0]+n1[1]*n1[1]+n1[2]*n1[2]);
+ double l2=sqrt(n2[0]*n2[0]+n2[1]*n2[1]+n2[2]*n2[2]);
+ double l3=sqrt(n3[0]*n3[0]+n3[1]*n3[1]+n3[2]*n3[2]);
if(l0<1.e-15 || l1<1.e-15 || l2<1.e-15 || l3<1e-15)
return std::numeric_limits<double>::min();
- double const warp=std::min(n0[0]/l0*n2[0]/l2+n0[1]/l0*n2[1]/l2+n0[2]/l0*n2[2]/l2,n1[0]/l1*n3[0]/l3+n1[1]/l1*n3[1]/l3+n1[2]/l1*n3[2]/l3);
+ double warp=std::min(n0[0]/l0*n2[0]/l2+n0[1]/l0*n2[1]/l2+n0[2]/l0*n2[2]/l2,n1[0]/l1*n3[0]/l3+n1[1]/l1*n3[1]/l3+n1[2]/l1*n3[2]/l3);
return warp*warp*warp;
}
double INTERP_KERNEL::triEdgeRatio(const double *coo)
{
- double const a2=(coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]);
- double const b2=(coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]);
- double const c2=(coo[0]-coo[6])*(coo[0]-coo[6])+(coo[1]-coo[7])*(coo[1]-coo[7])+(coo[2]-coo[8])*(coo[2]-coo[8]);
- double const mab=a2<b2?a2:b2;
- double const Mab=a2<b2?b2:a2;
- double const m2=c2>mab?mab:c2;
- double const M2=c2>Mab?c2:Mab;
+ double a2=(coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]);
+ double b2=(coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]);
+ double c2=(coo[0]-coo[6])*(coo[0]-coo[6])+(coo[1]-coo[7])*(coo[1]-coo[7])+(coo[2]-coo[8])*(coo[2]-coo[8]);
+ double mab=a2<b2?a2:b2;
+ double Mab=a2<b2?b2:a2;
+ double m2=c2>mab?mab:c2;
+ double M2=c2>Mab?c2:Mab;
if(m2>1.e-15)
return sqrt(M2/m2);
else
double INTERP_KERNEL::triAspectRatio(const double *coo)
{
- double const a=sqrt((coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]));
- double const b=sqrt((coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]));
- double const c=sqrt((coo[0]-coo[6])*(coo[0]-coo[6])+(coo[1]-coo[7])*(coo[1]-coo[7])+(coo[2]-coo[8])*(coo[2]-coo[8]));
+ double a=sqrt((coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]));
+ double b=sqrt((coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]));
+ double c=sqrt((coo[0]-coo[6])*(coo[0]-coo[6])+(coo[1]-coo[7])*(coo[1]-coo[7])+(coo[2]-coo[8])*(coo[2]-coo[8]));
double hm=a>b?a:b;
hm=hm>c?hm:c;
- double const ab[3]={(coo[4]-coo[1])*(coo[8]-coo[5])-(coo[7]-coo[4])*(coo[5]-coo[2]),
+ double ab[3]={(coo[4]-coo[1])*(coo[8]-coo[5])-(coo[7]-coo[4])*(coo[5]-coo[2]),
(coo[5]-coo[2])*(coo[6]-coo[3])-(coo[3]-coo[0])*(coo[8]-coo[5]),
(coo[3]-coo[0])*(coo[7]-coo[4])-(coo[4]-coo[1])*(coo[6]-coo[3])};
- double const d=sqrt(ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2]);
+ double d=sqrt(ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2]);
static const double normalizeCoeff=sqrt(3.)/6.;
if(d>1.e-15)
return normalizeCoeff*hm*(a+b+c)/d;
double INTERP_KERNEL::tetraEdgeRatio(const double *coo)
{
- double const a[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]};
- double const b[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]};
- double const c[3]={coo[0]-coo[6],coo[1]-coo[7],coo[2]-coo[8]};
- double const d[3]={coo[9]-coo[0],coo[10]-coo[1],coo[11]-coo[2]};
- double const e[3]={coo[9]-coo[3],coo[10]-coo[4],coo[11]-coo[5]};
- double const f[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]};
+ double a[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]};
+ double b[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]};
+ double c[3]={coo[0]-coo[6],coo[1]-coo[7],coo[2]-coo[8]};
+ double d[3]={coo[9]-coo[0],coo[10]-coo[1],coo[11]-coo[2]};
+ double e[3]={coo[9]-coo[3],coo[10]-coo[4],coo[11]-coo[5]};
+ double f[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]};
double l2[6]=
{a[0]*a[0]+a[1]*a[1]+a[2]*a[2],
e[0]*e[0]+e[1]*e[1]+e[2]*e[2],
f[0]*f[0]+f[1]*f[1]+f[2]*f[2]};
- double const M2=*std::max_element(l2,l2+6);
- double const m2=*std::min_element(l2,l2+6);
+ double M2=*std::max_element(l2,l2+6);
+ double m2=*std::min_element(l2,l2+6);
if(m2>1e-15)
return sqrt(M2/m2);
else
double INTERP_KERNEL::tetraAspectRatio(const double *coo)
{
static const double normalizeCoeff=sqrt(6.)/12.;
- double const ab[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]};
- double const ac[3]={coo[6]-coo[0],coo[7]-coo[1],coo[8]-coo[2]};
- double const ad[3]={coo[9]-coo[0],coo[10]-coo[1],coo[11]-coo[2]};
- double const detTet=(ab[0]*(ac[1]*ad[2]-ac[2]*ad[1]))+(ab[1]*(ac[2]*ad[0]-ac[0]*ad[2]))+(ab[2]*(ac[0]*ad[1]-ac[1]*ad[0]));
+ double ab[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]};
+ double ac[3]={coo[6]-coo[0],coo[7]-coo[1],coo[8]-coo[2]};
+ double ad[3]={coo[9]-coo[0],coo[10]-coo[1],coo[11]-coo[2]};
+ double detTet=(ab[0]*(ac[1]*ad[2]-ac[2]*ad[1]))+(ab[1]*(ac[2]*ad[0]-ac[0]*ad[2]))+(ab[2]*(ac[0]*ad[1]-ac[1]*ad[0]));
//if(detTet<1.e-15)
// return std::numeric_limits<double>::max();
- double const bc[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]};
+ double bc[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]};
double bd[3]={coo[9]-coo[3],coo[10]-coo[4],coo[11]-coo[5]};
- double const cd[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]};
+ double cd[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]};
- double const ab2=ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2];
- double const bc2=bc[0]*bc[0]+bc[1]*bc[1]+bc[2]*bc[2];
- double const ac2=ac[0]*ac[0]+ac[1]*ac[1]+ac[2]*ac[2];
- double const ad2=ad[0]*ad[0]+ad[1]*ad[1]+ad[2]*ad[2];
- double const bd2=bd[0]*bd[0]+bd[1]*bd[1]+bd[2]*bd[2];
- double const cd2=cd[0]*cd[0]+cd[1]*cd[1]+cd[2]*cd[2];
+ double ab2=ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2];
+ double bc2=bc[0]*bc[0]+bc[1]*bc[1]+bc[2]*bc[2];
+ double ac2=ac[0]*ac[0]+ac[1]*ac[1]+ac[2]*ac[2];
+ double ad2=ad[0]*ad[0]+ad[1]*ad[1]+ad[2]*ad[2];
+ double bd2=bd[0]*bd[0]+bd[1]*bd[1]+bd[2]*bd[2];
+ double cd2=cd[0]*cd[0]+cd[1]*cd[1]+cd[2]*cd[2];
double A=ab2>bc2?ab2:bc2;
double B=ac2>ad2?ac2:ad2;
double C=bd2>cd2?bd2:cd2;
double D=A>B?A:B;
- double const hm=D>C?sqrt(D):sqrt(C);
+ double hm=D>C?sqrt(D):sqrt(C);
bd[0]=ab[1]*bc[2]-ab[2]*bc[1]; bd[1]=ab[2]*bc[0]-ab[0]*bc[2]; bd[2]=ab[0]*bc[1]-ab[1]*bc[0];
A=sqrt(bd[0]*bd[0]+bd[1]*bd[1]+bd[2]*bd[2]);
#include "InterpKernelDenseMatrix.hxx"
#include "InterpKernelLUDecomp.hxx"
+#include "InterpKernelQRDecomp.hxx"
#include "InterpKernelException.hxx"
#include "MCIdType.hxx"
-#include <sstream>
#include <vector>
#include <limits>
#include <cmath>
-#include <functional>
template<class T>
inline T sqr(const T a) { return a*a; }
class JacobianCalculator
{
private:
- const double EPS{1.0e-8};
+ const double EPS;
T &func;
public:
- JacobianCalculator(T &funcc) : func(funcc) {}
+ JacobianCalculator(T &funcc) : EPS(1.0e-8),func(funcc) {}
INTERP_KERNEL::DenseMatrix operator() (const std::vector<double>& x, const std::vector<double>& fvec)
{
- mcIdType const n=x.size();
+ mcIdType n=x.size();
INTERP_KERNEL::DenseMatrix df(n,n);
std::vector<double> xh=x;
for (mcIdType j=0;j<n;j++)
{
- double const temp=xh[j];
+ double temp=xh[j];
double h=EPS*std::abs(temp);
if (h == 0.0) h=EPS;
xh[j]=temp+h;
#ifndef __INTERPOLATION_HXX__
#define __INTERPOLATION_HXX__
+#include "INTERPKERNELDefines.hxx"
#include "InterpolationOptions.hxx"
+#include "InterpKernelException.hxx"
#include <string>
class Interpolation : public InterpolationOptions
{
public:
- Interpolation() = default;
+ Interpolation() { }
Interpolation(const InterpolationOptions& io) :InterpolationOptions(io){}
//interpolation of two triangular meshes.
template<class MatrixType, class MyMeshType>
#define __INTERPOLATION_TXX__
#include "Interpolation.hxx"
+#include "IntegralUniformIntersector.hxx"
#include "IntegralUniformIntersector.txx"
-#include "InterpolationOptions.hxx"
-#include "InterpKernelException.hxx"
#include "VectorUtils.hxx"
-#include <algorithm>
-#include <string>
-#include <limits>
-#include <iostream>
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __INTERPOLATION1D_HXX__
#define __INTERPOLATION1D_HXX__
-#include "InterpolationOptions.hxx"
-#include "InterpolationCurve.txx"
+#include "InterpolationCurve.hxx"
namespace INTERP_KERNEL
{
class Interpolation1D : public InterpolationCurve<Interpolation1D>
{
public:
- Interpolation1D() = default;
+ Interpolation1D() { }
Interpolation1D(const InterpolationOptions& io):InterpolationCurve<Interpolation1D>(io) {}
};
}
#ifndef __INTERPOLATION1D_TXX__
#define __INTERPOLATION1D_TXX__
+#include "Interpolation1D.hxx"
+#include "InterpolationCurve.txx"
#endif
// Author : Anthony GEAY (EDF R&D)
#include "Interpolation1D0D.hxx"
-#include "InterpolationOptions.hxx"
-#include <cstddef>
-#include <vector>
+#include "Interpolation1D0D.txx"
namespace INTERP_KERNEL
{
Interpolation1D0D::Interpolation1D0D()
- = default;
+ {}
Interpolation1D0D::Interpolation1D0D(const InterpolationOptions& io):Interpolation<Interpolation1D0D>(io)
{}
const int SPACE_DIM = 3;
const double adj(getPrecision());// here precision is used instead of getBoundingBoxAdjustment and getBoundingBoxAdjustmentAbs because in the context only precision is relevant
- std::size_t const size = bbox.size()/(2*SPACE_DIM);
+ std::size_t size = bbox.size()/(2*SPACE_DIM);
for (std::size_t i=0; i<size; i++)
{
for(int idim=0; idim<SPACE_DIM; idim++)
#define __INTERPOLATION1D0D_HXX__
#include "INTERPKERNELDefines.hxx"
-#include "InterpolationOptions.hxx"
#include "Interpolation.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpolationOptions.hxx"
-#include <string>
#include <vector>
namespace INTERP_KERNEL
#ifndef __INTERPOLATION1D0D_TXX__
#define __INTERPOLATION1D0D_TXX__
-#include "InterpKernelException.hxx"
#include "Interpolation1D0D.hxx"
-#include "MeshElement.hxx"
+#include "Interpolation.txx"
+#include "MeshElement.txx"
+#include "PointLocator3DIntersectorP0P0.txx"
+#include "PointLocator3DIntersectorP0P1.txx"
+#include "PointLocator3DIntersectorP1P0.txx"
+#include "PointLocator3DIntersectorP1P1.txx"
#include "Log.hxx"
#include "BBTree.txx"
#include "InterpKernelAssert.hxx"
-#include <string>
-#include <vector>
-#include <map>
-#include <sstream>
namespace INTERP_KERNEL
{
typename MyMeshType::MyConnType Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
{
constexpr int SPACEDIM=MyMeshType::MY_SPACEDIM;
- typedef typename MyMeshType::MyConnType ConnType;
+ using ConnType=typename MyMeshType::MyConnType;
IKAssert(SPACEDIM==3);
if(InterpolationOptions::getIntersectionType() != PointLocator)
#ifndef __INTERPOLATION2D_HXX__
#define __INTERPOLATION2D_HXX__
-#include "InterpolationOptions.hxx"
-#include "PlanarIntersector.hxx"
-#include "InterpolationPlanar.txx"
-#include <vector>
+#include "InterpolationPlanar.hxx"
namespace INTERP_KERNEL
{
class Interpolation2D : public InterpolationPlanar<Interpolation2D>
{
public:
- Interpolation2D() = default;
+ Interpolation2D() { }
Interpolation2D(const InterpolationOptions& io):InterpolationPlanar<Interpolation2D>(io) { }
public:
bool doRotate() const { return false; }
#ifndef __INTERPOLATION2D_TXX__
#define __INTERPOLATION2D_TXX__
+#include "Interpolation2D.hxx"
+#include "InterpolationPlanar.txx"
#endif
#ifndef __INTERPOLATION2D1D_HXX__
#define __INTERPOLATION2D1D_HXX__
-#include <string>
-#include <set>
-#include <map>
-
-#include "InterpolationOptions.hxx"
#include "Interpolation.hxx"
-#include "MCIdType.hxx"
+#include "Planar2D1DIntersectorP0P0.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpolationOptions.hxx"
namespace INTERP_KERNEL
{
class Interpolation2D1D : public Interpolation<Interpolation2D1D>
{
public:
- using DuplicateFacesType = std::map<mcIdType, std::set<mcIdType>>;
+ typedef std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
Interpolation2D1D() { setOrientation(2); }
Interpolation2D1D(const InterpolationOptions& io):Interpolation<Interpolation2D1D>(io) { }
#define __INTERPOLATION2D1D_TXX__
#include "Interpolation2D1D.hxx"
-#include <string>
-#include "NormalizedUnstructuredMesh.hxx"
-#include "PlanarIntersector.txx"
-#include "Planar2D1DIntersectorP0P0.hxx"
-#include "InterpolationOptions.hxx"
-#include "Geometric2DIntersector.txx"
-#include "InterpKernelException.hxx"
-#include "BBTree.txx"
-#include "InterpolationUtils.hxx"
-
-#include <ctime>
-#include <cstddef>
-#include <utility>
-#include <vector>
-#include <iostream>
namespace INTERP_KERNEL
{
typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
- long const global_start =clock();
+ long global_start =clock();
std::size_t counter=0;
/***********************************************************/
/* Check both meshes are made of triangles and quadrangles */
}
PlanarIntersector<MyMeshType,MatrixType>* intersector=0;
- std::string const meth = InterpolationOptions::filterInterpolationMethod(method);
+ std::string meth = InterpolationOptions::filterInterpolationMethod(method);
if(meth=="P0P0")
{
switch (InterpolationOptions::getIntersectionType())
/* Instantiate the intersector and initialise the result vector */
/****************************************************************/
- long const start_filtering=clock();
+ long start_filtering=clock();
std::vector<double> bbox;
intersector->createBoundingBoxes(myMeshS,bbox); // create the bounding boxes
- const double *bboxPtr=nullptr;
+ const double *bboxPtr=0;
if(nbMailleS>0)
bboxPtr=&bbox[0];
BBTree<SPACEDIM,ConnType> my_tree(bboxPtr, 0, 0,nbMailleS, -getPrecision());//creating the search structure
- long const end_filtering=clock();
+ long end_filtering=clock();
result.resize(intersector->getNumberOfRowsOfResMatrix());//on initialise.
/****************************************************/
/* Loop on the target cells - core of the algorithm */
/****************************************************/
- long const start_intersection=clock();
+ long start_intersection=clock();
ConnType nbelem_type=myMeshT.getNumberOfElements();
const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr();
for(ConnType iT=0; iT<nbelem_type; iT++)
if (InterpolationOptions::getPrintLevel() >=1)
{
- long const end_intersection=clock();
+ long end_intersection=clock();
std::cout << "Filtering time= " << end_filtering-start_filtering << std::endl;
std::cout << "Intersection time= " << end_intersection-start_intersection << std::endl;
- long const global_end =clock();
+ long global_end =clock();
std::cout << "Number of computed intersections = " << counter << std::endl;
std::cout << "Global time= " << global_end - global_start << std::endl;
}
//
#include "Interpolation2D3D.hxx"
-#include "InterpolationOptions.hxx"
namespace INTERP_KERNEL
{
*
*/
Interpolation2D3D::Interpolation2D3D()
- = default;
+ {
+ }
Interpolation2D3D::Interpolation2D3D(const InterpolationOptions& io):Interpolation<Interpolation2D3D>(io)
{
}
#ifndef __INTERPOLATION2D3D_HXX__
#define __INTERPOLATION2D3D_HXX__
-#include <cstddef>
#include <set>
#include <map>
#include "INTERPKERNELDefines.hxx"
+#include "Interpolation.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "InterpolationOptions.hxx"
#include "MCIdType.hxx"
#include "Intersector3D.hxx"
-#include "NormalizedGeometricTypes"
-#include "Interpolation.hxx"
-#include <string>
+#include <vector>
namespace INTERP_KERNEL
{
class Interpolation2D3D : public Interpolation<Interpolation2D3D>
{
public:
- using DuplicateFacesType = std::map<mcIdType, std::set<mcIdType>>;
+ typedef std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
INTERPKERNEL_EXPORT Interpolation2D3D();
INTERPKERNEL_EXPORT Interpolation2D3D(const InterpolationOptions& io);
#ifndef __INTERPOLATION2D3D_TXX__
#define __INTERPOLATION2D3D_TXX__
-#include "BBTreeStandAlone.txx"
-#include "BoundingBox.hxx"
#include "Interpolation2D3D.hxx"
-// #include "Interpolation.txx"
-#include "Intersector3D.txx"
-#include "Log.hxx"
-#include "InterpolationOptions.hxx"
+#include "Interpolation.txx"
#include "MeshElement.txx"
-#include "NormalizedGeometricTypes"
+#include "TransformedTriangle.hxx"
#include "Polyhedron3D2DIntersectorP0P0.txx"
+#include "PointLocator3DIntersectorP0P0.txx"
+#include "PolyhedronIntersectorP0P1.txx"
+#include "PointLocator3DIntersectorP0P1.txx"
+#include "PolyhedronIntersectorP1P0.txx"
+#include "PolyhedronIntersectorP1P0Bary.txx"
+#include "PointLocator3DIntersectorP1P0.txx"
+#include "PolyhedronIntersectorP1P1.txx"
+#include "PointLocator3DIntersectorP1P1.txx"
#include "InterpolationHelper.txx"
-#include "InterpKernelException.hxx"
-#include <memory>
-#include <string>
-#include <vector>
-#include <utility>
+#include "BBTree.txx"
namespace INTERP_KERNEL
{
#include "Interpolation2DCurve.hxx"
#include "InterpolationCurve.txx"
-#include "InterpolationOptions.hxx"
namespace INTERP_KERNEL
{
#ifndef __INTERPOLATION2DCURVE_HXX__
#define __INTERPOLATION2DCURVE_HXX__
-#include "INTERPKERNELDefines.hxx"
-#include "InterpolationOptions.hxx"
#include "InterpolationCurve.hxx"
+#include "InterpolationOptions.hxx"
namespace INTERP_KERNEL
{
// Author : Anthony Geay (CEA/DEN)
#include "Interpolation3D.hxx"
-#include "InterpolationOptions.hxx"
+#include "Interpolation3D.txx"
namespace INTERP_KERNEL
{
*
*/
Interpolation3D::Interpolation3D()
- = default;
+ {
+ }
Interpolation3D::Interpolation3D(const InterpolationOptions& io):Interpolation<Interpolation3D>(io)
{
}
#define __INTERPOLATION3D_HXX__\r
\r
#include "INTERPKERNELDefines.hxx"\r
+#include "Interpolation.hxx"\r
+#include "NormalizedUnstructuredMesh.hxx"\r
#include "InterpolationOptions.hxx"\r
-#include "Interpolation.hxx"
-#include <string>
\r
namespace INTERP_KERNEL\r
{
#define __INTERPOLATION3D_TXX__
#include "Interpolation3D.hxx"
-
-#include "BBTreeStandAlone.txx"
-#include "BoundingBox.hxx"
-#include "InterpolationOptions.hxx"
-#include "Intersector3D.hxx"
+#include "Interpolation.txx"
#include "MeshElement.txx"
-
+#include "TransformedTriangle.hxx"
#include "PolyhedronIntersectorP0P0.txx"
#include "PointLocator3DIntersectorP0P0.txx"
#include "PolyhedronIntersectorP0P1.txx"
#include "Barycentric3DIntersectorP1P1.txx"
#include "MappedBarycentric3DIntersectorP1P1.txx"
#include "Log.hxx"
-#include "InterpKernelException.hxx"
-#include <memory>
-#include <string>
-#include <vector>
// If defined, use recursion to traverse the binary search tree, else use the BBTree class
//#define USE_RECURSIVE_BBOX_FILTER
#endif
+#include <memory>
namespace INTERP_KERNEL
{
// Author : Adrien Bruneton (CEA/DEN)
#include "Interpolation3D1D.hxx"
-#include "InterpolationOptions.hxx"
-#include <cstddef>
-#include <limits>
-#include <vector>
+#include "Interpolation3D1D.txx"
namespace INTERP_KERNEL
{
- Interpolation3D1D::Interpolation3D1D() = default;
+ Interpolation3D1D::Interpolation3D1D() { }
Interpolation3D1D::Interpolation3D1D(const InterpolationOptions& io):Interpolation<Interpolation3D1D>(io) { }
const double adj = getBoundingBoxAdjustmentAbs();
const double adjRel = getBoundingBoxAdjustment();
- std::size_t const size = sz/(2*SPACE_DIM);
+ std::size_t size = sz/(2*SPACE_DIM);
for (std::size_t i=0; i<size; i++)
{
double max=- std::numeric_limits<double>::max();
for(int idim=0; idim<SPACE_DIM; idim++)
{
- double const Dx=bbox[i*2*SPACE_DIM+1+2*idim]-bbox[i*2*SPACE_DIM+2*idim];
+ double Dx=bbox[i*2*SPACE_DIM+1+2*idim]-bbox[i*2*SPACE_DIM+2*idim];
max=(max<Dx)?Dx:max;
}
for(int idim=0; idim<SPACE_DIM; idim++)
#include "INTERPKERNELDefines.hxx"
#include "Interpolation.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "InterpolationOptions.hxx"
-#include <string>
-#include <cstddef>
#include <vector>
namespace INTERP_KERNEL
#pragma once
-#include "InterpKernelException.hxx"
-#include "BBTreeStandAlone.txx"
-#include "BoundingBox.hxx"
#include "Interpolation3D1D.hxx"
-#include "Intersector3D.hxx"
-#include "MeshElement.hxx"
-#include "PointLocator3DIntersectorP0P0.hxx"
-#include "PointLocator3DIntersectorP0P1.hxx"
-#include "PointLocator3DIntersectorP1P0.hxx"
-#include "PointLocator3DIntersectorP1P1.hxx"
+#include "Interpolation.txx"
+#include "MeshElement.txx"
+#include "PointLocator3DIntersectorP0P0.txx"
+#include "PointLocator3DIntersectorP0P1.txx"
+#include "PointLocator3DIntersectorP1P0.txx"
+#include "PointLocator3DIntersectorP1P1.txx"
#include "Log.hxx"
#include "InterpolationHelper.txx"
-#include <memory>
-#include <string>
-#include <vector>
namespace INTERP_KERNEL
{
// Author : Anthony Geay (CEA/DEN)
#include "Interpolation3DSurf.hxx"
-#include "InterpolationOptions.hxx"
#include "InterpolationPlanar.txx"
namespace INTERP_KERNEL
{
Interpolation3DSurf::Interpolation3DSurf()
- = default;
+ {
+ }
Interpolation3DSurf::Interpolation3DSurf(const InterpolationOptions& io):InterpolationPlanar<Interpolation3DSurf>(io)
{
- Values: integer between 0 and 3.
- Default: 0.
*/
- void Interpolation3DSurf::setOptions(double precision, int printLevel, double medianPlan,
- IntersectionType intersectionType, bool doRotat, int orientation)
+ void Interpolation3DSurf::setOptions(double precision, int printLevel, double medianPlan,
+ IntersectionType intersectionType, bool doRotat, int orientation)
{
InterpolationPlanar<Interpolation3DSurf>::setOptions(precision,printLevel,intersectionType, orientation);
InterpolationPlanar<Interpolation3DSurf>::setDoRotate(doRotat);
#ifndef __INTERPOLATION3DSURF_HXX__
#define __INTERPOLATION3DSURF_HXX__
+#include "InterpolationPlanar.txx"
#include "INTERPKERNELDefines.hxx"
#include "InterpolationOptions.hxx"
-#include "PlanarIntersector.hxx"
-#include "InterpolationPlanar.txx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __InterpolationCC_HXX__
#define __InterpolationCC_HXX__
-#include "InterpolationOptions.hxx"
#include "Interpolation.hxx"
namespace INTERP_KERNEL
//
#include "InterpolationCC.hxx"
-#include "InterpolationOptions.hxx"
#include "InterpolationUtils.hxx"
-#include <algorithm>
-#include <string>
-#include <list>
// convert index "From Mesh Index"
#define _FMI(i) OTT<typename MyMeshType::MyConnType,MyMeshType::My_numPol>::ind2C((i))
*/
//================================================================================
InterpolationCC::InterpolationCC()
- = default;
+ {
+ }
InterpolationCC::InterpolationCC(const InterpolationOptions& io):Interpolation<InterpolationCC>(io)
{
x2t = tgt_coords[ j ][ it+1 ];
x2s = src_coords[ j ][ is+1 ];
- double const x1 = std::max( x1s ,x1t );
- double const x2 = std::min( x2s ,x2t );
+ double x1 = std::max( x1s ,x1t );
+ double x2 = std::min( x2s ,x2t );
axis_interferences.push_back( Interference( is, it, x2 - x1 ));
// to the next target and/or source cell
- double const diff2 = x2s - x2t;
+ double diff2 = x2s - x2t;
if ( diff2 > -eps )
intersection = ( ++it < tgt_nb_cells[j] );
if ( diff2 < eps )
#ifndef __InterpolationCU_HXX__
#define __InterpolationCU_HXX__
-#include "InterpolationOptions.hxx"
#include "Interpolation.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
#include "InterpolationCU.hxx"
-#include "InterpolationUtils.hxx"
-#include "InterpolationOptions.hxx"
-#include "IntersectorCU.txx"
+#include "Interpolation.txx"
#include "IntersectorCU1D.txx"
#include "IntersectorCU2D.txx"
#include "IntersectorCU3D.txx"
-#include "NormalizedGeometricTypes"
-#include "TargetIntersector.hxx"
-#include <string>
-#include <map>
-#include <vector>
+#include <map>
// // convert index "From Mesh Index"
#define _FMIU(i) OTT<typename MyUMeshType::MyConnType,MyUMeshType::My_numPol>::ind2C((i))
//================================================================================
InterpolationCU::InterpolationCU()
- = default;
+ {
+ }
InterpolationCU::InterpolationCU(const InterpolationOptions & io)
:Interpolation<InterpolationCU>(io)
MatrixType revResult;
CConnType sizeT = interpolateMeshes( meshT, meshS, revResult, method );
- auto sizeS = static_cast<UConnType>(revResult.size());
+ UConnType sizeS = static_cast<UConnType>(revResult.size());
result.resize( sizeT );
for ( CConnType iS = 0; iS < sizeS; ++iS )
#include "BBTree.txx"\r
\r
#include <functional>\r
-#include <string>
-#include <vector>
\r
namespace INTERP_KERNEL\r
{
#ifndef __INTERPOLATIONCURVE_TXX__
#define __INTERPOLATIONCURVE_TXX__
-#include "Interpolation.txx"
-#include "BBTree.txx"
-#include "CurveIntersector.txx"
+#include "InterpolationCurve.hxx"
+#include "InterpolationOptions.hxx"
#include "CurveIntersectorP0P0.txx"
-#include "CurveIntersectorP0P1.txx"
#include "CurveIntersectorP1P0.txx"
+#include "CurveIntersectorP0P1.txx"
#include "CurveIntersectorP1P1.txx"
#include "CurveIntersectorP1P1PL.txx"
-#include "InterpolationCurve.hxx"
-#include "InterpolationOptions.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "InterpolationUtils.hxx"
-#include <string>
-#include <functional>
-#include <cstddef>
-#include <iostream>
-#include <ostream>
#include <time.h>
#include <memory>
-#include <vector>
namespace INTERP_KERNEL
{
template<class RealCurve>
InterpolationCurve<RealCurve>::InterpolationCurve()
- = default;
+ {
+ }
template<class RealCurve>
InterpolationCurve<RealCurve>::InterpolationCurve (const InterpolationOptions& io)
typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol = MyMeshType::My_numPol;
- long const global_start = clock();
+ long global_start = clock();
std::size_t counter=0;
ConnType nbMailleS = myMeshS.getNumberOfElements();
/* Instantiate the intersector and initialise the result vector */
/****************************************************************/
- long const start_filtering=clock();
+ long start_filtering=clock();
std::vector<double> bbox;
intersector->createBoundingBoxes(myMeshS,bbox); // create the bounding boxes
InterpolationOptions::getBoundingBoxAdjustmentAbs());
BBTree<SPACEDIM,ConnType> my_tree(&bbox[0], 0, 0, nbMailleS);//creating the search structure
- long const end_filtering = clock();
+ long end_filtering = clock();
result.resize(intersector->getNumberOfRowsOfResMatrix());//on initialise.
/****************************************************/
/* Loop on the target cells - core of the algorithm */
/****************************************************/
- long const start_intersection = clock();
+ long start_intersection = clock();
const ConnType *connIndxT = myMeshT.getConnectivityIndexPtr();
for(ConnType iT=0; iT<nbMailleT; iT++)
{
if (InterpolationOptions::getPrintLevel() >= 1)
{
- long const end_intersection=clock();
+ long end_intersection=clock();
std::cout << "Filtering time= " << end_filtering-start_filtering << std::endl;
std::cout << "Intersection time= " << end_intersection-start_intersection << std::endl;
- long const global_end =clock();
+ long global_end =clock();
std::cout << "Number of computed intersections = " << counter << std::endl;
std::cout << "Global time= " << global_end - global_start << std::endl;
}
#include "BBTreeStandAlone.txx"
#include "MeshElement.txx"
-#include "BoundingBox.hxx"
#include "Log.hxx"
#include <memory>
#include <functional>
-#include <utility>
namespace INTERP_KERNEL
{
// Author : Anthony Geay (CEA/DEN)
#include "InterpolationOptions.hxx"
+#include "InterpKernelGeo2DPrecision.hxx"
#include "InterpKernelException.hxx"
-#include "NormalizedGeometricTypes"
-#include <ostream>
-#include <ios>
#include <sstream>
-#include <string>
const double INTERP_KERNEL::InterpolationOptions::DFT_MEDIAN_PLANE=0.5;
}
else if(key==MEASURE_ABS_STR)
{
- bool const valBool=(value!=0);
+ bool valBool=(value!=0);
setMeasureAbsStatus(valBool);
return true;
}
#define __INTERPOLATIONOPTIONS_HXX__
#include "INTERPKERNELDefines.hxx"
-#include "NormalizedGeometricTypes"
+#include "NormalizedUnstructuredMesh.hxx"
#include <string>
\r
#include "Interpolation.hxx"\r
#include "PlanarIntersector.hxx"\r
+#include "NormalizedUnstructuredMesh.hxx"\r
#include "InterpolationOptions.hxx"\r
-#include <string>
-#include <vector>
\r
namespace INTERP_KERNEL\r
{
#define __INTERPOLATIONPLANAR_TXX__
#include "InterpolationPlanar.hxx"
-
#include "Interpolation.txx"
#include "InterpolationOptions.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "InterpolationUtils.hxx"
-
-#include "PlanarIntersectorP0P0.hxx"
-#include "PlanarIntersectorP1P0.hxx"
-#include "PlanarIntersectorP0P1.hxx"
-#include "PlanarIntersectorP1P1.hxx"
-#include "PlanarIntersectorP0P1Bary.hxx"
-#include "PlanarIntersectorP1P0Bary.hxx"
-
+#include "PlanarIntersector.hxx"
#include "PlanarIntersector.txx"
+#include "TriangulationIntersector.hxx"
#include "TriangulationIntersector.txx"
+#include "ConvexIntersector.hxx"
#include "ConvexIntersector.txx"
+#include "Geometric2DIntersector.hxx"
#include "Geometric2DIntersector.txx"
+#include "PointLocator2DIntersector.hxx"
#include "PointLocator2DIntersector.txx"
+#include "PlanarIntersectorP0P1PL.hxx"
#include "PlanarIntersectorP0P1PL.txx"
+#include "PlanarIntersectorP1P0PL.hxx"
#include "PlanarIntersectorP1P0PL.txx"
+#include "PlanarIntersectorP1P1PL.hxx"
#include "PlanarIntersectorP1P1PL.txx"
+#include "MappedBarycentric2DIntersectorP1P1.hxx"
#include "MappedBarycentric2DIntersectorP1P1.txx"
#include "VectorUtils.hxx"
#include "BBTree.txx"
-#include <algorithm>
-#include <cstddef>
-#include <iostream>
#include <limits>
-#include <string>
#include <time.h>
-#include <vector>
namespace INTERP_KERNEL
{
typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
- long const global_start =clock();
+ long global_start =clock();
std::size_t counter=0;
/***********************************************************/
/* Check both meshes are made of triangles and quadrangles */
/* Instantiate the intersector and initialise the result vector */
/****************************************************************/
- long const start_filtering=clock();
+ long start_filtering=clock();
std::vector<double> bbox;
intersector->createBoundingBoxes(myMeshS,bbox); // create the bounding boxes
performAdjustmentOfBB(intersector,bbox);
- const double *bboxPtr=nullptr;
+ const double *bboxPtr=0;
if(nbMailleS>0)
bboxPtr=&bbox[0];
BBTree<SPACEDIM,ConnType> my_tree(bboxPtr, 0, 0,nbMailleS);//creating the search structure
- long const end_filtering=clock();
+ long end_filtering=clock();
result.resize(intersector->getNumberOfRowsOfResMatrix());//on initialise.
/****************************************************/
/* Loop on the target cells - core of the algorithm */
/****************************************************/
- long const start_intersection=clock();
+ long start_intersection=clock();
ConnType nbelem_type=myMeshT.getNumberOfElements();
const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr();
for(ConnType iT=0; iT<nbelem_type; iT++)
if (InterpolationOptions::getPrintLevel() >=1)
{
- long const end_intersection=clock();
+ long end_intersection=clock();
std::cout << "Filtering time= " << end_filtering-start_filtering << std::endl;
std::cout << "Intersection time= " << end_intersection-start_intersection << std::endl;
- long const global_end =clock();
+ long global_end =clock();
std::cout << "Number of computed intersections = " << counter << std::endl;
std::cout << "Global time= " << global_end - global_start << std::endl;
}
#ifndef __INTERPOLATIONUTILS_HXX__
#define __INTERPOLATIONUTILS_HXX__
+#include "INTERPKERNELDefines.hxx"
#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
#include "VolSurfUser.hxx"
-#include "NormalizedGeometricTypes"
#include "NormalizedUnstructuredMesh.hxx"
-#include <cstddef>
#include <deque>
-#include <iterator>
#include <map>
#include <cmath>
-#include <utility>
+#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
inline double Surf_Tri(const double *P_1,const double *P_2,const double *P_3)
{
- double const A=(P_3[1]-P_1[1])*(P_2[0]-P_1[0])-(P_2[1]-P_1[1])*(P_3[0]-P_1[0]);
- double const Surface = 0.5*fabs(A);
+ double A=(P_3[1]-P_1[1])*(P_2[0]-P_1[0])-(P_2[1]-P_1[1])*(P_3[0]-P_1[0]);
+ double Surface = 0.5*fabs(A);
return Surface;
}
const double *P_2,
const double *P_3)
{
- double const mon_det=(P_1[0]-P_3[0])*(P_2[1]-P_3[1])-(P_2[0]-P_3[0])*(P_1[1]-P_3[1]);
+ double mon_det=(P_1[0]-P_3[0])*(P_2[1]-P_3[1])-(P_2[0]-P_3[0])*(P_1[1]-P_3[1]);
return mon_det;
}
inline double norme_vecteur(const double* P_1,const double* P_2)
{
- double const X=P_1[0]-P_2[0];
- double const Y=P_1[1]-P_2[1];
+ double X=P_1[0]-P_2[0];
+ double Y=P_1[1]-P_2[1];
return sqrt(X*X+Y*Y);
}
{
std::vector<double> Vect;
- double const P1_P2=norme_vecteur(P_1,P_2);
- double const P2_P3=norme_vecteur(P_2,P_3);
- double const P3_P1=norme_vecteur(P_3,P_1);
+ double P1_P2=norme_vecteur(P_1,P_2);
+ double P2_P3=norme_vecteur(P_2,P_3);
+ double P3_P1=norme_vecteur(P_3,P_1);
- double const N=P1_P2*P1_P2+P3_P1*P3_P1-P2_P3*P2_P3;
- double const D=2.0*P1_P2*P3_P1;
+ double N=P1_P2*P1_P2+P3_P1*P3_P1-P2_P3*P2_P3;
+ double D=2.0*P1_P2*P3_P1;
double COS=N/D;
if (COS>1.0) COS=1.0;
if (COS<-1.0) COS=-1.0;
Vect.push_back(COS);
- double const V=mon_determinant(P_2,P_3,P_1);
- double const D_1=P1_P2*P3_P1;
+ double V=mon_determinant(P_2,P_3,P_1);
+ double D_1=P1_P2*P3_P1;
double SIN=V/D_1;
if (SIN>1.0) SIN=1.0;
if (SIN<-1.0) SIN=-1.0;
inline std::vector<double> bary_poly(const std::vector<double>& V)
{
std::vector<double> Bary;
- std::size_t const taille=V.size();
+ std::size_t taille=V.size();
double x=0;
double y=0;
x=x+V[2*i];
y=y+V[2*i+1];
}
- double const A=2*x/(static_cast<double>(taille));
- double const B=2*y/(static_cast<double>(taille));
+ double A=2*x/(static_cast<double>(taille));
+ double B=2*y/(static_cast<double>(taille));
Bary.push_back(A);//taille vecteur=2*nb de points.
Bary.push_back(B);
double max = std::fabs( M[ iR[i] ][i] );
for ( int r = i+1; r < (int)nbRow; ++r )
{
- double const m = std::fabs( M[ iR[r] ][i] );
+ double m = std::fabs( M[ iR[r] ][i] );
if ( m > max )
{
max = m;
for ( int r = i+1; r < (int)nbRow; ++r )
{
double* mRow = M[ iR[r] ];
- double const coef = mRow[ i ] / tUpRow[ i ];
+ double coef = mRow[ i ] / tUpRow[ i ];
for ( int c = i+1; c < nbCol; ++c )
mRow[ c ] -= tUpRow[ c ] * coef;
}
T11 = triaCoords[0]-triaCoords[2*SPACEDIM], T12 = triaCoords[SPACEDIM]-triaCoords[2*SPACEDIM],
T21 = triaCoords[1]-triaCoords[2*SPACEDIM+1], T22 = triaCoords[SPACEDIM+1]-triaCoords[2*SPACEDIM+1];
// matrix determinant
- double const Tdet = T11*T22 - T12*T21;
+ double Tdet = T11*T22 - T12*T21;
if ( fabs( Tdet ) < std::numeric_limits<double>::min() ) {
bc[0]=1; bc[1]=0; bc[2]=0;
return;
inline void barycentric_coords_seg2(const std::vector<const double*>& n, const double *p, double *bc)
{
- double const delta=n[0][0]-n[1][0];
+ double delta=n[0][0]-n[1][0];
bc[0]=fabs((*p-n[1][0])/delta);
bc[1]=fabs((*p-n[0][0])/delta);
}
T11 = n[0][_XX]-n[2][_XX], T12 = n[1][_XX]-n[2][_XX],
T21 = n[0][_YY]-n[2][_YY], T22 = n[1][_YY]-n[2][_YY];
// matrix determinant
- double const Tdet = T11*T22 - T12*T21;
+ double Tdet = T11*T22 - T12*T21;
if ( (std::fabs( Tdet) ) < (std::numeric_limits<double>::min()) )
{
bc[0]=1; bc[1]=bc[2]=0; // no solution
inline bool IsPointOn3DSeg(const double segStart[3], const double segStop[3], const double point[3], double eps, double& bc0, double& bc1)
{
double AB[3]={segStop[0]-segStart[0],segStop[1]-segStart[1],segStop[2]-segStart[2]},AP[3]={point[0]-segStart[0],point[1]-segStart[1],point[2]-segStart[2]};
- double const l_AB(sqrt(AB[0]*AB[0]+AB[1]*AB[1]+AB[2]*AB[2]));
+ double l_AB(sqrt(AB[0]*AB[0]+AB[1]*AB[1]+AB[2]*AB[2]));
double AP_dot_AB((AP[0]*AB[0]+AP[1]*AB[1]+AP[2]*AB[2])/(l_AB*l_AB));
- double const projOfPOnAB[3]={segStart[0]+AP_dot_AB*AB[0],segStart[1]+AP_dot_AB*AB[1],segStart[2]+AP_dot_AB*AB[2]};
- double const V_dist_P_AB[3]={point[0]-projOfPOnAB[0],point[1]-projOfPOnAB[1],point[2]-projOfPOnAB[2]};
- double const dist_P_AB(sqrt(V_dist_P_AB[0]*V_dist_P_AB[0]+V_dist_P_AB[1]*V_dist_P_AB[1]+V_dist_P_AB[2]*V_dist_P_AB[2]));
+ double projOfPOnAB[3]={segStart[0]+AP_dot_AB*AB[0],segStart[1]+AP_dot_AB*AB[1],segStart[2]+AP_dot_AB*AB[2]};
+ double V_dist_P_AB[3]={point[0]-projOfPOnAB[0],point[1]-projOfPOnAB[1],point[2]-projOfPOnAB[2]};
+ double dist_P_AB(sqrt(V_dist_P_AB[0]*V_dist_P_AB[0]+V_dist_P_AB[1]*V_dist_P_AB[1]+V_dist_P_AB[2]*V_dist_P_AB[2]));
if(dist_P_AB>=eps)
return false;//to far from segment [segStart,segStop]
if(AP_dot_AB<-eps || AP_dot_AB>1.+eps)
*/
inline void quad_mapped_coords(const std::vector<const double*>& n, const double *p, double *bc)
{
- double const prec = 1.0e-14;
+ double prec = 1.0e-14;
enum { _XX=0, _YY, _ZZ };
if(n.size() != 4)
throw INTERP_KERNEL::Exception("INTERP_KERNEL::quad_mapped_coords : unrecognized geometric type! Only QUAD4 supported.");
- double const A[2] = {n[1][_XX] - n[0][_XX], n[1][_YY] - n[0][_YY]};
- double const B[2] = {n[2][_XX] - n[0][_XX], n[2][_YY] - n[0][_YY]};
- double const C[2] = {n[3][_XX] - n[0][_XX], n[3][_YY] - n[0][_YY]};
- double const N[2] = {B[_XX] - A[_XX] - C[_XX], B[_YY] - A[_YY] - C[_YY]};
- double const P[2] = {p[_XX] - n[0][_XX], p[_YY] - n[0][_YY]};
+ double A[2] = {n[1][_XX] - n[0][_XX], n[1][_YY] - n[0][_YY]};
+ double B[2] = {n[2][_XX] - n[0][_XX], n[2][_YY] - n[0][_YY]};
+ double C[2] = {n[3][_XX] - n[0][_XX], n[3][_YY] - n[0][_YY]};
+ double N[2] = {B[_XX] - A[_XX] - C[_XX], B[_YY] - A[_YY] - C[_YY]};
+ double P[2] = {p[_XX] - n[0][_XX], p[_YY] - n[0][_YY]};
// degenerated case: a rectangle:
if (fabs(N[0]) < prec && fabs(N[1]) < prec)
{
- double const det = C[0]*A[1] -C[1]*A[0];
+ double det = C[0]*A[1] -C[1]*A[0];
if (fabs(det) < prec)
throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: quad_mapped_coords() has a degenerated 2x2 system!");
bc[0] = (P[0]*A[1]-P[1]*A[0])/det;
c = -P[0]*A[1] + P[1]*A[0];
cas1 = false;
}
- double const delta = b*b - 4.0*a*c;
+ double delta = b*b - 4.0*a*c;
if (delta < 0.0)
throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: quad_mapped_coords(): imaginary solutions!");
bc[1] = 0.5*(-b+sqrt(delta))/a;
throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: quad_mapped_coords(): point doesn't seem to be in quad4!");
if (cas1)
{
- double const denom = C[0]+bc[1]*N[0];
+ double denom = C[0]+bc[1]*N[0];
if (fabs(denom) < prec)
throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: quad_mapped_coords(): point doesn't seem to be in quad4!");
bc[0] = (P[0]-bc[1]*A[0])/denom;
else
{
bc[0] = bc[1];
- double const denom = A[1]+bc[0]*N[1];
+ double denom = A[1]+bc[0]*N[1];
if (fabs(denom) < prec)
throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: cuboid_mapped_coord(): point doesn't seem to be in quad4!");
bc[1] = (P[1]-bc[0]*C[1])/denom;
inline void cuboid_mapped_coords(const std::vector<const double*>& n, const double *p, double *bc)
{
- double const prec = 1.0e-14;
+ double prec = 1.0e-14;
enum { _XX=0, _YY };
if (n.size() != 8)
throw INTERP_KERNEL::Exception("INTERP_KERNEL::cuboid_mapped_coords: unrecognized geometric type! Only HEXA8 supported.");
double Surface=0;
for(unsigned long i=0; i<(Poly.size())/2-2; i++)
{
- double const Surf=Surf_Tri( &Poly[0],&Poly[2*(i+1)],&Poly[2*(i+2)] );
+ double Surf=Surf_Tri( &Poly[0],&Poly[2*(i+1)],&Poly[2*(i+2)] );
Surface=Surface + Surf ;
}
return Surface ;
{
bool A=false;
- double const det_1=mon_determinant(P_1,P_3,P_0);
- double const det_2=mon_determinant(P_3,P_2,P_0);
- double const det_3=mon_determinant(P_2,P_1,P_0);
+ double det_1=mon_determinant(P_1,P_3,P_0);
+ double det_2=mon_determinant(P_3,P_2,P_0);
+ double det_3=mon_determinant(P_2,P_1,P_0);
if( (det_1>=-eps && det_2>=-eps && det_3>=-eps) || (det_1<=eps && det_2<=eps && det_3<=eps) )
{
A=true;
inline void verif_point_dans_vect(const double* P, std::vector<double>& V, double absolute_precision )
{
- std::size_t const taille=V.size();
+ std::size_t taille=V.size();
bool isPresent=false;
for(std::size_t i=0;i<taille/2;i++)
{
std::vector<double>& V, double dim_caracteristic, double precision)
{
- double const absolute_precision = precision*dim_caracteristic;
- bool const A_1=INTERP_KERNEL::point_dans_triangle(P_1,P_4,P_5,P_6,absolute_precision);
+ double absolute_precision = precision*dim_caracteristic;
+ bool A_1=INTERP_KERNEL::point_dans_triangle(P_1,P_4,P_5,P_6,absolute_precision);
if(A_1)
verif_point_dans_vect(P_1,V,absolute_precision);
- bool const A_2=INTERP_KERNEL::point_dans_triangle(P_2,P_4,P_5,P_6,absolute_precision);
+ bool A_2=INTERP_KERNEL::point_dans_triangle(P_2,P_4,P_5,P_6,absolute_precision);
if(A_2)
verif_point_dans_vect(P_2,V,absolute_precision);
- bool const A_3=INTERP_KERNEL::point_dans_triangle(P_3,P_4,P_5,P_6,absolute_precision);
+ bool A_3=INTERP_KERNEL::point_dans_triangle(P_3,P_4,P_5,P_6,absolute_precision);
if(A_3)
verif_point_dans_vect(P_3,V,absolute_precision);
}
double dim_caracteristic, double precision)
{
// calcul du determinant de P_1P_2 et P_3P_4.
- double const det=(P_2[0]-P_1[0])*(P_4[1]-P_3[1])-(P_4[0]-P_3[0])*(P_2[1]-P_1[1]);
+ double det=(P_2[0]-P_1[0])*(P_4[1]-P_3[1])-(P_4[0]-P_3[0])*(P_2[1]-P_1[1]);
- double const absolute_precision = dim_caracteristic*precision;
+ double absolute_precision = dim_caracteristic*precision;
if(fabs(det)>absolute_precision)
{
- double const k_1=-((P_3[1]-P_4[1])*(P_3[0]-P_1[0])+(P_4[0]-P_3[0])*(P_3[1]-P_1[1]))/det;
+ double k_1=-((P_3[1]-P_4[1])*(P_3[0]-P_1[0])+(P_4[0]-P_3[0])*(P_3[1]-P_1[1]))/det;
if (k_1 >= -absolute_precision && k_1 <= 1+absolute_precision)
//if( k_1 >= -precision && k_1 <= 1+precision)
{
- double const k_2= ((P_1[1]-P_2[1])*(P_1[0]-P_3[0])+(P_2[0]-P_1[0])*(P_1[1]-P_3[1]))/det;
+ double k_2= ((P_1[1]-P_2[1])*(P_1[0]-P_3[0])+(P_2[0]-P_1[0])*(P_1[1]-P_3[1]))/det;
if (k_2 >= -absolute_precision && k_2 <= 1+absolute_precision)
//if( k_2 >= -precision && k_2 <= 1+precision)
inline void verif_maill_dans_vect(int Num, std::vector<int>& V)
{
- std::size_t const taille=V.size();
+ std::size_t taille=V.size();
int A=0;
for(std::size_t i=0;i<taille;i++)
{
public:
bool operator()(std::pair<double,double>theta1, std::pair<double,double> theta2) const
{
- double const norm1 = sqrt(theta1.first*theta1.first +theta1.second*theta1.second);
- double const norm2 = sqrt(theta2.first*theta2.first +theta2.second*theta2.second);
+ double norm1 = sqrt(theta1.first*theta1.first +theta1.second*theta1.second);
+ double norm2 = sqrt(theta2.first*theta2.first +theta2.second*theta2.second);
- double const epsilon = 1.e-12;
+ double epsilon = 1.e-12;
if( norm1 < epsilon || norm2 < epsilon )
std::cout << "Warning InterpolationUtils.hxx: AngleLess : Vector with zero norm, cannot define the angle !!!! " << std::endl;
inline std::vector<double> reconstruct_polygon(const std::vector<double>& V)
{
- int const taille((int)V.size());
+ int taille((int)V.size());
//VB : why 6 ?
{return V;}
else
{
- auto *COS=new double[taille/2];
- auto *SIN=new double[taille/2];
+ double *COS=new double[taille/2];
+ double *SIN=new double[taille/2];
//double *angle=new double[taille/2];
std::vector<double> Bary=bary_poly(V);
COS[0]=1.0;
// }
for(micossin=CosSin.begin();micossin!=CosSin.end();micossin++)
{
- int const j=(*micossin).second;
+ int j=(*micossin).second;
Pt_ordonne.push_back(V[2*j]);
Pt_ordonne.push_back(V[2*j+1]);
}
for (int i=0; i<nb_nodes; i++)
{
- double const x = coordsOfMesh[3*(iP+i)];
- double const y = coordsOfMesh[3*(iP+i)+1];
- double const z = coordsOfMesh[3*(iP+i)+2];
+ double x = coordsOfMesh[3*(iP+i)];
+ double y = coordsOfMesh[3*(iP+i)+1];
+ double z = coordsOfMesh[3*(iP+i)+2];
bb[0]=(x<bb[0])?x:bb[0];
bb[1]=(x>bb[1])?x:bb[1];
bb[2]=(y<bb[2])?y:bb[2];
std::vector<bool> sw(3,false);
double inpVect2[3];
std::transform(inpVect,inpVect + 3,inpVect2,[](double c){return fabs(c);});
- std::size_t const posMin(std::distance(inpVect2,std::min_element(inpVect2,inpVect2+3)));
+ std::size_t posMin(std::distance(inpVect2,std::min_element(inpVect2,inpVect2+3)));
sw[posMin]=true;
std::size_t posMax(std::distance(inpVect2,std::max_element(inpVect2,inpVect2+3)));
if(posMax==posMin)
{ posMax=(posMin+1)%3; }
sw[posMax]=true;
- std::size_t const posMid(std::distance(sw.begin(),std::find(sw.begin(),sw.end(),false)));
+ std::size_t posMid(std::distance(sw.begin(),std::find(sw.begin(),sw.end(),false)));
outVect[posMin]=0.; outVect[posMid]=1.; outVect[posMax]=-inpVect[posMid]/inpVect[posMax];
}
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
/* Computes the geometric angle (in [0,Pi]) between two non zero vectors AB and AC */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
- template<int dim> inline double angle(const double * A, const double * B, const double * C, double * /*n*/)
+ template<int dim> inline double angle(const double * A, const double * B, const double * C, double * n)
{
double AB[dim];
double AC[dim];
double AB_dot_AC=dotprod<dim>(AB,AC);
for(int idim =0; idim<dim; idim++) orthAB[idim] = AC[idim]-AB_dot_AC*AB[idim];
- double const denom= normAC+AB_dot_AC;
+ double denom= normAC+AB_dot_AC;
double numer=norm<dim>(orthAB);
return 2*atan2(numer,denom);
*/
inline double TripleProduct(const double *A, const double *B, const double *C, const double *X)
{
- double const XA[3]={ A[0]-X[0], A[1]-X[1], A[2]-X[2] };
- double const XB[3]={ B[0]-X[0], B[1]-X[1], B[2]-X[2] };
- double const XC[3]={ C[0]-X[0], C[1]-X[1], C[2]-X[2] };
+ double XA[3]={ A[0]-X[0], A[1]-X[1], A[2]-X[2] };
+ double XB[3]={ B[0]-X[0], B[1]-X[1], B[2]-X[2] };
+ double XC[3]={ C[0]-X[0], C[1]-X[1], C[2]-X[2] };
- double const XA_cross_XB[3] = {XA[1]*XB[2]-XA[2]*XB[1], XA[2]*XB[0]-XA[0]*XB[2], XA[0]*XB[1]-XA[1]*XB[0]};
+ double XA_cross_XB[3] = {XA[1]*XB[2]-XA[2]*XB[1], XA[2]*XB[0]-XA[0]*XB[2], XA[0]*XB[1]-XA[1]*XB[0]};
// norm is equal to double the area of the triangle
- double const norm = std::sqrt(XA_cross_XB[0]*XA_cross_XB[0]+XA_cross_XB[1]*XA_cross_XB[1]+XA_cross_XB[2]*XA_cross_XB[2]);
+ double norm = std::sqrt(XA_cross_XB[0]*XA_cross_XB[0]+XA_cross_XB[1]*XA_cross_XB[1]+XA_cross_XB[2]*XA_cross_XB[2]);
return ( XA_cross_XB[0]*XC[0]+ XA_cross_XB[1]*XC[1] + XA_cross_XB[2]*XC[2] ) / norm;
}
#ifndef __INTERSECTOR3D_HXX__
#define __INTERSECTOR3D_HXX__
-#include "TargetIntersector.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
+#include "TargetIntersector.txx"
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
Intersector3D(const MyMeshType& targetMesh, const MyMeshType& srcMesh);
#define __INTERSECTOR3D_TXX__
#include "Intersector3D.hxx"
-#include "InterpolationUtils.hxx"
#include <algorithm>
-#include <vector>
namespace INTERP_KERNEL
{
{
ConnType nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT);
coordsT.resize(SPACEDIM*nbNodesT);
- auto iter=coordsT.begin();
+ std::vector<double>::iterator iter=coordsT.begin();
for (ConnType iT=0; iT<nbNodesT; iT++)
{
const double *coordsCur=getCoordsOfNode(iT,icellT,_target_mesh);
{
ConnType nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS);
coordsS.resize(SPACEDIM*nbNodesS);
- auto iter=coordsS.begin();
+ std::vector<double>::iterator iter=coordsS.begin();
for (ConnType iS=0; iS<nbNodesS; iS++)
{
const double *coordsCur=getCoordsOfNode(iS,icellS,_src_mesh);
#ifndef __INTERSECTOR3DP0P0_TXX__
#define __INTERSECTOR3DP0P0_TXX__
-#include "Intersector3D.hxx"
#include "Intersector3DP0P0.hxx"
+#include "Intersector3D.txx"
namespace INTERP_KERNEL
{
#ifndef __INTERSECTOR3DP0P1_TXX__
#define __INTERSECTOR3DP0P1_TXX__
-#include "Intersector3D.hxx"
#include "Intersector3DP0P1.hxx"
+#include "Intersector3D.txx"
namespace INTERP_KERNEL
{
#ifndef __INTERSECTOR3DP1P0_TXX__
#define __INTERSECTOR3DP1P0_TXX__
-#include "Intersector3D.hxx"
#include "Intersector3DP1P0.hxx"
+#include "Intersector3D.txx"
namespace INTERP_KERNEL
{
#ifndef __Intersector3DP1P0Bary_TXX__
#define __Intersector3DP1P0Bary_TXX__
-#include "Intersector3D.hxx"
#include "Intersector3DP1P0Bary.hxx"
+#include "Intersector3D.txx"
namespace INTERP_KERNEL
{
#ifndef __Intersector3DP1P1_TXX__
#define __Intersector3DP1P1_TXX__
-#include "Intersector3D.hxx"
#include "Intersector3DP1P1.hxx"
+#include "Intersector3D.txx"
namespace INTERP_KERNEL
{
#ifndef __IntersectorCU_HXX__
#define __IntersectorCU_HXX__
-#include "TargetIntersector.hxx"
-#include "InterpKernelException.hxx"
-#include <vector>
+#include "TargetIntersector.txx"
+#include "NormalizedUnstructuredMesh.hxx"
namespace INTERP_KERNEL
{
#define __IntersectorCU_TXX__
#include "IntersectorCU.hxx"
-#include "InterpolationUtils.hxx"
-#include <limits>
-#include <vector>
// convert index "From Mesh Index"
#define _FMIU(i) OTT<typename MyUMeshType::MyConnType,MyUMeshType::My_numPol>::ind2C((i))
_CU_TEMPLATE
_INTERSECTOR_CU_::~IntersectorCU()
- = default;
+ {
+ }
//================================================================================
/*!
const double* coord_node=_coordsU+SPACEDIM*(_FMCOO( _connectU[_FMCON (_connIndexU[_FMIU(icell)]+i)]));
for(int idim=0; idim<SPACEDIM; idim++)
{
- double const x = *(coord_node+idim);
+ double x = *(coord_node+idim);
bb[2*idim ] = (x<bb[2*idim ])?x:bb[2*idim ];
bb[2*idim+1] = (x>bb[2*idim+1])?x:bb[2*idim+1];
}
#define __IntersectorCU1D_HXX__
#include "IntersectorCU.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
class IntersectorCU1D : public IntersectorCU<MyCMeshType,MyUMeshType,MyMatrix,IntersectorCU1D<MyCMeshType,MyUMeshType,MyMatrix> >
{
public:
- using UConnType = typename MyUMeshType::MyConnType;
- using CConnType = typename MyCMeshType::MyConnType;
+ typedef typename MyUMeshType::MyConnType UConnType;
+ typedef typename MyCMeshType::MyConnType CConnType;
public:
IntersectorCU1D(const MyCMeshType& meshS, const MyUMeshType& meshT);
~IntersectorCU1D();
#ifndef __IntersectorCU1D_TXX__
#define __IntersectorCU1D_TXX__
-#include "IntersectorCU.hxx"
#include "IntersectorCU1D.hxx"
#include "IntersectorCU.txx"
-#include "InterpKernelException.hxx"
-#include <vector>
-#include <algorithm>
#define IntersectorCU1D_TEMPLATE template<class MyCMeshType, class MyUMeshType, class MyMatrix>
#define INTERSECTOR_CU1D IntersectorCU1D<MyCMeshType,MyUMeshType,MyMatrix >
IntersectorCU1D_TEMPLATE
INTERSECTOR_CU1D::~IntersectorCU1D()
- = default;
+ {
+ }
//================================================================================
/*!
const double* coordsC = & _INTER_CU::_coordsC[0][ _FMIC(icellS[0]) ];
- double const res = std::min( coordsU[1], coordsC[1] ) - std::max( coordsU[0], coordsC[0] );
+ double res = std::min( coordsU[1], coordsC[1] ) - std::max( coordsU[0], coordsC[0] );
return res;
}
}
#define __IntersectorCU2D_HXX__
#include "IntersectorCU.hxx"
-#include "PlanarIntersectorP0P0.hxx"
-#include "TriangulationIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
class IntersectorCU2D : public IntersectorCU<MyCMeshType,MyUMeshType,MyMatrix,IntersectorCU2D<MyCMeshType,MyUMeshType,MyMatrix> >
{
public:
- using UConnType = typename MyUMeshType::MyConnType;
- using CConnType = typename MyCMeshType::MyConnType;
+ typedef typename MyUMeshType::MyConnType UConnType;
+ typedef typename MyCMeshType::MyConnType CConnType;
public:
IntersectorCU2D(const MyCMeshType& meshS, const MyUMeshType& meshT);
double intersectGeometry(UConnType icellT, const std::vector<CConnType>& icellC);
#ifndef __IntersectorCU2D_TXX__
#define __IntersectorCU2D_TXX__
-#include "IntersectorCU.hxx"
#include "IntersectorCU2D.hxx"
#include "IntersectorCU.txx"
-#include "InterpKernelException.hxx"
-#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
-#include <vector>
#define IntersectorCU2D_TEMPLATE template<class MyCMeshType, class MyUMeshType, class MyMatrix>
#define INTERSECTOR_CU2D IntersectorCU2D<MyCMeshType, MyUMeshType, MyMatrix >
#include "IntersectorCU.hxx"
#include "SplitterTetra.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
class IntersectorCU3D : public IntersectorCU<MyCMeshType,MyUMeshType,MyMatrix,IntersectorCU3D<MyCMeshType,MyUMeshType,MyMatrix> >
{
public:
- using UConnType = typename MyUMeshType::MyConnType;
- using CConnType = typename MyCMeshType::MyConnType;
+ typedef typename MyUMeshType::MyConnType UConnType;
+ typedef typename MyCMeshType::MyConnType CConnType;
public:
IntersectorCU3D(const MyCMeshType& meshS, const MyUMeshType& meshT, SplittingPolicy splitting_policy);
~IntersectorCU3D();
private:
- using TSplitter = SplitterTetra2<MyUMeshType, _Cartesian3D2UnstructHexMesh>;
- using TTetra = SplitterTetra<_Cartesian3D2UnstructHexMesh>;
+ typedef SplitterTetra2<MyUMeshType, _Cartesian3D2UnstructHexMesh > TSplitter;
+ typedef SplitterTetra <_Cartesian3D2UnstructHexMesh > TTetra;
_Cartesian3D2UnstructHexMesh* _uHexMesh;
TSplitter* _split;
};
#ifndef __IntersectorCU3D_TXX__
#define __IntersectorCU3D_TXX__
-#include "IntersectorCU.hxx"
#include "IntersectorCU3D.hxx"
#include "IntersectorCU.txx"
-#include "MCIdType.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "InterpKernelException.hxx"
-#include "NormalizedGeometricTypes"
-#include "BoundingBox.hxx"
+#include "SplitterTetra.txx"
#define IntersectorCU3D_TEMPLATE template<class MyCMeshType, class MyUMeshType, class MyMatrix>
#define INTERSECTOR_CU3D IntersectorCU3D<MyCMeshType,MyUMeshType,MyMatrix >
public:
static const int MY_SPACEDIM=3;
static const int MY_MESHDIM=3;
- using MyConnType = mcIdType;
+ typedef mcIdType MyConnType;
static const NumberingPolicy My_numPol=ALL_C_MODE;
_Cartesian3D2UnstructHexMesh(const double * coords[3]): _coordsC(coords) {}
boundingBox[BoundingBox::ZMIN] = _coordsU[2];
boundingBox[BoundingBox::ZMAX] = _coordsU[2+4*MY_SPACEDIM];
}
- NormalizedCellType getTypeOfElement(mcIdType /*eltId*/) const { return NORM_HEXA8; }
- mcIdType getNumberOfNodesOfElement(mcIdType /*eltId*/) const { return 8; }
+ NormalizedCellType getTypeOfElement(mcIdType eltId) const { return NORM_HEXA8; }
+ mcIdType getNumberOfNodesOfElement(mcIdType eltId) const { return 8; }
mcIdType getNumberOfElements() const { return 1; }
mcIdType getNumberOfNodes() const { return 8; }
const double *getCoordinatesPtr() const { return _coordsU; }
IntersectorCU3D_TEMPLATE
INTERSECTOR_CU3D::~IntersectorCU3D()
{
- delete _uHexMesh; _uHexMesh=nullptr;
+ delete _uHexMesh; _uHexMesh=0;
delete _split; _split=0;
}
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "INTERPKERNELDefines.hxx"
#include "InterpKernelDenseMatrix.txx"
template class INTERPKERNEL_EXPORT INTERP_KERNEL::DenseMatrixT<double>;
// Implementation coming from Numerical Recipes in C of 1994 (version 2.04)
#include "InterpKernelLUDecomp.hxx"
-#include "InterpKernelDenseMatrix.hxx"
#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
#include <cmath>
-#include <vector>
#include <sstream>
using namespace INTERP_KERNEL;
#pragma once
-#include "INTERPKERNELDefines.hxx"
#include "InterpKernelDenseMatrix.hxx"
-#include "MCIdType.hxx"
#include <vector>
namespace INTERP_KERNEL
// Implementation coming from Numerical Recipes in C of 1994 (version 2.04)
#include "InterpKernelQRDecomp.hxx"
-#include "InterpKernelDenseMatrix.hxx"
#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
#include <cmath>
-#include <vector>
-#include <sstream>
using namespace INTERP_KERNEL;
#pragma once
#include "InterpKernelDenseMatrix.hxx"
-#include "MCIdType.hxx"
#include <vector>
namespace INTERP_KERNEL
#else
-using mcIdType = std::int64_t;
+typedef std::int64_t mcIdType;
#endif
#ifdef WIN32
typedef long long mcPyPtrType;
#else
-using mcPyPtrType = long;
+typedef long mcPyPtrType;
#endif
template <class T> inline std::size_t ToSizeT(T val)
#ifndef __MappedBarycenter2DIntersectorP1P1_HXX__
#define __MappedBarycenter2DIntersectorP1P1_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
MappedBarycentric2DIntersectorP1P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation);
#ifndef __MappedBarycentric2DIntersectorP1P1_TXX__
#define __MappedBarycentric2DIntersectorP1P1_TXX__
-#include "InterpolationUtils.hxx"
#include "MappedBarycentric2DIntersectorP1P1.hxx"
-#include "PlanarIntersector.hxx"
-#include "NormalizedGeometricTypes"
-#include "InterpKernelUtilities.hxx"
+#include "PlanarIntersector.txx"
+#include "CellModel.hxx"
#include "PointLocatorAlgos.txx"
-#include <vector>
+#include "MeshUtils.hxx"
namespace INTERP_KERNEL
{
#include "Intersector3DP1P1.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
#ifndef __MAPPEDBARYCENTRIC3DINTERSECTORP1P1_TXX__
#define __MAPPEDBARYCENTRIC3DINTERSECTORP1P1_TXX__
-#include "Intersector3DP1P1.txx"
-#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
#include "MappedBarycentric3DIntersectorP1P1.hxx"
-#include "NormalizedGeometricTypes"
-#include "CellModel.hxx"
-#include "PointLocatorAlgos.txx"
-#include <vector>
-#include <cstddef>
-#include <cmath>
+#include "Intersector3DP1P1.txx"
+#include "MeshUtils.hxx"
namespace INTERP_KERNEL
{
template<class MyMeshType, class MyMatrix>
MappedBarycentric3DIntersectorP1P1<MyMeshType,MyMatrix>::~MappedBarycentric3DIntersectorP1P1()
- = default;
+ {
+ }
/**
* @param targetCell in C mode.
//
#include "MeshElement.hxx"
-#include "BoundingBox.hxx"
namespace INTERP_KERNEL
{
template<class MyMeshType>
void assign(const ConnType index, const MyMeshType& mesh);
- ~MeshElement() = default;
+ ~MeshElement() { }
nbnodesincelltype getNumberOfNodes() const { return _number; }
private:
/// disallow copying
- MeshElement(const MeshElement& elem) = delete;
+ MeshElement(const MeshElement& elem);
nbnodesincelltype _number;
#ifndef __MESHELEMENT_TXX__
#define __MESHELEMENT_TXX__
-#include "InterpolationUtils.hxx"
-#include "InterpKernelException.hxx"
#include "MeshElement.hxx"
+#include "TetraAffineTransform.hxx"
+#include "TransformedTriangle.hxx"
#include "MeshUtils.hxx"
#include "BoundingBox.hxx"
#include <assert.h>
+#include <type_traits>
#include <limits>
#include <memory>
-#include <sstream>
namespace INTERP_KERNEL
{
#include "MeshElement.hxx"
#include "BoundingBox.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include <vector>
#ifndef __MESHREGION_TXX__
#define __MESHREGION_TXX__
-#include "MeshElement.hxx"
-#include "InterpolationUtils.hxx"
-#include "BoundingBox.hxx"
#include "MeshRegion.hxx"
+#include "MeshElement.txx"
#include "MeshUtils.hxx"
-#include <cassert>
namespace INTERP_KERNEL
{
*
*/
template<class ConnType>
- MeshRegion<ConnType>::MeshRegion():_box(nullptr)
+ MeshRegion<ConnType>::MeshRegion():_box(0)
{
}
const unsigned char numNodes = element->getNumberOfNodes();
const ConnType elemIdx = element->getIndex();
- if(_box == nullptr)
+ if(_box == 0)
{
- const auto** pts = new const double*[numNodes];
+ const double** pts = new const double*[numNodes];
// get coordinates of the nodes of the element
for(unsigned char i = 0 ; i < numNodes ; ++i)
#define __MESHUTILS_HXX__
#include "InterpolationUtils.hxx"
-#include "NormalizedGeometricTypes"
-#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#include "OrientationInverter.hxx"
#include "InterpKernelException.hxx"
#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
-#include "MCIdType.hxx"
-#include <iterator>
-#include <cstddef>
#include <sstream>
#include <algorithm>
void OrientationInverter2DQuadratic::operateAndShutUp(mcIdType *beginPt) const
{
- int const nbNodes(getNbNodes());
+ int nbNodes(getNbNodes());
std::reverse(beginPt+1,beginPt+nbNodes/2);
std::reverse(beginPt+nbNodes/2,beginPt+nbNodes);
}
void OrientationInverterQPolygon::operate(mcIdType *beginPt, mcIdType *endPt) const
{
- std::size_t const sz(std::distance(beginPt,endPt));
+ std::size_t sz(std::distance(beginPt,endPt));
std::reverse(beginPt+1,beginPt+sz/2);
std::reverse(beginPt+sz/2,endPt);
}
void OrientationInverter3DExtrusionLinear::operateAndShutUp(mcIdType *beginPt) const
{
- int const nbNodes(getNbNodes());
+ int nbNodes(getNbNodes());
std::reverse(beginPt+1,beginPt+nbNodes/2);
std::reverse(beginPt+nbNodes/2+1,beginPt+nbNodes);
}
{
public:
INTERPKERNEL_EXPORT static OrientationInverter *BuildInstanceFrom(NormalizedCellType gt);
- INTERPKERNEL_EXPORT virtual ~OrientationInverter() = default;
+ INTERPKERNEL_EXPORT virtual ~OrientationInverter() { }
INTERPKERNEL_EXPORT virtual void operate(mcIdType *beginPt, mcIdType *endPt) const = 0;
};
{
public:
OrientationInverterChecker(unsigned nbNodes):_nb_nodes(nbNodes) { }
- void operate(mcIdType *beginPt, mcIdType *endPt) const override { check(beginPt,endPt); operateAndShutUp(beginPt); }
+ void operate(mcIdType *beginPt, mcIdType *endPt) const { check(beginPt,endPt); operateAndShutUp(beginPt); }
virtual void operateAndShutUp(mcIdType *beginPt) const = 0;
protected:
unsigned getNbNodes() const { return _nb_nodes; }
{
public:
OrientationInverterSEG2():OrientationInverterChecker(2u) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterSEG3 : public OrientationInverterChecker
{
public:
OrientationInverterSEG3():OrientationInverterChecker(3u) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverter2DLinear : public OrientationInverterChecker
{
public:
OrientationInverter2DLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverter2DQuadratic : public OrientationInverterChecker
{
public:
OrientationInverter2DQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterPolygon : public OrientationInverter
{
public:
- void operate(mcIdType *beginPt, mcIdType *endPt) const override;
+ void operate(mcIdType *beginPt, mcIdType *endPt) const;
};
class OrientationInverterQPolygon : public OrientationInverter
{
public:
- void operate(mcIdType *beginPt, mcIdType *endPt) const override;
+ void operate(mcIdType *beginPt, mcIdType *endPt) const;
};
class OrientationInverterTetra4 : public OrientationInverterChecker
{
public:
OrientationInverterTetra4():OrientationInverterChecker(4u) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterTetra10 : public OrientationInverterChecker
{
public:
OrientationInverterTetra10():OrientationInverterChecker(10u) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterPyra5 : public OrientationInverterChecker
{
public:
OrientationInverterPyra5():OrientationInverterChecker(5u) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverterPyra13 : public OrientationInverterChecker
{
public:
OrientationInverterPyra13():OrientationInverterChecker(13u) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverter3DExtrusionLinear : public OrientationInverterChecker
{
public:
OrientationInverter3DExtrusionLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
class OrientationInverter3DExtrusionQuadratic : public OrientationInverterChecker
{
public:
OrientationInverter3DExtrusionQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
- void operateAndShutUp(mcIdType *beginPt) const override;
+ void operateAndShutUp(mcIdType *beginPt) const;
};
}
#ifndef __PLANAR2D1DINTERSECTORP0P0_HXX__
#define __PLANAR2D1DINTERSECTORP0P0_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#define __PLANAR2D1DINTERSECTORP0P0_TXX__
#include "Planar2D1DIntersectorP0P0.hxx"
-#include "PlanarIntersector.hxx"
-#include "InterpolationUtils.hxx"
-#include <vector>
-#include <set>
namespace INTERP_KERNEL
{
#include "TargetIntersector.txx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <cstddef>
#include <map>
#include <set>
-#include <vector>
namespace INTERP_KERNEL
{
#include "InterpolationUtils.hxx"
#include "TranslationRotationMatrix.hxx"
-#include <cmath>
#include <iostream>
#include <limits>
-#include <vector>
namespace INTERP_KERNEL
{
template<class MyMeshType, class MyMatrix>
PlanarIntersector<MyMeshType,MyMatrix>::~PlanarIntersector()
- = default;
+ {
+ }
/*!
\brief creates the bounding boxes for all the cells of mesh \a mesh
const double* coord_node=coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(conn[OTT<ConnType,numPol>::conn2C(conn_index[icell]+j)]);
for(int idim=0; idim<SPACEDIM; idim++)
{
- double const x=*(coord_node+idim);
+ double x=*(coord_node+idim);
bbox[ibox*2*SPACEDIM + 2*idim] = (bbox[ibox*2*SPACEDIM + 2*idim] <x)?bbox[ibox*2*SPACEDIM + 2*idim ]:x;
bbox[ibox*2*SPACEDIM + 2*idim+1] = (bbox[ibox*2*SPACEDIM + 2*idim+1]>x)?bbox[ibox*2*SPACEDIM + 2*idim+1]:x;
}
const double* coord_node=coords+SPACEDIM*(OTT<ConnType,numPol>::coo2C(conn[OTT<ConnType,numPol>::conn2C(conn_index[OTT<ConnType,numPol>::ind2C(iP)]+i)]));
for(int idim=0; idim<SPACEDIM; idim++)
{
- double const x = *(coord_node+idim);
+ double x = *(coord_node+idim);
//double y = *(mesh.getCoordinates(MED_FULL_INTERLACE)+3*(iP+i)+1);
bb[2*idim ] = (x<bb[2*idim ])?x:bb[2*idim ];
bb[2*idim+1] = (x>bb[2*idim+1])?x:bb[2*idim+1];
prodvect[0]=G1[1]*G2[2]-G1[2]*G2[1];
prodvect[1]=G1[2]*G2[0]-G1[0]*G2[2];
prodvect[2]=G1[0]*G2[1]-G1[1]*G2[0];
- double const prodscal=prodvect[0]*G3[0]+prodvect[1]*G3[1]+prodvect[2]*G3[2];
+ double prodscal=prodvect[0]*G3[0]+prodvect[1]*G3[1]+prodvect[2]*G3[2];
if(fabs(prodscal)>md3DSurf)
return 0;
}
#ifndef __PLANARINTERSECTORP0P0_HXX__
#define __PLANARINTERSECTORP0P0_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
protected:
PlanarIntersectorP0P0(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
#ifndef __PLANARINTERSECTORP0P0_TXX__
#define __PLANARINTERSECTORP0P0_TXX__
-#include "PlanarIntersector.hxx"
#include "PlanarIntersectorP0P0.hxx"
-#include "InterpolationUtils.hxx"
namespace INTERP_KERNEL
{
#ifndef __PLANARINTERSECTORP0P1_HXX__
#define __PLANARINTERSECTORP0P1_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
protected:
PlanarIntersectorP0P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
#ifndef __PLANARINTERSECTORP0P1_TXX__
#define __PLANARINTERSECTORP0P1_TXX__
-#include "PlanarIntersector.txx"
-#include "InterpKernelUtilities.hxx"
-#include "NormalizedGeometricTypes"
#include "PlanarIntersectorP0P1.hxx"
#include "InterpolationUtils.hxx"
#include "CellModel.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __PlanarIntersectorP0P1Bary_HXX__
#define __PlanarIntersectorP0P1Bary_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __PlanarIntersectorP0P1Bary_TXX__
#define __PlanarIntersectorP0P1Bary_TXX__
-#include "NormalizedGeometricTypes"
-#include "PlanarIntersector.hxx"
#include "PlanarIntersectorP0P1Bary.hxx"
#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
-#include "CellModel.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __PLANARINTERSECTORP0P1PL_HXX__
#define __PLANARINTERSECTORP0P1PL_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __PLANARINTERSECTORP0P1PL_TXX__
#define __PLANARINTERSECTORP0P1PL_TXX__
-#include "PlanarIntersector.hxx"
-#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
#include "PlanarIntersectorP0P1PL.hxx"
+#include "PlanarIntersector.txx"
+#include "CellModel.hxx"
#include "PointLocatorAlgos.txx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __PLANARINTERSECTORP1P0_HXX__
#define __PLANARINTERSECTORP1P0_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __PLANARINTERSECTORP1P0_TXX__
#define __PLANARINTERSECTORP1P0_TXX__
-#include "NormalizedGeometricTypes"
-#include "PlanarIntersector.txx"
#include "PlanarIntersectorP1P0.hxx"
#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
-#include "CellModel.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __PlanarIntersectorP1P0Bary_HXX__
#define __PlanarIntersectorP1P0Bary_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
protected:
PlanarIntersectorP1P0Bary(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel);
#ifndef __PlanarIntersectorP1P0Bary_TXX__
#define __PlanarIntersectorP1P0Bary_TXX__
-#include "NormalizedGeometricTypes"
-#include "PlanarIntersector.hxx"
#include "PlanarIntersectorP1P0Bary.hxx"
#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
-#include "CellModel.hxx"
-#include <vector>
#define PLAN_INTERSECTOR PlanarIntersectorP1P0Bary<MyMeshType,MyMatrix,ConcreteP1P0Intersector>
#define PLAN_INTER_TEMPLATE template<class MyMeshType, class MyMatrix, class ConcreteP1P0Intersector>
#ifndef __PLANARINTERSECTORP1P0PL_HXX__
#define __PLANARINTERSECTORP1P0PL_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
PlanarIntersectorP1P0PL(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation);
#ifndef __PLANARINTERSECTORP1P0PL_TXX__
#define __PLANARINTERSECTORP1P0PL_TXX__
-#include "PlanarIntersector.txx"
-#include "InterpolationUtils.hxx"
-#include "NormalizedGeometricTypes"
#include "PlanarIntersectorP1P0PL.hxx"
-#include "InterpKernelUtilities.hxx"
-#include "VolSurfFormulae.hxx"
+#include "PlanarIntersector.txx"
+#include "CellModel.hxx"
#include "PointLocatorAlgos.txx"
-#include <vector>
-#include <cmath>
+#include "InterpKernelGeo2DQuadraticPolygon.hxx"
+#include "MeshUtils.hxx"
namespace INTERP_KERNEL
{
#ifndef __PLANARINTERSECTORP1P1_HXX__
#define __PLANARINTERSECTORP1P1_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __PLANARINTERSECTORP1P1_TXX__
#define __PLANARINTERSECTORP1P1_TXX__
-#include "PlanarIntersector.txx"
#include "PlanarIntersectorP1P1.hxx"
#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
-#include <vector>
+#include "CellModel.hxx"
namespace INTERP_KERNEL
{
#ifndef __PLANARINTERSECTORP1P1PL_HXX__
#define __PLANARINTERSECTORP1P1PL_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __PLANARINTERSECTORP1P1PL_TXX__
#define __PLANARINTERSECTORP1P1PL_TXX__
-#include "PlanarIntersector.txx"
-#include "InterpolationUtils.hxx"
-#include "NormalizedGeometricTypes"
#include "PlanarIntersectorP1P1PL.hxx"
-#include "InterpKernelUtilities.hxx"
+#include "PlanarIntersector.txx"
+#include "CellModel.hxx"
#include "PointLocatorAlgos.txx"
-#include <vector>
-#include <cmath>
+#include "MeshUtils.hxx"
namespace INTERP_KERNEL
{
#ifndef __POINTLOCATORINTERSECTOR_HXX__
#define __POINTLOCATORINTERSECTOR_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include <vector>
+#include "PlanarIntersectorP0P0.hxx"
+#include "PlanarIntersectorP0P1.hxx"
+#include "PlanarIntersectorP1P0.hxx"
+#include "PlanarIntersectorP1P1.hxx"
+#include "PlanarIntersectorP1P0Bary.hxx"
namespace INTERP_KERNEL
{
#define __POINTLOCATORINTERSECTOR_TXX__
#include "PointLocator2DIntersector.hxx"
-#include "PlanarIntersector.hxx"
+#include "PlanarIntersectorP0P0.txx"
+#include "PlanarIntersectorP0P1.txx"
+#include "PlanarIntersectorP1P0.txx"
+#include "PlanarIntersectorP1P1.txx"
+#include "PlanarIntersectorP1P0Bary.txx"
#include "CellModel.hxx"
-#include "PointLocatorAlgos.txx"
-#include "NormalizedGeometricTypes"
-
-#include <vector>
-#include <numeric>
+#include "InterpKernelGeo2DQuadraticPolygon.hxx"
+#include "PointLocatorAlgos.txx"
#define PTLOC2D_INTERSECTOR PointLocator2DIntersector<MyMeshType,MyMatrix,InterpType>
#define INTERSECTOR_TEMPLATE template<class MyMeshType, class MyMatrix, template <class MeshType, class TheMatrix, class ThisIntersector> class InterpType>
#include "Intersector3DP0P0.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
#ifndef __POINTLOCATOR3DINTERSECTORP0P0_TXX__
#define __POINTLOCATOR3DINTERSECTORP0P0_TXX__
-#include "Intersector3DP0P0.txx"
-#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
-#include "NormalizedGeometricTypes"
-#include "CellModel.hxx"
#include "PointLocator3DIntersectorP0P0.hxx"
-#include "VolSurfFormulae.hxx"
+#include "Intersector3DP0P0.txx"
+#include "MeshUtils.hxx"
+#include "SplitterTetra.txx"
#include "PointLocatorAlgos.txx"
-#include <vector>
namespace INTERP_KERNEL
{
template<class MyMeshType, class MyMatrix>
PointLocator3DIntersectorP0P0<MyMeshType,MyMatrix>::~PointLocator3DIntersectorP0P0()
- = default;
+ {
+ }
/**
*
#include "Intersector3DP0P1.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
#ifndef __POINTLOCATOR3DINTERSECTORP0P1_TXX__
#define __POINTLOCATOR3DINTERSECTORP0P1_TXX__
-#include "Intersector3DP0P1.txx"
-#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
-#include "NormalizedGeometricTypes"
#include "PointLocator3DIntersectorP0P1.hxx"
-#include "PointLocatorAlgos.txx"
-#include "CellModel.hxx"
-#include <vector>
-#include <cstddef>
+#include "Intersector3DP0P1.txx"
+#include "MeshUtils.hxx"
namespace INTERP_KERNEL
{
template<class MyMeshType, class MyMatrix>
PointLocator3DIntersectorP0P1<MyMeshType,MyMatrix>::~PointLocator3DIntersectorP0P1()
- = default;
+ {
+ }
/**
*
#include "Intersector3DP1P0.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
PointLocator3DIntersectorP1P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh, double precision);
#ifndef __POINTLOCATOR3DINTERSECTORP1P0_TXX__
#define __POINTLOCATOR3DINTERSECTORP1P0_TXX__
-#include "Intersector3DP1P0.txx"
-#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
-#include "NormalizedGeometricTypes"
#include "PointLocator3DIntersectorP1P0.hxx"
-#include "CellModel.hxx"
-#include "PointLocatorAlgos.txx"
-#include "VolSurfFormulae.hxx"
-#include <vector>
-#include <cmath>
+#include "Intersector3DP1P0.txx"
+#include "MeshUtils.hxx"
namespace INTERP_KERNEL
{
template<class MyMeshType, class MyMatrix>
PointLocator3DIntersectorP1P0<MyMeshType,MyMatrix>::~PointLocator3DIntersectorP1P0()
- = default;
+ {
+ }
/**
* @param targetCell in C mode.
#include "Intersector3DP1P1.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
+#include "InterpKernelUtilities.hxx"
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
PointLocator3DIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, double precision);
#ifndef __POINTLOCATOR3DINTERSECTORP1P1_TXX__
#define __POINTLOCATOR3DINTERSECTORP1P1_TXX__
-#include "Intersector3DP1P1.txx"
-#include "InterpolationUtils.hxx"
-#include "InterpKernelUtilities.hxx"
-#include "NormalizedGeometricTypes"
#include "PointLocator3DIntersectorP1P1.hxx"
-#include "CellModel.hxx"
-#include "PointLocatorAlgos.txx"
-#include <vector>
-#include <cstddef>
-#include <cmath>
+#include "Intersector3DP1P1.txx"
+#include "MeshUtils.hxx"
namespace INTERP_KERNEL
{
template<class MyMeshType, class MyMatrix>
PointLocator3DIntersectorP1P1<MyMeshType,MyMatrix>::~PointLocator3DIntersectorP1P1()
- = default;
+ {
+ }
/**
* @param targetCell in C mode.
#ifndef __POINTLOCATORALGOS_TXX__
#define __POINTLOCATORALGOS_TXX__
-#include "InterpKernelGeo2DPrecision.hxx"
#include "InterpolationUtils.hxx"
#include "CellModel.hxx"
#include "BBTree.txx"
#include "InterpKernelGeo2DNode.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
-#include "MCIdType.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include <algorithm>
-#include <cmath>
#include <list>
#include <vector>
#include <set>
class GenericPointLocatorAlgos
{
public:
- virtual ~GenericPointLocatorAlgos() = default;
+ virtual ~GenericPointLocatorAlgos() { }
virtual std::list<mcIdType> locates(const double* x, double eps) = 0;
};
_tree=new BBTree<SPACEDIM,typename MyMeshType::MyConnType>(_bb,0,0,nelem);
}
- ~PointLocatorAlgos() override
+ ~PointLocatorAlgos()
{
delete[] _bb;
delete _tree;
//returns the list of elements that contains
//the point pointed to by x
- std::list<typename MyMeshType::MyConnType> locates(const double* x, double eps) override
+ std::list<typename MyMeshType::MyConnType> locates(const double* x, double eps)
{
typedef typename MyMeshType::MyConnType ConnType;
const NumberingPolicy numPol=MyMeshType::My_numPol;
here XA^XC and XC^XB have different signs*/
const int SPACEDIM=MyMeshType::MY_SPACEDIM;
- std::unique_ptr<char[]> const sign( new char[nbEdges] );
+ std::unique_ptr<char[]> sign( new char[nbEdges] );
for (mcIdType iedge=0; iedge<nbEdges; iedge++)
{
const double* A=cellPts+SPACEDIM*iedge;
const double* B=cellPts+SPACEDIM*((iedge+1)%nbEdges);
- double const a=mon_determinant(ptToTest, A, B);
+ double a=mon_determinant(ptToTest, A, B);
if(a<-eps)
sign[iedge]=-1;
else if(a>eps)
// Same as isElementContainsPointAlg2DSimple() with a different input format ...
static bool isElementContainsPointAlgo2DSimple2(const double *ptToTest, NormalizedCellType type,
const double *coords, const typename MyMeshType::MyConnType *conn_elem,
- typename MyMeshType::MyConnType /*conn_elem_sz*/, double eps)
+ typename MyMeshType::MyConnType conn_elem_sz, double eps)
{
const int SPACEDIM=MyMeshType::MY_SPACEDIM;
typedef typename MyMeshType::MyConnType ConnType;
const CellModel& cmType=CellModel::GetCellModel(type);
bool ret=false;
- int const nbEdges=cmType.getNumberOfSons();
- auto *pts = new double[nbEdges*SPACEDIM];
+ int nbEdges=cmType.getNumberOfSons();
+ double *pts = new double[nbEdges*SPACEDIM];
for (int iedge=0; iedge<nbEdges; iedge++)
{
const double* a=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[iedge]));
typename MyMeshType::MyConnType conn_elem_sz, double eps)
{
// Override precision for this method only:
- INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps);
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
const int SPACEDIM=MyMeshType::MY_SPACEDIM;
typedef typename MyMeshType::MyConnType ConnType;
const NumberingPolicy numPol=MyMeshType::My_numPol;
std::vector<INTERP_KERNEL::Node *> nodes(conn_elem_sz);
- INTERP_KERNEL::QuadraticPolygon *pol(nullptr);
+ INTERP_KERNEL::QuadraticPolygon *pol(0);
for(mcIdType j=0;j<conn_elem_sz;j++)
{
mcIdType nodeId(OTT<ConnType,numPol>::ind2C(conn_elem[j]));
pol=INTERP_KERNEL::QuadraticPolygon::BuildLinearPolygon(nodes);
else
pol=INTERP_KERNEL::QuadraticPolygon::BuildArcCirclePolygon(nodes);
- auto *n(new INTERP_KERNEL::Node(ptToTest[0],ptToTest[1]));
+ INTERP_KERNEL::Node *n(new INTERP_KERNEL::Node(ptToTest[0],ptToTest[1]));
double a(0.),b(0.),c(0.);
a=pol->normalizeMe(b,c); n->applySimilarity(b,c,a);
- bool const ret=pol->isInOrOut2(n);
+ bool ret=pol->isInOrOut2(n);
delete pol; n->decrRef();
return ret;
}
const NumberingPolicy numPol=MyMeshType::My_numPol;
int nbfaces = cmType.getNumberOfSons2(conn_elem,conn_elem_sz);
- std::unique_ptr<char[]> const sign( new char[nbfaces] );
+ std::unique_ptr<char[]> sign( new char[nbfaces] );
std::unique_ptr<ConnType[]> connOfSon( new ConnType[conn_elem_sz] );
- std::unique_ptr<double[]> const ptsOfTetrahedrizedPolyhedron( new double[3*3*nbfaces] );
+ std::unique_ptr<double[]> ptsOfTetrahedrizedPolyhedron( new double[3*3*nbfaces] );
for (int iface=0; iface<nbfaces; iface++)
{
NormalizedCellType typeOfSon;
}
}
double centerPt[3];
- double const normalizeFact = NormalizeTetrahedrizedPolyhedron(ptsOfTetrahedrizedPolyhedron.get(),nbfaces,centerPt);
+ double normalizeFact = NormalizeTetrahedrizedPolyhedron(ptsOfTetrahedrizedPolyhedron.get(),nbfaces,centerPt);
double ptToTestNorm[3] = {(ptToTest[0]-centerPt[0])/normalizeFact,
(ptToTest[1]-centerPt[1])/normalizeFact,
(ptToTest[2]-centerPt[2])/normalizeFact};
{
double p1=coords[(OTT<ConnType,numPol>::ind2C(conn_elem[0]))];
double p2=coords[(OTT<ConnType,numPol>::ind2C(conn_elem[1]))];
- double const delta=fabs(p1-p2)+eps;
- double const val=*ptToTest-std::min(p1,p2);
+ double delta=fabs(p1-p2)+eps;
+ double val=*ptToTest-std::min(p1,p2);
return val>-eps && val<delta;
}
throw INTERP_KERNEL::Exception("Invalid spacedim detected ! Managed spaceDim are 2 and 3 !");
#ifndef __POLYGONALGORITHMS_HXX__
#define __POLYGONALGORITHMS_HXX__
-#include <utility>
#include <vector>
#include <deque>
#include <map>
#include "PolygonAlgorithms.hxx"
#include "InterpolationUtils.hxx"
-#include <cmath>
-#include <deque>
-#include <cstdlib>
#include <list>
#include <map>
#include <iostream>
-#include <utility>
-#include <vector>
namespace INTERP_KERNEL
{
/* i is the local index of the current vertex */
/*************************************************************/
template<int DIM>
- inline void PolygonAlgorithms<DIM>::addNewVertex( int i, int i_glob, int i_next_glob, int /*i_prev_glob*/,
+ inline void PolygonAlgorithms<DIM>::addNewVertex( int i, int i_glob, int i_next_glob, int i_prev_glob,
const double * P)
{
/* Question:Should we add vertex i to the front or back ? */
//fifth and sixth arguments are useless here
{
/* Updating _End_segments */
- std::pair< int,int > const i_i_next = std::make_pair(i, i_next);
- std::pair< int,int > const j_j_next = std::make_pair(j, j_next);
+ std::pair< int,int > i_i_next = std::make_pair(i, i_next);
+ std::pair< int,int > j_j_next = std::make_pair(j, j_next);
if( _End_segments[0] == i_i_next)
{
for(int idim=DIM-1;idim>-1;idim--) _Inter.push_front(ABCD[idim]);
/* Updating _Status */
_Status.insert(make_pair(i_next,std::make_pair(i, false)));
- auto mi =_Status.find(j_next);
+ std::multimap< int, std::pair< int,bool> >::iterator mi =_Status.find(j_next);
((* mi).second).second= !((* mi).second).second;
}
else _Status.insert(std::make_pair(i_next,std::make_pair(i,true)));
int& j3, int& j3_glob, int& j4, int& j4_glob,
int& i_glob, int& i_next_glob, int& i_prev_glob,
const double * P_1, const double * P_2,
- int N1, int N2, int /*sign*/)
+ int N1, int N2, int sign)
{
int N0, shift;
if(i_glob < N1)
Poly1 = P_1;
Poly2 = P_2;
- auto mi1=_Status.rbegin();
+ std::multimap< int, std::pair< int,bool> >::reverse_iterator mi1=_Status.rbegin();
j1_glob=((*mi1).second).first;
j1=j1_glob-N1;
j2_glob=(*mi1).first;
Poly1 = P_2;
Poly2 = P_1;
- auto mi2= _Status.begin();
+ std::multimap< int, std::pair< int,bool> >::iterator mi2= _Status.begin();
j1_glob=((*mi2).second).first;
j1=j1_glob;
j2_glob=(*mi2).first;
/******** Treatment of the first vertex ********/
mi1=events.begin();
i_glob = (* mi1).second;
- bool const which_start = i_glob < N1;
+ bool which_start = i_glob < N1;
if(i_glob < N1){ i_next_glob = (i_glob +1)%N1; i_prev_glob = (i_glob -1+N1)%N1;}
else{ i_next_glob = (i_glob-N1+1)%N2 + N1;i_prev_glob = (i_glob-N1-1+N2)%N2 + N1;}
_Status.insert(std::make_pair(i_next_glob,std::make_pair(i_glob, false)));
which_is_inside[inside_j2] = std::make_pair(j1_glob,j2_glob);
which_is_inside[inside_j4] = std::make_pair(j3_glob,j4_glob);
- auto const min = which_is_inside.begin();
- auto minext = min;
+ std::map<double, std::pair<int,int> >::iterator min = which_is_inside.begin();
+ std::map<double, std::pair<int,int> >::iterator minext = min;
minext++;
- auto const max = which_is_inside.rbegin();
- auto j2_in_status = _Status.find(((*min).second).second);
- auto j4_in_status = _Status.find(((*minext).second).second);
+ std::map<double, std::pair<int,int> >::reverse_iterator max = which_is_inside.rbegin();
+ std::multimap< int, std::pair< int,bool> >::iterator j2_in_status = _Status.find(((*min).second).second);
+ std::multimap< int, std::pair< int,bool> >::iterator j4_in_status = _Status.find(((*minext).second).second);
if((*min).first < -_epsilon) //there is someone clearly inside
{
/* in the end, subP contains only the elements belonging to the convex hull, and not_in_hull the others */
/**************************************************************************/
template<int DIM>
- inline void PolygonAlgorithms<DIM>::convHull(const double *P, int /*N*/, double * normal,
+ inline void PolygonAlgorithms<DIM>::convHull(const double *P, int N, double * normal,
std::map< int,int >& subP, std::map< int,int >& not_in_hull,
int& NsubP, const double epsilon)
{
if(NsubP>3)
{
- auto mi_prev = subP.begin();
- auto mi = mi_prev;
+ std::map< int,int >::iterator mi_prev = subP.begin();
+ std::map< int,int >::iterator mi = mi_prev;
mi++;
- auto mi_next = mi;
+ std::map< int,int >::iterator mi_next = mi;
mi_next++;
double directframe=0.;
/* Check if the polygon subP is positively oriented */
- auto mi1=mi;
+ std::map< int,int >::iterator mi1=mi;
while(mi1 != subP.end() && distance2<DIM>(&P[DIM*(*subP.begin()).second],&P[DIM*(*mi1).second])< epsilon)
mi1++;
- auto mi2=mi1;
+ std::map< int,int >::iterator mi2=mi1;
while(mi2 != subP.end() && fabs(directframe)<epsilon)
{
directframe =direct_frame<DIM>(&P[DIM* (*mi1).second],
#define __POLYHEDRON3D2DINTERSECTORP0P0_HXX__
#include "Intersector3DP0P0.hxx"
-#include "MCIdType.hxx"
#include "SplitterTetra.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <map>
-#include <set>
-#include <vector>
namespace INTERP_KERNEL
{
template<class MyMeshType, class MyMatrixType>
class Polyhedron3D2DIntersectorP0P0 : public Intersector3DP0P0<MyMeshType,MyMatrixType>
{
- using DuplicateFacesType = typename std::map<mcIdType, std::set<mcIdType>>;
+ typedef typename std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
#ifndef __POLYHEDRON3D2DINTERSECTORP0P0_TXX__
#define __POLYHEDRON3D2DINTERSECTORP0P0_TXX__
-#include "NormalizedGeometricTypes"
-#include "Intersector3DP0P0.txx"
-#include "Intersector3D.hxx"
-#include "InterpolationUtils.hxx"
-#include "CellModel.hxx"
-#include "MCIdType.hxx"
#include "Polyhedron3D2DIntersectorP0P0.hxx"
+#include "Intersector3DP0P0.txx"
#include "MeshUtils.hxx"
-#include <vector>
-#include "SplitterTetra.txx"
-#include <set>
+#include "SplitterTetra.txx"
namespace INTERP_KERNEL
{
const CellModel& cellModelCell=CellModel::GetCellModel(normCellType);
const MyMeshType& src_mesh = Intersector3D<MyMeshType,MyMatrixType>::_src_mesh;
ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes();
- auto *polyNodes=new mcIdType[nbOfNodes4Type];
- auto **polyCoords = new double*[nbOfNodes4Type];
+ mcIdType *polyNodes=new mcIdType[nbOfNodes4Type];
+ double **polyCoords = new double*[nbOfNodes4Type];
for(int i = 0;i<(int)nbOfNodes4Type;++i)
{
// we could store mapping local -> global numbers too, but not sure it is worth it
if (isSrcFaceColinearWithFaceOfTetraTargetCell)
{
- auto intersectFacesIter = _intersect_faces.find(cellSrcIdx);
+ DuplicateFacesType::iterator intersectFacesIter = _intersect_faces.find(cellSrcIdx);
if (intersectFacesIter != _intersect_faces.end())
{
intersectFacesIter->second.insert(targetCell);
#include "Intersector3DP0P0.hxx"
#include "SplitterTetra.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
#define __POLYHEDRONINTERSECTORP0P0_TXX__
#include "PolyhedronIntersectorP0P0.hxx"
-
-#include <vector>
-
-#include "NormalizedGeometricTypes"
#include "Intersector3DP0P0.txx"
-#include "InterpolationUtils.hxx"
+#include "MeshUtils.hxx"
+
#include "SplitterTetra.txx"
namespace INTERP_KERNEL
#include "Intersector3DP0P1.hxx"
#include "SplitterTetra.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
#ifndef __POLYHEDRONINTERSECTORP0P1_TXX__
#define __POLYHEDRONINTERSECTORP0P1_TXX__
-#include "NormalizedGeometricTypes"
-#include "Intersector3DP0P1.txx"
-#include "InterpolationUtils.hxx"
#include "PolyhedronIntersectorP0P1.hxx"
+#include "Intersector3DP0P1.txx"
+#include "MeshUtils.hxx"
-#include "SplitterTetra.hxx"
-#include <sstream>
-#include <vector>
+#include "SplitterTetra.txx"
namespace INTERP_KERNEL
{
for(typename std::vector<SplitterTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
{
(*iter)->splitIntoDualCells(subTetras);
- for(auto tmp : subTetras)
+ for(int i=0;i<24;i++)
{
+ SplitterTetra<MyMeshType> *tmp=subTetras[i];
double volume = tmp->intersectSourceCell(*iterCellS);
if(volume!=0.)
{
#include "Intersector3DP1P0.hxx"
#include "SplitterTetra.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
#ifndef __POLYHEDRONINTERSECTORP1P0_TXX__
#define __POLYHEDRONINTERSECTORP1P0_TXX__
-#include "NormalizedGeometricTypes"
-#include "Intersector3DP1P0.txx"
-#include "InterpKernelException.hxx"
-#include "InterpolationUtils.hxx"
-#include "Intersector3D.txx"
#include "PolyhedronIntersectorP1P0.hxx"
+#include "Intersector3DP1P0.txx"
+#include "MeshUtils.hxx"
#include "SplitterTetra.txx"
-#include <vector>
namespace INTERP_KERNEL
{
{
(*iter)->splitIntoDualCells(subTetras);
double vol2 = 0.;
- for(auto tmp : subTetras)
+ for(int i=0;i<24;i++)
{
+ SplitterTetra<MyMeshType> *tmp=subTetras[i];
double volume = tmp->intersectSourceCell(targetCell);
vol2 += volume;
ConnType sourceNode=tmp->getId(0);
#include "Intersector3DP1P0Bary.hxx"
#include "SplitterTetra.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
#ifndef __PolyhedronIntersectorP1P0Bary_TXX__
#define __PolyhedronIntersectorP1P0Bary_TXX__
-#include "NormalizedGeometricTypes"
-#include "Intersector3DP1P0Bary.txx"
-#include "InterpolationUtils.hxx"
-#include "Intersector3D.txx"
#include "PolyhedronIntersectorP1P0Bary.hxx"
-// #include "MeshUtils.hxx"
+#include "Intersector3DP1P0Bary.txx"
+#include "MeshUtils.hxx"
#include "SplitterTetra.txx"
-#include <vector>
namespace INTERP_KERNEL
{
#define __PolyhedronIntersectorP1P1_HXX__
#include "Intersector3DP1P1.hxx"
+#include "SplitterTetra.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
#define __PolyhedronIntersectorP1P1_TXX__
#include "PolyhedronIntersectorP1P1.hxx"
-
-#include "NormalizedGeometricTypes"
#include "Intersector3DP1P1.txx"
-#include "InterpolationUtils.hxx"
-#include "Intersector3D.txx"
-// #include "MeshUtils.hxx"
+#include "MeshUtils.hxx"
#include "SplitterTetra.txx"
-#include <vector>
-#include <utility>
namespace INTERP_KERNEL
{
* @param policy splitting policy to be used
*/
template<class MyMeshType, class MyMatrix>
- PolyhedronIntersectorP1P1<MyMeshType,MyMatrix>::PolyhedronIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy /*policy*/):Intersector3DP1P1<MyMeshType,MyMatrix>(targetMesh,srcMesh)
+ PolyhedronIntersectorP1P1<MyMeshType,MyMatrix>::PolyhedronIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy):Intersector3DP1P1<MyMeshType,MyMatrix>(targetMesh,srcMesh)
{
// SPEC:
// "Limitation. Concerning P1P1 3D improvement only tetrahedron will be supported.
*/
template<class MyMeshType, class MyMatrix>
PolyhedronIntersectorP1P1<MyMeshType,MyMatrix>::~PolyhedronIntersectorP1P1()
- = default;
+ {
+ }
/**
* Calculates the volume of intersection of an element in the source mesh and the target element
srcTetra.splitIntoDualCells(subTetrasS);
// intersect each target subTetra with each source one
- for(auto tmp : subTetrasS)
+ for(int i=0;i<24;i++)
{
+ SplitterTetra<MyMeshType> *tmp=subTetrasS[i];
ConnType sourceNode=OTT<ConnType,numPol>::indFC(tmp->getId(0));
- for(auto & subTetraNode : subTetraNodes)
+ for(int j=0;j<24;j++)
{
- const double* tetraNodes12 = &subTetraNode.second[0];
+ const double* tetraNodes12 = &subTetraNodes[j].second[0];
const double* tetraNodesT[4]={ tetraNodes12, tetraNodes12+3, tetraNodes12+6, tetraNodes12+9 };
double volume = tmp->intersectTetra( tetraNodesT );
if(volume!=0.)
{
- ConnType tgtNode=subTetraNode.first;
+ ConnType tgtNode=subTetraNodes[j].first;
typename MyMatrix::value_type& resRow = res[tgtNode];
typename MyMatrix::value_type::const_iterator iterRes=resRow.find( sourceNode );
if(iterRes!=resRow.end())
{
public:
- RegionNode() = default;
+ RegionNode() { }
- ~RegionNode() = default;
+ ~RegionNode() { }
/**
* Accessor to source region
// Author : Anthony Geay (CEA/DEN)
#include "SplitterTetra.hxx"
-#include "MCIdType.hxx"
-#include "InterpKernelException.hxx"
-#include <vector>
-#include <iterator>
-#include <cstddef>
namespace INTERP_KERNEL
{
tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.;
for(int j=0;j<4;j++,conn+=4)
{
- mcIdType const tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]);
+ mcIdType tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]);
tmp2[0]+=coords[3*tmp3+0];
tmp2[1]+=coords[3*tmp3+1];
tmp2[2]+=coords[3*tmp3+2];
{
case NORM_TETRA4:
{
- std::size_t const sz(std::distance(nodalConnBg,nodalConnEnd));
+ std::size_t sz(std::distance(nodalConnBg,nodalConnEnd));
if(sz!=4)
throw INTERP_KERNEL::Exception("SplitIntoTetras : input tetra do not have 4 nodes !");
tetrasNodalConn.insert(tetrasNodalConn.end(),nodalConnBg,nodalConnEnd);
conn[0]=work[j]; conn[1]=work[(j+1)%nbOfNodesOfFace]; conn[2]=-(i+1); conn[3]=ToIdType(-(nbOfFaces+1));
tmp[0]+=coords[3*work[j]+0]; tmp[1]+=coords[3*work[j]+1]; tmp[2]+=coords[3*work[j]+2];
}
- auto const nbNF = (double)nbOfNodesOfFace;
+ double nbNF = (double)nbOfNodesOfFace;
tmp[0]/=nbNF; tmp[1]/=nbNF; tmp[2]/=nbNF;
tmp2[0]+=tmp[0]; tmp2[1]+=tmp[1]; tmp2[2]+=tmp[2];
work+=nbOfNodesOfFace+1;
}
- auto const nbF = (double)nbOfFaces;
+ double nbF = (double)nbOfFaces;
tmp2[0]/=nbF; tmp2[1]/=nbF; tmp2[2]/=nbF;
return ;
}
#define __SPLITTERTETRA_HXX__
#include "INTERPKERNELDefines.hxx"
-#include "InterpKernelHashFun.hxx"
#include "TransformedTriangle.hxx"
#include "TetraAffineTransform.hxx"
+#include "InterpolationOptions.hxx"
+#include "InterpKernelException.hxx"
#include "InterpKernelHashMap.hxx"
#include "VectorUtils.hxx"
#include "MCIdType.hxx"
-#include "NormalizedGeometricTypes"
#include <functional>
-#include <utility>
#include <vector>
#include <cassert>
+#include <map>
#include <set>
namespace INTERP_KERNEL
class SplitterTetra
{
public:
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId);
~SplitterTetra();
- double intersectSourceCell(typename MyMeshType::MyConnType srcCell, double* baryCentre=nullptr);
+ double intersectSourceCell(typename MyMeshType::MyConnType srcCell, double* baryCentre=0);
double intersectSourceFace(const NormalizedCellType polyType,
const ConnType polyNodesNbr,
const ConnType *const polyNodes,
inline void SplitterTetra<MyMeshType>::calculateNode(typename MyMeshType::MyConnType globalNodeNum)
{
const double* node = _src_mesh.getCoordinatesPtr()+MyMeshType::MY_SPACEDIM*globalNodeNum;
- auto* transformedNode = new double[MyMeshType::MY_SPACEDIM];
+ double* transformedNode = new double[MyMeshType::MY_SPACEDIM];
assert(transformedNode != 0);
_t->apply(transformedNode, node);
_nodes[globalNodeNum] = transformedNode;
template<class MyMeshType>
inline void SplitterTetra<MyMeshType>::calculateNode2(typename MyMeshType::MyConnType globalNodeNum, const double* node)
{
- auto* transformedNode = new double[MyMeshType::MY_SPACEDIM];
+ double* transformedNode = new double[MyMeshType::MY_SPACEDIM];
assert(transformedNode != 0);
_t->apply(transformedNode, node);
_nodes[globalNodeNum] = transformedNode;
#ifndef __SPLITTERTETRA_TXX__
#define __SPLITTERTETRA_TXX__
-#include "InterpKernelHashMap.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include "InterpolationUtils.hxx"
#include "SplitterTetra.hxx"
#include "TetraAffineTransform.hxx"
#include <cmath>
#include <cassert>
-#include <iostream>
-#include <cstddef>
-#include <functional>
-#include <set>
+#include <string>
+#include <sstream>
#include <vector>
namespace INTERP_KERNEL
*/
template<class MyMeshType>
SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId)
- : _t(nullptr), _src_mesh(srcMesh)
+ : _t(0), _src_mesh(srcMesh)
{
std::copy(nodesId,nodesId+4,_conn);
_coords[0]=tetraCorners[0][0]; _coords[1]=tetraCorners[0][1]; _coords[2]=tetraCorners[0][2];
* \param [in] tetraCorners array 4*3 doubles containing corners of input tetrahedron (P0X,P0Y,P0Y,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z).
*/
template<class MyMeshType>
- SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn): _t(nullptr),_src_mesh(srcMesh)
+ SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn): _t(0),_src_mesh(srcMesh)
{
if(!conn)
{ _conn[0]=0; _conn[1]=1; _conn[2]=2; _conn[3]=3; }
void SplitterTetra<MyMeshType>::splitMySelfForDual(double* output, int i, typename MyMeshType::MyConnType& nodeId)
{
double *tmp[4];
- int const offset=i/6;
+ int offset=i/6;
nodeId=_conn[offset];
tmp[0]=_coords+3*offset; tmp[1]=_coords+((offset+1)%4)*3; tmp[2]=_coords+((offset+2)%4)*3; tmp[3]=_coords+((offset+3)%4)*3;
- int const caseToTreat=i%6;
- int const case1=caseToTreat/2;
- int const case2=caseToTreat%2;
+ int caseToTreat=i%6;
+ int case1=caseToTreat/2;
+ int case2=caseToTreat%2;
const int tab[3][2]={{1,2},{3,2},{1,3}};
const int *curTab=tab[case1];
double pt0[3]; pt0[0]=(tmp[curTab[case2]][0]+tmp[0][0])/2.; pt0[1]=(tmp[curTab[case2]][1]+tmp[0][1])/2.; pt0[2]=(tmp[curTab[case2]][2]+tmp[0][2])/2.;
bool isTargetOutside = false;
// calculate the coordinates of the nodes
- auto *cellNodes=new ConnType[nbOfNodes4Type];
+ ConnType *cellNodes=new ConnType[nbOfNodes4Type];
for(ConnType i = 0;i<nbOfNodes4Type;++i)
{
// we could store mapping local -> global numbers too, but not sure it is worth it
// halfspace filtering check
// NB : might not be beneficial for caching of triangles
- for(bool const i : isOutside)
- if(i)
+ for(int i = 0; i < 8; ++i)
+ if(isOutside[i])
isTargetOutside = true;
double totalVolume = 0.0;
// Map 2D intersections back to the 3D triangle space.
if (maxNormal == 0)
{
- double const invNX = ((double) 1.) / planeNormal[0];
+ double invNX = ((double) 1.) / planeNormal[0];
for (i = 0; i < nb_inter; i++)
{
inter3[3 * i + 1] = inter2[2 * i];
}
else if (maxNormal == 1)
{
- double const invNY = ((double) 1.) / planeNormal[1];
+ double invNY = ((double) 1.) / planeNormal[1];
for (i = 0; i < nb_inter; i++)
{
inter3[3 * i] = inter2[2 * i];
}
else
{
- double const invNZ = ((double) 1.) / planeNormal[2];
+ double invNZ = ((double) 1.) / planeNormal[2];
for (i = 0; i < nb_inter; i++)
{
inter3[3 * i] = inter2[2 * i];
{ 0, 3, 1 },
{ 1, 2, 3 } };
double planeNormal[3];
- for (auto tetraFaceNodesConn : tetraFacesNodesConn)
+ for (int iTetraFace = 0; iTetraFace < 4; ++iTetraFace)
{
+ const int * const tetraFaceNodesConn = tetraFacesNodesConn[iTetraFace];
TriangleFaceKey key = TriangleFaceKey(_conn[tetraFaceNodesConn[0]],
_conn[tetraFaceNodesConn[1]],
_conn[tetraFaceNodesConn[2]]);
const double normOfTetraTriNormal = norm(planeNormal);
if (epsilonEqual(normOfTetraTriNormal, 0.))
{
- for (double & i : planeNormal)
+ for (int i = 0; i < 3; ++i)
{
- i = 0.;
+ planeNormal[i] = 0.;
}
}
else
{
const double invNormOfTetraTriNormal = 1. / normOfTetraTriNormal;
- for (double & i : planeNormal)
+ for (int i = 0; i < 3; ++i)
{
- i *= invNormOfTetraTriNormal;
+ planeNormal[i] *= invNormOfTetraTriNormal;
}
}
- double const planeConstant = dot(planeNormal, coordsTetraTriNode1);
+ double planeConstant = dot(planeNormal, coordsTetraTriNode1);
if (IsFacesCoplanar(planeNormal, planeConstant, polyCoords, precision))
{
ConnType nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles
// halfspace filtering check
// NB : might not be beneficial for caching of triangles
- for(bool const i : isOutside)
+ for(int i = 0; i < 8; ++i)
{
- if(i)
+ if(isOutside[i])
{
isTargetOutside = true;
}
cellModelCell.fillSonCellNodalConnectivity(ii,cellNodes,faceNodes);
TransformedTriangle tri(nodes[faceNodes[0]], nodes[faceNodes[1]], nodes[faceNodes[2]]);
- double const vol = tri.calculateIntersectionVolume();
+ double vol = tri.calculateIntersectionVolume();
LOG(1, "ii = " << ii << " Volume=" << vol)
totalVolume += vol;
}
// free potential sub-mesh nodes that have been allocated
if(_nodes.size()>=/*8*/_node_ids.size())
{
- auto nbOfNodesT = static_cast<typename MyMeshTypeT::MyConnType>(_node_ids.size());
- auto iter = _nodes.begin() + /*8*/nbOfNodesT;
+ typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast<typename MyMeshTypeT::MyConnType>(_node_ids.size());
+ std::vector<const double*>::iterator iter = _nodes.begin() + /*8*/nbOfNodesT;
while(iter != _nodes.end())
{
delete[] *iter;
nodes[node]=getCoordsOfNode2(node, OTT<ConnType,numPol>::indFC(targetCell),_target_mesh,conn[node]);
}
std::copy(conn,conn+4,_node_ids.begin());
- auto* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
tetra.push_back(t);
return ;
}
nodes[j] = getCoordsOfSubNode2(conn[j],realConn);
conn[j] = realConn;
}
- auto* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
tetra.push_back(t);
}
}
conn[j] = subZone[SPLIT_NODES_6[4*i+j]];
func(*this,conn[j],nodes[j]);
}
- auto* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
tetra.push_back(t);
}
}
conn[2] = TETRA_EDGES_GENERAL_24[2*row];
conn[3] = TETRA_EDGES_GENERAL_24[2*row + 1];
func(*this,conn,nodes);
- auto* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes, conn);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes, conn);
tetra.push_back(t);
}
}
// create tetrahedra
const double* nodes[4];
typename MyMeshTypeS::MyConnType conn[4];
- for(auto i : SPLIT_PYPA5)
+ for(int i = 0; i < 2; ++i)
{
for(int j = 0; j < 4; ++j)
- nodes[j] = getCoordsOfSubNode2(i[j],conn[j]);
- auto* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
+ nodes[j] = getCoordsOfSubNode2(SPLIT_PYPA5[i][j],conn[j]);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
tetra.push_back(t);
}
}
if ( normCellType != NORM_POLYHED )
cellModelCell.fillSonCellNodalConnectivity(ii,&allNodeIndices[0],faceNodes);
- int const nbTetra = nbFaceNodes - 2; // split polygon into nbTetra triangles
+ int nbTetra = nbFaceNodes - 2; // split polygon into nbTetra triangles
// create tetrahedra
for(int i = 0; i < nbTetra; ++i)
nodes[0] = getCoordsOfSubNode2( faceNodes[0], conn[0]);
nodes[1] = getCoordsOfSubNode2( faceNodes[1+i],conn[1]);
nodes[2] = getCoordsOfSubNode2( faceNodes[2+i],conn[2]);
- auto* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
tetra.push_back(t);
}
{
// retrieve real mesh nodes
- auto nbOfNodesT = static_cast<typename MyMeshTypeT::MyConnType>(_node_ids.size());// Issue 0020634. _node_ids.resize(8);
+ typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast<typename MyMeshTypeT::MyConnType>(_node_ids.size());// Issue 0020634. _node_ids.resize(8);
for(int node = 0; node < nbOfNodesT ; ++node)
{
// calculate only normal nodes
{
for(int i = 0; i < 7; ++i)
{
- auto* barycenter = new double[3];
+ double* barycenter = new double[3];
calcBarycenter(4, barycenter, &GENERAL_24_SUB_NODES[4*i]);
_nodes.push_back(barycenter);
}
{
for(int i = 0; i < 19; ++i)
{
- auto* barycenter = new double[3];
+ double* barycenter = new double[3];
calcBarycenter(2, barycenter, &GENERAL_48_SUB_NODES[2*i]);
_nodes.push_back(barycenter);
}
// add barycenter of a cell
std::vector<int> allIndices(nbOfNodesT);
for ( int i = 0; i < nbOfNodesT; ++i ) allIndices[i] = i;
- auto* barycenter = new double[3];
+ double* barycenter = new double[3];
calcBarycenter(nbOfNodesT, barycenter, &allIndices[0]);
_nodes.push_back(barycenter);
}
#ifndef __TARGETINTERSECTOR__HXX__
#define __TARGETINTERSECTOR__HXX__
+#include "INTERPKERNELDefines.hxx"
-#include <cstddef>
#include <vector>
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
public:
/*!
* Tool for cell intersection, result is always positive.
virtual ConnType getNumberOfRowsOfResMatrix() const = 0;
virtual ConnType getNumberOfColsOfResMatrix() const = 0;
- virtual ~TargetIntersector() = default;
+ virtual ~TargetIntersector() { }
void adjustBoundingBoxes(std::vector<double>& bbox, double adjustmentEps, double adjustmentEpsAbs);
void adjustBoundingBoxes(double *bbox, std::size_t sz, double adjustmentEps, double adjustmentEpsAbs);
};
#define __TARGETINTERSECTOR__TXX__
#include "TargetIntersector.hxx"
-#include <cstddef>
#include <limits>
-#include <vector>
namespace INTERP_KERNEL
{
}
// swap rows in index vector
- int const tmp = idx[k];
+ int tmp = idx[k];
idx[k] = idx[row];
idx[row] = tmp;
//
#include "TransformedTriangle.hxx"
-#include "Log.hxx"
#include "VectorUtils.hxx"
#include "TetraAffineTransform.hxx"
-#include <cmath>
-#include <cstddef>
#include <iostream>
+#include <fstream>
#include <cassert>
#include <algorithm>
+#include <functional>
+#include <iterator>
#include <math.h>
#include <vector>
// };
// double sign = uv_xy[0] * uv_xy[3] - uv_xy[1] * uv_xy[2];
- int const sign = isTriangleInclinedToFacet( OXY );
+ int sign = isTriangleInclinedToFacet( OXY );
if(sign == 0 )
{
{
if(testSurfaceEdgeIntersection(edge))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
calcIntersectionPtSurfaceEdge(edge, ptA);
_polygonA.push_back(ptA);
LOG(3,"Surface-edge (edge " << strTE(edge) << "): " << vToStr(ptA) << " added to A ");
if(edge >= XY)
{
- auto* ptB = new double[3];
+ double* ptB = new double[3];
copyVector3(ptA, ptB);
_polygonB.push_back(ptB);
LOG(3,"Surface-edge (edge " << strTE(edge) << "): " << vToStr(ptB) << " added to B ");
{
if(testSurfaceRayIntersection(corner))
{
- auto* ptB = new double[3];
+ double* ptB = new double[3];
copyVector3(&COORDS_TET_CORNER[3 * corner], ptB);
_polygonB.push_back(ptB);
LOG(3,"Surface-ray (corner " << strTC(corner) << "): " << vToStr(ptB) << " added to B");
if(doTest && testSegmentFacetIntersection(seg, facet))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
calcIntersectionPtSegmentFacet(seg, facet, ptA);
_polygonA.push_back(ptA);
LOG(3,"Segment-facet (facet " << strTF(facet) << ", seg " << strTriS(seg) << "): " << vToStr(ptA) << " added to A");
if(facet == XYZ)
{
- auto* ptB = new double[3];
+ double* ptB = new double[3];
copyVector3(ptA, ptB);
_polygonB.push_back(ptB);
LOG(3,"Segment-facet (facet " << strTF(facet) << ", seg " << strTriS(seg) << "): " << vToStr(ptB) << " added to B");
// segment - edge
for(TetraEdge edge = OX ; edge <= ZX ; edge = TetraEdge(edge + 1))
{
- const auto edge_dp = DoubleProduct(edge);
+ const DoubleProduct edge_dp = DoubleProduct(edge);
if(isZero[edge_dp] && testSegmentEdgeIntersection(seg, edge))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
calcIntersectionPtSegmentEdge(seg, edge, ptA);
_polygonA.push_back(ptA);
LOG(3,"Segment-edge (edge " << strTE(edge) << ", seg " << strTriS(seg) << "): " << vToStr(ptA) << " added to A");
if(edge >= XY)
{
- auto* ptB = new double[3];
+ double* ptB = new double[3];
copyVector3(ptA, ptB);
_polygonB.push_back(ptB);
LOG(3,"Segment-edge (edge " << strTE(edge) << ", seg " << strTriS(seg) << "): " << vToStr(ptA) << " added to B");
if(doTest && testSegmentCornerIntersection(seg, corner))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
copyVector3(&COORDS_TET_CORNER[3 * corner], ptA);
_polygonA.push_back(ptA);
LOG(3,"Segment-corner (corner " << strTC(corner) << ", seg " << strTriS(seg) << "): " << vToStr(ptA) << " added to A");
if(corner != O)
{
- auto* ptB = new double[3];
+ double* ptB = new double[3];
_polygonB.push_back(ptB);
copyVector3(&COORDS_TET_CORNER[3 * corner], ptB);
LOG(3,"Segment-corner (corner " << strTC(corner) << ", seg " << strTriS(seg) << "): " << vToStr(ptB) << " added to B");
{
if(isZero[DP_SEGMENT_RAY_INTERSECTION[7*(corner-1)]] && testSegmentRayIntersection(seg, corner))
{
- auto* ptB = new double[3];
+ double* ptB = new double[3];
copyVector3(&COORDS_TET_CORNER[3 * corner], ptB);
_polygonB.push_back(ptB);
LOG(3,"Segment-ray (corner " << strTC(corner) << ", seg " << strTriS(seg) << "): " << vToStr(ptB) << " added to B");
#endif
if(testSegmentHalfstripIntersection(seg, edge))
{
- auto* ptB = new double[3];
+ double* ptB = new double[3];
calcIntersectionPtSegmentHalfstrip(seg, edge, ptB);
_polygonB.push_back(ptB);
LOG(3,"Segment-halfstrip : " << vToStr(ptB) << " added to B");
// tetrahedron
if(testCornerInTetrahedron(corner))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
copyVector3(&_coords[5*corner], ptA);
_polygonA.push_back(ptA);
LOG(3,"Inclusion tetrahedron (corner " << strTriC(corner) << "): " << vToStr(ptA) << " added to A");
// XYZ - plane
if(testCornerOnXYZFacet(corner))
{
- auto* ptB = new double[3];
+ double* ptB = new double[3];
copyVector3(&_coords[5*corner], ptB);
_polygonB.push_back(ptB);
LOG(3,"Inclusion XYZ-plane (corner " << strTriC(corner) << "): " << vToStr(ptB) << " added to B");
// projection on XYZ - facet
if(testCornerAboveXYZFacet(corner))
{
- auto* ptB = new double[3];
+ double* ptB = new double[3];
copyVector3(&_coords[5*corner], ptB);
ptB[2] = 1 - ptB[0] - ptB[1]; // lower z to project on XYZ
assert(epsilonEqual(ptB[0]+ptB[1]+ptB[2] - 1, 0.0));
{
if(testSurfaceEdgeIntersection(edge))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
calcIntersectionPtSurfaceEdge(edge, ptA);
_polygonA.push_back(ptA);
LOG(3,"Surface-edge : " << vToStr(ptA) << " added to A ");
if(doTest && testSegmentFacetIntersection(seg, facet))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
calcIntersectionPtSegmentFacet(seg, facet, ptA);
_polygonA.push_back(ptA);
LOG(3,"Segment-facet : " << vToStr(ptA) << " added to A");
// segment - edge
for(TetraEdge edge = OX ; edge <= ZX ; edge = TetraEdge(edge + 1))
{
- const auto edge_dp = DoubleProduct(edge);
+ const DoubleProduct edge_dp = DoubleProduct(edge);
if(isZero[edge_dp] && testSegmentEdgeIntersection(seg, edge))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
calcIntersectionPtSegmentEdge(seg, edge, ptA);
_polygonA.push_back(ptA);
LOG(3,"Segment-edge : " << vToStr(ptA) << " added to A");
if(doTest && testSegmentCornerIntersection(seg, corner))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
copyVector3(&COORDS_TET_CORNER[3 * corner], ptA);
_polygonA.push_back(ptA);
LOG(3,"Segment-corner : " << vToStr(ptA) << " added to A");
// tetrahedron
if(testCornerInTetrahedron(corner))
{
- auto* ptA = new double[3];
+ double* ptA = new double[3];
copyVector3(&_coords[5*corner], ptA);
_polygonA.push_back(ptA);
LOG(3,"Inclusion tetrahedron : " << vToStr(ptA) << " added to A");
}
// create order object
- SortOrder const order(barycenter, type);
+ SortOrder order(barycenter, type);
// sort vector with this object
// NB : do not change place of first object, with respect to which the order
#include "VectorUtils.hxx"
#include "assert.h"
-#include <string>
-#include <cmath>
-#include <map>
#include <vector>
// Levels :
_coords[5*corner + 3] // z
};
- for(double const i : pt)
+ for(int i = 0 ; i < 4 ; ++i)
{
- if(i < 0.0 || i > 1.0)
+ if(pt[i] < 0.0 || pt[i] > 1.0)
{
return false;
}
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "Log.hxx"
#include "TransformedTriangle.hxx"
+#include <iostream>
+#include <fstream>
#include <cassert>
#include <cmath>
+#include "VectorUtils.hxx"
namespace INTERP_KERNEL
{
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "Log.hxx"
#include "TransformedTriangle.hxx"
-#include <algorithm>
+#include <iostream>
+#include <fstream>
#include <cassert>
#include <cmath>
#include <limits>
#include <map>
-#include <math.h>
#include <utility>
#include "VectorUtils.hxx"
double TransformedTriangle::calculateDistanceCornerSegment(const TetraCorner corner, const TriSegment seg) const
{
// NB uses fact that TriSegment <=> TriCorner that is first point of segment (PQ <=> P)
- const auto ptP_idx = TriCorner(seg);
- const auto ptQ_idx = TriCorner( (seg + 1) % 3);
+ const TriCorner ptP_idx = TriCorner(seg);
+ const TriCorner ptQ_idx = TriCorner( (seg + 1) % 3);
const double ptP[3] = { _coords[5*ptP_idx], _coords[5*ptP_idx + 1], _coords[5*ptP_idx + 2] };
const double ptQ[3] = { _coords[5*ptQ_idx], _coords[5*ptQ_idx + 1], _coords[5*ptQ_idx + 2] };
const DoubleProduct dp = DP_FOR_DETERMINANT_EXPANSION[3*corner + (row - 1)];
// get edge by using correspondence between Double Product and Edge
- auto const edge = TetraEdge(dp);
+ TetraEdge edge = TetraEdge(dp);
// use edge only if it is surrounded by the surface
if( _triangleSurroundsEdgeCache[edge] )
void rotate_x (double* P)
{
_rotation_coeffs[0]=1.0;
- double const r_sqr = P[1]*P[1]+P[2]*P[2];
+ double r_sqr = P[1]*P[1]+P[2]*P[2];
if (r_sqr < EPS)
{_rotation_coeffs[4]=1.0; _rotation_coeffs[8]=1.0; return;}
- double const r = sqrt(r_sqr);
- double const cos =P[1]/r;
- double const sin =P[2]/r;
+ double r = sqrt(r_sqr);
+ double cos =P[1]/r;
+ double sin =P[2]/r;
_rotation_coeffs[4]=cos;
_rotation_coeffs[5]=sin;
void rotate_z (double* P)
{
_rotation_coeffs[8]=1.0;
- double const r_sqr = P[0]*P[0]+P[1]*P[1];
+ double r_sqr = P[0]*P[0]+P[1]*P[1];
if (r_sqr < EPS)
{_rotation_coeffs[4]=1.0; _rotation_coeffs[0]=1.0; return;}
- double const r = sqrt(r_sqr);
- double const cos =P[0]/r;
- double const sin =P[1]/r;
+ double r = sqrt(r_sqr);
+ double cos =P[0]/r;
+ double sin =P[1]/r;
_rotation_coeffs[0]=cos;
_rotation_coeffs[1]=sin;
#ifndef __TRIANGULATIONINTERSECTOR_HXX__
#define __TRIANGULATIONINTERSECTOR_HXX__
-#include "NormalizedUnstructuredMesh.hxx"
-#include <vector>
+#include "PlanarIntersectorP0P0.hxx"
+#include "PlanarIntersectorP0P1.hxx"
+#include "PlanarIntersectorP1P0.hxx"
+#include "PlanarIntersectorP1P1.hxx"
+#include "PlanarIntersectorP1P0Bary.hxx"
namespace INTERP_KERNEL
{
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
static const int MESHDIM=MyMeshType::MY_MESHDIM;
- using ConnType = typename MyMeshType::MyConnType;
+ typedef typename MyMeshType::MyConnType ConnType;
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
TriangulationIntersector(const MyMeshType& meshT, const MyMeshType& meshS,
#ifndef __TRIANGULATIONINTERSECTOR_TXX__
#define __TRIANGULATIONINTERSECTOR_TXX__
-#include "InterpKernelUtilities.hxx"
#include "TriangulationIntersector.hxx"
-#include "PlanarIntersector.hxx"
+#include "PlanarIntersectorP0P0.txx"
+#include "PlanarIntersectorP0P1.txx"
+#include "PlanarIntersectorP1P0.txx"
+#include "PlanarIntersectorP1P0Bary.txx"
+
#include "InterpolationUtils.hxx"
+#include "PlanarIntersector.hxx"
#include <iostream>
-#include <vector>
-
-
#define TRI_INTERSECTOR TriangulationIntersector<MyMeshType,MyMatrix,InterpType>
#define TRI_INTER_TEMPLATE template<class MyMeshType, class MyMatrix, \
//
#include "UnitTetraIntersectionBary.hxx"
-#include "TransformedTriangle.hxx"
#include "VectorUtils.hxx"
#include "InterpolationUtils.hxx"
#include "VolSurfFormulae.hxx"
-#include <vector>
-#include <cmath>
-#include <list>
-#include <cstddef>
#define NB_TETRA_SIDES 4
#define NB_TETRA_NODES 4
}
// check if polygon orientation is same as the one of triangle
- auto p = pPolygonA->begin(), pEnd = pPolygonA->end();
+ std::vector<double*>::const_iterator p = pPolygonA->begin(), pEnd = pPolygonA->end();
#ifdef DMP_UNITTETRAINTERSECTIONBARY
std::cout.precision(18);
std::cout << "**** int polygon() " << std::endl;
baryCenter[0] = baryCenter[1] = baryCenter[2] = 0.;
- auto f = _faces.begin(), fEnd = _faces.end();
+ std::list< std::vector< double* > >::iterator f = _faces.begin(), fEnd = _faces.end();
double * PP = f->at(0);
for ( ++f; f != fEnd; ++f )
continue;
bool pBelongsToPoly = false;
- auto v = polygon.begin(), vEnd = polygon.end();
+ std::vector<double*>::iterator v = polygon.begin(), vEnd = polygon.end();
for ( ; !pBelongsToPoly && v != vEnd; ++v )
pBelongsToPoly = samePoint( PP, *v );
if ( pBelongsToPoly )
bool sideAdded[NB_TETRA_SIDES] = { false, false, false, false };
int nbAddedSides = 0;
- auto f = _faces.begin(), fEnd = _faces.end();
+ std::list< std::vector< double* > >::iterator f = _faces.begin(), fEnd = _faces.end();
for ( ; f != fEnd; ++f )
{
- std::vector< double* > const& polygon = *f;
+ std::vector< double* >& polygon = *f;
double coordSum[3] = {0,0,0};
- for (auto p : polygon)
+ for ( int i = 0; i < (int)polygon.size(); ++i )
{
+ double* p = polygon[i];
coordSum[0] += p[0];
coordSum[1] += p[1];
coordSum[2] += p[2];
// Add segments of already added polygons to future polygonal faces on sides of tetra
// ---------------------------------------------------------------------------------
- std::size_t const nbIntersectPolygs = _faces.size();
+ std::size_t nbIntersectPolygs = _faces.size();
std::vector< double* > * sideFaces[ 4 ]; // future polygons on sides of tetra
for ( int i = 0; i < NB_TETRA_SIDES; ++i )
{
- sideFaces[ i ]=nullptr;
+ sideFaces[ i ]=0;
if ( !sideAdded[ i ] )
{
_faces.push_back( std::vector< double* > () );
if ( ic ) corner2Poly[ ic-1 ] -= 1.0;
// _polyNormals are outside of a tetrahedron
- double const dot = dotprod<3>( corner2Poly, &_polyNormals[iF][0] );
+ double dot = dotprod<3>( corner2Poly, &_polyNormals[iF][0] );
if ( dot < -DEFAULT_ABS_TOL*DEFAULT_ABS_TOL )
{
#ifdef DMP_UNITTETRAINTERSECTIONBARY
if ( !sideFaces[i] ) continue;
std::vector< double* >& sideFace = *sideFaces[i];
- std::size_t const nbPoints = sideFace.size();
+ std::size_t nbPoints = sideFace.size();
if ( nbPoints == 0 )
continue; // not intersected face at all - no cut off corners can be detected
bool isSegmentOnEdge=false;
for ( std::size_t ip = 0; ip < nbPoints; ++ip )
{
- std::size_t const isSegmentEnd = ( ip % 2 );
+ std::size_t isSegmentEnd = ( ip % 2 );
double* p = sideFace[ ip ];
- double* p2 = isSegmentEnd ? nullptr : sideFace[ip+1];
+ double* p2 = isSegmentEnd ? 0 : sideFace[ip+1];
if ( !isSegmentEnd )
isSegmentOnEdge = false; // initialize
if ( !sideFaces[ i ] ) continue;
std::vector< double* >& sideFace = *sideFaces[i];
- int const excludeCorner = (i + 1) % NB_TETRA_NODES;
+ int excludeCorner = (i + 1) % NB_TETRA_NODES;
for ( int ic = 0; ic < NB_TETRA_NODES; ++ic )
{
if ( !cutOffCorners[ ic ] && ic != excludeCorner )
sortIntersectionPolygon( A, _barycenterA );
}
// exclude equal points
- auto v = _polygonA.begin(), vEnd = _polygonA.end();
+ std::vector< double* >::iterator v = _polygonA.begin(), vEnd = _polygonA.end();
face.push_back( *v );
*v = 0;
for ( ++v; v != vEnd; ++v )
void UnitTetraIntersectionBary::clearPolygons(bool andFaces)
{
- for(auto & it : _polygonA)
- { delete[] it;
- it = nullptr;
+ for(std::vector<double*>::iterator it = _polygonA.begin() ; it != _polygonA.end() ; ++it)
+ { delete[] *it;
+ *it = 0;
}
- for(auto & it : _polygonB)
+ for(std::vector<double*>::iterator it = _polygonB.begin() ; it != _polygonB.end() ; ++it)
{
- delete[] it;
- it = nullptr;
+ delete[] *it;
+ *it = 0;
}
_polygonA.clear();
if ( andFaces )
{
- auto f = this->_faces.begin(), fEnd = this->_faces.end();
+ std::list< std::vector< double* > >::iterator f = this->_faces.begin(), fEnd = this->_faces.end();
for ( ; f != fEnd; ++f )
{
std::vector< double* >& polygon = *f;
- for(auto & it : polygon)
+ for(std::vector<double*>::iterator it = polygon.begin() ; it != polygon.end() ; ++it)
{
- delete[] it;
- it = nullptr;
+ delete[] *it;
+ *it = 0;
}
}
this->_faces.clear();
#ifndef __VTKNORMALIZEDUNSTRUCTUREDMESH_HXX__
#define __VTKNORMALIZEDUNSTRUCTUREDMESH_HXX__
+#include "NormalizedUnstructuredMesh.hxx"
#include "vtkType.h"
#ifndef __VTKNORMALIZEDUNSTRUCTUREDMESH_TXX__
#define __VTKNORMALIZEDUNSTRUCTUREDMESH_TXX__
+#include "VTKNormalizedUnstructuredMesh.hxx"
#include "vtkUnstructuredGrid.h"
#include "vtkCellArray.h"
#define __VECTORUTILS_HXX__
#include <algorithm>
-#include <ios>
#include <sstream>
#include <iomanip>
+#include <numeric>
#include <string>
#include <cmath>
+#include <map>
namespace INTERP_KERNEL
*/
inline double normInf(const double mat[9])
{
- double const ret(std::max(sumOfAbsoluteValues(mat),sumOfAbsoluteValues(mat+3)));
+ double ret(std::max(sumOfAbsoluteValues(mat),sumOfAbsoluteValues(mat+3)));
return std::max(ret,sumOfAbsoluteValues(mat+6));
}
#ifndef __VOLSURFFORMULAE_HXX__
#define __VOLSURFFORMULAE_HXX__
-#include "InterpKernelGeo2DNode.hxx"
#include "InterpolationUtils.hxx"
#include "InterpKernelException.hxx"
+#include "InterpKernelGeo2DEdgeLin.hxx"
+#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
#include "MCIdType.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include <cstddef>
-#include <limits>
#include <sstream>
#include <cmath>
-#include <vector>
namespace INTERP_KERNEL
{
if(spaceDim==2)
{
Edge *ed=Edge::BuildEdgeFrom3Points(begin,middle,end);
- double const ret=ed->getCurveLength(); ed->decrRef();
+ double ret=ed->getCurveLength(); ed->decrRef();
return ret;
}
else
calculateBarycenterDyn(coords,nbOfPtsInPolygs,spaceDim,coordOfBary);
for ( mcIdType i=0; i<nbOfPtsInPolygs; i++ )
{
- double const tmp = calculateAreaForTria(coords[i],coords[(i+1)%nbOfPtsInPolygs],
+ double tmp = calculateAreaForTria(coords[i],coords[(i+1)%nbOfPtsInPolygs],
coordOfBary,spaceDim);
ret+=tmp;
}
for(mcIdType i=0;i<nbOfPtsInPolygs;i++)
nodes[i]=new Node(coords[i][0],coords[i][1]);
QuadraticPolygon *pol=QuadraticPolygon::BuildArcCirclePolygon(nodes);
- double const ret=pol->getArea();
+ double ret=pol->getArea();
delete pol;
return -ret;
}
double f1 = (p1[0]-p3[0])/2.0, f2 = (p1[1]-p3[1])/2.0, f3 = (p1[2]-p3[2])/2.0;
double h1 = (p4[0]-p6[0])/2.0, h2 = (p4[1]-p6[1])/2.0, h3 = (p4[2]-p6[2])/2.0;
- double const A = a1*c2*f3 - a1*c3*f2 - a2*c1*f3 + a2*c3*f1 + a3*c1*f2 - a3*c2*f1;
- double const B = b1*c2*h3 - b1*c3*h2 - b2*c1*h3 + b2*c3*h1 + b3*c1*h2 - b3*c2*h1;
- double const C = (a1*c2*h3 + b1*c2*f3) - (a1*c3*h2 + b1*c3*f2)
+ double A = a1*c2*f3 - a1*c3*f2 - a2*c1*f3 + a2*c3*f1 + a3*c1*f2 - a3*c2*f1;
+ double B = b1*c2*h3 - b1*c3*h2 - b2*c1*h3 + b2*c3*h1 + b3*c1*h2 - b3*c2*h1;
+ double C = (a1*c2*h3 + b1*c2*f3) - (a1*c3*h2 + b1*c3*f2)
- (a2*c1*h3 + b2*c1*f3) + (a2*c3*h1 + b2*c3*f1)
+ (a3*c1*h2 + b3*c1*f2) - (a3*c2*h1 + b3*c2*f1);
- double const D = a1*d2*f3 - a1*d3*f2 - a2*d1*f3 + a2*d3*f1 + a3*d1*f2 - a3*d2*f1;
- double const E = b1*d2*h3 - b1*d3*h2 - b2*d1*h3 + b2*d3*h1 + b3*d1*h2 - b3*d2*h1;
- double const F = (a1*d2*h3 + b1*d2*f3) - (a1*d3*h2 + b1*d3*f2)
+ double D = a1*d2*f3 - a1*d3*f2 - a2*d1*f3 + a2*d3*f1 + a3*d1*f2 - a3*d2*f1;
+ double E = b1*d2*h3 - b1*d3*h2 - b2*d1*h3 + b2*d3*h1 + b3*d1*h2 - b3*d2*h1;
+ double F = (a1*d2*h3 + b1*d2*f3) - (a1*d3*h2 + b1*d3*f2)
- (a2*d1*h3 + b2*d1*f3) + (a2*d3*h1 + b2*d3*f1)
+ (a3*d1*h2 + b3*d1*f2) - (a3*d2*h1 + b3*d2*f1);
- double const G = a1*e2*f3 - a1*e3*f2 - a2*e1*f3 + a2*e3*f1 + a3*e1*f2 - a3*e2*f1;
- double const H = b1*e2*h3 - b1*e3*h2 - b2*e1*h3 + b2*e3*h1 + b3*e1*h2 - b3*e2*h1;
- double const P = (a1*e2*h3 + b1*e2*f3) - (a1*e3*h2 + b1*e3*f2)
+ double G = a1*e2*f3 - a1*e3*f2 - a2*e1*f3 + a2*e3*f1 + a3*e1*f2 - a3*e2*f1;
+ double H = b1*e2*h3 - b1*e3*h2 - b2*e1*h3 + b2*e3*h1 + b3*e1*h2 - b3*e2*h1;
+ double P = (a1*e2*h3 + b1*e2*f3) - (a1*e3*h2 + b1*e3*f2)
- (a2*e1*h3 + b2*e1*f3) + (a2*e3*h1 + b2*e3*f1)
+ (a3*e1*h2 + b3*e1*f2) - (a3*e2*h1 + b3*e2*f1);
double s1=(pt2[0]-pt6[0])/8.0, s2=(pt2[1]-pt6[1])/8.0, s3=(pt2[2]-pt6[2])/8.0;
double t1=(pt1[0]-pt5[0])/8.0, t2=(pt1[1]-pt5[1])/8.0, t3=(pt1[2]-pt5[2])/8.0;
- double const A = a1*e2*q3 - a1*e3*q2 - a2*e1*q3 + a2*e3*q1 + a3*e1*q2 - a3*e2*q1;
- double const B = c1*h2*q3 - c1*h3*q2 - c2*h1*q3 + c2*h3*q1 + c3*h1*q2 - c3*h2*q1;
- double const C = (a1*h2 + c1*e2)*q3 - (a1*h3 + c1*e3)*q2
+ double A = a1*e2*q3 - a1*e3*q2 - a2*e1*q3 + a2*e3*q1 + a3*e1*q2 - a3*e2*q1;
+ double B = c1*h2*q3 - c1*h3*q2 - c2*h1*q3 + c2*h3*q1 + c3*h1*q2 - c3*h2*q1;
+ double C = (a1*h2 + c1*e2)*q3 - (a1*h3 + c1*e3)*q2
- (a2*h1 + c2*e1)*q3 + (a2*h3 + c2*e3)*q1
+ (a3*h1 + c3*e1)*q2 - (a3*h2 + c3*e2)*q1;
- double const D = b1*e2*s3 - b1*e3*s2 - b2*e1*s3 + b2*e3*s1 + b3*e1*s2 - b3*e2*s1;
- double const E = d1*h2*s3 - d1*h3*s2 - d2*h1*s3 + d2*h3*s1 + d3*h1*s2 - d3*h2*s1;
- double const F = (b1*h2 + d1*e2)*s3 - (b1*h3 + d1*e3)*s2
+ double D = b1*e2*s3 - b1*e3*s2 - b2*e1*s3 + b2*e3*s1 + b3*e1*s2 - b3*e2*s1;
+ double E = d1*h2*s3 - d1*h3*s2 - d2*h1*s3 + d2*h3*s1 + d3*h1*s2 - d3*h2*s1;
+ double F = (b1*h2 + d1*e2)*s3 - (b1*h3 + d1*e3)*s2
- (b2*h1 + d2*e1)*s3 + (b2*h3 + d2*e3)*s1
+ (b3*h1 + d3*e1)*s2 - (b3*h2 + d3*e2)*s1;
- double const G = (a1*e2*s3 + b1*e2*q3) - (a1*e3*s2 + b1*e3*q2)
+ double G = (a1*e2*s3 + b1*e2*q3) - (a1*e3*s2 + b1*e3*q2)
- (a2*e1*s3 + b2*e1*q3) + (a2*e3*s1 + b2*e3*q1)
+ (a3*e1*s2 + b3*e1*q2) - (a3*e2*s1 + b3*e2*q1);
- double const H = (c1*h2*s3 + d1*h2*q3) - (c1*h3*s2 + d1*h3*q2)
+ double H = (c1*h2*s3 + d1*h2*q3) - (c1*h3*s2 + d1*h3*q2)
- (c2*h1*s3 + d2*h1*q3) + (c2*h3*s1 + d2*h3*q1)
+ (c3*h1*s2 + d3*h1*q2) - (c3*h2*s1 + d3*h2*q1);
- double const I = ((a1*h2 + c1*e2)*s3 + (b1*h2 + d1*e2)*q3)
+ double I = ((a1*h2 + c1*e2)*s3 + (b1*h2 + d1*e2)*q3)
- ((a1*h3 + c1*e3)*s2 + (b1*h3 + d1*e3)*q2)
- ((a2*h1 + c2*e1)*s3 + (b2*h1 + d2*e1)*q3)
+ ((a2*h3 + c2*e3)*s1 + (b2*h3 + d2*e3)*q1)
+ ((a3*h1 + c3*e1)*s2 + (b3*h1 + d3*e1)*q2)
- ((a3*h2 + c3*e2)*s1 + (b3*h2 + d3*e2)*q1);
- double const J = a1*f2*r3 - a1*f3*r2 - a2*f1*r3 + a2*f3*r1 + a3*f1*r2 - a3*f2*r1;
- double const K = c1*p2*r3 - c1*p3*r2 - c2*p1*r3 + c2*p3*r1 + c3*p1*r2 - c3*p2*r1;
- double const L = (a1*p2 + c1*f2)*r3 - (a1*p3 + c1*f3)*r2
+ double J = a1*f2*r3 - a1*f3*r2 - a2*f1*r3 + a2*f3*r1 + a3*f1*r2 - a3*f2*r1;
+ double K = c1*p2*r3 - c1*p3*r2 - c2*p1*r3 + c2*p3*r1 + c3*p1*r2 - c3*p2*r1;
+ double L = (a1*p2 + c1*f2)*r3 - (a1*p3 + c1*f3)*r2
- (a2*p1 + c2*f1)*r3 + (a2*p3 + c2*f3)*r1
+ (a3*p1 + c3*f1)*r2 - (a3*p2 + c3*f2)*r1;
- double const M = b1*f2*t3 - b1*f3*t2 - b2*f1*t3 + b2*f3*t1 + b3*f1*t2 - b3*f2*t1;
- double const N = d1*p2*t3 - d1*p3*t2 - d2*p1*t3 + d2*p3*t1 + d3*p1*t2 - d3*p2*t1;
- double const O = (b1*p2 + d1*f2)*t3 - (b1*p3 + d1*f3)*t2
+ double M = b1*f2*t3 - b1*f3*t2 - b2*f1*t3 + b2*f3*t1 + b3*f1*t2 - b3*f2*t1;
+ double N = d1*p2*t3 - d1*p3*t2 - d2*p1*t3 + d2*p3*t1 + d3*p1*t2 - d3*p2*t1;
+ double O = (b1*p2 + d1*f2)*t3 - (b1*p3 + d1*f3)*t2
- (b2*p1 + d2*f1)*t3 + (b2*p3 + d2*f3)*t1
+ (b3*p1 + d3*f1)*t2 - (b3*p2 + d3*f2)*t1;
- double const P = (a1*f2*t3 + b1*f2*r3) - (a1*f3*t2 + b1*f3*r2)
+ double P = (a1*f2*t3 + b1*f2*r3) - (a1*f3*t2 + b1*f3*r2)
- (a2*f1*t3 + b2*f1*r3) + (a2*f3*t1 + b2*f3*r1)
+ (a3*f1*t2 + b3*f1*r2) - (a3*f2*t1 + b3*f2*r1);
- double const Q = (c1*p2*t3 + d1*p2*r3) - (c1*p3*t2 + d1*p3*r2)
+ double Q = (c1*p2*t3 + d1*p2*r3) - (c1*p3*t2 + d1*p3*r2)
- (c2*p1*t3 + d2*p1*r3) + (c2*p3*t1 + d2*p3*r1)
+ (c3*p1*t2 + d3*p1*r2) - (c3*p2*t1 + d3*p2*r1);
- double const R = ((a1*p2 + c1*f2)*t3 + (b1*p2 + d1*f2)*r3)
+ double R = ((a1*p2 + c1*f2)*t3 + (b1*p2 + d1*f2)*r3)
- ((a1*p3 + c1*f3)*t2 + (b1*p3 + d1*f3)*r2)
- ((a2*p1 + c2*f1)*t3 + (b2*p1 + d2*f1)*r3)
+ ((a2*p3 + c2*f3)*t1 + (b2*p3 + d2*f3)*r1)
+ ((a3*p1 + c3*f1)*t2 + (b3*p1 + d3*f1)*r2)
- ((a3*p2 + c3*f2)*t1 + (b3*p2 + d3*f2)*r1);
- double const S = (a1*e2*r3 + a1*f2*q3) - (a1*e3*r2 + a1*f3*q2)
+ double S = (a1*e2*r3 + a1*f2*q3) - (a1*e3*r2 + a1*f3*q2)
- (a2*e1*r3 + a2*f1*q3) + (a2*e3*r1 + a2*f3*q1)
+ (a3*e1*r2 + a3*f1*q2) - (a3*e2*r1 + a3*f2*q1);
- double const T = (c1*h2*r3 + c1*p2*q3) - (c1*h3*r2 + c1*p3*q2)
+ double T = (c1*h2*r3 + c1*p2*q3) - (c1*h3*r2 + c1*p3*q2)
- (c2*h1*r3 + c2*p1*q3) + (c2*h3*r1 + c2*p3*q1)
+ (c3*h1*r2 + c3*p1*q2) - (c3*h2*r1 + c3*p2*q1);
- double const U = ((a1*h2 + c1*e2)*r3 + (a1*p2 + c1*f2)*q3)
+ double U = ((a1*h2 + c1*e2)*r3 + (a1*p2 + c1*f2)*q3)
- ((a1*h3 + c1*e3)*r2 + (a1*p3 + c1*f3)*q2)
- ((a2*h1 + c2*e1)*r3 + (a2*p1 + c2*f1)*q3)
+ ((a2*h3 + c2*e3)*r1 + (a2*p3 + c2*f3)*q1)
+ ((a3*h1 + c3*e1)*r2 + (a3*p1 + c3*f1)*q2)
- ((a3*h2 + c3*e2)*r1 + (a3*p2 + c3*f2)*q1);
- double const V = (b1*e2*t3 + b1*f2*s3) - (b1*e3*t2 + b1*f3*s2)
+ double V = (b1*e2*t3 + b1*f2*s3) - (b1*e3*t2 + b1*f3*s2)
- (b2*e1*t3 + b2*f1*s3) + (b2*e3*t1 + b2*f3*s1)
+ (b3*e1*t2 + b3*f1*s2) - (b3*e2*t1 + b3*f2*s1);
- double const W = (d1*h2*t3 + d1*p2*s3) - (d1*h3*t2 + d1*p3*s2)
+ double W = (d1*h2*t3 + d1*p2*s3) - (d1*h3*t2 + d1*p3*s2)
- (d2*h1*t3 + d2*p1*s3) + (d2*h3*t1 + d2*p3*s1)
+ (d3*h1*t2 + d3*p1*s2) - (d3*h2*t1 + d3*p2*s1);
- double const X = ((b1*h2 + d1*e2)*t3 + (b1*p2 + d1*f2)*s3)
+ double X = ((b1*h2 + d1*e2)*t3 + (b1*p2 + d1*f2)*s3)
- ((b1*h3 + d1*e3)*t2 + (b1*p3 + d1*f3)*s2)
- ((b2*h1 + d2*e1)*t3 + (b2*p1 + d2*f1)*s3)
+ ((b2*h3 + d2*e3)*t1 + (b2*p3 + d2*f3)*s1)
+ ((b3*h1 + d3*e1)*t2 + (b3*p1 + d3*f1)*s2)
- ((b3*h2 + d3*e2)*t1 + (b3*p2 + d3*f2)*s1);
- double const Y = (a1*e2*t3 + a1*f2*s3 + b1*e2*r3 + b1*f2*q3)
+ double Y = (a1*e2*t3 + a1*f2*s3 + b1*e2*r3 + b1*f2*q3)
- (a1*e3*t2 + a1*f3*s2 + b1*e3*r2 + b1*f3*q2)
- (a2*e1*t3 + a2*f1*s3 + b2*e1*r3 + b2*f1*q3)
+ (a2*e3*t1 + a2*f3*s1 + b2*e3*r1 + b2*f3*q1)
+ (a3*e1*t2 + a3*f1*s2 + b3*e1*r2 + b3*f1*q2)
- (a3*e2*t1 + a3*f2*s1 + b3*e2*r1 + b3*f2*q1);
- double const Z = (c1*h2*t3 + c1*p2*s3 + d1*h2*r3 + d1*p2*q3)
+ double Z = (c1*h2*t3 + c1*p2*s3 + d1*h2*r3 + d1*p2*q3)
- (c1*h3*t2 + c1*p3*s2 + d1*h3*r2 + d1*p3*q2)
- (c2*h1*t3 + c2*p1*s3 + d2*h1*r3 + d2*p1*q3)
+ (c2*h3*t1 + c2*p3*s1 + d2*h3*r1 + d2*p3*q1)
+ (c3*h1*t2 + c3*p1*s2 + d3*h1*r2 + d3*p1*q2)
- (c3*h2*t1 + c3*p2*s1 + d3*h2*r1 + d3*p2*q1);
- double const AA = ((a1*h2 + c1*e2)*t3 + (a1*p2 + c1*f2)*s3
+ double AA = ((a1*h2 + c1*e2)*t3 + (a1*p2 + c1*f2)*s3
+(b1*h2 + d1*e2)*r3 + (b1*p2 + d1*f2)*q3)
- ((a1*h3 + c1*e3)*t2 + (a1*p3 + c1*f3)*s2
+(b1*h3 + d1*e3)*r2 + (b1*p3 + d1*f3)*q2)
coords[3*OTT<ConnType,numPol>::coo2C(connec[i+1])+2])/3.;
ConnType tmpConn[3]={connec[0],connec[i],connec[i+1]};
areaVectorOfPolygon<ConnType,numPol>(tmpConn,3,coords,tmpArea);
- double const norm2=sqrt(tmpArea[0]*tmpArea[0]+tmpArea[1]*tmpArea[1]+tmpArea[2]*tmpArea[2]);
+ double norm2=sqrt(tmpArea[0]*tmpArea[0]+tmpArea[1]*tmpArea[1]+tmpArea[2]*tmpArea[2]);
if(norm2>1e-12)
{
tmpArea[0]/=norm2; tmpArea[1]/=norm2; tmpArea[2]/=norm2;
- double const signOfArea=area[0]*tmpArea[0]+area[1]*tmpArea[1]+area[2]*tmpArea[2];
+ double signOfArea=area[0]*tmpArea[0]+area[1]*tmpArea[1]+area[2]*tmpArea[2];
res[0]+=signOfArea*norm2*v[0]/norm; res[1]+=signOfArea*norm2*v[1]/norm; res[2]+=signOfArea*norm2*v[2]/norm;
}
}
// projection to (u,v) of each faces of polyh to compute integral(x^2/2) on each faces.
double normal[3];
areaVectorOfPolygon<ConnType,numPol>(work,nbOfNodesOfCurFace,coords,normal);
- double const normOfNormal=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
+ double normOfNormal=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
if(normOfNormal<std::numeric_limits<double>::min())
continue;
normal[0]/=normOfNormal; normal[1]/=normOfNormal; normal[2]/=normOfNormal;
double u[2]={normal[1],-normal[0]};
- double const s=sqrt(u[0]*u[0]+u[1]*u[1]);
- double const c=normal[2];
+ double s=sqrt(u[0]*u[0]+u[1]*u[1]);
+ double c=normal[2];
if(fabs(s)>1e-12)
{
u[0]/=std::abs(s); u[1]/=std::abs(s);
normal[1]*coords[3*OTT<ConnType,numPol>::coo2C(work[0])+1]+
normal[2]*coords[3*OTT<ConnType,numPol>::coo2C(work[0])+2];
// A,B,D,F,G,H,L,M,N coeffs of rotation matrix defined by (u,c,s)
- double const A=u[0]*u[0]*(1-c)+c;
- double const B=u[0]*u[1]*(1-c);
- double const D=u[1]*s;
- double const F=B;
- double const G=u[1]*u[1]*(1-c)+c;
- double const H=-u[0]*s;
- double const L=-u[1]*s;
- double const M=u[0]*s;
- double const N=c;
- double const CX=-w*D;
- double const CY=-w*H;
- double const CZ=-w*N;
+ double A=u[0]*u[0]*(1-c)+c;
+ double B=u[0]*u[1]*(1-c);
+ double D=u[1]*s;
+ double F=B;
+ double G=u[1]*u[1]*(1-c)+c;
+ double H=-u[0]*s;
+ double L=-u[1]*s;
+ double M=u[0]*s;
+ double N=c;
+ double CX=-w*D;
+ double CY=-w*H;
+ double CZ=-w*N;
for(int j=0;j<nbOfNodesOfCurFace;j++)
{
const double *p1=coords+3*OTT<ConnType,numPol>::coo2C(work[j]);
const double *p2=coords+3*OTT<ConnType,numPol>::coo2C(work[(j+1)%nbOfNodesOfCurFace]);
- double const u1=A*p1[0]+B*p1[1]+D*p1[2];
- double const u2=A*p2[0]+B*p2[1]+D*p2[2];
- double const v1=F*p1[0]+G*p1[1]+H*p1[2];
- double const v2=F*p2[0]+G*p2[1]+H*p2[2];
+ double u1=A*p1[0]+B*p1[1]+D*p1[2];
+ double u2=A*p2[0]+B*p2[1]+D*p2[2];
+ double v1=F*p1[0]+G*p1[1]+H*p1[2];
+ double v2=F*p2[0]+G*p2[1]+H*p2[2];
//
- double const gx=integrationOverA3DLine(u1,v1,u2,v2,A,B,CX);
- double const gy=integrationOverA3DLine(u1,v1,u2,v2,F,G,CY);
- double const gz=integrationOverA3DLine(u1,v1,u2,v2,L,M,CZ);
+ double gx=integrationOverA3DLine(u1,v1,u2,v2,A,B,CX);
+ double gy=integrationOverA3DLine(u1,v1,u2,v2,F,G,CY);
+ double gz=integrationOverA3DLine(u1,v1,u2,v2,L,M,CZ);
res[0]+=gx*normal[0];
res[1]+=gy*normal[1];
res[2]+=gz*normal[2];
int nbOfNodesOfCurFace=(int)std::distance(work,work2);
double normal[3];
areaVectorOfPolygon<ConnType,numPol>(work,nbOfNodesOfCurFace,coords,normal);
- double const normOfNormal=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
+ double normOfNormal=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
if(normOfNormal<std::numeric_limits<double>::min())
continue;
sum+=normOfNormal;
res[0]=0.; res[1]=0.;
for(mcIdType i=0;i<lgth;i++)
{
- double const cp=coords[i][0]*coords[(i+1)%lgth][1]-coords[i][1]*coords[(i+1)%lgth][0];
+ double cp=coords[i][0]*coords[(i+1)%lgth][1]-coords[i][1]*coords[(i+1)%lgth][0];
area+=cp;
res[0]+=cp*(coords[i][0]+coords[(i+1)%lgth][0]);
res[1]+=cp*(coords[i][1]+coords[(i+1)%lgth][1]);
template<class ConnType, NumberingPolicy numPol>
inline void computePolygonBarycenter2D(const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
- auto **coords2=new double *[lgth];
+ double **coords2=new double *[lgth];
for(mcIdType i=0;i<lgth;i++)
coords2[i]=const_cast<double *>(coords+2*OTT<ConnType,numPol>::coo2C(connec[i]));
computePolygonBarycenter2DEngine(coords2,lgth,res);
#include "VolSurfUser.hxx"
#include "InterpKernelAutoPtr.hxx"
#include "InterpolationUtils.hxx"
-#include "MCIdType.hxx"
+#include "VectorUtils.hxx"
#include <cmath>
-#include <cstddef>
-#include <iterator>
#include <limits>
#include <algorithm>
#include <functional>
*/
double OrthoDistanceFromPtToPlaneInSpaceDim3(const double *p, const double *p1, const double *p2, const double *p3)
{
- double const prec = 1.0e-14;
- double const T[2][3] = {{p1[0] - p2[0], p1[1] - p2[1], p1[2] - p2[2]},
+ double prec = 1.0e-14;
+ double T[2][3] = {{p1[0] - p2[0], p1[1] - p2[1], p1[2] - p2[2]},
{p3[0] - p2[0], p3[1] - p2[1], p3[2] - p2[2]}};
- double const N[3] = {T[0][1]*T[1][2]-T[0][2]*T[1][1],
+ double N[3] = {T[0][1]*T[1][2]-T[0][2]*T[1][1],
T[0][2]*T[1][0]-T[0][0]*T[1][2],
T[0][0]*T[1][1]-T[0][1]*T[1][0]};
- double const norm2 = N[0]*N[0] + N[1]*N[1] + N[2]*N[2];
+ double norm2 = N[0]*N[0] + N[1]*N[1] + N[2]*N[2];
if (norm2 < prec)
throw INTERP_KERNEL::Exception("OrthoDistanceFromPtToPlaneInSpaceDim3: degenerated normal vector!");
- double const num = N[0]*(p[0]-p1[0]) + N[1]*(p[1]-p1[1]) + N[2]*(p[2]-p1[2]);
+ double num = N[0]*(p[0]-p1[0]) + N[1]*(p[1]-p1[1]) + N[2]*(p[2]-p1[2]);
return num/sqrt(norm2);
}
double SquareDistanceFromPtToSegInSpaceDim2(const double *pt, const double *pt0Seg2, const double *pt1Seg2, std::size_t &nbOfHint)
{
double dx=pt1Seg2[0]-pt0Seg2[0],dy=pt1Seg2[1]-pt0Seg2[1];
- double const norm=sqrt(dx*dx+dy*dy);
+ double norm=sqrt(dx*dx+dy*dy);
if(norm==0.)
return (pt[0]-pt0Seg2[0])*(pt[0]-pt0Seg2[0])+(pt[1]-pt0Seg2[1])*(pt[1]-pt0Seg2[1]);//return std::numeric_limits<double>::max();
dx/=norm; dy/=norm;
double dx2=pt[0]-pt0Seg2[0],dy2=pt[1]-pt0Seg2[1];
- double const dotP=(dx2*dx+dy2*dy);
+ double dotP=(dx2*dx+dy2*dy);
if(dotP<0. || dotP>norm)
return dotP<0.?(pt[0]-pt0Seg2[0])*(pt[0]-pt0Seg2[0])+(pt[1]-pt0Seg2[1])*(pt[1]-pt0Seg2[1]):(pt[0]-pt1Seg2[0])*(pt[0]-pt1Seg2[0])+(pt[1]-pt1Seg2[1])*(pt[1]-pt1Seg2[1]);
nbOfHint++;
w[i] = pt[i] - pt0Seg2[i];
}
- double const c1 = dotprod<3>(w,v);
+ double c1 = dotprod<3>(w,v);
if ( c1 <= 0 )
return norm<3>(w);
- double const c2 = dotprod<3>(v,v);
+ double c2 = dotprod<3>(v,v);
if ( c2 <= c1 )
{
for(int i=0; i < 3; i++)
w[i] = pt[i] - pt1Seg2[i];
return norm<3>(w);
}
- double const b = c1 / c2;
+ double b = c1 / c2;
for(int i=0; i < 3; i++)
w[i] = pt0Seg2[i] + b * v[i] - pt[i];
return norm<3>(w);
double a00=dotprod<3>(edge0, edge0), a01=dotprod<3>(edge0,edge1), a11=dotprod<3>(edge1,edge1);
double b0=dotprod<3>(diff, edge0), b1=dotprod<3>(diff, edge1), c=dotprod<3>(diff, diff);
- double const det = fabs(a00*a11 - a01*a01);
+ double det = fabs(a00*a11 - a01*a01);
double s = a01*b1 - a11*b0, t = a01*b0 - a00*b1;
double sDist;
{
// points are colinear (degenerated triangle)
// => Compute distance between segments
- double const distance = std::min(DistanceFromPtToSegInSpaceDim3(pt, pt0Tri3, pt1Tri3),
+ double distance = std::min(DistanceFromPtToSegInSpaceDim3(pt, pt0Tri3, pt1Tri3),
DistanceFromPtToSegInSpaceDim3(pt, pt1Tri3, pt2Tri3));
return distance;
}
// else we can divide by non-zero
- double const invDet = 1 / det;
+ double invDet = 1 / det;
s *= invDet; t *= invDet;
sDist = s*(a00*s + a01*t + 2*b0) + t*(a01*s + a11*t + 2*b1) + c;
}
if (t < 0.0) // region 6
sDist = _HelperDistancePtToTri3D_2(a01, a11, a00, b1, b0, c);
else { // region 1
- double const numer = a11 + b1 - a01 - b0;
+ double numer = a11 + b1 - a01 - b0;
if (numer <= 0.0)
sDist = a11 + 2*b1 + c;
else {
- double const denom = a00 - 2*a01 + a11;
+ double denom = a00 - 2*a01 + a11;
if (numer >= denom)
sDist = a00 + 2*b0 + c;
else {
double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const mcIdType *connOfPolygonBg, const mcIdType *connOfPolygonEnd, const double *coords)
{
- std::size_t const nbOfEdges=std::distance(connOfPolygonBg,connOfPolygonEnd);
+ std::size_t nbOfEdges=std::distance(connOfPolygonBg,connOfPolygonEnd);
if(nbOfEdges<3)
throw INTERP_KERNEL::Exception("DistanceFromPtToPolygonInSpaceDim3 : trying to compute a distance to a polygon containing less than 3 edges !");
double baryOfNodes[3]={0.,0.,0.};
ptXY[2*i+1]=matrix[4]*coords[3*connOfPolygonBg[i]]+matrix[5]*coords[3*connOfPolygonBg[i]+1]+matrix[6]*coords[3*connOfPolygonBg[i]+2]+matrix[7];
}
double xy[2]={matrix[0]*pt[0]+matrix[1]*pt[1]+matrix[2]*pt[2]+matrix[3],matrix[4]*pt[0]+matrix[5]*pt[1]+matrix[6]*pt[2]+matrix[7]};
- double const z=matrix[8]*pt[0]+matrix[9]*pt[1]+matrix[10]*pt[2]+matrix[11];
+ double z=matrix[8]*pt[0]+matrix[9]*pt[1]+matrix[10]*pt[2]+matrix[11];
double ret=std::numeric_limits<double>::max();
std::size_t nbOfHint=0;
for(std::size_t i=0;i<nbOfEdges;i++)
{
- double const tmp=SquareDistanceFromPtToSegInSpaceDim2(xy,((double *)ptXY)+2*i,((double *)ptXY)+2*((i+1)%nbOfEdges),nbOfHint);
+ double tmp=SquareDistanceFromPtToSegInSpaceDim2(xy,((double *)ptXY)+2*i,((double *)ptXY)+2*((i+1)%nbOfEdges),nbOfHint);
ret=std::min(ret,z*z+tmp);
}
if(nbOfHint==nbOfEdges)
z*s,y*y*(1-c)+c,y*z*(1-c),
-y*s,z*y*(1-c),z*z*(1-c)+c};
// 2nd rotation matrix
- double const x=p2[0]-p0[0];
+ double x=p2[0]-p0[0];
y=p2[1]-p0[1]; z=p2[2]-p0[2];
double y1=x*r0[3]+y*r0[4]+z*r0[5],z1=x*r0[6]+y*r0[7]+z*r0[8];
c=y1/sqrt(y1*y1+z1*z1);
#define __VOLSURFUSER_HXX__
#include "INTERPKERNELDefines.hxx"
+#include "InterpKernelException.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include "NormalizedGeometricTypes"
#include "MCIdType.hxx"
-#include <cstddef>
namespace INTERP_KERNEL
{
#ifndef __VOLSURFUSER_TXX__
#define __VOLSURFUSER_TXX__
-#include "NormalizedGeometricTypes"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "MCIdType.hxx"
-#include "InterpKernelGeo2DEdge.hxx"
#include "VolSurfUser.hxx"
#include "VolSurfFormulae.hxx"
#include "InterpolationUtils.hxx"
#include "VectorUtils.hxx"
#include <algorithm>
-#include <functional>
-#include <cmath>
namespace INTERP_KERNEL
{
break;
case INTERP_KERNEL::NORM_POLYGON :
{
- const auto **pts=new const double *[lgth];
+ const double **pts=new const double *[lgth];
for(int inod=0;inod<lgth;inod++)
pts[inod] = coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[inod]);
double val=INTERP_KERNEL::calculateAreaForPolyg(pts,lgth,SPACEDIM);
break;
case INTERP_KERNEL::NORM_QPOLYG :
{
- const auto **pts=new const double *[lgth];
+ const double **pts=new const double *[lgth];
for(int inod=0;inod<lgth;inod++)
pts[inod] = coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[inod]);
double val=INTERP_KERNEL::calculateAreaForQPolyg(pts,lgth,SPACEDIM);
{
if(SPACEDIM==2)
{
- auto **pts=new double *[lgth];
+ double **pts=new double *[lgth];
for(int i=0;i<lgth;i++)
pts[i]=const_cast<double *>(coords+2*OTT<ConnType,numPol>::coo2C(connec[i]));
computeQPolygonBarycenter2D(pts,lgth,2,res);
double AB = getDistanceBtw2Pts<SPACEDIM>(PA,PB); double maxLength = AB;
double BC = getDistanceBtw2Pts<SPACEDIM>(PB,PC); if (BC > maxLength) maxLength = BC;
double CA = getDistanceBtw2Pts<SPACEDIM>(PC,PA); if (CA > maxLength) maxLength = CA;
- double const perim( (AB+BC+CA)*0.5 );
- double const num( 2*sqrt(perim*(perim-AB)*(perim-BC)*(perim-CA)) );
+ double perim( (AB+BC+CA)*0.5 );
+ double num( 2*sqrt(perim*(perim-AB)*(perim-BC)*(perim-CA)) );
res[0] = num/AB; res[1] = num/BC; res[2] = num/CA;
if (AB/maxLength <= EPS)
res[0] = BC;
//
#include "BBTreeTest.hxx"
-#include <cppunit/TestAssert.h>
+#include <iostream>
#include <vector>
-#include "BBTree.txx"
#include "DirectedBoundingBox.hxx"
namespace INTERP_TEST
void BBTreeTest::test_BBTree() {
//bbox tree creation
const int N=10;
- auto* bbox=new double[4*N*N];
+ double* bbox=new double[4*N*N];
for (int i=0; i<N; i++)
for (int j=0; j<N; j++)
{
bbox[4*(i*N+j)+2]=j;
bbox[4*(i*N+j)+3]=j+1;
}
- BBTree<2> const tree(bbox,nullptr,0,N*N);
+ BBTree<2> tree(bbox,0,0,N*N);
std::vector <int> elems;
//box outside the tree
0,-3,0, 2,-3,0, 2,-2,0, 0,-2,0,
10,-3,10, 12,-3,10, 12,-2,10, 10,-2,10
};
- INTERP_KERNEL::DirectedBoundingBox const shiftedBB_x( shifted_x, nbP, dim);
- INTERP_KERNEL::DirectedBoundingBox const shiftedBB_X( shifted_X, nbP, dim);
- INTERP_KERNEL::DirectedBoundingBox const shiftedBB_y( shifted_y, nbP, dim);
- INTERP_KERNEL::DirectedBoundingBox const shiftedBB_Y( shifted_Y, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox shiftedBB_x( shifted_x, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox shiftedBB_X( shifted_X, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox shiftedBB_y( shifted_y, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox shiftedBB_Y( shifted_Y, nbP, dim);
CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_x ));
CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_X ));
0,0,0, 2,0,0, 2,1,0, 0,1,0,
0,0,2, 2,0,2, 2,1,2, 0,1,2
};
- INTERP_KERNEL::DirectedBoundingBox const ibb( inters_coords, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox ibb( inters_coords, nbP, dim);
CPPUNIT_ASSERT( !bb.isDisjointWith( ibb ));
// overlapping non-directed BB
-3,0, -1,0,
7,10, 9,10,
};
- INTERP_KERNEL::DirectedBoundingBox const shiftedBB_x( shifted_x, nbP, dim);
- INTERP_KERNEL::DirectedBoundingBox const shiftedBB_X( shifted_X, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox shiftedBB_x( shifted_x, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox shiftedBB_X( shifted_X, nbP, dim);
CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_x ));
CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_X ));
0,0, 2,0,
0,2, 2,2
};
- INTERP_KERNEL::DirectedBoundingBox const ibb( inters_coords, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox ibb( inters_coords, nbP, dim);
CPPUNIT_ASSERT( !bb.isDisjointWith( ibb ));
// overlapping non-directed BB
{
-3.0, -0.001
};
- INTERP_KERNEL::DirectedBoundingBox const shiftedBB_x( shifted_x, nbP, dim);
- INTERP_KERNEL::DirectedBoundingBox const shiftedBB_X( shifted_X, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox shiftedBB_x( shifted_x, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox shiftedBB_X( shifted_X, nbP, dim);
CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_x ));
CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_X ));
{
-2,2
};
- INTERP_KERNEL::DirectedBoundingBox const ibb( inters_coords, nbP, dim);
+ INTERP_KERNEL::DirectedBoundingBox ibb( inters_coords, nbP, dim);
CPPUNIT_ASSERT( !bb.isDisjointWith( ibb ));
// overlapping non-directed BB
#ifndef __TU_BB_TREE_HXX__
#define __TU_BB_TREE_HXX__
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include "BBTree.txx"
#include "InterpKernelTestExport.hxx"
+#include "BBTree.txx"
namespace INTERP_TEST
{
#define _BASICMAINTEST_HXX_
#include <cppunit/CompilerOutputter.h>
-#include <cppunit/Portability.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TextTestProgressListener.h>
+#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestRunner.h>
+#include <stdexcept>
#include <iostream>
#include <fstream>
*/
// ============================================================================
-int main(int /*argc*/, char* /*argv*/[])
+int main(int argc, char* argv[])
{
#if !defined WIN32 && !defined __APPLE__
fpu_control_t cw = _FPU_DEFAULT & ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM);
// --- Run the tests.
- bool const wasSucessful = result.wasSuccessful();
+ bool wasSucessful = result.wasSuccessful();
testFile.close();
// --- Return error code 1 if the one of test failed.
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#include "CppUnitTest.hxx"
#ifndef __TU_TEST_CPPUNIT_HXX__
#define __TU_TEST_CPPUNIT_HXX__
-#include <cppunit/TestFixture.h>
-#include <cppunit/TestAssert.h>
#include <cppunit/extensions/HelperMacros.h>
#include "InterpKernelTestExport.hxx"
CPPUNIT_TEST_SUITE_END();
public:
- void setUp() override {
+ void setUp() {
obj = new BogusClass(3.14);
}
- void tearDown() override {
+ void tearDown() {
delete obj;
}
// Author : Anthony Geay (CEA/DEN)
#include "ExprEvalInterpTest.hxx"
-#include "InterpKernelException.hxx"
#include "InterpKernelExprParser.hxx"
-#include "InterpKernelUnit.hxx"
-#include <cppunit/TestAssert.h>
-#include <algorithm>
#include <limits>
-#include <string>
-#include <set>
-#include <vector>
+#include <iterator>
using namespace INTERP_TEST;
void ExprEvalInterpTest::testInterpreterUnit1()
{
- INTERP_KERNEL::Unit const unit1("m/s");
- INTERP_KERNEL::Unit const unit2("km/h");
+ INTERP_KERNEL::Unit unit1("m/s");
+ INTERP_KERNEL::Unit unit2("km/h");
CPPUNIT_ASSERT(unit1.isCompatibleWith(unit2) && unit2.isCompatibleWith(unit1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(360,unit1.convert(unit2,100.),1e-10);
- INTERP_KERNEL::Unit const unit3("J/s");
- INTERP_KERNEL::Unit const unit4("kW");
+ INTERP_KERNEL::Unit unit3("J/s");
+ INTERP_KERNEL::Unit unit4("kW");
CPPUNIT_ASSERT(unit3.isCompatibleWith(unit4) && unit4.isCompatibleWith(unit3));
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,unit3.convert(unit4,1000.),1e-10);
CPPUNIT_ASSERT(unit4.getCoarseRepr()=="kW");
- INTERP_KERNEL::Unit const unit5("kpT");
+ INTERP_KERNEL::Unit unit5("kpT");
CPPUNIT_ASSERT(!unit5.isInterpretationOK());
CPPUNIT_ASSERT(unit5.getCoarseRepr()=="kpT");
- INTERP_KERNEL::Unit const unit6("m*kpT");
+ INTERP_KERNEL::Unit unit6("m*kpT");
CPPUNIT_ASSERT(!unit6.isInterpretationOK());
- INTERP_KERNEL::Unit const unit7("m*s^-1");
+ INTERP_KERNEL::Unit unit7("m*s^-1");
CPPUNIT_ASSERT(unit7.isCompatibleWith(unit2) && unit2.isCompatibleWith(unit7));
CPPUNIT_ASSERT_DOUBLES_EQUAL(360,unit7.convert(unit2,100.),1e-10);
const char unit8C[3]={-0x50,0x43,0x0};
- INTERP_KERNEL::Unit const unit8(unit8C);
- INTERP_KERNEL::Unit const unit9("K");
+ INTERP_KERNEL::Unit unit8(unit8C);
+ INTERP_KERNEL::Unit unit9("K");
CPPUNIT_ASSERT(unit9.isCompatibleWith(unit8) && unit8.isCompatibleWith(unit9));
CPPUNIT_ASSERT_DOUBLES_EQUAL(335.15,unit8.convert(unit9,62.),1e-10);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-16.37,unit9.convert(unit8,256.78),1e-10);
- INTERP_KERNEL::Unit const unit10("m");
- INTERP_KERNEL::Unit const unit11("cm");
+ INTERP_KERNEL::Unit unit10("m");
+ INTERP_KERNEL::Unit unit11("cm");
CPPUNIT_ASSERT(unit10.isCompatibleWith(unit11) && unit11.isCompatibleWith(unit10));
CPPUNIT_ASSERT_DOUBLES_EQUAL(6200.,unit10.convert(unit11,62.),1e-8);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.62,unit11.convert(unit10,62.),1e-15);
- INTERP_KERNEL::Unit const unit12("m-m");
+ INTERP_KERNEL::Unit unit12("m-m");
CPPUNIT_ASSERT(!unit12.isInterpretationOK());
}
INTERP_KERNEL::ExprParser expr5("x-2*cos(y/3.)");
expr5.parse();
expr5.prepareFastEvaluator();
- auto *aa(new double[2]);
+ double *aa(new double[2]);
std::vector<std::string> vv(2); vv[0]="x"; vv[1]="y";
expr5.prepareExprEvaluationDouble(vv,2,1,0,aa,aa+2);
expr5.prepareFastEvaluator();
#ifndef _EXPREVALINTERPTEST_HXX_
#define _EXPREVALINTERPTEST_HXX_
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "InterpKernelTestExport.hxx"
#define __HEXA_TESTS_HXX_
#include "InterpolationTestSuite.hxx"
-#include <cppunit/extensions/HelperMacros.h>
namespace INTERP_TEST
{
#include "Interpolation3DTest.hxx"
#include "MEDFileMesh.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MeshTestToolkit.hxx"
-#include <cstdlib>
-#include <cppunit/TestAssert.h>
-#include <cmath>
#include <map>
-#include <string>
+#include <cmath>
+#include <vector>
#include <iostream>
#include <algorithm>
-#include <vector>
-#include <numeric>
#include "VectorUtils.hxx"
#ifndef __TU_INTERPOLATION_3D_TEST_HXX__
#define __TU_INTERPOLATION_3D_TEST_HXX__
-#include "MeshTestToolkit.hxx"
+#include <cppunit/extensions/HelperMacros.h>
#include "Interpolation3D.hxx"
-#include <cppunit/TestFixture.h>
-
#define ERR_TOL 1.0e-8
/// \brief OBSOLETE - renamed Interpolation3DTestSuite
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingNormalizedUnstructuredMesh.txx"
-#include "Interpolation2D.hxx"
#include "MEDFileMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "InterpolationOptionsTest.hxx"
+#include "MEDCouplingNormalizedUnstructuredMesh.txx"
+#include "Interpolation2D.txx"
#include "TestInterpKernelUtils.hxx"
-#include <string>
+#include <iostream>
+#include <vector>
using namespace MEDCoupling;
*/
void InterpolationOptionsTest::test_InterpolationOptions()
{
- std::string const sourcename=INTERP_TEST::getResourceFile("square1.med");
+ std::string sourcename=INTERP_TEST::getResourceFile("square1.med");
MEDFileUMesh *source_mesh=MEDFileUMesh::New(sourcename.c_str(),"Mesh_2");
- std::string const targetname=INTERP_TEST::getResourceFile("square2.med");
+ std::string targetname=INTERP_TEST::getResourceFile("square2.med");
MEDFileUMesh *target_mesh=MEDFileUMesh::New(targetname.c_str(),"Mesh_3");
MEDCouplingUMesh *source_mesh_mc=source_mesh->getMeshAtLevel(0);
targetvalue[i]=0.0;
// Ok at this point we have our mesh in MED-Memory format.
// Go to wrap med_source_mesh and med_target_mesh.
- MEDCouplingNormalizedUnstructuredMesh<2,2> const wrap_source_mesh(source_mesh_mc);
- MEDCouplingNormalizedUnstructuredMesh<2,2> const wrap_target_mesh(target_mesh_mc);
+ MEDCouplingNormalizedUnstructuredMesh<2,2> wrap_source_mesh(source_mesh_mc);
+ MEDCouplingNormalizedUnstructuredMesh<2,2> wrap_target_mesh(target_mesh_mc);
// Go for interpolation...
INTERP_KERNEL::Interpolation2D myInterpolator;
//optional call to parametrize your interpolation. First precision, tracelevel, intersector wanted.
#ifndef __TU_INTERPOLATIONOPTIONS_HXX__
#define __TU_INTERPOLATIONOPTIONS_HXX__
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "InterpKernelTestExport.hxx"
#ifndef __TU_INTERPOLATION_PLANAR_TEST_SUITE_HXX__
#define __TU_INTERPOLATION_PLANAR_TEST_SUITE_HXX__
-#include <cppunit/TestFixture.h>
-#include <cstddef>
+#include <cppunit/extensions/HelperMacros.h>
#include <deque>
#include <cmath>
#include <iostream>
-#include <vector>
namespace INTERP_TEST
{
* Sets up the test suite.
*
*/
- void setUp() override
+ void setUp()
{
_Epsilon = 1.e-6;
_Precision = 1.e-6;
}
- void tearDown() override {}
+ void tearDown() {}
// bool checkDequesEqual(std::deque< double > deque1, std::deque< double > deque2, double epsilon);
// bool checkVectorsEqual(std::vector< double > Vect1, std::vector< double > Vect2, double epsilon);
bool checkDequesEqual(std::deque< double > deque1,
std::deque< double > deque2, double epsilon)
{
- std::size_t const size1 = deque1.size();
- std::size_t const size2 = deque2.size();
+ std::size_t size1 = deque1.size();
+ std::size_t size2 = deque2.size();
bool are_equal = size1 == size2;
if(are_equal)
bool checkVectorsEqual(std::vector< double > vect1,
std::vector< double > vect2, double epsilon)
{
- std::size_t const size1 = vect1.size();
- std::size_t const size2 = vect2.size();
+ std::size_t size1 = vect1.size();
+ std::size_t size2 = vect2.size();
bool are_equal = size1 == size2;
if(are_equal)
}
void dequePrintOut(std::deque< double > deque1)
{
- for(double const i : deque1)
+ for(std::size_t i = 0; i< deque1.size(); i++)
{
- std::cerr << i << " ";
+ std::cerr << deque1[i] << " ";
}
std::cerr<< std::endl;
}
void vectPrintOut(std::vector< double > vect)
{
- for(double const i : vect)
+ for(std::size_t i = 0; i< vect.size(); i++)
{
- std::cerr << i << " ";
+ std::cerr << vect[i] << " ";
}
std::cerr<< std::endl;
}
#ifndef __TU_INTERPOLATION_TEST_SUITE_HXX__
#define __TU_INTERPOLATION_TEST_SUITE_HXX__
-#include "MeshTestToolkit.hxx"
#include "MeshTestToolkit.txx"
-#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
namespace INTERP_TEST
{
#include "MCAuto.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "MEDMeshMaker.hxx"
#ifndef __TU_MESH_TEST_TOOLKIT_HXX__
#define __TU_MESH_TEST_TOOLKIT_HXX__
-#include "InterpolationOptions.hxx"
-#include "MCIdType.hxx"
+#include "Interpolation3D.hxx"
+#include "Interpolation3D.txx"
+#include "InterpolationPlanar.hxx"
#include <vector>
#include <map>
{
public:
- double _precision{1.e-6};
- INTERP_KERNEL::IntersectionType _intersectionType{INTERP_KERNEL::Triangulation};//Used only in the case MESHDIM==2 (planar intersections)
+ double _precision;
+ INTERP_KERNEL::IntersectionType _intersectionType;//Used only in the case MESHDIM==2 (planar intersections)
- MeshTestToolkit() = default;
+ MeshTestToolkit():_precision(1.e-6),_intersectionType(INTERP_KERNEL::Triangulation) {}
- ~MeshTestToolkit() = default;
+ ~MeshTestToolkit() {}
void intersectMeshes(const char* mesh1, const char* mesh2, const double correctVol, const double prec = 1.0e-5, bool doubleTest = true) const;
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#ifndef __MESHTESTTOOLKI_TXX__
-#define __MESHTESTTOOLKI_TXX__
+#include "TestInterpKernelUtils.hxx"
#include "MeshTestToolkit.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "Interpolation2D.hxx"
-
#include "MEDFileMesh.hxx"
+#include "MEDCouplingNormalizedUnstructuredMesh.hxx"
#include "MEDCouplingNormalizedUnstructuredMesh.txx"
#include "MEDCouplingFieldDouble.hxx"
#include "Interpolation3DSurf.hxx"
#include "Interpolation2D.txx"
#include "Interpolation3D.txx"
-#include "TestInterpKernelUtils.hxx"
-#include <cppunit/TestAssert.h>
-#include <cmath>
#include <map>
-#include <string>
+#include <cmath>
+#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
-#include <vector>
-#include <numeric>
// levels :
// 4 - empty
// 5 - misc
#include "Log.hxx"
-#include "VectorUtils.hxx"
+#include <cppunit/extensions/HelperMacros.h>
//#define VOL_PREC 1.0e-6
using namespace MEDCoupling;
double MeshTestToolkit<SPACEDIM,MESHDIM>::sumRow(const IntersectionMatrix& m, int i) const
{
double vol = 0.0;
- for(const auto & iter : m)
+ for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
- if(iter.count(i) != 0.0)
+ if(iter->count(i) != 0.0)
{
- auto iter2 = iter.find(i);
+ std::map<mcIdType, double>::const_iterator iter2 = iter->find(i);
vol += fabs(iter2->second);
}
}
{
double vol = 0.0;
const std::map<mcIdType, double>& col = m[i];
- for(auto iter : col)
+ for(std::map<mcIdType, double>::const_iterator iter = col.begin() ; iter != col.end() ; ++iter)
{
- vol += fabs(iter.second);
+ vol += fabs(iter->second);
}
return vol;
}
double MeshTestToolkit<SPACEDIM,MESHDIM>::sumVolume(const IntersectionMatrix& m) const
{
std::vector<double> volumes;
- for(const auto & iter : m)
+ for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
- for(const auto & iter2 : iter)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
- volumes.push_back(fabs(iter2.second));
+ volumes.push_back(fabs(iter2->second));
}
}
// sum in ascending order to avoid rounding errors
- std::sort(volumes.begin(), volumes.end());
+ sort(volumes.begin(), volumes.end());
const double vol = accumulate(volumes.begin(), volumes.end(), 0.0);
return vol;
bool ok = true;
// source elements
- auto* sVol = new double[sMesh.getNumberOfCells()];
+ double* sVol = new double[sMesh.getNumberOfCells()];
getVolumes(sMesh, sVol);
for(int i = 0; i < sMesh.getNumberOfCells(); ++i)
}
// target elements
- auto* tVol = new double[tMesh.getNumberOfCells()];
+ double* tVol = new double[tMesh.getNumberOfCells()];
getVolumes(tMesh, tVol);
for(int i = 0; i < tMesh.getNumberOfCells(); ++i)
{
int i = 0;
for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter)
{
- for(auto iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
mcIdType j = iter2->first;
if(m2.at(j).count(i) == 0)
for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter)
{
- for(auto iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
mcIdType j = iter2->first;
const double v1 = fabs(iter2->second);
bool isDiagonal = true;
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
- for(auto iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
- mcIdType const j = iter2->first;
+ mcIdType j = iter2->first;
const double vol = iter2->second;
if(vol != 0.0 && (i != j))
{
intersectMeshes(path1.c_str(), mesh1, path2.c_str(), mesh2, correctVol, prec, doubleTest);
}
}
-
-#endif
#include "InterpolationTestSuite.hxx"
-#include <cppunit/extensions/HelperMacros.h>
-#include "MeshTestToolkit.hxx"
-
namespace INTERP_TEST
{
/**
#define __MULTI_ELEMENT_3DSurf_TESTS_HXX_
#include "InterpolationTestSuite.hxx"
-#include "InterpolationOptions.hxx"
-#include <cppunit/extensions/HelperMacros.h>
-#include "MeshTestToolkit.hxx"
namespace INTERP_TEST
{
* different geometries : triangle, quadrilateral.
*
*/
- class MultiElement3DSurfTests : public InterpolationTestSuite<3,2>
+ class MultiElement2DTests : public InterpolationTestSuite<3,2>
{
CPPUNIT_TEST_SUITE( MultiElement3DSurfTests );
#define __MULTI_ELEMENT_TETRA_TESTS_HXX_
#include "InterpolationTestSuite.hxx"
-#include <cppunit/extensions/HelperMacros.h>
namespace INTERP_TEST
{
#include "Interpolation3D.hxx"
#include "Interpolation3D.txx"
-#include "MeshTestToolkit.hxx"
-#include "MCAuto.hxx"
-#include "MEDFileMesh.hxx"
-#include "MEDCouplingUMesh.hxx"
#include "MeshTestToolkit.txx"
#include "Log.hxx"
#include "VectorUtils.hxx"
+#include "TestInterpKernelUtils.hxx"
-#include "MEDCouplingNormalizedUnstructuredMesh.txx"
+#include "MEDCouplingNormalizedUnstructuredMesh.hxx"
#include <cassert>
#include <string>
-#include <utility>
/**
* Test program which takes two meshes and calculates their intersection matrix.
// Author : Anthony Geay (CEA/DEN)
#include "QuadraticPlanarInterpTest.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DElementaryEdge.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
#include "TestInterpKernelUtils.hxx"
-#include <cppunit/TestAssert.h>
-#include <math.h>
#include <sstream>
+#include <iostream>
using namespace INTERP_KERNEL;
{
//Testing bounds calculation. For Seg2
std::istringstream stream("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4700");
- auto *e1=new EdgeLin(stream);
+ EdgeLin *e1=new EdgeLin(stream);
Bounds bound=e1->getBounds();
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,bound[1],ADMISSIBLE_ERROR);
void QuadraticPlanarInterpTest::ReadWriteInXfigGlobal()
{
- QuadraticPolygon const pol1(INTERP_TEST::getResourceFile("Pol1.fig").c_str());
+ QuadraticPolygon pol1(INTERP_TEST::getResourceFile("Pol1.fig").c_str());
pol1.dumpInXfigFile("Pol1_gen.fig");
- QuadraticPolygon const pol2(INTERP_TEST::getResourceFile("Pol2.fig").c_str());
+ QuadraticPolygon pol2(INTERP_TEST::getResourceFile("Pol2.fig").c_str());
pol2.dumpInXfigFile("Pol2_gen.fig");
- QuadraticPolygon const pol3(INTERP_TEST::getResourceFile("Pol3.fig").c_str());
+ QuadraticPolygon pol3(INTERP_TEST::getResourceFile("Pol3.fig").c_str());
pol3.dumpInXfigFile("Pol3_gen.fig");
- QuadraticPolygon const pol4(INTERP_TEST::getResourceFile("Pol4.fig").c_str());
+ QuadraticPolygon pol4(INTERP_TEST::getResourceFile("Pol4.fig").c_str());
CPPUNIT_ASSERT_EQUAL(1,pol4.size());
- auto *edge1=dynamic_cast<ElementaryEdge *>(pol4[0]);
+ ElementaryEdge *edge1=dynamic_cast<ElementaryEdge *>(pol4[0]);
CPPUNIT_ASSERT(edge1);
Edge *edge2=edge1->getPtr();
- auto *edge=dynamic_cast<EdgeArcCircle *>(edge2);
+ EdgeArcCircle *edge=dynamic_cast<EdgeArcCircle *>(edge2);
CPPUNIT_ASSERT(edge);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT_DOUBLES_EQUAL(5.7857653289925404,edge->getAngle(),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.49741997818704586,edge->getAngle(),ADMISSIBLE_ERROR);//5.7857653289925404 + 2*PI
n1->decrRef();
//A half circle.
- auto *e=new EdgeArcCircle(0.84,0.54,0.78,0.6,0.84,0.66);
+ EdgeArcCircle *e=new EdgeArcCircle(0.84,0.54,0.78,0.6,0.84,0.66);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.06,e->getRadius(),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.1415925921507317,e->getAngle(),1e-5);
e->decrRef();
{
Node *n1=new Node(1.,1.);
Node *n2=new Node(4.,2.);
- auto *e1=new EdgeLin(n1,n2);
+ EdgeLin *e1=new EdgeLin(n1,n2);
double tmp[2];
e1->getNormalVector(tmp);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.94868329805051377,tmp[1],ADMISSIBLE_ERROR);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0158113883008418,e1->getDistanceToPoint(tmp),1e-12);
tmp[0]=0.; tmp[1]=5.;
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,e1->getDistanceToPoint(tmp),1e-12);
- auto *e=new EdgeArcCircle(4.,3.,0.,5.,-5.,0.);
+ EdgeArcCircle *e=new EdgeArcCircle(4.,3.,0.,5.,-5.,0.);
tmp[0]=-4.; tmp[1]=3.;
CPPUNIT_ASSERT(e->isNodeLyingOn(tmp));
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,e->getDistanceToPoint(tmp),1e-12);
{
//Testing intersection of Bounds.
std::istringstream stream1("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800");
- auto *e1=new EdgeLin(stream1);
+ EdgeLin *e1=new EdgeLin(stream1);
std::istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800");
- auto *e2=new EdgeLin(stream2);
+ EdgeLin *e2=new EdgeLin(stream2);
Bounds *bound=e1->getBounds().amIIntersectingWith(e2->getBounds()); CPPUNIT_ASSERT(bound);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,(*bound)[0],ADMISSIBLE_ERROR);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,(*bound)[1],ADMISSIBLE_ERROR);
e2->decrRef(); e1->decrRef();
//
std::istringstream stream3("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3000 7200 6000 3700");
- auto *e3=new EdgeLin(stream3);
+ EdgeLin *e3=new EdgeLin(stream3);
std::istringstream stream4("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4800 6600 7200 4200");
- auto *e4=new EdgeLin(stream4);
+ EdgeLin *e4=new EdgeLin(stream4);
bound=e3->getBounds().amIIntersectingWith(e4->getBounds()); CPPUNIT_ASSERT(bound);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,(*bound)[0],ADMISSIBLE_ERROR);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.6,(*bound)[1],ADMISSIBLE_ERROR);
void QuadraticPlanarInterpTest::EdgeLinUnitary()
{
- auto *e1=new EdgeLin(0.5,0.5,3.7,4.1);
+ EdgeLin *e1=new EdgeLin(0.5,0.5,3.7,4.1);
Node *n=new Node(2.1,2.3);
CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),0.5,1e-8);
n->decrRef();
v1.clear(); v2.clear(); v3.clear();
//Test 3bis - INSIDE - INSIDE - Bis | opp dir.
double center[2]={0.,0.};
- double const radius=1.;
+ double radius=1.;
e1=buildArcOfCircle(center,radius,-M_PI,0); e2=buildArcOfCircle(center,radius,-2*M_PI/3.+2*M_PI,-M_PI/3.);
CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.*M_PI/3.,e2->getCurveLength(),1e-12);// To check that in the previous line +2.M_PI has done its job.
CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
void QuadraticPlanarInterpTest::IntersectionPointOnlyUnitarySegSeg()
{
// 0deg - classical
- auto *e1=new EdgeLin(0.,0.,1.,0.);
- auto *e2=new EdgeLin(0.3,0.3,0.5,-0.3);
+ EdgeLin *e1=new EdgeLin(0.,0.,1.,0.);
+ EdgeLin *e2=new EdgeLin(0.3,0.3,0.5,-0.3);
ComposedEdge& v1=*(new ComposedEdge);
ComposedEdge& v2=*(new ComposedEdge); MergePoints v3;
CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
#ifndef _QUADRATICPLANARINTERPTEST_HXX_
#define _QUADRATICPLANARINTERPTEST_HXX_
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include "InterpKernelGeo2DNode.hxx"
#include "InterpKernelTestExport.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
//
// Author : Anthony Geay (CEA/DEN)
-#include "InterpKernelGeo2DEdge.hxx"
-#include "InterpKernelGeo2DNode.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
#include "QuadraticPlanarInterpTest.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
#include <cmath>
-#include <math.h>
-#include <cppunit/TestAssert.h>
-#include <vector>
+#include <sstream>
+#include <iostream>
using namespace INTERP_KERNEL;
void QuadraticPlanarInterpTest::IntersectArcCircleBase()
{
double center[2]={0.5,0.5};
- double const radius=0.3;
+ double radius=0.3;
EdgeArcCircle *e1=buildArcOfCircle(center,radius,M_PI/4.,M_PI/3.);
CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI/3),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(M_PI/4),ADMISSIBLE_ERROR);
std::vector<Node *> v4;
MergePoints v3;
EdgeArcCircle *e2;
- ArcCArcCIntersector *intersector=nullptr;
+ ArcCArcCIntersector *intersector=0;
for(unsigned k=0;k<8;k++)
{
e1=buildArcOfCircle(center,radius,M_PI/4.+k*M_PI/4.,M_PI/3.+k*M_PI/4.);
CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10);
- for(auto & iter : v4)
- iter->decrRef();
+ for(std::vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+ (*iter)->decrRef();
v4.clear(); v3.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10);
- for(auto & iter : v4)
- iter->decrRef();
+ for(std::vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+ (*iter)->decrRef();
v4.clear(); v3.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10);
- for(auto & iter : v4)
- iter->decrRef();
+ for(std::vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+ (*iter)->decrRef();
v4.clear(); v3.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10);
- for(auto & iter : v4)
- iter->decrRef();
+ for(std::vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+ (*iter)->decrRef();
v4.clear(); v3.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10);
- for(auto & iter : v4)
- iter->decrRef();
+ for(std::vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+ (*iter)->decrRef();
v4.clear(); v3.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10);
- for(auto & iter : v4)
- iter->decrRef();
+ for(std::vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+ (*iter)->decrRef();
v4.clear(); v3.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10);
- for(auto & iter : v4)
- iter->decrRef();
+ for(std::vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+ (*iter)->decrRef();
v4.clear(); v3.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10);
- for(auto & iter : v4)
- iter->decrRef();
+ for(std::vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+ (*iter)->decrRef();
v4.clear(); v3.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
- for(auto & iter : v4)
- iter->decrRef();
+ for(std::vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+ (*iter)->decrRef();
v4.clear(); v4.clear();
delete intersector; e2->decrRef(); e1->decrRef();
}
void QuadraticPlanarInterpTest::IntersectArcCircleFull()
{
- double center1[2]; center1[0]=0.; center1[1]=0.; double const radius1=3.;
+ double center1[2]; center1[0]=0.; center1[1]=0.; double radius1=3.;
double center2[2]; center2[0]=0.75; center2[1]=-2.6; double radius2=1.;
EdgeArcCircle *e1=buildArcOfCircle(center1,radius1,-M_PI/3.,4.*M_PI/3.);
EdgeArcCircle *e2=buildArcOfCircle(center2,radius2,0.,M_PI/2.);
{
double center[2]={2.,2.};
EdgeArcCircle *e1=buildArcOfCircle(center,2.3,M_PI/4.,5.*M_PI/4.);
- auto *e2=new EdgeLin(-1.3,1.,3.,5.3);
+ EdgeLin *e2=new EdgeLin(-1.3,1.,3.,5.3);
EdgeIntersector *intersector=new ArcCSegIntersector(*e1,*e2);
bool order;
bool obvious,areOverlapped;
EdgeArcCircle *QuadraticPlanarInterpTest::buildArcOfCircle(const double *center, double radius, double alphaStart, double alphaEnd)
{
- double const alphaM=(alphaStart+alphaEnd)/2;
+ double alphaM=(alphaStart+alphaEnd)/2;
return new EdgeArcCircle(center[0]+cos(alphaStart)*radius,center[1]+sin(alphaStart)*radius,
center[0]+cos(alphaM)*radius,center[1]+sin(alphaM)*radius,
center[0]+cos(alphaEnd)*radius,center[1]+sin(alphaEnd)*radius);
double tmp1[2],tmp2[2];
tmp1[0]=n1Pt[0]-center[0]; tmp1[1]=n1Pt[1]-center[1];
tmp2[0]=n2Pt[0]-center[0]; tmp2[1]=n2Pt[1]-center[1];
- double const distTmp1=sqrt(tmp1[0]*tmp1[0]+tmp1[1]*tmp1[1]);
- double const distTmp2=sqrt(tmp2[0]*tmp2[0]+tmp2[1]*tmp2[1]);
+ double distTmp1=sqrt(tmp1[0]*tmp1[0]+tmp1[1]*tmp1[1]);
+ double distTmp2=sqrt(tmp2[0]*tmp2[0]+tmp2[1]*tmp2[1]);
double ret=acos((tmp1[0]*tmp2[0]+tmp1[1]*tmp2[1])/(distTmp1*distTmp2));
if(tmp1[0]*tmp2[1]-tmp1[1]*tmp2[0]<0)
ret=-ret;
//
// Author : Anthony Geay (CEA/DEN)
-#include "InterpKernelGeo2DNode.hxx"
-#include "InterpKernelGeo2DComposedEdge.hxx"
-#include "InterpKernelGeo2DAbstractEdge.hxx"
-#include "InterpKernelGeo2DEdge.hxx"
#include "QuadraticPlanarInterpTest.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
#include "InterpKernelGeo2DElementaryEdge.hxx"
+#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
#include <cmath>
-#include <cppunit/TestAssert.h>
+#include <sstream>
+#include <iostream>
using namespace INTERP_KERNEL;
Node *n1=new Node(0.,0.);
Node *n2=new Node(1.,0.);
Node *n3=new Node(0.5,1.);
- auto *e1=new EdgeLin(n1,n2);
- auto *e2=new EdgeLin(n2,n3);
- auto *e3=new EdgeLin(n3,n1);
- auto *tri=new ComposedEdge;
+ EdgeLin *e1=new EdgeLin(n1,n2);
+ EdgeLin *e2=new EdgeLin(n2,n3);
+ EdgeLin *e3=new EdgeLin(n3,n1);
+ ComposedEdge *tri=new ComposedEdge;
tri->pushBack(e1); tri->pushBack(e2); tri->pushBack(e3);
//
Node *where=new Node(0.4,0.1);
void QuadraticPlanarInterpTest::checkAssemblingBases1()
{
Node *n1=new Node(0.,0.);
- Node *n2=new Node(0.1,0.); auto *e1_2=new EdgeLin(n1,n2);
- Node *n3=new Node(0.2,0.); auto *e2_3=new EdgeLin(n2,n3);
- Node *n4=new Node(0.3,0.); auto *e3_4=new EdgeLin(n3,n4);
- Node *n5=new Node(0.4,0.); auto *e4_5=new EdgeLin(n4,n5);
- Node *n6=new Node(0.5,0.); auto *e5_6=new EdgeLin(n5,n6);
- Node *n7=new Node(0.6,0.); auto *e6_7=new EdgeLin(n6,n7);
- Node *n8=new Node(0.7,0.); auto *e7_8=new EdgeLin(n7,n8);
- Node *n9=new Node(0.8,0.); auto *e8_9=new EdgeLin(n8,n9);
- Node *n10=new Node(0.9,0.); auto *e9_10=new EdgeLin(n9,n10);
- Node *n11=new Node(1.,0.); auto *e10_11=new EdgeLin(n10,n11);
- Node *n12=new Node(0.5,1.); auto *e11_12=new EdgeLin(n11,n12);
- auto *e12_1=new EdgeLin(n12,n1);
+ Node *n2=new Node(0.1,0.); EdgeLin *e1_2=new EdgeLin(n1,n2);
+ Node *n3=new Node(0.2,0.); EdgeLin *e2_3=new EdgeLin(n2,n3);
+ Node *n4=new Node(0.3,0.); EdgeLin *e3_4=new EdgeLin(n3,n4);
+ Node *n5=new Node(0.4,0.); EdgeLin *e4_5=new EdgeLin(n4,n5);
+ Node *n6=new Node(0.5,0.); EdgeLin *e5_6=new EdgeLin(n5,n6);
+ Node *n7=new Node(0.6,0.); EdgeLin *e6_7=new EdgeLin(n6,n7);
+ Node *n8=new Node(0.7,0.); EdgeLin *e7_8=new EdgeLin(n7,n8);
+ Node *n9=new Node(0.8,0.); EdgeLin *e8_9=new EdgeLin(n8,n9);
+ Node *n10=new Node(0.9,0.); EdgeLin *e9_10=new EdgeLin(n9,n10);
+ Node *n11=new Node(1.,0.); EdgeLin *e10_11=new EdgeLin(n10,n11);
+ Node *n12=new Node(0.5,1.); EdgeLin *e11_12=new EdgeLin(n11,n12);
+ EdgeLin *e12_1=new EdgeLin(n12,n1);
//Only one level
e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_7->incrRef();
e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef();
- auto *c=new ComposedEdge;
+ ComposedEdge *c=new ComposedEdge;
c->pushBack(e1_2); c->pushBack(e2_3); c->pushBack(e3_4); c->pushBack(e4_5); c->pushBack(e5_6); c->pushBack(e6_7);
c->pushBack(e7_8); c->pushBack(e8_9); c->pushBack(e9_10); c->pushBack(e10_11); c->pushBack(e11_12); c->pushBack(e12_1);
CPPUNIT_ASSERT_EQUAL(12,c->recursiveSize());
//(e1_2, (e2_3,(e3_4, e4_5, e5_6, e6_7, (e7_8, e8_9 ), ( e9_10 , e10_11 ), e11_12 ),e12_1 ) )
e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_7->incrRef();
e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef();
- auto *c2_2_4=new ComposedEdge; c2_2_4->pushBack(e7_8); c2_2_4->pushBack(e8_9);
- auto *c2_2_5=new ComposedEdge; c2_2_5->pushBack(e9_10); c2_2_5->pushBack(e10_11);
- auto *c2_2=new ComposedEdge; c2_2->pushBack(e3_4); c2_2->pushBack(e4_5); c2_2->pushBack(e5_6); c2_2->pushBack(e6_7); c2_2->pushBack(c2_2_4); c2_2->pushBack(c2_2_5); c2_2->pushBack(e11_12);
- auto *c2=new ComposedEdge; c2->pushBack(e2_3); c2->pushBack(c2_2); c2->pushBack(e12_1);
+ ComposedEdge *c2_2_4=new ComposedEdge; c2_2_4->pushBack(e7_8); c2_2_4->pushBack(e8_9);
+ ComposedEdge *c2_2_5=new ComposedEdge; c2_2_5->pushBack(e9_10); c2_2_5->pushBack(e10_11);
+ ComposedEdge *c2_2=new ComposedEdge; c2_2->pushBack(e3_4); c2_2->pushBack(e4_5); c2_2->pushBack(e5_6); c2_2->pushBack(e6_7); c2_2->pushBack(c2_2_4); c2_2->pushBack(c2_2_5); c2_2->pushBack(e11_12);
+ ComposedEdge *c2=new ComposedEdge; c2->pushBack(e2_3); c2->pushBack(c2_2); c2->pushBack(e12_1);
c=new ComposedEdge; c->pushBack(e1_2); c->pushBack(c2); CPPUNIT_ASSERT_EQUAL(12,c->recursiveSize());
IteratorOnComposedEdge it2(c);
CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2);
Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-0.3);
Node *n2=new Node(1.,0.); Node *n5=new Node(1.,-0.3);
Node *n3=new Node(0.5,1.); Node *n6=new Node(0.5,0.7);
- auto *e1_2=new EdgeLin(n1,n2); auto *e4_5=new EdgeLin(n4,n5);
- auto *e2_3=new EdgeLin(n2,n3); auto *e5_6=new EdgeLin(n5,n6);
- auto *e3_1=new EdgeLin(n3,n1); auto *e6_4=new EdgeLin(n6,n4);
+ EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5);
+ EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6);
+ EdgeLin *e3_1=new EdgeLin(n3,n1); EdgeLin *e6_4=new EdgeLin(n6,n4);
//
e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
QuadraticPolygon pol1; pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1);
QuadraticPolygon pol2; pol2.pushBack(e4_5); pol2.pushBack(e5_6); pol2.pushBack(e6_4);
- QuadraticPolygon const cpyPol1(pol1); int nbOfSplits=0;
+ QuadraticPolygon cpyPol1(pol1); int nbOfSplits=0;
cpyPol1.SplitPolygonsEachOther(pol1,pol2,nbOfSplits);
CPPUNIT_ASSERT_EQUAL(5,pol1.recursiveSize());
CPPUNIT_ASSERT_EQUAL(5,pol2.recursiveSize());CPPUNIT_ASSERT_EQUAL(15,nbOfSplits);
CPPUNIT_ASSERT(pol2[3]->getEndNode()==pol1[0]->getEndNode());
CPPUNIT_ASSERT(pol2[3]->getEndNode()->getLoc()==ON_1);
cpyPol1.performLocatingOperation(pol2);
- auto *tmp=dynamic_cast<ElementaryEdge *>(pol2[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_5);
+ ElementaryEdge *tmp=dynamic_cast<ElementaryEdge *>(pol2[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_5);
CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
tmp=dynamic_cast<ElementaryEdge *>(pol2[1]); CPPUNIT_ASSERT(tmp);
n2=new Node(1.,0.); n5=new Node(0.5,0.);
n3=new Node(0.5,1.); n6=new Node(0.75,0.5); Node *n7=new Node(2.,0.5);
e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
- auto *e5_4=new EdgeLin(n5,n4); auto *e4_7=new EdgeLin(n4,n7); auto *e7_6=new EdgeLin(n7,n6); auto *e6_5=new EdgeLin(n6,n5);
+ EdgeLin *e5_4=new EdgeLin(n5,n4); EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_6=new EdgeLin(n7,n6); EdgeLin *e6_5=new EdgeLin(n6,n5);
//
e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e5_4->incrRef(); e4_7->incrRef(); e7_6->incrRef(); e6_5->incrRef();
QuadraticPolygon pol3; pol3.pushBack(e1_2); pol3.pushBack(e2_3); pol3.pushBack(e3_1);
QuadraticPolygon pol4; pol4.pushBack(e5_4); pol4.pushBack(e4_7); pol4.pushBack(e7_6); pol4.pushBack(e6_5);
- QuadraticPolygon const cpyPol3(pol3); nbOfSplits=0;
+ QuadraticPolygon cpyPol3(pol3); nbOfSplits=0;
cpyPol3.SplitPolygonsEachOther(pol3,pol4,nbOfSplits);
CPPUNIT_ASSERT_EQUAL(5,pol3.recursiveSize());
CPPUNIT_ASSERT_EQUAL(4,pol4.recursiveSize());CPPUNIT_ASSERT_EQUAL(16,nbOfSplits);
e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
QuadraticPolygon pol5; pol5.pushBack(e1_2); pol5.pushBack(e2_3); pol5.pushBack(e3_1);
QuadraticPolygon pol6; pol6.pushBack(e4_5); pol6.pushBack(e5_6); pol6.pushBack(e6_4);
- QuadraticPolygon const cpyPol5(pol5); nbOfSplits=0;
+ QuadraticPolygon cpyPol5(pol5); nbOfSplits=0;
cpyPol5.SplitPolygonsEachOther(pol5,pol6,nbOfSplits);
CPPUNIT_ASSERT_EQUAL(4,pol5.recursiveSize());
CPPUNIT_ASSERT_EQUAL(4,pol6.recursiveSize()); CPPUNIT_ASSERT_EQUAL(13,nbOfSplits);
e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
QuadraticPolygon pol7; pol7.pushBack(e1_2); pol7.pushBack(e2_3); pol7.pushBack(e3_1);
QuadraticPolygon pol8; pol8.pushBack(e4_5); pol8.pushBack(e5_6); pol8.pushBack(e6_4);
- QuadraticPolygon const cpyPol7(pol7); nbOfSplits=0;
+ QuadraticPolygon cpyPol7(pol7); nbOfSplits=0;
cpyPol7.SplitPolygonsEachOther(pol7,pol8,nbOfSplits);
tmp=dynamic_cast<ElementaryEdge *>(pol8[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e1_2);
CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1);
//
// Author : Anthony Geay (CEA/DEN)
-#include "InterpKernelGeo2DNode.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
-#include "InterpKernelGeo2DBounds.hxx"
#include "QuadraticPlanarInterpTest.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
#include "InterpKernelGeo2DElementaryEdge.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
-#include <algorithm>
#include <cmath>
-#include <cppunit/TestAssert.h>
-#include <math.h>
-#include <map>
-#include <vector>
+#include <sstream>
+#include <iostream>
+#include <iterator>
using namespace INTERP_KERNEL;
Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-0.3);
Node *n2=new Node(1.,0.); Node *n5=new Node(1.,-0.3);
Node *n3=new Node(0.5,1.); Node *n6=new Node(0.5,0.7);
- auto *e1_2=new EdgeLin(n1,n2); auto *e4_5=new EdgeLin(n4,n5);
- auto *e2_3=new EdgeLin(n2,n3); auto *e5_6=new EdgeLin(n5,n6);
- auto *e3_1=new EdgeLin(n3,n1); auto *e6_4=new EdgeLin(n6,n4);
+ EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5);
+ EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6);
+ EdgeLin *e3_1=new EdgeLin(n3,n1); EdgeLin *e6_4=new EdgeLin(n6,n4);
//
std::vector<QuadraticPolygon *> result;
for(int k=0;k<2;k++)
n2=new Node(1.,0.); n5=new Node(0.5,0.);
n3=new Node(0.5,1.); n6=new Node(0.75,0.5); Node *n7=new Node(2.,0.5);
e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
- auto *e5_4=new EdgeLin(n5,n4); auto *e4_7=new EdgeLin(n4,n7); auto *e7_6=new EdgeLin(n7,n6); auto *e6_5=new EdgeLin(n6,n5);
+ EdgeLin *e5_4=new EdgeLin(n5,n4); EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_6=new EdgeLin(n7,n6); EdgeLin *e6_5=new EdgeLin(n6,n5);
//
for(int k=0;k<2;k++)
for(int i=0;i<3;i++)
QuadraticPolygon *pol=QuadraticPolygon::BuildArcCirclePolygon(nodes);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.04719755,pol->getArea(),1e-5);
CPPUNIT_ASSERT_EQUAL(3,pol->size());
- auto *e0=dynamic_cast<ElementaryEdge *>((*pol)[0]);
- auto *e1=dynamic_cast<ElementaryEdge *>((*pol)[1]);
- auto *e2=dynamic_cast<ElementaryEdge *>((*pol)[0]);
+ ElementaryEdge *e0=dynamic_cast<ElementaryEdge *>((*pol)[0]);
+ ElementaryEdge *e1=dynamic_cast<ElementaryEdge *>((*pol)[1]);
+ ElementaryEdge *e2=dynamic_cast<ElementaryEdge *>((*pol)[0]);
CPPUNIT_ASSERT(e0); CPPUNIT_ASSERT(e1); CPPUNIT_ASSERT(e2);
CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e0->getPtr()));// <- testing detection of colinearity
CPPUNIT_ASSERT(dynamic_cast<EdgeArcCircle *>(e1->getPtr()));
0.1000 , 0.1500 , 0.2000 , 0.2500, 0.3000, 0.3500, 0.4000, 0.4500, 0.5000, 0.5500,
0.6000, 0.6500, 0.7000, 0.7194, 0.7388, 0.7581, 0.7775, 0.7969, 0.8163, 0.8356,
0.8550};
- std::vector<double> const zLev1(Z_VALS_1,Z_VALS_1+NB_OF_CELL_AXIAL_1+1);
+ std::vector<double> zLev1(Z_VALS_1,Z_VALS_1+NB_OF_CELL_AXIAL_1+1);
const int NB_OF_CELL_AXIAL_2=46;
static const double Z_VALS_2[NB_OF_CELL_AXIAL_2+1]=
, 0.20, 0.25, 0.30, 0.350 ,0.40 ,0.450 ,0.500 , 0.550, 0.600 ,0.650 ,0.700
, 0.7194 ,0.7388 ,0.7581 ,0.7775 ,0.7969 ,0.8163 ,0.8356, 0.8550
, 0.8738 ,0.8925 ,0.9113 ,0.9300 ,0.9488 ,0.9675 ,0.9863, 1.0050};
- std::vector<double> const zLev2(Z_VALS_2,Z_VALS_2+NB_OF_CELL_AXIAL_2+1);
+ std::vector<double> zLev2(Z_VALS_2,Z_VALS_2+NB_OF_CELL_AXIAL_2+1);
std::map<int,std::map<int,double> > m;
Edge::Interpolate1DLin(zLev1,zLev2,m);
CPPUNIT_ASSERT_EQUAL(30,(int)m.size());
static const double Z_VALS_3[NB_OF_CELL_AXIAL_3+1]={
0.,0.01,0.05,0.10,0.15,0.20,0.25,0.30,
0.35,0.40,0.45,0.50,0.55,0.60 };
- std::vector<double> const zLev3(Z_VALS_3,Z_VALS_3+NB_OF_CELL_AXIAL_3+1);
+ std::vector<double> zLev3(Z_VALS_3,Z_VALS_3+NB_OF_CELL_AXIAL_3+1);
Edge::Interpolate1DLin(zLev3,zLev1,m);
CPPUNIT_ASSERT_EQUAL(13,(int)m.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,m[0][8],1e-12);
const double radius1=2.902;
const double angleS1=-0.49999999950907054; const double angleL1=-0.0942156629996692;
const double center1[2]={13.66, -23.66};
- auto *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1);
+ EdgeArcCircle *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1);
//
const double coords2[]=
{
const double radius2=2.4345;
const double angleS2=-0.523598776190207; const double angleL2=0.5235987755846041;
const double center2[]={ 13.933240960547204, -24.132999998525658 };
- auto *e2=new EdgeArcCircle(nS2,nE2,center2,radius2,angleS2,angleL2);
+ EdgeArcCircle *e2=new EdgeArcCircle(nS2,nE2,center2,radius2,angleS2,angleL2);
MergePoints merge;
QuadraticPolygon c1,c2;
e1->intersectWith(e2,merge,c1,c2);
const double radius1=3.4304999897666599;
const double angleS1=2.6179938783536514; const double angleL1=-0.52359877711901204;
const double center1[2]={13.933240950441375, -24.132999992807399};
- auto *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1);
+ EdgeArcCircle *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1);
//
const double coords2[]=
{
};
Node *nS2=new Node(coords2);
Node *nE2=new Node(coords2+2);
- auto *e2=new EdgeLin(nS2,nE2);
+ EdgeLin *e2=new EdgeLin(nS2,nE2);
MergePoints merge;
QuadraticPolygon c1,c2;
CPPUNIT_ASSERT(e1->intersectWith(e2,merge,c1,c2));
CPPUNIT_ASSERT_EQUAL(2,c1.size());
CPPUNIT_ASSERT_EQUAL(2,c2.size());
- auto *tmp1=dynamic_cast<ElementaryEdge *>(c1.front()); CPPUNIT_ASSERT(tmp1);
- auto *tmp2=dynamic_cast<EdgeArcCircle *>(tmp1->getPtr()); CPPUNIT_ASSERT(tmp2);
+ ElementaryEdge *tmp1=dynamic_cast<ElementaryEdge *>(c1.front()); CPPUNIT_ASSERT(tmp1);
+ EdgeArcCircle *tmp2=dynamic_cast<EdgeArcCircle *>(tmp1->getPtr()); CPPUNIT_ASSERT(tmp2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(2.6179938783536514,tmp2->getAngle0(),1e-14);
//clean-up
nS1->decrRef(); nE1->decrRef(); nS2->decrRef(); nE2->decrRef(); e1->decrRef(); e2->decrRef();
nodes2.push_back(new Node(coords2+12));
nodes2.push_back(new Node(coords2+14));
QuadraticPolygon *pol2=QuadraticPolygon::BuildArcCirclePolygon(nodes2);
- std::vector<QuadraticPolygon *> const v=pol1->intersectMySelfWith(*pol2);
+ std::vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
CPPUNIT_ASSERT_EQUAL(0,(int)v.size());
//CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00164773941455998,v[0]->getArea(),1e-7);
//delete v[0];
nodes2.push_back(new Node(coords2+12));
nodes2.push_back(new Node(coords2+14));
QuadraticPolygon *pol2=QuadraticPolygon::BuildArcCirclePolygon(nodes2);
- std::vector<QuadraticPolygon *> const v=pol1->intersectMySelfWith(*pol2);
+ std::vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
CPPUNIT_ASSERT_EQUAL(0,(int)v.size());
delete pol1;
delete pol2;
Node *n3_1=new Node(coords1+4);
Node *n1_2=new Node(coords2);
Node *n2_2=new Node(coords2+2);
- auto *e1=new EdgeArcCircle(n1_1,n3_1,n2_1);
- auto *e2=new EdgeLin(n1_2,n2_2);
+ EdgeArcCircle *e1=new EdgeArcCircle(n1_1,n3_1,n2_1);
+ EdgeLin *e2=new EdgeLin(n1_2,n2_2);
MergePoints merge;
- auto *c1=new ComposedEdge;
- auto *c2=new ComposedEdge;
+ ComposedEdge *c1=new ComposedEdge;
+ ComposedEdge *c2=new ComposedEdge;
CPPUNIT_ASSERT(e1->intersectWith(e2,merge,*c1,*c2));
CPPUNIT_ASSERT_EQUAL(2,c1->size());
CPPUNIT_ASSERT_EQUAL(2,c2->size());
Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-3.);
Node *n2=new Node(10.,0.); Node *n5=new Node(10.,-3.);
Node *n3=new Node(5.,10.); Node *n6=new Node(5.,7.);
- auto *e1_2=new EdgeLin(n1,n2); auto *e4_5=new EdgeLin(n4,n5);
- auto *e2_3=new EdgeLin(n2,n3); auto *e5_6=new EdgeLin(n5,n6);
- auto *e3_1=new EdgeLin(n3,n1); auto *e6_4=new EdgeLin(n6,n4);
+ EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5);
+ EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6);
+ EdgeLin *e3_1=new EdgeLin(n3,n1); EdgeLin *e6_4=new EdgeLin(n6,n4);
//
QuadraticPolygon pol1; pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1);
QuadraticPolygon pol2; pol2.pushBack(e4_5); pol2.pushBack(e5_6); pol2.pushBack(e6_4);
n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
- double const area1Start=pol1.getArea();
+ double area1Start=pol1.getArea();
double xb,yb;
- double const fact=pol1.normalize(&pol2,xb,yb);
- double const area1End=pol1.getArea();
+ double fact=pol1.normalize(&pol2,xb,yb);
+ double area1End=pol1.getArea();
CPPUNIT_ASSERT_DOUBLES_EQUAL(area1Start,area1End*fact*fact,1e-14);
CPPUNIT_ASSERT_DOUBLES_EQUAL(13.,fact,1.e-14);
- double const area=pol1.intersectWith(pol2);
+ double area=pol1.intersectWith(pol2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(24.5,area*fact*fact,1e-14);
//
n1=new Node(0.,0.); n4=new Node(0.,-3.);
CPPUNIT_ASSERT_DOUBLES_EQUAL(24.5,pol3.intersectWithAbs(pol4),1.e-14);
// Ok testing EdgeArcCircle update.
double center[2]={5.,5.};
- double const radius=300.;
+ double radius=300.;
EdgeArcCircle *e1=buildArcOfCircle(center,radius,M_PI/4.,M_PI/3.);
const Bounds& b=e1->getBounds();
double x,y,fact2;
Node *n1=new Node(0.,0.5); Node *n5=new Node(0.3,1.2);
Node *n2=new Node(1.,0.5); Node *n6=new Node(1.1,1.3);
Node *n3=new Node(1.,0.); Node *n7=new Node(-0.1,0.9);
- auto *e0_1=new EdgeLin(n0,n1);
- auto *e1_2=new EdgeLin(n1,n2); auto *e4_5=new EdgeLin(n4,n5);
- auto *e2_3=new EdgeLin(n2,n3); auto *e5_6=new EdgeLin(n5,n6);
- auto *e3_0=new EdgeLin(n3,n0); auto *e6_4=new EdgeLin(n6,n4);
- auto *e4_7=new EdgeLin(n4,n7); auto *e7_5=new EdgeLin(n7,n5);
+ EdgeLin *e0_1=new EdgeLin(n0,n1);
+ EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5);
+ EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6);
+ EdgeLin *e3_0=new EdgeLin(n3,n0); EdgeLin *e6_4=new EdgeLin(n6,n4);
+ EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_5=new EdgeLin(n7,n5);
QuadraticPolygon pol1; pol1.pushBack(e0_1); pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_0);
QuadraticPolygon pol2; pol2.pushBack(e4_5); pol2.pushBack(e5_6); pol2.pushBack(e6_4);
pol2.pushBack(e7_5); e4_5->incrRef(); pol2.pushBack(new ElementaryEdge(e4_5,false)); pol2.pushBack(e4_7);
*/
void QuadraticPlanarInterpTest::checkArcArcIntersection1()
{
- double const eps=1.0e-8;
+ double eps=1.0e-8;
INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(eps);
Node *n0=new Node(6.37533,38.8928); Node *n3=new Node(6.29194,39.2789);
Node *n6=new Node(6.2534549999999998, 38.861800000000002); // to have a linear edge e1
//EdgeArcCircle *e1=new EdgeArcCircle(n0, n2, n6, true); // to have a linear edge e1
- auto *e1=new EdgeArcCircle(n0, n2, n1, true);
- auto *e2=new EdgeArcCircle(n3, n5, n4, true);
+ EdgeArcCircle *e1=new EdgeArcCircle(n0, n2, n1, true);
+ EdgeArcCircle *e2=new EdgeArcCircle(n3, n5, n4, true);
MergePoints merge;
QuadraticPolygon c1,c2;
//
// Author : Anthony Geay (CEA/DEN)
-#include "InterpKernelGeo2DPrecision.hxx"
-#include "InterpKernelGeo2DNode.hxx"
#include "QuadraticPlanarInterpTest.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
+#include "InterpKernelGeo2DElementaryEdge.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
+#include "InterpKernelGeo2DEdgeLin.hxx"
-#include <algorithm>
#include <cmath>
-#include <cppunit/TestAssert.h>
-#include <vector>
+#include <sstream>
+#include <iostream>
+#include <iterator>
using namespace INTERP_KERNEL;
Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
// start, end, center_x, center_y, radius, angle0, angle
- EdgeArcCircle const e(start, end, e_center, 1.2264175471673588, -0.9533904350433241, 0.95339043504332388);
+ EdgeArcCircle e(start, end, e_center, 1.2264175471673588, -0.9533904350433241, 0.95339043504332388);
e.getMiddleOfPoints(p1, p2, mid);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.37969180470645592, mid[0], 1.e-7);
Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
// start, end, center_x, center_y, radius, angle0, angle
- EdgeArcCircle const e(start, end, e_center, 6.0104076400856474, -0.69522150912422953, -0.18035330854643861);
+ EdgeArcCircle e(start, end, e_center, 6.0104076400856474, -0.69522150912422953, -0.18035330854643861);
e.getMiddleOfPoints(p1, p2, mid);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.6, mid[0], 1.e-7);
Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
// start, end, center_x, center_y, radius, angle0, angle
- EdgeArcCircle const e(start, end, e_center, 2.0977501175200861, 1.0829141821052615, -0.59503203741562627);
+ EdgeArcCircle e(start, end, e_center, 2.0977501175200861, 1.0829141821052615, -0.59503203741562627);
e.getMiddleOfPoints(p1, p2, mid);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[0], 1.e-7);
Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
// start, end, center_x, center_y, radius, angle0, angle
- EdgeArcCircle const e(start, end, e_center, 1.0, -0.7853981633974485, -1.5707963267948966);
+ EdgeArcCircle e(start, end, e_center, 1.0, -0.7853981633974485, -1.5707963267948966);
e.getMiddleOfPointsOriented(p1, p2, mid);
CPPUNIT_ASSERT_DOUBLES_EQUAL(1., mid[0], 1.e-7);
#include "SingleElementPlanarTests.hxx"
#include "InterpolationUtils.hxx"
+#include "PolygonAlgorithms.hxx"
#include "PolygonAlgorithms.txx"
-#include <cppunit/TestAssert.h>
+#include "InterpolationPlanarTestSuite.hxx"
#include <deque>
-#include <vector>
using namespace INTERP_KERNEL;
// \brief Status : pass
void SingleElementPlanarTests::identicalSquares()
{
- INTERP_KERNEL::PolygonAlgorithms<2> const intersector (_Epsilon, _Precision);;
+ INTERP_KERNEL::PolygonAlgorithms<2> intersector (_Epsilon, _Precision);;
/*
////////////////// TEST DEACTIVATED by A. GEAY because memory fault :
// conditional jump INTERP_KERNEL::PolygonAlgorithms<2>::intersectConvexPolygons(double const*, double const*, int, int) (PolygonAlgorithms.txx:629)
#include "InterpKernelTestExport.hxx"
#include "InterpolationPlanarTestSuite.hxx"
-#include <cppunit/extensions/HelperMacros.h>
namespace INTERP_TEST
{
#define __SINGLE_ELEMENT_TETRA_TESTS_HXX_
#include "InterpolationTestSuite.hxx"
-#include <cppunit/extensions/HelperMacros.h>
namespace INTERP_TEST
{
#include "TransformedTriangleTest.hxx"
#include "UnitTetraIntersectionBaryTest.hxx"
#include "UnitTetra3D2DIntersectionTest.hxx"
-#include "MeshTestToolkit.txx"
-#include <cppunit/extensions/HelperMacros.h>
#ifndef MEDCOUPLING_MICROMED
#include "HexaTests.hxx"
#include "InterpKernelException.hxx"
#include <cstdlib>
-#include <string>
#ifdef WIN32
#include<direct.h>
#define getcwd _getcwd
resourceFile = getenv("MEDCOUPLING_ROOT_DIR");
resourceFile += "/share/resources/med/";
resourceFile += filename;
- std::ifstream const my_file(resourceFile.c_str());
+ std::ifstream my_file(resourceFile.c_str());
if (my_file.good())
return resourceFile;
}
resourceFile.erase(std::remove(resourceFile.begin(), resourceFile.end(), ':'), resourceFile.end());
resourceFile += "/";
resourceFile += filename;
- std::ifstream const my_file(resourceFile.c_str());
+ std::ifstream my_file(resourceFile.c_str());
if (my_file.good())
return resourceFile;
}
// else
- char * tmp_c = getcwd(nullptr, 0);
+ char * tmp_c = getcwd(NULL, 0);
resourceFile = tmp_c;
free(tmp_c);
resourceFile += "/";
resourceFile += "../";
resourceFile += "resources/";
resourceFile += filename;
- std::ifstream const my_file(resourceFile.c_str());
+ std::ifstream my_file(resourceFile.c_str());
if (!my_file.good())
{
std::stringstream ss;
//
#include "ThreeDSurfProjectionTest.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.txx"
#include "MCIdType.hxx"
-#include <algorithm>
-#include <cppunit/TestAssert.h>
class MyMeshType
{
//MEDCouplingPointSet.Rotate3DAlg([0.,0.,0.],[2.,1.,3.],0.3,coo2)
const double coo[9]={0.,0.,0.,0.96809749223257568,0.24332379388106262,-0.059839592782071335,-0.23056279077409292,0.95852673990234838,0.16753294721527912};
const double coo2[9]={9.8122602102980502e-08,-1.4839144255482456e-7,9.8404874611628791e-7,0.96809759035517784,0.24332364548962007,-0.059838608733325221,-0.23056269265149082,0.9585265915109058,0.16753393126402524};
- auto *tmp0(new double[9]),*tmp1(new double[9]);
+ double *tmp0(new double[9]),*tmp1(new double[9]);
int ret;
//eps=1e-2. eps is a tolerance to detect that two points are the same or not in a same polygon.
// here the max 3D distance is 1e-5 > 1e-6 so 1 is expected
//
const double coo[9]={0.,0.,0.,0.96809749223257568,0.24332379388106262,-0.059839592782071335,-0.23056279077409292,0.95852673990234838,0.16753294721527912};
const double coo2[9]={7.2311562622637225e-07,6.8998795679738294e-07,3.1943866106249849e-08,0.72852072144314628,0.33125439126063028,0.5996079016637561,0.0090154262465889021,0.87059752249869415,-0.49191448334281612};
- auto *tmp0(new double[9]),*tmp1(new double[9]);
+ double *tmp0(new double[9]),*tmp1(new double[9]);
int ret;
//eps=1e-2. eps is a tolerance to detect that two points are the same or not in a same polygon.
// here the max 3D distance is 1e-5 > 1e-6 so 1 is expected
#ifndef __THREEDSURFPROJECTIONTEST_HXX__
#define __THREEDSURFPROJECTIONTEST_HXX__
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "InterpKernelTestExport.hxx"
//
#include "TransformedTriangleIntersectTest.hxx"
-#include <cppunit/TestAssert.h>
-#include <cmath>
+#include <iostream>
+#include <iomanip>
#include "Log.hxx"
-#include "TransformedTriangle.hxx"
/// macro to test for zero double products outside the segment-edge intersection test method
/// as is done in TransformedTriangle when OPTIMIZE is defined
0.4, 2.5, 0.5 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
1.5, 0.5,-0.25, // Q
-0.5,-1.5, 0.75 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
-0.4, 0.3, 0.9 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
0.2, -1.3, -1.4 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
0.5, -2.6, 1.3 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
-3.0, 3.0, -0.5 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
0.3, 0.4, 0.2 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
-0.1, -0.4, 0.9 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
0.1, 0.2, 0.8 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
0.4, 0.3, 0.3 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
0.3, 0.3, 0.3 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
0.6, 0.6, -0.6 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
-0.2, -0.1, 3.0 // R
};
- auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+ TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
// run all intersection tests and ensure that the ones
// listed with yes in the tables above return true and
0.44117647058823506, 0, 0.55882352941176483,
-0.89215686274509864, 1.3333333333333339, 0.55882352941176483};
- double const refVol = 0.054383777732546296;
+ double refVol = 0.054383777732546296;
TransformedTriangle tri(&coords[0], &coords[3], &coords[6]);
const double vol = tri.calculateIntersectionVolume();
-0.55882352941176472, 0, 1.5588235294117649,
-0.89215686274509864, 1.3333333333333339, 0.55882352941176483 };
- double const refVol = -0.06869529818848;
+ double refVol = -0.06869529818848;
TransformedTriangle tri(&coords[0], &coords[3], &coords[6]);
const double vol = tri.calculateIntersectionVolume();
-1.2062474433365091, -0.037350951323461778, 2.1879983126221099,
0.49877186496532655, 0.59827776894780405, 0.79353793765518521
};
- double const refVol = -0.051135429735185;
+ double refVol = -0.051135429735185;
TransformedTriangle tri(&coords[0], &coords[3], &coords[6]);
const double vol = tri.calculateIntersectionVolume();
2.022774182629973, -1.020222639063029, -0.01375178680446254,
0.7495960843059706, 0.1125313911637846, 0.7430770879625861
};
- double const refVol = -0.00060846166394417;
+ double refVol = -0.00060846166394417;
TransformedTriangle tri(&coords[0], &coords[3], &coords[6]);
const double vol = tri.calculateIntersectionVolume();
-3.552713678800501e-15, 0, 0.9999999999999982,
0, 1.000000000000004, -8.881784197001252e-16
};
- double const refVol = -1/6.;
+ double refVol = -1/6.;
TransformedTriangle tri(&coords[0], &coords[3], &coords[6]);
const double vol = tri.calculateIntersectionVolume();
1.000000000000004, 0, 0,
0, 0, 0.9999999999999929,
3.552713678800501e-15, 1, 0};
- double const refVol = -1/6.;
+ double refVol = -1/6.;
TransformedTriangle tri(&coords[0], &coords[3], &coords[6]);
const double vol = tri.calculateIntersectionVolume();
3.700743415417188e-17, 0.9999999999999999, 3.700743415417188e-17
};
- double const refVol = -1/6.;
+ double refVol = -1/6.;
TransformedTriangle tri(&coords[0], &coords[3], &coords[6]);
const double vol = tri.calculateIntersectionVolume();
-7.105427357601002e-15, 1.000000000000014, -3.552713678800501e-15
};
- double const refVol = -1/6.;
+ double refVol = -1/6.;
TransformedTriangle tri(&coords[0], &coords[3], &coords[6]);
const double vol = tri.calculateIntersectionVolume();
#ifndef __TU_TRANSFORMED_TRIANGLE_INTERSECT_HXX__
#define __TU_TRANSFORMED_TRIANGLE_INTERSECT_HXX__
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "InterpKernelTestExport.hxx"
//
#include "TransformedTriangleTest.hxx"
-#include "TransformedTriangle.hxx"
-#include <cppunit/TestAssert.h>
+#include <iostream>
using namespace INTERP_KERNEL;
void TransformedTriangleTest::test_constructor() {
// test that _coords has correct values after constructor is called
- double const good_values1[15] =
+ double good_values1[15] =
{
p1[0], p1[1], p1[2], hp1, Hp1,
q1[0], q1[1], q1[2], hq1, Hq1,
r1[0], r1[1], r1[2], hr1, Hr1
};
- double const good_values2[15] =
+ double good_values2[15] =
{
p2[0], p2[1], p2[2], hp2, Hp2,
q2[0], q2[1], q2[2], hq2, Hq2,
// test that the correct c-values are calculated
- double const correct_c_vals[24] =
+ double correct_c_vals[24] =
{
p1[0] * q1[1] - p1[1] * q1[0],
p1[1] * q1[2] - p1[2] * q1[1],
for(int i = 0; i < 3 ; ++i)
{
- DoubleProduct const dp = DOUBLE_PRODUCTS[3*min_corner + i];
+ DoubleProduct dp = DOUBLE_PRODUCTS[3*min_corner + i];
// std::cout << std::endl << "in test inconsistent (seg,dp) :(" << seg <<", " << dp << ")" << std::endl;
CPPUNIT_ASSERT_EQUAL(0.0, tri2->calcStableC(seg, dp));
correct_c_vals[8*seg + dp] = 0.0;
#ifndef __TU_TRANSFORMED_TRIANGLE_HXX__
#define __TU_TRANSFORMED_TRIANGLE_HXX__
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "InterpKernelTestExport.hxx"
// CPPUNIT_TEST( test_calcStableC_Consistency );
CPPUNIT_TEST_SUITE_END();
- using TriSegment = INTERP_KERNEL::TransformedTriangle::TriSegment;
- using DoubleProduct = INTERP_KERNEL::TransformedTriangle::DoubleProduct;
+ typedef INTERP_KERNEL::TransformedTriangle::TriSegment TriSegment;
+ typedef INTERP_KERNEL::TransformedTriangle::DoubleProduct DoubleProduct;
public:
void setUp();
#include "UnitTetra3D2DIntersectionTest.hxx"
+#include "TetraAffineTransform.hxx"
+#include "InterpolationUtils.hxx"
#include "SplitterTetra.txx"
-#include "NormalizedGeometricTypes"
#include "MCIdType.hxx"
-#include <cppunit/TestAssert.h>
-#include <set>
+#include <iostream>
using namespace INTERP_KERNEL;
{
struct __MESH_DUMMY
{
- using MyConnType = mcIdType;
+ typedef mcIdType MyConnType;
static const int MY_SPACEDIM=3;
};
const double* tetraCoords[]={ targetCoords, targetCoords+3, targetCoords+6, targetCoords+9 };
- __MESH_DUMMY const dummyMesh;
+ __MESH_DUMMY dummyMesh;
SplitterTetra<__MESH_DUMMY>* targetTetra = new SplitterTetra<__MESH_DUMMY>( dummyMesh, tetraCoords, conn );
return targetTetra;
}
CPPUNIT_ASSERT_EQUAL(4,(int)listOfTetraFacesTreated.size());
std::multiset<TriangleFaceKey> correctListOfTetraFacesTreated;
- TriangleFaceKey const key1 = TriangleFaceKey(0, 1, 2);
+ TriangleFaceKey key1 = TriangleFaceKey(0, 1, 2);
correctListOfTetraFacesTreated.insert(key1);
- TriangleFaceKey const key2 = TriangleFaceKey(0, 1, 3);
+ TriangleFaceKey key2 = TriangleFaceKey(0, 1, 3);
correctListOfTetraFacesTreated.insert(key2);
- TriangleFaceKey const key3 = TriangleFaceKey(0, 2, 3);
+ TriangleFaceKey key3 = TriangleFaceKey(0, 2, 3);
correctListOfTetraFacesTreated.insert(key3);
- TriangleFaceKey const key4 = TriangleFaceKey(1, 2, 3);
+ TriangleFaceKey key4 = TriangleFaceKey(1, 2, 3);
correctListOfTetraFacesTreated.insert(key4);
CPPUNIT_ASSERT(correctListOfTetraFacesTreated == listOfTetraFacesTreated);
CPPUNIT_ASSERT_EQUAL(4,(int)listOfTetraFacesTreated.size());
std::multiset<TriangleFaceKey> correctListOfTetraFacesTreated;
- TriangleFaceKey const key1 = TriangleFaceKey(0, 1, 2);
+ TriangleFaceKey key1 = TriangleFaceKey(0, 1, 2);
correctListOfTetraFacesTreated.insert(key1);
- TriangleFaceKey const key2 = TriangleFaceKey(0, 1, 3);
+ TriangleFaceKey key2 = TriangleFaceKey(0, 1, 3);
correctListOfTetraFacesTreated.insert(key2);
- TriangleFaceKey const key3 = TriangleFaceKey(0, 2, 3);
+ TriangleFaceKey key3 = TriangleFaceKey(0, 2, 3);
correctListOfTetraFacesTreated.insert(key3);
- TriangleFaceKey const key4 = TriangleFaceKey(1, 2, 3);
+ TriangleFaceKey key4 = TriangleFaceKey(1, 2, 3);
correctListOfTetraFacesTreated.insert(key4);
CPPUNIT_ASSERT(correctListOfTetraFacesTreated == listOfTetraFacesTreated);
#ifndef __UNITTETRA3D2DINTERSECTIONTEST_HXX__
#define __UNITTETRA3D2DINTERSECTIONTEST_HXX__
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "InterpKernelTestExport.hxx"
//
#include "UnitTetraIntersectionBaryTest.hxx"
-#include "TransformedTriangle.hxx"
-#include "SplitterTetra.txx"
-#include "InterpKernelException.hxx"
#include "UnitTetraIntersectionBary.hxx"
#include "TetraAffineTransform.hxx"
#include "InterpolationUtils.hxx"
+#include "SplitterTetra.txx"
#include "MCIdType.hxx"
-#include <cppunit/TestAssert.h>
-#include <vector>
+#include <iostream>
using namespace INTERP_KERNEL;
// { 1, 2, 3 },
// { 3, 2, 0 } };
bary.init(true);
- for (auto faceNodes : faceConn) {
+ for ( int i = 0; i < 4; ++i ) {
+ int* faceNodes = faceConn[ i ];
TransformedTriangle tri(nodes[faceNodes[0]], nodes[faceNodes[1]], nodes[faceNodes[2]]);
tri.calculateIntersectionVolume();
bary.addSide( tri );
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.166667, vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.25, baryCenter[0], 1e-5);
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.166667, vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.25, baryCenter[0], 1e-5);
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.020833333333333332, vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.125, baryCenter[0], 1e-5);
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.020833333333333332, vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.125, baryCenter[0], 1e-5);
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.1215, vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.225, baryCenter[0], 1e-5);
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.000441855, vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.353463 , baryCenter[0], 1e-5 );
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0103501, vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.215578 , baryCenter[0], 1e-5 );
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0349217, vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.332275 , baryCenter[0], 1e-2 );
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( !ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, vol, 1e-15);
CPPUNIT_ASSERT_DOUBLES_EQUAL( -1. , baryCenter[0], 1e-5 );
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.166667, vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.25, baryCenter[0], 1e-5);
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.15873 , vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.250000, baryCenter[0], 1e-5);
UnitTetraIntersectionBary bary;
fill_UnitTetraIntersectionBary(bary,nodes);
double baryCenter[3];
- bool const ok = bary.getBary( baryCenter );
- double const vol = bary.getVolume();
+ bool ok = bary.getBary( baryCenter );
+ double vol = bary.getVolume();
CPPUNIT_ASSERT( ok );
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.005208 , vol, 1e-5);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.562500, baryCenter[0], 1e-5);
struct __MESH_DUMMY
{
- using MyConnType = mcIdType;
+ typedef mcIdType MyConnType;
};
void UnitTetraIntersectionBaryTest::test_UnitTetraIntersectionBary_13()
75,150,75,
100,100,100};
- mcIdType const conn[4] = { 0,1,2,3 };
+ mcIdType conn[4] = { 0,1,2,3 };
const double* tnodes[4]={ T, T+3, T+6, T+9 };
const double* snodes[4]={ S, S+3, S+6, S+9 };
- __MESH_DUMMY const dummyMesh;
+ __MESH_DUMMY dummyMesh;
SplitterTetra<__MESH_DUMMY> src( dummyMesh, snodes, conn );
double volume = src.intersectTetra( tnodes );
CPPUNIT_ASSERT_DOUBLES_EQUAL(6944.4444444444443,volume,1e-9);
41.6666666666666714036, 120.0, 6.3333333333333348136,
25.0, 120.0, 17.6666666666666714036};
- mcIdType const conn[4] = { 0,1,2,3 };
+ mcIdType conn[4] = { 0,1,2,3 };
const double* tnodes[4]={ T, T+3, T+6, T+9 };
const double* snodes[4]={ S, S+3, S+6, S+9 };
const double refVol = 48.6591695501729;
- __MESH_DUMMY const dummyMesh;
+ __MESH_DUMMY dummyMesh;
SplitterTetra<__MESH_DUMMY> src( dummyMesh, snodes, conn );
- double const volume = src.intersectTetra( tnodes );
+ double volume = src.intersectTetra( tnodes );
CPPUNIT_ASSERT_DOUBLES_EQUAL(refVol,volume,1e-9);
// Now the other way round:
SplitterTetra<__MESH_DUMMY> tgt( dummyMesh, tnodes, conn );
- double const volume2 = tgt.intersectTetra( snodes );
+ double volume2 = tgt.intersectTetra( snodes );
CPPUNIT_ASSERT_DOUBLES_EQUAL(refVol,volume2,1e-9);
}
// double pSrc[3] = { -4.0, 9.0, 3.0 };
double pSrc[3] = { 40., -20., 100. };
double pDest[] = {1,1,1};
- TetraAffineTransform const a(nodes);
+ TetraAffineTransform a(nodes);
a.apply( pDest, pSrc );
a.reverseApply( pDest, pDest );
CPPUNIT_ASSERT_DOUBLES_EQUAL( pSrc[0], pDest[0], 1e-12);
void UnitTetraIntersectionBaryTest::test_barycentric_coords()
{
// compute barycentric coordinates
- double const nodes[4][3] = { {11.0, 0.0, 2.0 },
+ double nodes[4][3] = { {11.0, 0.0, 2.0 },
{-4.0, 9.0, 3.0 },
{ 0.0, 0.0, 0.0 },
{ 6.0, 1.0,10.0 }};
{ 1.0, 2.0, 0.0 }
};
// Translate cube:
- for (auto & node : nodes)
- for (double & j : node)
- j += 15.0;
+ for (int i=0; i < 8; ++i)
+ for (int j=0; j < 3; ++j)
+ nodes[i][j] += 15.0;
std::vector<const double*> n (8);
for (int i=0; i<8; i++)
{ 1.0, 0.0 } };
// Translate quad4:
- for (auto & node : nodes)
- for (double & j : node)
- j += 15.0;
+ for (int i=0; i < 4; ++i)
+ for (int j=0; j < 2; ++j)
+ nodes[i][j] += 15.0;
std::vector<const double*> n (4);
for (int i=0; i<4; i++)
#ifndef __UNITTETRAINTERSECTIONBARYTEST_HXX__
#define __UNITTETRAINTERSECTIONBARYTEST_HXX__
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "InterpKernelTestExport.hxx"
#pragma once
+#include "MEDCouplingRefCountObject.hxx"
#include "InterpKernelException.hxx"
-#include <cstddef>
#include <vector>
#include <algorithm>
#include "MCAuto.hxx"
-#include <cstddef>
#include <vector>
namespace MEDCoupling
#include <cstdint>
#include <stddef.h>
+#include <cstddef>
namespace MEDCoupling
{
//
// Author : Anthony Geay (EDF R&D)
-#include "CellModel.hxx"
-#include "MEDCouplingPointSet.hxx"
#include "MEDCoupling1GTUMesh.txx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "InterpKernelHashMap.hxx"
-#include "InterpKernelException.hxx"
-#include "MEDCouplingStructuredMesh.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include "SplitterTetra.txx"
+#include "SplitterTetra.hxx"
#include "DiameterCalculator.hxx"
#include "OrientationInverter.hxx"
#include "InterpKernelAutoPtr.hxx"
#include "VolSurfUser.txx"
-#include <string>
-#include <set>
-#include <sstream>
-#include <vector>
-#include <ostream>
-#include <cstddef>
-#include <algorithm>
-#include <iterator>
-#include <functional>
-#include <map>
-#include <cstdlib>
-#include <limits>
using namespace MEDCoupling;
const int MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS[6]={0,1,2,4,3,5};
-MEDCoupling1GTUMesh::MEDCoupling1GTUMesh():_cm(nullptr)
+MEDCoupling1GTUMesh::MEDCoupling1GTUMesh():_cm(0)
{
}
{
if(!m)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::New : input mesh is null !");
- std::set<INTERP_KERNEL::NormalizedCellType> const gts(m->getAllGeoTypes());
+ std::set<INTERP_KERNEL::NormalizedCellType> gts(m->getAllGeoTypes());
if(gts.size()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::New : input mesh must have exactly one geometric type !");
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*gts.begin());
*/
DataArrayIdType *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !");
if(code[0]!=ToIdType(getCellModelEnum()))
if(code[2]==-1)
{
if(code[1]==nbOfCells)
- return nullptr;
+ return 0;
else
{
std::ostringstream oss; oss << "MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : mismatch between the number of cells in this (" << nbOfCells << ") and the number of non profile (" << code[1] << ") !";
return false;
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::isEqualIfNotWhy : input other pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCoupling1GTUMesh *>(other);
+ const MEDCoupling1GTUMesh *otherC=dynamic_cast<const MEDCoupling1GTUMesh *>(other);
if(!otherC)
{
reason="mesh given in input is not castable in MEDCouplingSGTUMesh !";
return false;
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::isEqualWithoutConsideringStr : input other pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCoupling1GTUMesh *>(other);
+ const MEDCoupling1GTUMesh *otherC=dynamic_cast<const MEDCoupling1GTUMesh *>(other);
if(!otherC)
return false;
if(_cm!=otherC->_cm)
if(!firstPart)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : the first instance in input parts is null !");
const DataArrayDouble *coords(firstPart->getCoords());
- int const meshDim(firstPart->getMeshDimension());
+ int meshDim(firstPart->getMeshDimension());
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New(firstPart->getName(),meshDim)); ret->setDescription(firstPart->getDescription());
ret->setCoords(coords);
mcIdType nbOfCells(0),connSize(0);
- for(auto part : parts)
+ for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++)
{
- if(!part)
+ if(!(*it))
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : presence of null pointer in input vector !");
- if(part->getMeshDimension()!=meshDim)
+ if((*it)->getMeshDimension()!=meshDim)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances in input vector must have same mesh dimension !");
- if(part->getCoords()!=coords)
+ if((*it)->getCoords()!=coords)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances must share the same coordinates pointer !");
- nbOfCells+=part->getNumberOfCells();
- connSize+=part->getNodalConnectivityLength();
+ nbOfCells+=(*it)->getNumberOfCells();
+ connSize+=(*it)->getNodalConnectivityLength();
}
MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New());
connI->alloc(nbOfCells+1,1); conn->alloc(connSize+nbOfCells,1);
mcIdType *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0;
- for(auto part : parts)
+ for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++)
{
- mcIdType const curNbCells=part->getNumberOfCells();
- mcIdType const geoType(ToIdType(part->getCellModelEnum()));
- const mcIdType *cinPtr(part->getNodalConnectivity()->begin());
- const auto *ps(dynamic_cast<const MEDCoupling1SGTUMesh *>(part));
- const auto *pd(dynamic_cast<const MEDCoupling1DGTUMesh *>(part));
+ mcIdType curNbCells=(*it)->getNumberOfCells();
+ mcIdType geoType(ToIdType((*it)->getCellModelEnum()));
+ const mcIdType *cinPtr((*it)->getNodalConnectivity()->begin());
+ const MEDCoupling1SGTUMesh *ps(dynamic_cast<const MEDCoupling1SGTUMesh *>(*it));
+ const MEDCoupling1DGTUMesh *pd(dynamic_cast<const MEDCoupling1DGTUMesh *>(*it));
if(ps && !pd)
{
- mcIdType const nNodesPerCell(ps->getNumberOfNodesPerCell());
+ mcIdType nNodesPerCell(ps->getNumberOfNodesPerCell());
for(int i=0;i<curNbCells;i++,ci++,cinPtr+=nNodesPerCell)
{
*c++=geoType;
}
MEDCoupling1SGTUMesh::MEDCoupling1SGTUMesh()
-= default;
+{
+}
MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New()
{
{
if(!m)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : input mesh is null !");
- std::set<INTERP_KERNEL::NormalizedCellType> const gts(m->getAllGeoTypes());
+ std::set<INTERP_KERNEL::NormalizedCellType> gts(m->getAllGeoTypes());
if(gts.size()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : input mesh must have exactly one geometric type !");
- mcIdType const geoType(ToIdType(*gts.begin()));
+ mcIdType geoType(ToIdType(*gts.begin()));
MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin()));
ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
- mcIdType const nbCells=m->getNumberOfCells();
- mcIdType const nbOfNodesPerCell(ret->getNumberOfNodesPerCell());
+ mcIdType nbCells=m->getNumberOfCells();
+ mcIdType nbOfNodesPerCell(ret->getNumberOfNodesPerCell());
MCAuto<DataArrayIdType> conn(DataArrayIdType::New()); conn->alloc(nbCells*nbOfNodesPerCell,1);
mcIdType *c(conn->getPointer());
const mcIdType *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin());
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::shallowCopyConnectivityFrom : input pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
+ const MEDCoupling1SGTUMesh *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::shallowCopyConnectivityFrom : input pointer is not an MEDCoupling1SGTUMesh instance !");
setNodalConnectivity(otherC->getNodalConnectivity());
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::isEqualIfNotWhy : input other pointer is null !");
std::ostringstream oss; oss.precision(15);
- const auto *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
+ const MEDCoupling1SGTUMesh *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
if(!otherC)
{
reason="mesh given in input is not castable in MEDCoupling1SGTUMesh !";
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::isEqualWithoutConsideringStr : input other pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
+ const MEDCoupling1SGTUMesh *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
if(!otherC)
return false;
if(!MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(other,prec))
checkConsistencyOfConnectivity();
}
-void MEDCoupling1SGTUMesh::checkConsistency(double /*eps*/) const
+void MEDCoupling1SGTUMesh::checkConsistency(double eps) const
{
checkConsistencyLight();
const DataArrayIdType *c1(_conn);
- mcIdType const nbOfTuples(c1->getNumberOfTuples());
- mcIdType const nbOfNodesPerCell=_cm->getNumberOfNodes();
+ mcIdType nbOfTuples(c1->getNumberOfTuples());
+ mcIdType nbOfNodesPerCell=_cm->getNumberOfNodes();
if(nbOfTuples%nbOfNodesPerCell!=0)
{
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::checkConsistency : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType const nbOfNodes=getNumberOfNodes();
- mcIdType const nbOfCells=nbOfTuples/nbOfNodesPerCell;
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=nbOfTuples/nbOfNodesPerCell;
const mcIdType *w(c1->begin());
for(mcIdType i=0;i<nbOfCells;i++)
for(int j=0;j<nbOfNodesPerCell;j++,w++)
mcIdType MEDCoupling1SGTUMesh::getNumberOfCells() const
{
- mcIdType const nbOfTuples(getNodalConnectivityLength());
- mcIdType const nbOfNodesPerCell(getNumberOfNodesPerCell());
+ mcIdType nbOfTuples(getNodalConnectivityLength());
+ mcIdType nbOfNodesPerCell(getNumberOfNodesPerCell());
if(nbOfTuples%nbOfNodesPerCell!=0)
{
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh:getNumberOfCells: : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !";
return nbOfTuples/nbOfNodesPerCell;
}
-mcIdType MEDCoupling1SGTUMesh::getNumberOfNodesInCell(mcIdType /*cellId*/) const
+mcIdType MEDCoupling1SGTUMesh::getNumberOfNodesInCell(mcIdType cellId) const
{
return getNumberOfNodesPerCell();
}
{
checkNonDynamicGeoType();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
ret->alloc(nbCells,1);
mcIdType *retPtr(ret->getPointer());
- mcIdType const nbNodesPerCell(getNumberOfNodesPerCell());
+ mcIdType nbNodesPerCell(getNumberOfNodesPerCell());
const mcIdType *conn(_conn->begin());
for(mcIdType i=0;i<nbCells;i++,conn+=nbNodesPerCell,retPtr++)
{
- std::set<mcIdType> const s(conn,conn+nbNodesPerCell);
+ std::set<mcIdType> s(conn,conn+nbNodesPerCell);
*retPtr=ToIdType(s.size());
}
return ret.retn();
void MEDCoupling1SGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const
{
- mcIdType const sz=getNumberOfNodesPerCell();
+ mcIdType sz=getNumberOfNodesPerCell();
conn.resize(sz);
if(cellId<getNumberOfCells())
std::copy(_conn->begin()+cellId*sz,_conn->begin()+(cellId+1)*sz,conn.begin());
ret << "Single static geometic type (" << _cm->getRepr() << ") unstructured mesh with name : \"" << getName() << "\"\n";
ret << "Description of mesh : \"" << getDescription() << "\"\n";
int tmpp1,tmpp2;
- double const tt=getTime(tmpp1,tmpp2);
+ double tt=getTime(tmpp1,tmpp2);
ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Mesh dimension : " << getMeshDimension() << "\nSpace dimension : ";
- if(_coords!=nullptr)
+ if(_coords!=0)
{
const int spaceDim=getSpaceDimension();
ret << spaceDim << "\nInfo attached on space dimension : ";
else
ret << msg0 << "\n";
ret << "Number of nodes : ";
- if(_coords!=nullptr)
+ if(_coords!=0)
ret << getNumberOfNodes() << "\n";
else
ret << msg0 << "\n";
{
if(_conn->getNumberOfComponents()==1)
{
- mcIdType const nbOfCells=getNumberOfCells();
- mcIdType const sz=getNumberOfNodesPerCell();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType sz=getNumberOfNodesPerCell();
const mcIdType *connPtr=_conn->begin();
for(mcIdType i=0;i<nbOfCells;i++,connPtr+=sz)
{
DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() const
{
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int const spaceDim=getSpaceDimension();
- mcIdType const nbOfCells=getNumberOfCells();//checkConsistencyLight()
- mcIdType const nbOfNodes=getNumberOfNodes();
+ int spaceDim=getSpaceDimension();
+ mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight()
+ mcIdType nbOfNodes=getNumberOfNodes();
ret->alloc(nbOfCells,spaceDim);
double *ptToFill=ret->getPointer();
const double *coor=_coords->begin();
const mcIdType *nodal=_conn->begin();
- mcIdType const sz=getNumberOfNodesPerCell();
- double const coeff=1./FromIdType<double>(sz);
+ mcIdType sz=getNumberOfNodesPerCell();
+ double coeff=1./FromIdType<double>(sz);
for(mcIdType i=0;i<nbOfCells;i++,ptToFill+=spaceDim)
{
std::fill(ptToFill,ptToFill+spaceDim,0.);
void MEDCoupling1SGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
MCAuto<DataArrayIdType> o2n=DataArrayIdType::New();
o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1);
if(check)
MCAuto<DataArrayIdType> newConn=DataArrayIdType::New();
newConn->alloc(_conn->getNumberOfTuples(),1);
newConn->copyStringInfoFrom(*_conn);
- mcIdType const sz=getNumberOfNodesPerCell();
+ mcIdType sz=getNumberOfNodesPerCell();
//
mcIdType *newC=newConn->getPointer();
for(mcIdType i=0;i<nbCells;i++,newC+=sz)
{
- mcIdType const pos=n2oPtr[i];
+ mcIdType pos=n2oPtr[i];
std::copy(conn+pos*sz,conn+(pos+1)*sz,newC);
}
_conn=newConn;
*/
void MEDCoupling1SGTUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1);
mcIdType tmp=-1;
mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1;
if(*work>=0 && *work<sz)
fastFinder[*work]=true;
const mcIdType *conn=_conn->begin();
- mcIdType const nbNodesPerCell=getNumberOfNodesPerCell();
+ mcIdType nbNodesPerCell=getNumberOfNodesPerCell();
for(mcIdType i=0;i<nbOfCells;i++,conn+=nbNodesPerCell)
{
int ref=0,nbOfHit=0;
{
if(other->getType()!=SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED)
throw INTERP_KERNEL::Exception("Merge of umesh only available with umesh single static geo type each other !");
- const auto *otherC=static_cast<const MEDCoupling1SGTUMesh *>(other);
+ const MEDCoupling1SGTUMesh *otherC=static_cast<const MEDCoupling1SGTUMesh *>(other);
return Merge1SGTUMeshes(this,otherC);
}
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
ret->setCoords(getCoords());
const mcIdType *nodalConn=_conn->begin();
- mcIdType const nbCells=getNumberOfCells();
- mcIdType const nbNodesPerCell=getNumberOfNodesPerCell();
- mcIdType const geoType=ToIdType(getCellModelEnum());
+ mcIdType nbCells=getNumberOfCells();
+ mcIdType nbNodesPerCell=getNumberOfNodesPerCell();
+ mcIdType geoType=ToIdType(getCellModelEnum());
MCAuto<DataArrayIdType> c=DataArrayIdType::New(); c->alloc(nbCells*(nbNodesPerCell+1),1);
mcIdType *cPtr=c->getPointer();
for(mcIdType i=0;i<nbCells;i++,nodalConn+=nbNodesPerCell)
struct MEDCouplingAccVisit
{
- MEDCouplingAccVisit() = default;
+ MEDCouplingAccVisit():_new_nb_of_nodes(0) { }
mcIdType operator()(mcIdType val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; }
- mcIdType _new_nb_of_nodes{0};
+ mcIdType _new_nb_of_nodes;
};
/// @endcond
DataArrayIdType *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const
{
checkConsistencyOfConnectivity();
- mcIdType const nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
std::vector<bool> fetchedNodes(nbNodes,false);
computeNodeIdsAlg(fetchedNodes);
- mcIdType const sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true)));
+ mcIdType sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true)));
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(sz,1);
mcIdType *retPtr(ret->getPointer());
for(mcIdType i=0;i<nbNodes;i++)
DataArrayIdType *MEDCoupling1SGTUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const
{
nbrOfNodesInUse=-1;
- mcIdType const nbOfNodes=getNumberOfNodes();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
ret->alloc(nbOfNodes,1);
mcIdType *traducer=ret->getPointer();
std::fill(traducer,traducer+nbOfNodes,-1);
const mcIdType *conn=_conn->begin();
- mcIdType const nbNodesPerCell=getNumberOfNodesPerCell();
+ mcIdType nbNodesPerCell=getNumberOfNodesPerCell();
for(mcIdType i=0;i<nbOfCells;i++)
for(int j=0;j<nbNodesPerCell;j++,conn++)
if(*conn>=0 && *conn<nbOfNodes)
MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshes(std::vector<const MEDCoupling1SGTUMesh *>& a)
{
- std::size_t const sz=a.size();
+ std::size_t sz=a.size();
if(sz==0)
return Merge1SGTUMeshesLL(a);
for(std::size_t ii=0;ii<sz;ii++)
std::vector<const MEDCoupling1SGTUMesh *>::const_iterator it=a.begin();
mcIdType nbOfCells=(*it)->getNumberOfCells();
const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel());
- mcIdType const nbNodesPerCell=(*it)->getNumberOfNodesPerCell();
+ mcIdType nbNodesPerCell=(*it)->getNumberOfNodesPerCell();
it++;
for(;it!=a.end();it++)
{
mcIdType offset=0;
for(it=a.begin();it!=a.end();it++)
{
- mcIdType const curConnLgth=(*it)->getNodalConnectivityLength();
+ mcIdType curConnLgth=(*it)->getNodalConnectivityLength();
const mcIdType *curC=(*it)->_conn->begin();
cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind(std::plus<mcIdType>(),std::placeholders::_1,offset));
offset+=(*it)->getNumberOfNodes();
MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const
{
- mcIdType const ncell=getNumberOfCells();
+ mcIdType ncell=getNumberOfCells();
MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
- std::size_t const nbOfElemsRet=std::distance(begin,end);
+ std::size_t nbOfElemsRet=std::distance(begin,end);
const mcIdType *inConn=_conn->getConstPointer();
- mcIdType const sz=getNumberOfNodesPerCell();
+ mcIdType sz=getNumberOfNodesPerCell();
MCAuto<DataArrayIdType> connRet=DataArrayIdType::New(); connRet->alloc(nbOfElemsRet*sz,1);
mcIdType *connPtr=connRet->getPointer();
for(const mcIdType *work=begin;work!=end;work++,connPtr+=sz)
MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
{
- mcIdType const ncell=getNumberOfCells();
- mcIdType const nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : ");
+ mcIdType ncell=getNumberOfCells();
+ mcIdType nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : ");
MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
const mcIdType *inConn=_conn->getConstPointer();
- mcIdType const sz=getNumberOfNodesPerCell();
+ mcIdType sz=getNumberOfNodesPerCell();
MCAuto<DataArrayIdType> connRet=DataArrayIdType::New(); connRet->alloc(nbOfElemsRet*sz,1);
mcIdType *connPtr=connRet->getPointer();
mcIdType curId=start;
void MEDCoupling1SGTUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const
{
- mcIdType const sz(ToIdType(nodeIdsInUse.size()));
+ mcIdType sz(ToIdType(nodeIdsInUse.size()));
for(const mcIdType *conn=_conn->begin();conn!=_conn->end();conn++)
{
if(*conn>=0 && *conn<sz)
DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePol0()
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4)
return DataArrayIdType::Range(0,nbOfCells,1);
MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1);
DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePol1()
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4)
return DataArrayIdType::Range(0,nbOfCells,1);
MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1);
DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePlanarFace5()
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8)
return DataArrayIdType::Range(0,nbOfCells,1);
MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(5*4*nbOfCells,1);
DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePlanarFace6()
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8)
return DataArrayIdType::Range(0,nbOfCells,1);
MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(6*4*nbOfCells,1);
/*!
* First step of unserialization process.
*/
-bool MEDCoupling1SGTUMesh::isEmptyMesh(const std::vector<mcIdType>& /*tinyInfo*/) const
+bool MEDCoupling1SGTUMesh::isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const
{
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::isEmptyMesh : not implemented yet !");
}
void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
- double const time=getTime(it,order);
+ double time=getTime(it,order);
tinyInfo.clear(); tinyInfoD.clear(); littleStrings.clear();
//
littleStrings.push_back(getName());
tinyInfoD.push_back(time);
}
-void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& /*littleStrings*/) const
+void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
- std::vector<mcIdType> const tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+tinyInfo[5]);
- std::vector<mcIdType> const tinyInfo1(tinyInfo.begin()+7+tinyInfo[5],tinyInfo.begin()+7+tinyInfo[5]+tinyInfo[6]);
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+tinyInfo[5]);
+ std::vector<mcIdType> tinyInfo1(tinyInfo.begin()+7+tinyInfo[5],tinyInfo.begin()+7+tinyInfo[5]+tinyInfo[6]);
a1->resizeForUnserialization(tinyInfo1);
a2->resizeForUnserialization(tinyInfo2);
}
void MEDCoupling1SGTUMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
- auto const gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]);
+ INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]);
_cm=&INTERP_KERNEL::CellModel::GetCellModel(gt);
setName(littleStrings[0]);
setDescription(littleStrings[1]);
mcIdType sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]);
//
_coords=DataArrayDouble::New();
- std::vector<mcIdType> const tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+sz2);
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+sz2);
_coords->resizeForUnserialization(tinyInfo2);
std::copy(a2->begin(),a2->end(),_coords->getPointer());
_conn=DataArrayIdType::New();
- std::vector<mcIdType> const tinyInfo3(tinyInfo.begin()+7+sz2,tinyInfo.begin()+7+sz2+sz3);
+ std::vector<mcIdType> tinyInfo3(tinyInfo.begin()+7+sz2,tinyInfo.begin()+7+sz2+sz3);
_conn->resizeForUnserialization(tinyInfo3);
std::copy(a1->begin(),a1->end(),_conn->getPointer());
- std::vector<std::string> const littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0);
+ std::vector<std::string> littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0);
_coords->finishUnserialization(tinyInfo2,littleStrings2);
- std::vector<std::string> const littleStrings3(littleStrings.begin()+3+sz0,littleStrings.begin()+3+sz0+sz1);
+ std::vector<std::string> littleStrings3(littleStrings.begin()+3+sz0,littleStrings.begin()+3+sz0+sz1);
_conn->finishUnserialization(tinyInfo3,littleStrings3);
}
void MEDCoupling1SGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
{
MEDCouplingPointSet::checkFastEquivalWith(other,prec);
- const auto *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
+ const MEDCoupling1SGTUMesh *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::checkFastEquivalWith : Two meshes are not unstructured with single static geometric type !");
const DataArrayIdType *c1(_conn),*c2(otherC->_conn);
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::mergeMyselfWithOnSameCoords : input other is null !");
- const auto *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
+ const MEDCoupling1SGTUMesh *otherC=dynamic_cast<const MEDCoupling1SGTUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::mergeMyselfWithOnSameCoords : the input other mesh is not of type single statuc geo type unstructured !");
std::vector<const MEDCoupling1SGTUMesh *> ms(2);
void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const
{
checkFullyDefined();
- mcIdType const nbOfNodes=getNumberOfNodes();
- auto *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType));
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType));
revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1);
std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
const mcIdType *conn=_conn->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType nbOfEltsInRevNodal=0;
- mcIdType const nbOfNodesPerCell=getNumberOfNodesPerCell();
+ mcIdType nbOfNodesPerCell=getNumberOfNodesPerCell();
for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
for(int j=0;j<nbOfNodesPerCell;j++,conn++)
}
std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<mcIdType>());
conn=_conn->begin();
- auto *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType));
+ mcIdType *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType));
revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1);
std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1);
for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
*/
void MEDCoupling1SGTUMesh::insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd)
{
- mcIdType const sz=ToIdType(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd));
- mcIdType const ref=getNumberOfNodesPerCell();
+ mcIdType sz=ToIdType(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd));
+ mcIdType ref=getNumberOfNodesPerCell();
if(sz==ref)
{
DataArrayIdType *c(_conn);
const INTERP_KERNEL::CellModel& cm(getCellModel());
if(cm.getEnum()!=INTERP_KERNEL::NORM_HEXA8)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4 : this method can be applied only on HEXA8 mesh !");
- mcIdType const nbHexa8=getNumberOfCells();
+ mcIdType nbHexa8=getNumberOfCells();
const mcIdType *inConnPtr(getNodalConnectivity()->begin());
MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4));
MCAuto<DataArrayIdType> c(DataArrayIdType::New()); c->alloc(nbHexa8*6*4,1);
if(cm.getEnum()!=INTERP_KERNEL::NORM_TRI3)
THROW_IK_EXCEPTION("MEDCoupling1SGTUMesh::computeTriangleHeight : this method can be applied only on TRI3 mesh !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- mcIdType const nbTri3( getNumberOfCells() );
+ mcIdType nbTri3( getNumberOfCells() );
const double *coordPtr( this->getCoords()->begin() );
const mcIdType *inConnPtr(getNodalConnectivity()->begin());
ret->alloc(nbTri3,3);
MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayIdType *& cellPerm, DataArrayIdType *& nodePerm, double eps) const
{
checkConsistencyLight();
- int spaceDim(getSpaceDimension()),meshDim(getMeshDimension()); mcIdType const nbNodes(getNumberOfNodes());
+ int spaceDim(getSpaceDimension()),meshDim(getMeshDimension()); mcIdType nbNodes(getNumberOfNodes());
if(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(meshDim)!=getCellModelEnum())
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::structurizeMe : the unique geo type in this is not compatible with the geometric type regarding mesh dimension !");
MCAuto<MEDCouplingCMesh> cm(MEDCouplingCMesh::New());
for(int i=0;i<spaceDim;i++)
{
- std::vector<std::size_t> const tmp(1,i);
+ std::vector<std::size_t> tmp(1,i);
MCAuto<DataArrayDouble> elt(static_cast<DataArrayDouble*>(getCoords()->keepSelectedComponents(tmp)));
elt=elt->getDifferentValues(eps);
elt->sort(true);
static const int TAB2[6]={0,0,3,3,3,3};
if(myNeighbours[validAxis]==neighId && allFacesNodalConn[4*validAxis+0]==validConnQuad4NeighSide[TAB2[validAxis]])
return true;
- mcIdType const oldAxis(ToIdType(std::distance(myNeighbours,std::find(myNeighbours,myNeighbours+6,neighId))));
- std::size_t const pos(std::distance(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,std::find(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS+6,oldAxis)));
+ mcIdType oldAxis(ToIdType(std::distance(myNeighbours,std::find(myNeighbours,myNeighbours+6,neighId))));
+ std::size_t pos(std::distance(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,std::find(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS+6,oldAxis)));
std::size_t pos0(pos/2),pos1(pos%2);
- int const oldAxisOpp(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2]);
+ int oldAxisOpp(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2]);
mcIdType oldConn[8],myConn2[8]={-1,-1,-1,-1,-1,-1,-1,-1},myConn[8],edgeConn[2],allFacesTmp[24],neighTmp[6];
oldConn[0]=allFacesNodalConn[0]; oldConn[1]=allFacesNodalConn[1]; oldConn[2]=allFacesNodalConn[2]; oldConn[3]=allFacesNodalConn[3];
oldConn[4]=allFacesNodalConn[4]; oldConn[5]=allFacesNodalConn[7]; oldConn[6]=allFacesNodalConn[6]; oldConn[7]=allFacesNodalConn[5];
myConn2[i]=validConnQuad4NeighSide[(4-i+TAB2[validAxis])%4];
for(int i=0;i<4;i++)
{
- mcIdType const nodeId(myConn2[i]);//the node id for which the opposite one will be found
+ mcIdType nodeId(myConn2[i]);//the node id for which the opposite one will be found
bool found(false);
INTERP_KERNEL::NormalizedCellType typeOfSon;
for(int j=0;j<12 && !found;j++)
for(int i=0;i<6;i++)
{
cm.fillSonCellNodalConnectivity(i,myConn,allFacesTmp+4*i);
- std::set<mcIdType> const s(allFacesTmp+4*i,allFacesTmp+4*i+4);
+ std::set<mcIdType> s(allFacesTmp+4*i,allFacesTmp+4*i+4);
bool found(false);
for(int j=0;j<6 && !found;j++)
{
- std::set<mcIdType> const s1(allFacesNodalConn+4*j,allFacesNodalConn+4*j+4);
+ std::set<mcIdType> s1(allFacesNodalConn+4*j,allFacesNodalConn+4*j+4);
if(s==s1)
{
neighTmp[i]=myNeighbours[j];
DataArrayIdType *MEDCoupling1SGTUMesh::sortHexa8EachOther()
{
MCAuto<MEDCoupling1SGTUMesh> quads(explodeEachHexa8To6Quad4());//checks that only hexa8
- mcIdType const nbHexa8=getNumberOfCells();
+ mcIdType nbHexa8=getNumberOfCells();
mcIdType *cQuads(quads->getNodalConnectivity()->getPointer());
MCAuto<DataArrayIdType> neighOfQuads(DataArrayIdType::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1);
mcIdType *ptNeigh(neighOfQuads->getPointer());
{//neighOfQuads tells for each face of each Quad8 which cell (if!=-1) is connected to this face.
MCAuto<MEDCouplingUMesh> quadsTmp(quads->buildUnstructured());
MCAuto<DataArrayIdType> ccSafe,cciSafe;
- DataArrayIdType *cc(nullptr),*cci(nullptr);
+ DataArrayIdType *cc(0),*cci(0);
quadsTmp->findCommonCells(3,0,cc,cci);
ccSafe=cc; cciSafe=cci;
const mcIdType *ccPtr(ccSafe->begin());
- mcIdType const nbOfPair=cci->getNumberOfTuples()-1;
+ mcIdType nbOfPair=cci->getNumberOfTuples()-1;
for(mcIdType i=0;i<nbOfPair;i++)
{ ptNeigh[ccPtr[2*i+0]]=ccPtr[2*i+1]/6; ptNeigh[ccPtr[2*i+1]]=ccPtr[2*i+0]/6; }
}
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
std::vector<bool> fetched(nbHexa8,false);
- auto it(std::find(fetched.begin(),fetched.end(),false));
+ std::vector<bool>::iterator it(std::find(fetched.begin(),fetched.end(),false));
while(it!=fetched.end())//it will turns as time as number of connected zones
{
- mcIdType const cellId(ToIdType(std::distance(fetched.begin(),it)));//it is the seed of the connected zone.
+ mcIdType cellId(ToIdType(std::distance(fetched.begin(),it)));//it is the seed of the connected zone.
std::set<mcIdType> s; s.insert(cellId);//s contains already organized.
while(!s.empty())
{
std::set<mcIdType> sNext;
- for(long const it0 : s)
+ for(std::set<mcIdType>::const_iterator it0=s.begin();it0!=s.end();it0++)
{
- fetched[it0]=true;
- mcIdType *myNeighb(ptNeigh+6*it0);
+ fetched[*it0]=true;
+ mcIdType *myNeighb(ptNeigh+6*(*it0));
for(int i=0;i<6;i++)
{
if(myNeighb[i]!=-1 && !fetched[myNeighb[i]])
{
- std::size_t const pos(std::distance(HEXA8_FACE_PAIRS,std::find(HEXA8_FACE_PAIRS,HEXA8_FACE_PAIRS+6,i)));
+ std::size_t pos(std::distance(HEXA8_FACE_PAIRS,std::find(HEXA8_FACE_PAIRS,HEXA8_FACE_PAIRS+6,i)));
std::size_t pos0(pos/2),pos1(pos%2);
- if(!UpdateHexa8Cell(HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2],it0,cQuads+6*4*it0+4*i,cQuads+6*4*myNeighb[i],ptNeigh+6*myNeighb[i]))
+ if(!UpdateHexa8Cell(HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2],*it0,cQuads+6*4*(*it0)+4*i,cQuads+6*4*myNeighb[i],ptNeigh+6*myNeighb[i]))
ret->pushBackSilent(myNeighb[i]);
fetched[myNeighb[i]]=true;
sNext.insert(myNeighb[i]);
if(!ret->empty())
{
mcIdType *conn(getNodalConnectivity()->getPointer());
- for(long const cellId : *ret)
+ for(const mcIdType *pt=ret->begin();pt!=ret->end();pt++)
{
+ mcIdType cellId(*pt);
conn[8*cellId+0]=cQuads[24*cellId+0]; conn[8*cellId+1]=cQuads[24*cellId+1]; conn[8*cellId+2]=cQuads[24*cellId+2]; conn[8*cellId+3]=cQuads[24*cellId+3];
conn[8*cellId+4]=cQuads[24*cellId+4]; conn[8*cellId+5]=cQuads[24*cellId+7]; conn[8*cellId+6]=cQuads[24*cellId+6]; conn[8*cellId+7]=cQuads[24*cellId+5];
}
MCAuto<MEDCouplingUMesh> edges(thisu->explode3DMeshTo1D(d1Arr,di1Arr,rd1Arr,rdi1Arr));
const mcIdType *d1(d1Arr->begin());
MCAuto<DataArrayIdType> d2Arr(DataArrayIdType::New()),di2Arr(DataArrayIdType::New()),rd2Arr(DataArrayIdType::New()),rdi2Arr(DataArrayIdType::New());
- MCAuto<MEDCouplingUMesh> faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=nullptr;
+ MCAuto<MEDCouplingUMesh> faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
const mcIdType *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
MCAuto<DataArrayDouble> edgesBaryArr(edges->computeCellCenterOfMass()),facesBaryArr(faces->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass());
const mcIdType nbOfNodes(getNumberOfNodes());
const mcIdType offset0=nbOfNodes+faces->getNumberOfCells();
const mcIdType offset1=offset0+edges->getNumberOfCells();
- edges=nullptr; faces=nullptr;
+ edges=0; faces=0;
std::vector<const DataArrayDouble *> v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr;
- MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=nullptr; edgesBaryArr=nullptr; facesBaryArr=nullptr;
+ MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0;
std::string name("DualOf_"); name+=getName();
MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr);
MCAuto<DataArrayIdType> cArr(DataArrayIdType::New()),ciArr(DataArrayIdType::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
for(mcIdType i=0;i<nbOfNodes;i++,revNodI++)
{
- mcIdType const nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
+ mcIdType nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
if(nbOfCellsSharingNode==0)
{
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::computeDualMesh3D : Node #" << i << " is orphan !";
}
for(int j=0;j<nbOfCellsSharingNode;j++)
{
- mcIdType const curCellId(revNod[revNodI[0]+j]);
+ mcIdType curCellId(revNod[revNodI[0]+j]);
const mcIdType *connOfCurCell(nodal+4*curCellId);
- std::size_t const nodePosInCurCell(std::distance(connOfCurCell,std::find(connOfCurCell,connOfCurCell+4,i)));
+ std::size_t nodePosInCurCell(std::distance(connOfCurCell,std::find(connOfCurCell,connOfCurCell+4,i)));
if(j!=0) cArr->pushBackSilent(-1);
mcIdType tmp[14];
//
thisu->getReverseNodalConnectivity(revNodArr,revNodIArr);
const mcIdType *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin());
MCAuto<DataArrayIdType> d2Arr(DataArrayIdType::New()),di2Arr(DataArrayIdType::New()),rd2Arr(DataArrayIdType::New()),rdi2Arr(DataArrayIdType::New());
- MCAuto<MEDCouplingUMesh> edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=nullptr;
+ MCAuto<MEDCouplingUMesh> edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
const mcIdType *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
MCAuto<DataArrayDouble> edgesBaryArr(edges->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass());
const mcIdType nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells());
- edges=nullptr;
+ edges=0;
std::vector<const DataArrayDouble *> v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr;
- MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=nullptr; edgesBaryArr=nullptr;
+ MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0;
std::string name("DualOf_"); name+=getName();
MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr);
MCAuto<DataArrayIdType> cArr(DataArrayIdType::New()),ciArr(DataArrayIdType::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
for(mcIdType i=0;i<nbOfNodes;i++,revNodI++)
{
- mcIdType const nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
+ mcIdType nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
if(nbOfCellsSharingNode==0)
{
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::computeDualMesh2D : Node #" << i << " is orphan !";
std::vector< std::vector<mcIdType> > polyg;
for(int j=0;j<nbOfCellsSharingNode;j++)
{
- mcIdType const curCellId(revNod[revNodI[0]+j]);
+ mcIdType curCellId(revNod[revNodI[0]+j]);
const mcIdType *connOfCurCell(nodal+3*curCellId);
- std::size_t const nodePosInCurCell(std::distance(connOfCurCell,std::find(connOfCurCell,connOfCurCell+4,i)));
+ std::size_t nodePosInCurCell(std::distance(connOfCurCell,std::find(connOfCurCell,connOfCurCell+4,i)));
std::vector<mcIdType> locV(3);
locV[0]=d2[3*curCellId+DUAL_TRI_0[2*nodePosInCurCell+0]]+nbOfNodes; locV[1]=curCellId+offset0; locV[2]=d2[3*curCellId+DUAL_TRI_0[2*nodePosInCurCell+1]]+nbOfNodes;
polyg.push_back(locV);
if(rdi2[*edgeId+1]-rdi2[*edgeId]==1)
{
std::vector<mcIdType> locV2(2);
- int const zeLocEdgeIdRel(DUAL_TRI_1[2*nodePosInCurCell+kk]);
+ int zeLocEdgeIdRel(DUAL_TRI_1[2*nodePosInCurCell+kk]);
if(zeLocEdgeIdRel>0)
{ locV2[0]=d2[3*curCellId+zeLocEdgeIdRel-3]+nbOfNodes; locV2[1]=i; }
else
* \throw If \a this is not fully set (coordinates and connectivity).
* \throw If a cell in \a this has no valid nodeId.
*/
-DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double /*arcDetEps*/) const
+DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const
{
mcIdType spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
int kk(0);
for(int j=0;j<nbOfNodesPerCell;j++,conn++)
{
- mcIdType const nodeId(*conn);
+ mcIdType nodeId(*conn);
if(nodeId>=0 && nodeId<nbOfNodes)
{
for(int k=0;k<spaceDim;k++)
{
checkFullyDefined();
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr(DataArrayDouble::New());
arr->alloc(nbCells,1);
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::DiameterCalculator> dc(_cm->buildInstanceOfDiameterCalulator(getSpaceDimension()));
}
MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh()
-= default;
+{
+}
MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm):MEDCoupling1GTUMesh(name,cm)
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::isEqualIfNotWhy : input other pointer is null !");
std::ostringstream oss; oss.precision(15);
- const auto *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
+ const MEDCoupling1DGTUMesh *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
if(!otherC)
{
reason="mesh given in input is not castable in MEDCoupling1DGTUMesh !";
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::isEqualWithoutConsideringStr : input other pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
+ const MEDCoupling1DGTUMesh *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
if(!otherC)
return false;
if(!MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(other,prec))
void MEDCoupling1DGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
{
MEDCouplingPointSet::checkFastEquivalWith(other,prec);
- const auto *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
+ const MEDCoupling1DGTUMesh *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkFastEquivalWith : Two meshes are not unstructured with single dynamic geometric type !");
const DataArrayIdType *c1(_conn),*c2(otherC->_conn);
else
throw INTERP_KERNEL::Exception("Nodal connectivity array not defined !");
//
- mcIdType const sz2(_conn->getNumberOfTuples());
+ mcIdType sz2(_conn->getNumberOfTuples());
c1=_conn_indx;
if(c1)
{
}
else
throw INTERP_KERNEL::Exception("Nodal connectivity index array not defined !");
- mcIdType const szOfC1Exp=_conn_indx->back();
+ mcIdType szOfC1Exp=_conn_indx->back();
if(sz2<szOfC1Exp)
{
std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity : The expected length of nodal connectivity array regarding index is " << szOfC1Exp << " but the actual size of it is " << c1->getNumberOfTuples() << " !";
checkConsistencyOfConnectivity();
}
-void MEDCoupling1DGTUMesh::checkConsistency(double /*eps*/) const
+void MEDCoupling1DGTUMesh::checkConsistency(double eps) const
{
checkConsistencyLight();
const DataArrayIdType *c1(_conn),*c2(_conn_indx);
if(!c2->isMonotonic(true))
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkConsistency : the nodal connectivity index is expected to be increasing monotinic !");
//
- mcIdType const nbOfTuples(c1->getNumberOfTuples());
- mcIdType const nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfTuples(c1->getNumberOfTuples());
+ mcIdType nbOfNodes=getNumberOfNodes();
const mcIdType *w(c1->begin());
for(mcIdType i=0;i<nbOfTuples;i++,w++)
{
if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
return _conn_indx->deltaShiftIndex();
// for polyhedrons
- mcIdType const nbOfCells=_conn_indx->getNumberOfTuples()-1;
+ mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
mcIdType *retPtr=ret->getPointer();
return ret.retn();
}
// for polyhedrons
- mcIdType const nbOfCells=_conn_indx->getNumberOfTuples()-1;
+ mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
mcIdType *retPtr=ret->getPointer();
{
checkConsistencyLight();
_conn_indx->checkMonotonic(true);
- mcIdType const nbOfCells=_conn_indx->getNumberOfTuples()-1;
+ mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
mcIdType *retPtr(ret->getPointer());
{
for(mcIdType i=0;i<nbOfCells;i++,retPtr++,ci++)
{
- std::set<mcIdType> const s(c+ci[0],c+ci[1]);
+ std::set<mcIdType> s(c+ci[0],c+ci[1]);
*retPtr=ToIdType(s.size());
}
}
void MEDCoupling1DGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const
{
- mcIdType const nbOfCells(getNumberOfCells());//performs checks
+ mcIdType nbOfCells(getNumberOfCells());//performs checks
if(cellId<nbOfCells)
{
mcIdType strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
- mcIdType const nbOfNodes=stp-strt;
+ mcIdType nbOfNodes=stp-strt;
if(nbOfNodes<0)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::getNodeIdsOfCell : the index array is invalid ! Should be increasing monotonic !");
conn.resize(nbOfNodes);
mcIdType MEDCoupling1DGTUMesh::getNumberOfNodesInCell(mcIdType cellId) const
{
- mcIdType const nbOfCells=getNumberOfCells();//performs checks
+ mcIdType nbOfCells=getNumberOfCells();//performs checks
if(cellId>=0 && cellId<nbOfCells)
{
const mcIdType *conn(_conn->begin());
ret << "Single dynamic geometic type (" << _cm->getRepr() << ") unstructured mesh with name : \"" << getName() << "\"\n";
ret << "Description of mesh : \"" << getDescription() << "\"\n";
int tmpp1,tmpp2;
- double const tt=getTime(tmpp1,tmpp2);
+ double tt=getTime(tmpp1,tmpp2);
ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Mesh dimension : " << getMeshDimension() << "\nSpace dimension : ";
- if(_coords!=nullptr)
+ if(_coords!=0)
{
const int spaceDim=getSpaceDimension();
ret << spaceDim << "\nInfo attached on space dimension : ";
else
ret << msg0 << "\n";
ret << "Number of nodes : ";
- if(_coords!=nullptr)
+ if(_coords!=0)
ret << getNumberOfNodes() << "\n";
else
ret << msg0 << "\n";
}
if(!isOK)
return ret.str();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *ci=_conn_indx->begin(),*c=_conn->begin();
for(mcIdType i=0;i<nbOfCells;i++,ci++)
{
DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() const
{
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int const spaceDim=getSpaceDimension();
- mcIdType const nbOfCells=getNumberOfCells();//checkConsistencyLight()
- mcIdType const nbOfNodes=getNumberOfNodes();
+ int spaceDim=getSpaceDimension();
+ mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight()
+ mcIdType nbOfNodes=getNumberOfNodes();
ret->alloc(nbOfCells,spaceDim);
double *ptToFill=ret->getPointer();
const double *coor=_coords->begin();
void MEDCoupling1DGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
MCAuto<DataArrayIdType> o2n=DataArrayIdType::New();
o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1);
if(check)
mcIdType *newC=newConn->getPointer(),*newCI=newConnI->getPointer();
for(mcIdType i=0;i<nbCells;i++)
{
- mcIdType const newPos=o2nPtr[i];
- mcIdType const sz=conni[i+1]-conni[i];
+ mcIdType newPos=o2nPtr[i];
+ mcIdType sz=conni[i+1]-conni[i];
if(sz>=0)
newCI[newPos]=sz;
else
//
for(mcIdType i=0;i<nbCells;i++,conni++)
{
- mcIdType const newp=o2nPtr[i];
+ mcIdType newp=o2nPtr[i];
std::copy(conn+conni[0],conn+conni[1],newC+newCI[newp]);
}
_conn=newConn;
{
if(other->getType()!=SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED)
throw INTERP_KERNEL::Exception("Merge of umesh only available with umesh single dynamic geo type each other !");
- const auto *otherC=static_cast<const MEDCoupling1DGTUMesh *>(other);
+ const MEDCoupling1DGTUMesh *otherC=static_cast<const MEDCoupling1DGTUMesh *>(other);
return Merge1DGTUMeshes(this,otherC);
}
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
ret->setCoords(getCoords());
const mcIdType *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin();
- mcIdType const nbCells=getNumberOfCells();//checkConsistencyLight
- mcIdType const geoType=ToIdType(getCellModelEnum());
+ mcIdType nbCells=getNumberOfCells();//checkConsistencyLight
+ mcIdType geoType=ToIdType(getCellModelEnum());
MCAuto<DataArrayIdType> c=DataArrayIdType::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1);
MCAuto<DataArrayIdType> cI=DataArrayIdType::New(); cI->alloc(nbCells+1);
mcIdType *cPtr=c->getPointer(),*ciPtr=cI->getPointer();
ciPtr[0]=0;
for(mcIdType i=0;i<nbCells;i++,ciPtr++)
{
- mcIdType const sz=nodalConnI[i+1]-nodalConnI[i];
+ mcIdType sz=nodalConnI[i+1]-nodalConnI[i];
if(sz>=0)
{
*cPtr++=geoType;
/*!
* Do nothing for the moment, because there is no policy that allows to split polygons, polyhedrons ... into simplexes
*/
-DataArrayIdType *MEDCoupling1DGTUMesh::simplexize(int /*policy*/)
+DataArrayIdType *MEDCoupling1DGTUMesh::simplexize(int policy)
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
ret->iota(0);
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::shallowCopyConnectivityFrom : input pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
+ const MEDCoupling1DGTUMesh *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::shallowCopyConnectivityFrom : input pointer is not an MEDCoupling1DGTUMesh instance !");
setNodalConnectivity(otherC->getNodalConnectivity(),otherC->getNodalConnectivityIndex());
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords : input other is null !");
- const auto *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
+ const MEDCoupling1DGTUMesh *otherC=dynamic_cast<const MEDCoupling1DGTUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords : the input other mesh is not of type single statuc geo type unstructured !");
std::vector<const MEDCoupling1DGTUMesh *> ms(2);
checkConsistencyLight();
MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
- DataArrayIdType *c=nullptr,*ci=nullptr;
+ DataArrayIdType *c=0,*ci=0;
DataArrayIdType::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci);
MCAuto<DataArrayIdType> cSafe(c),ciSafe(ci);
ret->setNodalConnectivity(c,ci);
checkConsistencyLight();
MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
- DataArrayIdType *c=nullptr,*ci=nullptr;
+ DataArrayIdType *c=0,*ci=0;
DataArrayIdType::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci);
MCAuto<DataArrayIdType> cSafe(c),ciSafe(ci);
ret->setNodalConnectivity(c,ci);
void MEDCoupling1DGTUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const
{
checkConsistency();
- mcIdType const sz(ToIdType(nodeIdsInUse.size()));
+ mcIdType sz(ToIdType(nodeIdsInUse.size()));
for(const mcIdType *conn=_conn->begin();conn!=_conn->end();conn++)
{
if(*conn>=0 && *conn<sz)
void MEDCoupling1DGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const
{
checkFullyDefined();
- mcIdType const nbOfNodes=getNumberOfNodes();
- auto *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType));
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType));
revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1);
std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
const mcIdType *conn=_conn->begin(),*conni=_conn_indx->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType nbOfEltsInRevNodal=0;
for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
- mcIdType const nbOfNodesPerCell=conni[eltId+1]-conni[eltId];
+ mcIdType nbOfNodesPerCell=conni[eltId+1]-conni[eltId];
if(nbOfNodesPerCell>=0)
{
for(mcIdType j=0;j<nbOfNodesPerCell;j++)
{
- mcIdType const nodeId=conn[conni[eltId]+j];
+ mcIdType nodeId=conn[conni[eltId]+j];
if(nodeId==-1) continue;
if(nodeId>=0 && nodeId<nbOfNodes)
{
}
std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<mcIdType>());
conn=_conn->begin();
- auto *revNodalPtr=(mcIdType *)malloc((nbOfEltsInRevNodal)*sizeof(mcIdType));
+ mcIdType *revNodalPtr=(mcIdType *)malloc((nbOfEltsInRevNodal)*sizeof(mcIdType));
revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1);
std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1);
for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
- mcIdType const nbOfNodesPerCell=conni[eltId+1]-conni[eltId];
+ mcIdType nbOfNodesPerCell=conni[eltId+1]-conni[eltId];
for(mcIdType j=0;j<nbOfNodesPerCell;j++)
{
- mcIdType const nodeId=conn[conni[eltId]+j];
+ mcIdType nodeId=conn[conni[eltId]+j];
if(nodeId!=-1)
*std::find_if(revNodalPtr+revNodalIndxPtr[nodeId],revNodalPtr+revNodalIndxPtr[nodeId+1],std::bind(std::equal_to<mcIdType>(),std::placeholders::_1,-1))=eltId;
}
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkFullyDefined : part of this is not fully defined.");
}
-bool MEDCoupling1DGTUMesh::isEmptyMesh(const std::vector<mcIdType>& /*tinyInfo*/) const
+bool MEDCoupling1DGTUMesh::isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const
{
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::isEmptyMesh : not implemented yet !");
}
void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
- double const time=getTime(it,order);
+ double time=getTime(it,order);
tinyInfo.clear(); tinyInfoD.clear(); littleStrings.clear();
//
littleStrings.push_back(getName());
tinyInfoD.push_back(time);
}
-void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& /*littleStrings*/) const
+void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
- std::vector<mcIdType> const tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]);
- std::vector<mcIdType> const tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]);
- std::vector<mcIdType> const tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]);
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]);
+ std::vector<mcIdType> tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]);
+ std::vector<mcIdType> tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]);
MCAuto<DataArrayIdType> p1(DataArrayIdType::New()); p1->resizeForUnserialization(tinyInfo1);
MCAuto<DataArrayIdType> p2(DataArrayIdType::New()); p2->resizeForUnserialization(tinyInfo12);
std::vector<const DataArrayIdType *> v(2); v[0]=p1; v[1]=p2;
void MEDCoupling1DGTUMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
- auto gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]);
+ INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]);
_cm=&INTERP_KERNEL::CellModel::GetCellModel(gt);
setName(littleStrings[0]);
setDescription(littleStrings[1]);
mcIdType sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]),sz4(tinyInfo[7]),sz5(tinyInfo[8]);
//
_coords=DataArrayDouble::New();
- std::vector<mcIdType> const tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+sz3);
+ std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+sz3);
_coords->resizeForUnserialization(tinyInfo2);
std::copy(a2->begin(),a2->end(),_coords->getPointer());
_conn=DataArrayIdType::New();
- std::vector<mcIdType> const tinyInfo3(tinyInfo.begin()+9+sz3,tinyInfo.begin()+9+sz3+sz4);
+ std::vector<mcIdType> tinyInfo3(tinyInfo.begin()+9+sz3,tinyInfo.begin()+9+sz3+sz4);
_conn->resizeForUnserialization(tinyInfo3);
std::copy(a1->begin(),a1->begin()+_conn->getNbOfElems(),_conn->getPointer());
_conn_indx=DataArrayIdType::New();
- std::vector<mcIdType> const tinyInfo4(tinyInfo.begin()+9+sz3+sz4,tinyInfo.begin()+9+sz3+sz4+sz5);
+ std::vector<mcIdType> tinyInfo4(tinyInfo.begin()+9+sz3+sz4,tinyInfo.begin()+9+sz3+sz4+sz5);
_conn_indx->resizeForUnserialization(tinyInfo4);
std::copy(a1->begin()+_conn->getNbOfElems(),a1->end(),_conn_indx->getPointer());
- std::vector<std::string> const littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0);
+ std::vector<std::string> littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0);
_coords->finishUnserialization(tinyInfo2,littleStrings2);
- std::vector<std::string> const littleStrings3(littleStrings.begin()+3+sz0,littleStrings.begin()+3+sz0+sz1);
+ std::vector<std::string> littleStrings3(littleStrings.begin()+3+sz0,littleStrings.begin()+3+sz0+sz1);
_conn->finishUnserialization(tinyInfo3,littleStrings3);
- std::vector<std::string> const littleStrings4(littleStrings.begin()+3+sz0+sz1,littleStrings.begin()+3+sz0+sz1+sz2);
+ std::vector<std::string> littleStrings4(littleStrings.begin()+3+sz0+sz1,littleStrings.begin()+3+sz0+sz1+sz2);
_conn_indx->finishUnserialization(tinyInfo4,littleStrings4);
}
DataArrayIdType *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const
{
checkConsistency();
- mcIdType const nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
std::vector<bool> fetchedNodes(nbNodes,false);
computeNodeIdsAlg(fetchedNodes);
- mcIdType const sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true)));
+ mcIdType sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true)));
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(sz,1);
mcIdType *retPtr(ret->getPointer());
for(mcIdType i=0;i<nbNodes;i++)
DataArrayIdType *MEDCoupling1DGTUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const
{
nbrOfNodesInUse=-1;
- mcIdType const nbOfNodes=getNumberOfNodes();
- mcIdType const nbOfCells=getNumberOfCells();//checkConsistencyLight
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfNodes,1);
mcIdType *traducer=ret->getPointer();
const mcIdType *conn=_conn->begin(),*conni(_conn_indx->begin());
for(mcIdType i=0;i<nbOfCells;i++,conni++)
{
- mcIdType const nbNodesPerCell=conni[1]-conni[0];
+ mcIdType nbNodesPerCell=conni[1]-conni[0];
for(mcIdType j=0;j<nbNodesPerCell;j++)
{
- mcIdType const nodeId=conn[conni[0]+j];
+ mcIdType nodeId=conn[conni[0]+j];
if(nodeId==-1) continue;
if(nodeId>=0 && nodeId<nbOfNodes)
traducer[nodeId]=1;
{
getNumberOfCells();//only to check that all is well defined.
//
- mcIdType const nbOfTuples(_conn->getNumberOfTuples());
+ mcIdType nbOfTuples(_conn->getNumberOfTuples());
mcIdType *pt(_conn->getPointer());
for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
*/
void MEDCoupling1DGTUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1);
mcIdType tmp=-1;
mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1;
for(mcIdType i=0;i<nbOfCells;i++,conni++)
{
int ref=0,nbOfHit=0;
- mcIdType const nbNodesPerCell=conni[1]-conni[0];
+ mcIdType nbNodesPerCell=conni[1]-conni[0];
if(nbNodesPerCell>=0)
{
for(mcIdType j=0;j<nbNodesPerCell;j++)
{
- mcIdType const nodeId=conn[conni[0]+j];
+ mcIdType nodeId=conn[conni[0]+j];
if(nodeId>=0)
{
ref++;
*/
void MEDCoupling1DGTUMesh::insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd)
{
- std::size_t const sz(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd));
+ std::size_t sz(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd));
DataArrayIdType *c(_conn),*c2(_conn_indx);
if(c && c2)
{
- mcIdType const pos=c2->back();
+ mcIdType pos=c2->back();
if(pos==c->getNumberOfTuples())
{
c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd);
MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const
{
MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
- DataArrayIdType *nc=nullptr,*nci=nullptr;
+ DataArrayIdType *nc=0,*nci=0;
isShallowCpyOfNodalConnn=retrievePackedNodalConnectivity(nc,nci);
MCAuto<DataArrayIdType> ncs(nc),ncis(nci);
ret->_conn=ncs; ret->_conn_indx=ncis;
MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(std::vector<const MEDCoupling1DGTUMesh *>& a)
{
- std::size_t const sz=a.size();
+ std::size_t sz=a.size();
if(sz==0)
return Merge1DGTUMeshesLL(a);
for(std::size_t ii=0;ii<sz;ii++)
* \throw If \a this is not fully set (coordinates and connectivity).
* \throw If a cell in \a this has no valid nodeId.
*/
-DataArrayDouble *MEDCoupling1DGTUMesh::getBoundingBoxForBBTree(double /*arcDetEps*/) const
+DataArrayDouble *MEDCoupling1DGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const
{
checkFullyDefined();
mcIdType spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
const mcIdType *conn(_conn->getConstPointer()),*connI(_conn_indx->getConstPointer());
for(mcIdType i=0;i<nbOfCells;i++)
{
- mcIdType const offset=connI[i];
+ mcIdType offset=connI[i];
mcIdType nbOfNodesForCell(connI[i+1]-offset),kk(0);
for(mcIdType j=0;j<nbOfNodesForCell;j++)
{
- mcIdType const nodeId=conn[offset+j];
+ mcIdType nodeId=conn[offset+j];
if(nodeId>=0 && nodeId<nbOfNodes)
{
for(int k=0;k<spaceDim;k++)
{
checkConsistencyOfConnectivity();
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum()));
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
const mcIdType *connI(_conn_indx->begin());
mcIdType *conn(_conn->getPointer());
for(mcIdType i=0;i<nbCells;i++)
if(sz1==0)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : empty vectors in input !");
mcIdType nbOfTuples=0;
- for(auto nodalConn : nodalConns)
+ for(std::vector<const DataArrayIdType *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++)
{
- if(!nodalConn)
+ if(!(*it))
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of null pointer in input vector !");
- if(!nodalConn->isAllocated())
+ if(!(*it)->isAllocated())
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of non allocated array in input vector !");
- if(nodalConn->getNumberOfComponents()!=1)
+ if((*it)->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of array with not exactly one component !");
- nbOfTuples+=nodalConn->getNumberOfTuples();
+ nbOfTuples+=(*it)->getNumberOfTuples();
}
MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1);
mcIdType *pt=ret->getPointer();
mcIdType i=0;
- for(auto it=nodalConns.begin();it!=nodalConns.end();it++,i++)
+ for(std::vector<const DataArrayIdType *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++)
{
- mcIdType const curNbt=(*it)->getNumberOfTuples();
+ mcIdType curNbt=(*it)->getNumberOfTuples();
const mcIdType *inPt=(*it)->begin();
- mcIdType const offset=offsetInNodeIdsPerElt[i];
+ mcIdType offset=offsetInNodeIdsPerElt[i];
for(mcIdType j=0;j<curNbt;j++,pt++)
{
if(inPt[j]!=-1)
{
if(!m)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : input mesh is null !");
- std::set<INTERP_KERNEL::NormalizedCellType> const gts(m->getAllGeoTypes());
+ std::set<INTERP_KERNEL::NormalizedCellType> gts(m->getAllGeoTypes());
if(gts.size()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : input mesh must have exactly one geometric type !");
- mcIdType const geoType(ToIdType(*gts.begin()));
+ mcIdType geoType(ToIdType(*gts.begin()));
MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin()));
ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
- mcIdType const nbCells=m->getNumberOfCells();
+ mcIdType nbCells=m->getNumberOfCells();
MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New());
conn->alloc(m->getNodalConnectivityArrayLen()-nbCells,1); connI->alloc(nbCells+1,1);
mcIdType *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0;
#ifndef __PARAMEDMEM_MEDCOUPLING1GTUMESH_HXX__
#define __PARAMEDMEM_MEDCOUPLING1GTUMESH_HXX__
-#include "InterpKernelHashMap.hxx"
#include "MEDCoupling.hxx"
#include "MCType.hxx"
-#include "MEDCouplingMesh.hxx"
#include "MEDCouplingPointSet.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MCAuto.hxx"
#include "CellModel.hxx"
-#include <string>
-#include "NormalizedGeometricTypes"
-#include <set>
-#include <vector>
-#include <ostream>
-#include <cstddef>
-#include "MEDCouplingRefCountObject.hxx"
-#include <map>
namespace MEDCoupling
{
MEDCOUPLING_EXPORT static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
MEDCOUPLING_EXPORT const INTERP_KERNEL::CellModel& getCellModel() const;
MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
- MEDCOUPLING_EXPORT int getMeshDimension() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const override;
- MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const override;
- MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const override;
- MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const override;
- MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override;
- MEDCOUPLING_EXPORT std::string getVTKDataSetType() const override;
- MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override;
+ MEDCOUPLING_EXPORT int getMeshDimension() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const;
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
+ MEDCOUPLING_EXPORT std::string getVTKDataSetType() const;
+ MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
//
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT mcIdType getNodalConnectivityLength() const;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override;
- MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override;
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const override;
MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) override;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const override;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const override;
- MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const override;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const;
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
+ MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const;
MEDCOUPLING_EXPORT static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(const std::vector< const MEDCoupling1GTUMesh *>& parts);
public:
MEDCOUPLING_EXPORT virtual void allocateCells(mcIdType nbOfCells=0) = 0;
MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New();
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCoupling1SGTUMesh"); }
// Copy methods
- MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *clone(bool recDeepCpy) const override;
- MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopy() const override;
- MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopyConnectivityOnly() const override;
+ MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *clone(bool recDeepCpy) const;
+ MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopy() const;
+ MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopyConnectivityOnly() const;
// overload of TimeLabel and RefCountObject
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
// overload of MEDCouplingMesh
- MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED; }
+ MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED; }
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override;
- MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const override;
- MEDCOUPLING_EXPORT std::string simpleRepr() const override;
- MEDCOUPLING_EXPORT std::string advancedRepr() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
+ MEDCOUPLING_EXPORT std::string simpleRepr() const;
+ MEDCOUPLING_EXPORT std::string advancedRepr() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
// overload of MEDCouplingPointSet
- MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) override;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const override;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const override;
- MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const override;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override;
- MEDCOUPLING_EXPORT void checkFullyDefined() const override;
- MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const override;
- MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset) override;
- MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N) override;
+ MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const;
+ MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
+ MEDCOUPLING_EXPORT void checkFullyDefined() const;
+ MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const;
+ MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N);
MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N) override;
- MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N) override;
- MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const override;
- MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const override;
- MEDCOUPLING_EXPORT void invertOrientationOfAllCells() override;
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const;
+ MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
// overload of MEDCoupling1GTUMesh
- MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const override;
- MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0) override;
- MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd) override;
+ MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const;
+ MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0);
+ MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd);
public://specific
MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayIdType *nodalConn);
- MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const override;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const;
MEDCOUPLING_EXPORT mcIdType getNumberOfNodesPerCell() const;
MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2);
MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(std::vector<const MEDCoupling1SGTUMesh *>& a);
MEDCOUPLING_EXPORT MCAuto<DataArrayDouble> computeTriangleHeight() const;
MEDCOUPLING_EXPORT MEDCouplingCMesh *structurizeMe(DataArrayIdType *& cellPerm, DataArrayIdType *& nodePerm, double eps=1e-12) const;
public://serialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override;
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
- const std::vector<std::string>& littleStrings) override;
+ const std::vector<std::string>& littleStrings);
private:
MEDCoupling1SGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm);
MEDCoupling1SGTUMesh(const MEDCoupling1SGTUMesh& other, bool recDeepCpy);
MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New();
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCoupling1DGTUMesh"); }
// Copy methods
- MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *clone(bool recDeepCpy) const override;
- MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopy() const override;
- MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopyConnectivityOnly() const override;
+ MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *clone(bool recDeepCpy) const;
+ MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopy() const;
+ MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopyConnectivityOnly() const;
// overload of TimeLabel and RefCountObject
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
// overload of MEDCouplingMesh
- MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED; }
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override;
- MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const override;
- MEDCOUPLING_EXPORT std::string simpleRepr() const override;
- MEDCOUPLING_EXPORT std::string advancedRepr() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED; }
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
+ MEDCOUPLING_EXPORT std::string simpleRepr() const;
+ MEDCOUPLING_EXPORT std::string advancedRepr() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
// overload of MEDCouplingPointSet
- MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) override;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const override;
- MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const override;
- MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const override;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override;
- MEDCOUPLING_EXPORT void checkFullyDefined() const override;
- MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const override;
- MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset) override;
- MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N) override;
+ MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const;
+ MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
+ MEDCOUPLING_EXPORT void checkFullyDefined() const;
+ MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const;
+ MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N);
MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N) override;
- MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N) override;
- MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const override;
- MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const override;
- MEDCOUPLING_EXPORT void invertOrientationOfAllCells() override;
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const;
+ MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
// overload of MEDCoupling1GTUMesh
- MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const override;
- MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0) override;
- MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd) override;
+ MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const;
+ MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0);
+ MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd);
public://specific
MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex);
- MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const override;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const;
MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivityIndex() const;
MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const;
MEDCOUPLING_EXPORT bool retrievePackedNodalConnectivity(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndx) const;
MEDCOUPLING_EXPORT static std::vector<mcIdType> BuildAPolygonFromParts(const std::vector< std::vector<mcIdType> >& parts);
MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const;
public://serialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override;
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
- const std::vector<std::string>& littleStrings) override;
+ const std::vector<std::string>& littleStrings);
private:
MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm);
MEDCoupling1DGTUMesh(const MEDCoupling1DGTUMesh& other, bool recDeepCpy);
// Author : Anthony Geay (EDF R&D)
#pragma once
-#include "MCType.hxx"
#include "MEDCoupling1GTUMesh.hxx"
-#include <iterator>
#include <sstream>
template<class MAPCLS>
{
getNumberOfCells();//only to check that all is well defined.
mcIdType *begPtr(_conn->getPointer());
- mcIdType const nbElt(_conn->getNumberOfTuples());
+ mcIdType nbElt(_conn->getNumberOfTuples());
mcIdType *endPtr(begPtr+nbElt);
for(mcIdType *it=begPtr;it!=endPtr;it++)
{
{
getNumberOfCells();//only to check that all is well defined.
//
- mcIdType const nbOfTuples(_conn->getNumberOfTuples());
+ mcIdType nbOfTuples(_conn->getNumberOfTuples());
mcIdType *pt(_conn->getPointer());
for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
// Author : Anthony Geay
#include "MEDCouplingAMRAttribute.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingCartesianAMRMesh.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingIMesh.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingStructuredMesh.hxx"
-
-#include <algorithm>
-#include <cstddef>
-#include <iterator>
-#include <set>
-#include <map>
+
#include <sstream>
#include <fstream>
#include <functional>
-#include <string>
-#include <utility>
-#include <vector>
using namespace MEDCoupling;
void DataArrayDoubleCollection::allocTuples(mcIdType nbOfTuples)
{
- std::size_t const sz(_arrs.size());
+ std::size_t sz(_arrs.size());
for(std::size_t i=0;i<sz;i++)
_arrs[i].first->reAlloc(nbOfTuples);
}
void DataArrayDoubleCollection::dellocTuples()
{
- std::size_t const sz(_arrs.size());
+ std::size_t sz(_arrs.size());
for(std::size_t i=0;i<sz;i++)
_arrs[i].first->reAlloc(0);
}
void DataArrayDoubleCollection::copyFrom(const DataArrayDoubleCollection& other)
{
- std::size_t const sz(_arrs.size());
+ std::size_t sz(_arrs.size());
if(sz!=other._arrs.size())
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::copyFrom : size are not the same !");
for(std::size_t i=0;i<sz;i++)
void DataArrayDoubleCollection::spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames)
{
- std::size_t const sz(_arrs.size());
+ std::size_t sz(_arrs.size());
if(sz!=compNames.size())
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::spillInfoOnComponents : first size of compNames has to be equal to the number of fields defined !");
for(std::size_t i=0;i<sz;i++)
void DataArrayDoubleCollection::spillNatures(const std::vector<NatureOfField>& nfs)
{
- std::size_t const sz(_arrs.size());
+ std::size_t sz(_arrs.size());
if(sz!=nfs.size())
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::spillNatures : first size of vector of NatureOfField has to be equal to the number of fields defined !");
for(std::size_t i=0;i<sz;i++)
std::vector< std::pair < std::string, std::vector<std::string> > > DataArrayDoubleCollection::getInfoOnComponents() const
{
- std::size_t const sz(_arrs.size());
+ std::size_t sz(_arrs.size());
std::vector< std::pair < std::string, std::vector<std::string> > > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
std::vector<NatureOfField> DataArrayDoubleCollection::getNatures() const
{
- std::size_t const sz(_arrs.size());
+ std::size_t sz(_arrs.size());
std::vector<NatureOfField> ret(sz);
for(std::size_t i=0;i<sz;i++)
ret[i]=_arrs[i].second;
std::vector<DataArrayDouble *> DataArrayDoubleCollection::retrieveFields() const
{
- std::size_t const sz(_arrs.size());
+ std::size_t sz(_arrs.size());
std::vector<DataArrayDouble *> ret(sz);
for(std::size_t i=0;i<sz;i++)
{
const DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name) const
{
std::vector<std::string> vec;
- for(const auto & _arr : _arrs)
+ for(std::vector< std::pair< MCAuto<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
{
- const DataArrayDouble *obj(_arr.first);
+ const DataArrayDouble *obj((*it).first);
if(obj)
{
if(obj->getName()==name)
DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name)
{
std::vector<std::string> vec;
- for(auto & _arr : _arrs)
+ for(std::vector< std::pair< MCAuto<DataArrayDouble>, NatureOfField > >::iterator it=_arrs.begin();it!=_arrs.end();it++)
{
- DataArrayDouble *obj(_arr.first);
+ DataArrayDouble *obj((*it).first);
if(obj)
{
if(obj->getName()==name)
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineToCoarse : the input DataArrayDouble collections must be non NULL !");
- std::size_t const sz(coarse->_arrs.size());
+ std::size_t sz(coarse->_arrs.size());
if(fine->_arrs.size()!=sz)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineToCoarse : the input DataArrayDouble collection must have the same size !");
for(std::size_t i=0;i<sz;i++)
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFine : the input DataArrayDouble collections must be non NULL !");
- std::size_t const sz(coarse->_arrs.size());
+ std::size_t sz(coarse->_arrs.size());
if(fine->_arrs.size()!=sz)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFine : the input DataArrayDouble collection must have the same size !");
for(std::size_t i=0;i<sz;i++)
{
if(!fatherOfFineMesh)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : father is NULL !");
- std::size_t const sz(children.size());
+ std::size_t sz(children.size());
if(fieldsOnFine.size()!=sz)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : sizes of vectors mismatch !");
if(sz<=1)
return ;
- std::size_t const nbOfCall(fieldsOnFine[0]->_arrs.size());
+ std::size_t nbOfCall(fieldsOnFine[0]->_arrs.size());
for(std::size_t i=0;i<sz;i++)
if(fatherOfFineMesh->getPatchIdFromChildMesh(children[i])!=ToIdType(i))
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : internal error !");
{
if(!p1 || !p1dac || !p2 || !p2dac)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo : input pointer must be not NULL !");
- std::size_t const sz(p1dac->_arrs.size());
+ std::size_t sz(p1dac->_arrs.size());
if(p2dac->_arrs.size()!=sz)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo : size of DataArrayDouble Collection must be the same !");
for(std::size_t i=0;i<sz;i++)
{
const DataArrayDouble *zeArrWhichGhostsWillBeUpdated(p1dac->_arrs[i].first);
DataArrayDoubleCollection::CheckSameNatures(p1dac->_arrs[i].second,p2dac->_arrs[i].second);
- bool const isConservative(DataArrayDoubleCollection::IsConservativeNature(p1dac->_arrs[i].second));
+ bool isConservative(DataArrayDoubleCollection::IsConservativeNature(p1dac->_arrs[i].second));
MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(ghostLev,p1,p2,const_cast<DataArrayDouble *>(zeArrWhichGhostsWillBeUpdated),p2dac->_arrs[i].first,isConservative);
}
}
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone : the input DataArrayDouble collections must be non NULL !");
- std::size_t const sz(coarse->_arrs.size());
+ std::size_t sz(coarse->_arrs.size());
if(fine->_arrs.size()!=sz)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone : the input DataArrayDouble collection must have the same size !");
for(std::size_t i=0;i<sz;i++)
void DataArrayDoubleCollection::synchronizeMyGhostZoneUsing(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const
{
- auto *thisNC(const_cast<DataArrayDoubleCollection *>(this));
- std::size_t const sz(_arrs.size());
+ DataArrayDoubleCollection *thisNC(const_cast<DataArrayDoubleCollection *>(this));
+ std::size_t sz(_arrs.size());
if(other._arrs.size()!=sz)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::synchronizeMyGhostZoneUsing : sizes of collections must match !");
for(std::size_t i=0;i<sz;i++)
void DataArrayDoubleCollection::synchronizeMyGhostZoneUsingExt(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const
{
- auto *thisNC(const_cast<DataArrayDoubleCollection *>(this));
- std::size_t const sz(_arrs.size());
+ DataArrayDoubleCollection *thisNC(const_cast<DataArrayDoubleCollection *>(this));
+ std::size_t sz(_arrs.size());
if(other._arrs.size()!=sz)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::synchronizeMyGhostZoneUsingExt : sizes of collections must match !");
for(std::size_t i=0;i<sz;i++)
DataArrayDoubleCollection::DataArrayDoubleCollection(const std::vector< std::pair<std::string,int> >& fieldNames):_arrs(fieldNames.size())
{
- std::size_t const sz(fieldNames.size());
+ std::size_t sz(fieldNames.size());
std::vector<std::string> names(sz);
for(std::size_t i=0;i<sz;i++)
{
DataArrayDoubleCollection::DataArrayDoubleCollection(const DataArrayDoubleCollection& other):RefCountObject(other),_arrs(other._arrs.size())
{
- std::size_t const sz(other._arrs.size());
+ std::size_t sz(other._arrs.size());
for(std::size_t i=0;i<sz;i++)
{
_arrs[i].second=other._arrs[i].second;
std::vector<const BigMemoryObject *> DataArrayDoubleCollection::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _arr : _arrs)
- ret.push_back((const DataArrayDouble *)_arr.first);
+ for(std::vector< std::pair< MCAuto<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
+ ret.push_back((const DataArrayDouble *)(*it).first);
return ret;
}
void DataArrayDoubleCollection::updateTime() const
{
- for(const auto & _arr : _arrs)
+ for(std::vector< std::pair< MCAuto<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
{
- const DataArrayDouble *pt(_arr.first);
+ const DataArrayDouble *pt((*it).first);
if(pt)
updateTimeWith(*pt);
}
void DataArrayDoubleCollection::CheckDiscriminantNames(const std::vector<std::string>& names)
{
- std::set<std::string> const s(names.begin(),names.end());
+ std::set<std::string> s(names.begin(),names.end());
if(s.size()!=names.size())
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::CheckDiscriminantNames : The names of fields must be different each other ! It is not the case !");
}
void MEDCouplingGridCollection::alloc(mcIdType ghostLev)
{
- for(auto & it : _map_of_dadc)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
- mcIdType const nbTuples(it.first->getNumberOfCellsAtCurrentLevelGhost(ghostLev));
- DataArrayDoubleCollection *dadc(it.second);
+ mcIdType nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev));
+ DataArrayDoubleCollection *dadc((*it).second);
if(dadc)
dadc->allocTuples(nbTuples);
else
void MEDCouplingGridCollection::dealloc()
{
- for(auto & it : _map_of_dadc)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
- DataArrayDoubleCollection *dadc(it.second);
+ DataArrayDoubleCollection *dadc((*it).second);
if(dadc)
dadc->dellocTuples();
else
void MEDCouplingGridCollection::spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames)
{
- for(auto & it : _map_of_dadc)
- it.second->spillInfoOnComponents(compNames);
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ (*it).second->spillInfoOnComponents(compNames);
}
void MEDCouplingGridCollection::spillNatures(const std::vector<NatureOfField>& nfs)
{
- for(auto & it : _map_of_dadc)
- it.second->spillNatures(nfs);
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ (*it).second->spillNatures(nfs);
}
std::vector< std::pair<std::string, std::vector<std::string> > > MEDCouplingGridCollection::getInfoOnComponents() const
bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen *m, mcIdType& pos) const
{
mcIdType ret(0);
- for(auto it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++)
{
if((*it).first==m)
{
*/
void MEDCouplingGridCollection::copyOverlappedZoneFrom(mcIdType ghostLev, const MEDCouplingGridCollection& other)
{
- for(auto & it : _map_of_dadc)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
std::vector<mcIdType> deltaThis,deltaOther;
- std::vector< std::pair<mcIdType,mcIdType> > const rgThis(it.first->positionRelativeToGodFather(deltaThis));
- std::vector<mcIdType> thisSt(it.first->getImageMesh()->getCellGridStructure());
+ std::vector< std::pair<mcIdType,mcIdType> > rgThis((*it).first->positionRelativeToGodFather(deltaThis));
+ std::vector<mcIdType> thisSt((*it).first->getImageMesh()->getCellGridStructure());
std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind(std::plus<mcIdType>(),std::placeholders::_1,2*ghostLev));
- for(const auto & it2 : other._map_of_dadc)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++)
{
- std::vector< std::pair<mcIdType,mcIdType> > const rgOther(it2.first->positionRelativeToGodFather(deltaOther));
+ std::vector< std::pair<mcIdType,mcIdType> > rgOther((*it2).first->positionRelativeToGodFather(deltaOther));
if(MEDCouplingStructuredMesh::AreRangesIntersect(rgThis,rgOther))
{
- std::vector< std::pair<mcIdType,mcIdType> > const isect(MEDCouplingStructuredMesh::IntersectRanges(rgThis,rgOther));
+ std::vector< std::pair<mcIdType,mcIdType> > isect(MEDCouplingStructuredMesh::IntersectRanges(rgThis,rgOther));
std::vector< std::pair<mcIdType,mcIdType> > pThis,pOther;
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(rgThis,isect,pThis,true);
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(rgOther,isect,pOther,true);
- std::vector<mcIdType> otherSt(it2.first->getImageMesh()->getCellGridStructure());
+ std::vector<mcIdType> otherSt((*it2).first->getImageMesh()->getCellGridStructure());
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(pThis,ghostLev);
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(pOther,ghostLev);
std::transform(otherSt.begin(),otherSt.end(),otherSt.begin(),std::bind(std::plus<mcIdType>(),std::placeholders::_1,2*ghostLev));
- mcIdType const sz(it2.second->size());
+ mcIdType sz((*it2).second->size());
for(mcIdType i=0;i<sz;i++)
{
- const DataArrayDouble *otherArr(it2.second->at(i));
- DataArrayDouble *thisArr(it.second->at(i));
+ const DataArrayDouble *otherArr((*it2).second->at(i));
+ DataArrayDouble *thisArr((*it).second->at(i));
MCAuto<DataArrayDouble> partOfOther(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(otherSt,otherArr,pOther));
MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(thisSt,thisArr,pThis,partOfOther);
}
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeFineToCoarse : one or more input pointer is NULL !");
const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
- for(const auto & it : mf)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=mf.begin();it!=mf.end();it++)
{
- const MEDCouplingCartesianAMRMeshGen *fineMesh(it.first);
+ const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first);
const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather());
bool found(false);
- for(auto it0=mc.begin();it0!=mc.end() && !found;it0++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
{
if((*it0).first==fatherOfFineMesh)
{
found=true;
- mcIdType const patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
+ mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
const DataArrayDoubleCollection *coarseDaCol((*it0).second);
- auto *coarseModified(const_cast<DataArrayDoubleCollection *>(coarseDaCol));//coarse values in DataArrayDouble will be altered
- DataArrayDoubleCollection::SynchronizeFineToCoarse(ghostLev,fatherOfFineMesh,patchId,it.second,coarseModified);
+ DataArrayDoubleCollection *coarseModified(const_cast<DataArrayDoubleCollection *>(coarseDaCol));//coarse values in DataArrayDouble will be altered
+ DataArrayDoubleCollection::SynchronizeFineToCoarse(ghostLev,fatherOfFineMesh,patchId,(*it).second,coarseModified);
}
}
if(!found)
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFine : one or more input pointer is NULL !");
const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
- for(const auto & it : mf)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=mf.begin();it!=mf.end();it++)
{
- const MEDCouplingCartesianAMRMeshGen *fineMesh(it.first);
+ const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first);
const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather());
bool found(false);
- for(auto it0=mc.begin();it0!=mc.end() && !found;it0++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
{
if((*it0).first==fatherOfFineMesh)
{
found=true;
- mcIdType const patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
- const DataArrayDoubleCollection *fineDaCol(it.second);
- auto *fineModified(const_cast<DataArrayDoubleCollection *>(fineDaCol));//fine values in DataArrayDouble will be altered
+ mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
+ const DataArrayDoubleCollection *fineDaCol((*it).second);
+ DataArrayDoubleCollection *fineModified(const_cast<DataArrayDoubleCollection *>(fineDaCol));//fine values in DataArrayDouble will be altered
DataArrayDoubleCollection::SynchronizeCoarseToFine(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified);
}
}
*/
void MEDCouplingGridCollection::synchronizeFineEachOther(mcIdType ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const
{
- for(const auto & p : ps)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=ps.begin();it!=ps.end();it++)
{
mcIdType p1,p2;
- if(!presenceOf(p.first->getMesh(),p1))
+ if(!presenceOf((*it).first->getMesh(),p1))
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOther : internal error #1 !");
- if(!presenceOf(p.second->getMesh(),p2))
+ if(!presenceOf((*it).second->getMesh(),p2))
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOther : internal error #2 !");
const DataArrayDoubleCollection& col1(getFieldsAt(p1));
const DataArrayDoubleCollection& col2(getFieldsAt(p2));
- col1.synchronizeMyGhostZoneUsing(ghostLev,col2,p.first,p.second,p.first->getMesh()->getFather());
+ col1.synchronizeMyGhostZoneUsing(ghostLev,col2,(*it).first,(*it).second,(*it).first->getMesh()->getFather());
}
}
*/
void MEDCouplingGridCollection::synchronizeFineEachOtherExt(mcIdType ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const
{
- for(const auto & p : ps)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=ps.begin();it!=ps.end();it++)
{
mcIdType p1,p2;
- if(!presenceOf(p.first->getMesh(),p1))
+ if(!presenceOf((*it).first->getMesh(),p1))
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOtherExt : internal error #1 !");
- if(!presenceOf(p.second->getMesh(),p2))
+ if(!presenceOf((*it).second->getMesh(),p2))
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOtherExt : internal error #2 !");
const DataArrayDoubleCollection& col1(getFieldsAt(p1));
const DataArrayDoubleCollection& col2(getFieldsAt(p2));
- col1.synchronizeMyGhostZoneUsingExt(ghostLev,col2,p.first,p.second);
+ col1.synchronizeMyGhostZoneUsingExt(ghostLev,col2,(*it).first,(*it).second);
}
}
{
std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > ret;
std::map<const MEDCouplingCartesianAMRMeshGen *,std::vector< const MEDCouplingCartesianAMRMeshGen * > > m;
- for(const auto & it : _map_of_dadc)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
- const MEDCouplingCartesianAMRMeshGen *fineMesh(it.first);
+ const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first);
const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather());
m[fatherOfFineMesh].push_back(fineMesh);
}
for(std::map<const MEDCouplingCartesianAMRMeshGen *,std::vector< const MEDCouplingCartesianAMRMeshGen * > >::const_iterator it0=m.begin();it0!=m.end();it0++)
{
- for(auto it1=(*it0).second.begin();it1!=(*it0).second.end();it1++)
+ for(std::vector<const MEDCouplingCartesianAMRMeshGen *>::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++)
{
- mcIdType const patchId((*it0).first->getPatchIdFromChildMesh(*it1));
- std::vector<mcIdType> const neighs((*it0).first->getPatchIdsInTheNeighborhoodOf(patchId,ghostLev));
+ mcIdType patchId((*it0).first->getPatchIdFromChildMesh(*it1));
+ std::vector<mcIdType> neighs((*it0).first->getPatchIdsInTheNeighborhoodOf(patchId,ghostLev));
const MEDCouplingCartesianAMRPatch *pRef((*it0).first->getPatch(patchId));
- for(long const neigh : neighs)
+ for(std::vector<mcIdType>::const_iterator it2=neighs.begin();it2!=neighs.end();it2++)
{
- const MEDCouplingCartesianAMRPatch *pLoc((*it0).first->getPatch(neigh));
+ const MEDCouplingCartesianAMRPatch *pLoc((*it0).first->getPatch(*it2));
ret.push_back(std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *>(pRef,pLoc));
}
}
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone : one or more input pointer is NULL !");
const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
- for(const auto & it : mf)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=mf.begin();it!=mf.end();it++)
{
- const MEDCouplingCartesianAMRMeshGen *fineMesh(it.first);
+ const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first);
const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather());
bool found(false);
- for(auto it0=mc.begin();it0!=mc.end() && !found;it0++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
{
if((*it0).first==fatherOfFineMesh)
{
found=true;
- mcIdType const patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
- const DataArrayDoubleCollection *fineDaCol(it.second);
- auto *fineModified(const_cast<DataArrayDoubleCollection *>(fineDaCol));//fine values in DataArrayDouble will be altered
+ mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
+ const DataArrayDoubleCollection *fineDaCol((*it).second);
+ DataArrayDoubleCollection *fineModified(const_cast<DataArrayDoubleCollection *>(fineDaCol));//fine values in DataArrayDouble will be altered
DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified);
}
}
void MEDCouplingGridCollection::fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector<const DataArrayDouble *>& recurseArrs) const
{
- for(const auto & it : _map_of_dadc)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
- const MEDCouplingCartesianAMRMeshGen *a(it.first);
+ const MEDCouplingCartesianAMRMeshGen *a((*it).first);
if(head==a || head->isObjectInTheProgeny(a))
{
- const DataArrayDoubleCollection *gc(it.second);
+ const DataArrayDoubleCollection *gc((*it).second);
recurseArrs.push_back(gc->getFieldWithName(fieldName));
}
}
MEDCouplingGridCollection::MEDCouplingGridCollection(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames):_map_of_dadc(ms.size())
{
- std::size_t const sz(ms.size());
+ std::size_t sz(ms.size());
for(std::size_t i=0;i<sz;i++)
{
if(!ms[i])
MEDCouplingGridCollection::MEDCouplingGridCollection(const MEDCouplingGridCollection& other, const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf):RefCountObject(other),_map_of_dadc(other._map_of_dadc.size())
{
- std::size_t const sz(other._map_of_dadc.size());
+ std::size_t sz(other._map_of_dadc.size());
for(std::size_t i=0;i<sz;i++)
{
- std::vector<mcIdType> const pos(other._map_of_dadc[i].first->getPositionRelativeTo(oldGf));
+ std::vector<mcIdType> pos(other._map_of_dadc[i].first->getPositionRelativeTo(oldGf));
_map_of_dadc[i].first=newGf->getMeshAtPosition(pos);
const DataArrayDoubleCollection *dac(other._map_of_dadc[i].second);
if(dac)
std::vector<const BigMemoryObject *> MEDCouplingGridCollection::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & it : _map_of_dadc)
- ret.push_back((const DataArrayDoubleCollection *)it.second);
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ ret.push_back((const DataArrayDoubleCollection *)(*it).second);
return ret;
}
void MEDCouplingGridCollection::updateTime() const
{
- for(const auto & it : _map_of_dadc)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
- const MEDCouplingCartesianAMRMeshGen *a(it.first);
+ const MEDCouplingCartesianAMRMeshGen *a((*it).first);
if(a)
updateTimeWith(*a);
- const DataArrayDoubleCollection *b(it.second);
+ const DataArrayDoubleCollection *b((*it).second);
if(b)
updateTimeWith(*b);
}
bool MEDCouplingDataForGodFather::changeGodFather(MEDCouplingCartesianAMRMesh *gf)
{
- bool const ret(_tlc.keepTrackOfNewTL(gf));
+ bool ret(_tlc.keepTrackOfNewTL(gf));
if(ret)
{
_gf=gf;
{
const MEDCouplingCartesianAMRMesh *gf(other._gf);
if(gf)
- _gf=gf->deepCopy(nullptr);
+ _gf=gf->deepCopy(0);
_tlc.keepTrackOfNewTL(_gf);
}
}
MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string, std::vector<std::string> > >& fieldNames, mcIdType ghostLev)
{
- std::size_t const sz(fieldNames.size());
+ std::size_t sz(fieldNames.size());
std::vector< std::pair<std::string,int> > fieldNames2(sz);
std::vector< std::vector<std::string> > compNames(sz);
for(std::size_t i=0;i<sz;i++)
void MEDCouplingAMRAttribute::spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames)
{
_tlc.checkConst();
- for(auto & _lev : _levs)
- _lev->spillInfoOnComponents(compNames);
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
+ (*it)->spillInfoOnComponents(compNames);
}
/*!
void MEDCouplingAMRAttribute::spillNatures(const std::vector<NatureOfField>& nfs)
{
_tlc.checkConst();
- for(auto & _lev : _levs)
- _lev->spillNatures(nfs);
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
+ (*it)->spillNatures(nfs);
}
MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCopy() const
*/
std::vector<DataArrayDouble *> MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
{
- for(const auto & _lev : _levs)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
mcIdType tmp(-1);
- if(_lev->presenceOf(mesh,tmp))
+ if((*it)->presenceOf(mesh,tmp))
{
- const DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp));
+ const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
return ddc.retrieveFields();
}
}
*/
const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
{
- for(const auto & _lev : _levs)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
mcIdType tmp(-1);
- if(_lev->presenceOf(mesh,tmp))
+ if((*it)->presenceOf(mesh,tmp))
{
- const DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp));
+ const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
return ddc.getFieldWithName(fieldName);
}
}
DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName)
{
- for(auto & _lev : _levs)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
{
mcIdType tmp(-1);
- if(_lev->presenceOf(mesh,tmp))
+ if((*it)->presenceOf(mesh,tmp))
{
- DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp));
+ DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
return ddc.getFieldWithName(fieldName);
}
}
{
std::vector<const DataArrayDouble *> recurseArrs;
std::size_t lev(0);
- for(auto it=_levs.begin();it!=_levs.end();it++,lev++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++)
{
mcIdType tmp(-1);
if((*it)->presenceOf(mesh,tmp))
*/
MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
{
- const DataArrayDouble *arr(nullptr);
- for(const auto & _lev : _levs)
+ const DataArrayDouble *arr(0);
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
mcIdType tmp(-1);
- if(_lev->presenceOf(mesh,tmp))
+ if((*it)->presenceOf(mesh,tmp))
{
- const DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp));
+ const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
arr=ddc.getFieldWithName(fieldName);
}
}
*/
MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
{
- const DataArrayDouble *arr(nullptr);
- for(const auto & _lev : _levs)
+ const DataArrayDouble *arr(0);
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
mcIdType tmp(-1);
- if(_lev->presenceOf(mesh,tmp))
+ if((*it)->presenceOf(mesh,tmp))
{
- const DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp));
+ const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
arr=ddc.getFieldWithName(fieldName);
}
}
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost : the mesh specified is not in the progeny of this !");
//
- MCAuto<MEDCouplingIMesh> const im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
+ MCAuto<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
std::vector<mcIdType> cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure());
MCAuto<DataArrayDouble> arr2(DataArrayDouble::New());
arr2->alloc(mesh->getImageMesh()->getNumberOfCells(),arr->getNumberOfComponents());
std::vector< std::pair<mcIdType,mcIdType> > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs));
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev);
- std::vector<mcIdType> const fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1);
+ std::vector<mcIdType> fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1);
MEDCouplingIMesh::SpreadCoarseToFine(arr,cgsWG,arr2,cgs2,fakeFactors);
arr2->copyStringInfoFrom(*arr);
//
const MEDCouplingIMesh *gfm(gf->getImageMesh());
std::vector<double> orig(gfm->getOrigin());
std::vector<double> spacing(gfm->getDXYZ());
- mcIdType const dim(ToIdType(orig.size()));
+ mcIdType dim(ToIdType(orig.size()));
std::copy(orig.begin(),orig.end(),std::ostream_iterator<double>(ofs," ")); ofs << "\" grid_description=\"";
for(mcIdType i=0;i<dim;i++)
{
for(mcIdType i=0;i<maxLev;i++)
{
std::vector<MEDCouplingCartesianAMRPatchGen *> patches(gf->retrieveGridsAt(i));
- std::size_t const sz(patches.size());
+ std::size_t sz(patches.size());
std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> > patchesSafe(sz);
for(std::size_t j=0;j<sz;j++)
patchesSafe[j]=patches[j];
for(std::vector<MEDCouplingCartesianAMRPatchGen *>::const_iterator it=patches.begin();it!=patches.end();it++,jj++,kk++)
{
ofs << " <DataSet index=\"" << jj << "\" amr_box=\"";
- const auto *patchCast(dynamic_cast<const MEDCouplingCartesianAMRPatch *>(*it));
+ const MEDCouplingCartesianAMRPatch *patchCast(dynamic_cast<const MEDCouplingCartesianAMRPatch *>(*it));
const MEDCouplingCartesianAMRMeshGen *mesh((*it)->getMesh());
if(patchCast)
{
{
const DataArrayDoubleCollection& ddc(_levs[i]->getFieldsAt(tmp));
std::vector<DataArrayDouble *> arrs(ddc.retrieveFields());
- std::size_t const nbFields(arrs.size());
+ std::size_t nbFields(arrs.size());
std::vector< MCAuto<DataArrayDouble> > arrsSafe(nbFields),arrs2Safe(nbFields);
std::vector< const MEDCouplingFieldDouble *> fields(nbFields);
std::vector< MCAuto<MEDCouplingFieldDouble> > fieldsSafe(nbFields);
arrsSafe[pp]=arrs[pp];
for(std::size_t pp=0;pp<nbFields;pp++)
{
- MCAuto<MEDCouplingIMesh> const im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
+ MCAuto<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
std::vector<mcIdType> cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure());
arrs2Safe[pp]=DataArrayDouble::New();
arrs2Safe[pp]->alloc(mesh->getImageMesh()->getNumberOfCells(),arrs[pp]->getNumberOfComponents());
std::vector< std::pair<mcIdType,mcIdType> > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs));
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev);
- std::vector<mcIdType> const fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1);
+ std::vector<mcIdType> fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1);
MEDCouplingIMesh::SpreadCoarseToFine(arrs[pp],cgsWG,arrs2Safe[pp],cgs2,fakeFactors);
arrs2Safe[pp]->copyStringInfoFrom(*arrs[pp]);
//
const MEDCouplingGridCollection *lev0(_levs[0]);
if(!lev0)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::projectTo : lev0 is NULL !");
- std::vector< std::pair < std::string, std::vector<std::string> > > const fieldNames(lev0->getInfoOnComponents());
+ std::vector< std::pair < std::string, std::vector<std::string> > > fieldNames(lev0->getInfoOnComponents());
MCAuto<MEDCouplingAMRAttribute> ret(MEDCouplingAMRAttribute::New(targetGF,fieldNames,_ghost_lev));
ret->spillNatures(lev0->getNatures());
ret->alloc();
- mcIdType const nbLevs(getNumberOfLevels());
+ mcIdType nbLevs(getNumberOfLevels());
if(targetGF->getMaxNumberOfLevelsRelativeToThis()!=nbLevs)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::projectTo : number of levels of this and targetGF must be the same !");
// first step copy level0
*/
void MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev)
{
- mcIdType const nbl(getNumberOfLevels());
+ mcIdType nbl(getNumberOfLevels());
if(fromLev<0 || toLev<0 || fromLev>=nbl || toLev>=nbl)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween : fromLev and toLev must be >= 0 and lower than number of levels in this !");
if(fromLev==toLev)
{
if(_levs.empty())
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeCoarseToFine : not any levels in this !");
- std::size_t const sz(_levs.size());
+ std::size_t sz(_levs.size());
//
for(std::size_t i=0;i<sz-1;i++)
synchronizeCoarseToFineByOneLevel(ToIdType(i));
*/
void MEDCouplingAMRAttribute::synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev)
{
- mcIdType const nbl(getNumberOfLevels());
+ mcIdType nbl(getNumberOfLevels());
if(fromLev<0 || toLev<0 || fromLev>=nbl || toLev>=nbl)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeCoarseToFineBetween : fromLev and toLev must be >= 0 and lower than number of levels in this !");
if(fromLev==toLev)
*/
void MEDCouplingAMRAttribute::synchronizeAllGhostZones()
{
- mcIdType const sz(getNumberOfLevels());
+ mcIdType sz(getNumberOfLevels());
if(sz==0)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineEachOther : not any levels in this !");
// 1st - synchronize from coarse to the finest all the patches (excepted the god father one)
curLev->synchronizeFineEachOther(_ghost_lev,_neighbors[i]);
}
// 3rd - mixed level
- for(const auto & _mixed_lev_neighbor : _mixed_lev_neighbors)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=_mixed_lev_neighbors.begin();it!=_mixed_lev_neighbors.end();it++)
{
- const DataArrayDoubleCollection *firstDAC(&findCollectionAttachedTo(_mixed_lev_neighbor.first->getMesh())),*secondDAC(&findCollectionAttachedTo(_mixed_lev_neighbor.second->getMesh()));
- DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(_ghost_lev,_mixed_lev_neighbor.first,firstDAC,_mixed_lev_neighbor.second,secondDAC);
+ const DataArrayDoubleCollection *firstDAC(&findCollectionAttachedTo((*it).first->getMesh())),*secondDAC(&findCollectionAttachedTo((*it).second->getMesh()));
+ DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(_ghost_lev,(*it).first,firstDAC,(*it).second,secondDAC);
}
// 4th - same level but with far ancestor.
for(mcIdType i=1;i<sz;i++)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf : the specified level does not exist ! Must be in [0,nbOfLevelsOfThis-1) !");
const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& itemsToFilter(_neighbors[level+1]);
std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > itemsToSync; itemsToSync.reserve(itemsToFilter.size());
- for(const auto & it : itemsToFilter)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=itemsToFilter.begin();it!=itemsToFilter.end();it++)
{
- if(it.first->getMesh()->getFather()==mesh && it.second->getMesh()->getFather()==mesh)
- itemsToSync.push_back(std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *>(it.first,it.second));
+ if((*it).first->getMesh()->getFather()==mesh && (*it).second->getMesh()->getFather()==mesh)
+ itemsToSync.push_back(std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *>((*it).first,(*it).second));
}
const MEDCouplingGridCollection *curLev(_levs[level+1]);
if(!curLev)
*/
void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level)
{
- mcIdType const maxLev(getNumberOfLevels());
+ mcIdType maxLev(getNumberOfLevels());
if(level<0 || level>=maxLev)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel : the specified level must be in [0,maxLevel) !");
if(level==0)
*/
void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level)
{
- mcIdType const maxLev(getNumberOfLevels());
+ mcIdType maxLev(getNumberOfLevels());
if(level<=0 || level>=maxLev)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather : the specified level must be in (0,maxLevel) !");
const MEDCouplingGridCollection *fine(_levs[level]),*coarse(_levs[level-1]);
void MEDCouplingAMRAttribute::alloc()
{
_tlc.resetState();
- for(auto & _lev : _levs)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
{
- MEDCouplingGridCollection *elt(_lev);
+ MEDCouplingGridCollection *elt(*it);
if(elt)
elt->alloc(_ghost_lev);
else
void MEDCouplingAMRAttribute::dealloc()
{
_tlc.checkConst();
- for(auto & _lev : _levs)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
{
- MEDCouplingGridCollection *elt(_lev);
+ MEDCouplingGridCollection *elt(*it);
if(elt)
elt->dealloc();
else
bool MEDCouplingAMRAttribute::changeGodFather(MEDCouplingCartesianAMRMesh *gf)
{
- bool const ret(MEDCouplingDataForGodFather::changeGodFather(gf));
+ bool ret(MEDCouplingDataForGodFather::changeGodFather(gf));
return ret;
}
std::vector<const BigMemoryObject *> MEDCouplingAMRAttribute::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _lev : _levs)
- ret.push_back((const MEDCouplingGridCollection *)_lev);
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
+ ret.push_back((const MEDCouplingGridCollection *)*it);
return ret;
}
MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, mcIdType ghostLev):MEDCouplingDataForGodFather(gf),_ghost_lev(ghostLev)
{
//gf non empty, checked by constructor
- mcIdType const maxLev(gf->getMaxNumberOfLevelsRelativeToThis());
+ mcIdType maxLev(gf->getMaxNumberOfLevelsRelativeToThis());
_levs.resize(maxLev);
for(mcIdType i=0;i<maxLev;i++)
{
std::vector<MEDCouplingCartesianAMRPatchGen *> patches(gf->retrieveGridsAt(i));
- std::size_t const sz(patches.size());
+ std::size_t sz(patches.size());
std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> > patchesSafe(patches.size());
for(std::size_t j=0;j<sz;j++)
patchesSafe[j]=patches[j];
_cross_lev_neighbors.resize(_levs.size());
if(_levs.empty())
throw INTERP_KERNEL::Exception("constructor of MEDCouplingAMRAttribute : not any levels in this !");
- std::size_t const sz(_levs.size());
+ std::size_t sz(_levs.size());
for(std::size_t i=1;i<sz;i++)
{
const MEDCouplingGridCollection *fine(_levs[i]);
{
MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf(_ghost_lev,(*it).first,(*it).second,_mixed_lev_neighbors);
std::vector< std::vector < std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > > neighs2(MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev(_ghost_lev,(*it).first,(*it).second));
- std::size_t const fullLev(i+neighs2.size());
+ std::size_t fullLev(i+neighs2.size());
if(fullLev>=sz)
throw INTERP_KERNEL::Exception("constructor of MEDCouplingAMRAttribute : internal error ! something is wrong in computation of cross level neighbors !");
std::size_t ii(i+1);
for(std::size_t i=0;i<sz;i++)
{
const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& neigh2(other._neighbors[i]);
- std::size_t const sz2(neigh2.size());
+ std::size_t sz2(neigh2.size());
std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& neigh3(_neighbors[i]);
for(std::size_t j=0;j<sz2;j++)
{
for(std::size_t i=0;i<sz;i++)
{
const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& neigh2(other._cross_lev_neighbors[i]);
- std::size_t const sz2(neigh2.size());
+ std::size_t sz2(neigh2.size());
std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& neigh3(_cross_lev_neighbors[i]);
for(std::size_t j=0;j<sz2;j++)
{
const DataArrayDoubleCollection& MEDCouplingAMRAttribute::findCollectionAttachedTo(const MEDCouplingCartesianAMRMeshGen *m) const
{
- for(const auto & _lev : _levs)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
- const MEDCouplingGridCollection *elt(_lev);
+ const MEDCouplingGridCollection *elt(*it);
if(elt)
{
mcIdType tmp(-1);
void MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel(mcIdType level)
{
- mcIdType const nbl(getNumberOfLevels());
+ mcIdType nbl(getNumberOfLevels());
if(level<=0 || level>=nbl)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel : the input level must be in ]0,nb_of_levels[ !");
const MEDCouplingGridCollection *fine(_levs[level]),*coarse(_levs[level-1]);
void MEDCouplingAMRAttribute::synchronizeCoarseToFineByOneLevel(mcIdType level)
{
- mcIdType const nbl(getNumberOfLevels());
+ mcIdType nbl(getNumberOfLevels());
if(level<0 || level>=nbl-1)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel : the input level must be in [0,nb_of_levels[ !");
const MEDCouplingGridCollection *fine(_levs[level+1]),*coarse(_levs[level]);
#ifndef __MEDCOUPLINGAMRATTRIBUTE_HXX__
#define __MEDCOUPLINGAMRATTRIBUTE_HXX__
-#include "MCType.hxx"
-#include "MCAuto.hxx"
#include "MEDCoupling.hxx"
#include "MEDCouplingNatureOfFieldEnum"
#include "MEDCouplingCartesianAMRMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTimeLabel.hxx"
-#include <vector>
-#include <utility>
-#include <string>
-#include <cstddef>
namespace MEDCoupling
{
private:
DataArrayDoubleCollection(const std::vector< std::pair<std::string,int> >& fieldNames);
DataArrayDoubleCollection(const DataArrayDoubleCollection& other);
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- void updateTime() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ void updateTime() const;
static void CheckDiscriminantNames(const std::vector<std::string>& names);
static bool IsConservativeNature(NatureOfField n);
static void CheckSameNatures(NatureOfField n1, NatureOfField n2);
private:
MEDCouplingGridCollection(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames);
MEDCouplingGridCollection(const MEDCouplingGridCollection& other, const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf);
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- void updateTime() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ void updateTime() const;
private:
std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > > _map_of_dadc;
};
//
MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const;
//
- MEDCOUPLING_EXPORT void synchronizeFineToCoarse() override;
- MEDCOUPLING_EXPORT void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev) override;
- MEDCOUPLING_EXPORT void synchronizeCoarseToFine() override;
- MEDCOUPLING_EXPORT void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev) override;
- MEDCOUPLING_EXPORT void synchronizeAllGhostZones() override;
- MEDCOUPLING_EXPORT void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh) override;
- MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level) override;
- MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level) override;
+ MEDCOUPLING_EXPORT void synchronizeFineToCoarse();
+ MEDCOUPLING_EXPORT void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev);
+ MEDCOUPLING_EXPORT void synchronizeCoarseToFine();
+ MEDCOUPLING_EXPORT void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev);
+ MEDCOUPLING_EXPORT void synchronizeAllGhostZones();
+ MEDCOUPLING_EXPORT void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh);
+ MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level);
+ MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level);
//
- MEDCOUPLING_EXPORT void alloc() override;
- MEDCOUPLING_EXPORT void dealloc() override;
- MEDCOUPLING_EXPORT bool changeGodFather(MEDCouplingCartesianAMRMesh *gf) override;
+ MEDCOUPLING_EXPORT void alloc();
+ MEDCOUPLING_EXPORT void dealloc();
+ MEDCOUPLING_EXPORT bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
//
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT void updateTime() const override;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT void updateTime() const;
private:
MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames, mcIdType ghostLev);
MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& other, bool deepCpyGF);
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingCMesh.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingCurveLinearMesh.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "MEDCouplingStructuredMesh.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include <cstddef>
#include <functional>
#include <algorithm>
-#include <iterator>
-#include <ostream>
#include <sstream>
-#include <string>
-#include <vector>
-#include <utility>
+#include <numeric>
using namespace MEDCoupling;
-MEDCouplingCMesh::MEDCouplingCMesh():_x_array(nullptr),_y_array(nullptr),_z_array(nullptr)
+MEDCouplingCMesh::MEDCouplingCMesh():_x_array(0),_y_array(0),_z_array(0)
{
}
if(other._x_array)
_x_array=other._x_array->deepCopy();
else
- _x_array=nullptr;
+ _x_array=0;
if(other._y_array)
_y_array=other._y_array->deepCopy();
else
- _y_array=nullptr;
+ _y_array=0;
if(other._z_array)
_z_array=other._z_array->deepCopy();
else
- _z_array=nullptr;
+ _z_array=0;
}
else
{
MEDCouplingCMesh *MEDCouplingCMesh::New(const std::string& meshName)
{
- auto *ret(new MEDCouplingCMesh);
+ MEDCouplingCMesh *ret(new MEDCouplingCMesh);
ret->setName(meshName);
return ret;
}
MEDCouplingCurveLinearMesh *MEDCouplingCMesh::buildCurveLinear() const
{
checkConsistencyLight();
- std::size_t const dim(getSpaceDimension());
+ std::size_t dim(getSpaceDimension());
MCAuto<MEDCouplingCurveLinearMesh> ret(MEDCouplingCurveLinearMesh::New());
ret->MEDCouplingStructuredMesh::operator=(*this);
INTERP_KERNEL::AutoPtr<mcIdType> ngs(new mcIdType[dim]);
void MEDCouplingCMesh::copyTinyStringsFrom(const MEDCouplingMesh *other)
{
MEDCouplingStructuredMesh::copyTinyStringsFrom(other);
- const auto *otherC(dynamic_cast<const MEDCouplingCMesh *>(other));
+ const MEDCouplingCMesh *otherC(dynamic_cast<const MEDCouplingCMesh *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::copyTinyStringsFrom : meshes have not same type !");
if(_x_array && otherC->_x_array)
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::isEqualIfNotWhy : input other pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCouplingCMesh *>(other);
+ const MEDCouplingCMesh *otherC=dynamic_cast<const MEDCouplingCMesh *>(other);
if(!otherC)
{
reason="mesh given in input is not castable in MEDCouplingCMesh !";
std::ostringstream oss; oss.precision(15);
for(int i=0;i<3;i++)
{
- if((thisArr[i]!=nullptr && otherArr[i]==nullptr) || (thisArr[i]==nullptr && otherArr[i]!=nullptr))
+ if((thisArr[i]!=0 && otherArr[i]==0) || (thisArr[i]==0 && otherArr[i]!=0))
{
oss << "Only one CMesh between the two this and other has its coordinates of rank" << i << " defined !";
reason=oss.str();
bool MEDCouplingCMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingCMesh *>(other);
+ const MEDCouplingCMesh *otherC=dynamic_cast<const MEDCouplingCMesh *>(other);
if(!otherC)
return false;
const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
const DataArrayDouble *otherArr[3]={otherC->_x_array,otherC->_y_array,otherC->_z_array};
for(int i=0;i<3;i++)
{
- if((thisArr[i]!=nullptr && otherArr[i]==nullptr) || (thisArr[i]==nullptr && otherArr[i]!=nullptr))
+ if((thisArr[i]!=0 && otherArr[i]==0) || (thisArr[i]==0 && otherArr[i]!=0))
return false;
if(thisArr[i])
if(!thisArr[i]->isEqualWithoutConsideringStr(*otherArr[i],prec))
return true;
}
-void MEDCouplingCMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec,
- DataArrayIdType *& /*cellCor*/, DataArrayIdType *& /*nodeCor*/) const
+void MEDCouplingCMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalWith : Meshes are not the same !");
* Nothing is done here (except to check that the other is a MEDCoupling::MEDCouplingCMesh instance too).
* The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingCMesh, \a this and \a other are the same !
*/
-void MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec,
- DataArrayIdType *& /*cellCor*/) const
+void MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayIdType *&cellCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const
{
checkConsistencyLight();
- int const dim(getSpaceDimension());
+ int dim(getSpaceDimension());
if(dim!=ToIdType(cellPart.size()))
{
std::ostringstream oss; oss << "MEDCouplingCMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
void MEDCouplingCMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const
{
mcIdType tmp[3];
- int const spaceDim=getSpaceDimension();
+ int spaceDim=getSpaceDimension();
getSplitNodeValues(tmp);
const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
mcIdType tmp2[3];
ret << "Cartesian mesh with name : \"" << getName() << "\"\n";
ret << "Description of mesh : \"" << getDescription() << "\"\n";
int tmpp1,tmpp2;
- double const tt=getTime(tmpp1,tmpp2);
+ double tt=getTime(tmpp1,tmpp2);
ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Space dimension : " << getSpaceDimension() << "\n\nArrays :\n________\n\n";
void MEDCouplingCMesh::getBoundingBox(double *bbox) const
{
- int const dim=getSpaceDimension();
+ int dim=getSpaceDimension();
int j=0;
for (int idim=0; idim<dim; idim++)
{
if(c)
{
const double *coords=c->getConstPointer();
- mcIdType const nb=ToIdType(c->getNbOfElems());
+ mcIdType nb=ToIdType(c->getNbOfElems());
bbox[2*j]=coords[0];
bbox[2*j+1]=coords[nb-1];
j++;
* and one time . The caller is to delete this field using decrRef() as it is no
* more needed.
*/
-MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool /*isAbs*/) const
+MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool isAbs) const
{
std::string name="MeasureOfMesh_";
name+=getName();
- mcIdType const nbelem=ToIdType(getNumberOfCells());
+ mcIdType nbelem=ToIdType(getNumberOfCells());
MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
field->setName(name);
DataArrayDouble* array=DataArrayDouble::New();
field->synchronizeTimeWithMesh();
mcIdType tmp[3];
getSplitCellValues(tmp);
- int const dim=getSpaceDimension();
- const auto **thisArr=new const double *[dim];
+ int dim=getSpaceDimension();
+ const double **thisArr=new const double *[dim];
const DataArrayDouble *thisArr2[3]={_x_array,_y_array,_z_array};
for(int i=0;i<dim;i++)
thisArr[i]=thisArr2[i]->getConstPointer();
/*!
* not implemented yet !
*/
-MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureFieldOnNode(bool /*isAbs*/) const
+MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureFieldOnNode(bool isAbs) const
{
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getMeasureFieldOnNode : not implemented yet !");
//return 0;
mcIdType MEDCouplingCMesh::getCellContainingPoint(const double *pos, double eps) const
{
- int const dim=getSpaceDimension();
+ int dim=getSpaceDimension();
mcIdType ret=0;
mcIdType coeff=1;
for(int i=0;i<dim;i++)
{
const double *d=getCoordsAt(i)->getConstPointer();
- mcIdType const nbOfNodes=getCoordsAt(i)->getNbOfElems();
- double const ref=pos[i];
+ mcIdType nbOfNodes=getCoordsAt(i)->getNbOfElems();
+ double ref=pos[i];
const double *w=std::find_if(d,d+nbOfNodes,std::bind(std::greater_equal<double>(),std::placeholders::_1,ref));
mcIdType w2=ToIdType(std::distance(d,w));
if(w2<nbOfNodes)
void MEDCouplingCMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
{
- mcIdType const ret(getCellContainingPoint(pos,eps));
+ mcIdType ret(getCellContainingPoint(pos,eps));
elts.push_back(ret);
}
-void MEDCouplingCMesh::rotate(const double * /*center*/, const double * /*vector*/, double /*angle*/)
+void MEDCouplingCMesh::rotate(const double *center, const double *vector, double angle)
{
throw INTERP_KERNEL::Exception("No rotation available on CMesh : Traduce it to untructured mesh to apply it !");
}
if(c)
{
double *coords=c->getPointer();
- mcIdType const lgth=ToIdType(c->getNbOfElems());
+ mcIdType lgth=ToIdType(c->getNbOfElems());
std::transform(coords,coords+lgth,coords,std::bind(std::minus<double>(),std::placeholders::_1,point[i]));
std::transform(coords,coords+lgth,coords,std::bind(std::multiplies<double>(),std::placeholders::_1,factor));
std::transform(coords,coords+lgth,coords,std::bind(std::plus<double>(),std::placeholders::_1,point[i]));
updateTime();
}
-MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh * /*other*/) const
+MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh *other) const
{
//not implemented yet !
- return nullptr;
+ return 0;
}
/*!
DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- int const spaceDim(getSpaceDimension());
- mcIdType const nbNodes(getNumberOfNodes());
+ int spaceDim(getSpaceDimension());
+ mcIdType nbNodes(getNumberOfNodes());
ret->alloc(nbNodes,spaceDim);
double *pt(ret->getPointer());
mcIdType tmp[3];
DataArrayDouble *MEDCouplingCMesh::computeCellCenterOfMass() const
{
DataArrayDouble *ret=DataArrayDouble::New();
- int const spaceDim=getSpaceDimension();
- mcIdType const nbCells=ToIdType(getNumberOfCells());
+ int spaceDim=getSpaceDimension();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
ret->alloc(nbCells,spaceDim);
double *pt=ret->getPointer();
mcIdType tmp[3];
std::vector<double> tabsPtr[3];
for(int j=0;j<spaceDim;j++)
{
- mcIdType const sz=tabs[j]->getNbOfElems()-1;
+ mcIdType sz=tabs[j]->getNbOfElems()-1;
ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0));
const double *srcPtr=tabs[j]->getConstPointer();
tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz);
return MEDCouplingCMesh::computeCellCenterOfMass();
}
-void MEDCouplingCMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*check*/)
+void MEDCouplingCMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for CMesh !");
}
void MEDCouplingCMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
- double const time=getTime(it,order);
+ double time=getTime(it,order);
tinyInfo.clear();
tinyInfoD.clear();
littleStrings.clear();
littleStrings.push_back(getDescription());
littleStrings.push_back(getTimeUnit());
const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
- for(auto & i : thisArr)
+ for(int i=0;i<3;i++)
{
mcIdType val=-1;
std::string st;
- if(i)
+ if(thisArr[i])
{
- val=i->getNumberOfTuples();
- st=i->getInfoOnComponent(0);
+ val=thisArr[i]->getNumberOfTuples();
+ st=thisArr[i]->getInfoOnComponent(0);
}
tinyInfo.push_back(val);
littleStrings.push_back(st);
tinyInfoD.push_back(time);
}
-void MEDCouplingCMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& /*littleStrings*/) const
+void MEDCouplingCMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
a1->alloc(0,1);
mcIdType sum=0;
a1->alloc(0,1);
const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
mcIdType sz=0;
- for(auto & i : thisArr)
+ for(int i=0;i<3;i++)
{
- if(i)
- sz+=i->getNumberOfTuples();
+ if(thisArr[i])
+ sz+=thisArr[i]->getNumberOfTuples();
}
a2=DataArrayDouble::New();
a2->alloc(sz,1);
double *a2Ptr=a2->getPointer();
- for(auto & i : thisArr)
- if(i)
- a2Ptr=std::copy(i->getConstPointer(),i->getConstPointer()+i->getNumberOfTuples(),a2Ptr);
+ for(int i=0;i<3;i++)
+ if(thisArr[i])
+ a2Ptr=std::copy(thisArr[i]->getConstPointer(),thisArr[i]->getConstPointer()+thisArr[i]->getNumberOfTuples(),a2Ptr);
}
-void MEDCouplingCMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType * /*a1*/, DataArrayDouble *a2,
+void MEDCouplingCMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
setName(littleStrings[0]);
{
std::ostringstream extent;
DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
- for(auto & i : thisArr)
+ for(int i=0;i<3;i++)
{
- if(i)
- { extent << "0 " << i->getNumberOfTuples()-1 << " "; }
+ if(thisArr[i])
+ { extent << "0 " << thisArr[i]->getNumberOfTuples()-1 << " "; }
else
{ extent << "0 0 "; }
}
ofs << " <CellData>\n" << cellData << std::endl;
ofs << " </CellData>\n";
ofs << " <Coordinates>\n";
- for(auto & i : thisArr)
+ for(int i=0;i<3;i++)
{
- if(i)
- i->writeVTK(ofs,8,"Array",byteData);
+ if(thisArr[i])
+ thisArr[i]->writeVTK(ofs,8,"Array",byteData);
else
{
MCAuto<DataArrayDouble> coo=DataArrayDouble::New(); coo->alloc(1,1);
mcIdType nbOfCells=1,nbOfNodes=1;
for(int i=0;i<3;i++)
{
- isDef[i]=thisArr[i]!=nullptr;
+ isDef[i]=thisArr[i]!=0;
if(isDef[i])
{
- char const tmp=(char)((int)('X')+i);
+ char tmp=(char)((int)('X')+i);
stream2[i] << tmp << " positions array ";
if(!thisArr[i]->isAllocated())
stream2[i] << "set but not allocated.";
else
{
- std::size_t const nbCompo=thisArr[i]->getNumberOfComponents();
+ std::size_t nbCompo=thisArr[i]->getNumberOfComponents();
if(nbCompo==1)
{
- mcIdType const nbTuples=thisArr[i]->getNumberOfTuples();
+ mcIdType nbTuples=thisArr[i]->getNumberOfTuples();
if(nbTuples<1)
{ stream2[i] << "set and allocated - WARNING number of elements < 1 !"; nbOfCells=-1; nbOfNodes=-1; }
else
#ifndef __PARAMEDMEM_MEDCOUPLINGCMESH_HXX__
#define __PARAMEDMEM_MEDCOUPLINGCMESH_HXX__
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingStructuredMesh.hxx"
-#include <string>
-#include <cstddef>
-#include <vector>
-#include <utility>
-#include <ostream>
namespace MEDCoupling
{
MEDCOUPLING_EXPORT static MEDCouplingCMesh *New();
MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(const std::string& meshName);
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingCMesh"); }
- MEDCOUPLING_EXPORT MEDCouplingCMesh *deepCopy() const override;
- MEDCOUPLING_EXPORT MEDCouplingCMesh *clone(bool recDeepCpy) const override;
- MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override;
+ MEDCOUPLING_EXPORT MEDCouplingCMesh *deepCopy() const;
+ MEDCOUPLING_EXPORT MEDCouplingCMesh *clone(bool recDeepCpy) const;
+ MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const;
MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *buildCurveLinear() const;
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return CARTESIAN; }
- MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return CARTESIAN; }
+ MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor) const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override;
- MEDCOUPLING_EXPORT int getSpaceDimension() const override;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const override;
- MEDCOUPLING_EXPORT std::string simpleRepr() const override;
- MEDCOUPLING_EXPORT std::string advancedRepr() const override;
+ DataArrayIdType *&cellCor) const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
+ MEDCOUPLING_EXPORT int getSpaceDimension() const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT std::string simpleRepr() const;
+ MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT const DataArrayDouble *getCoordsAt(int i) const;
MEDCOUPLING_EXPORT DataArrayDouble *getCoordsAt(int i);
MEDCOUPLING_EXPORT void setCoordsAt(int i, const DataArrayDouble *arr);
MEDCOUPLING_EXPORT void setCoords(const DataArrayDouble *coordsX,
- const DataArrayDouble *coordsY=nullptr,
- const DataArrayDouble *coordsZ=nullptr);
+ const DataArrayDouble *coordsY=0,
+ const DataArrayDouble *coordsZ=0);
// tools
- MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override;
- MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const override;
- MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override;
- MEDCOUPLING_EXPORT void translate(const double *vector) override;
- MEDCOUPLING_EXPORT void scale(const double *point, double factor) override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override;
- MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override;
+ MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
+ MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
+ MEDCOUPLING_EXPORT void translate(const double *vector);
+ MEDCOUPLING_EXPORT void scale(const double *point, double factor);
+ MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
//some useful methods
- MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const override;
- MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeGridStructure() const override;
- MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const override;
+ MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeGridStructure() const;
+ MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const;
//serialisation-unserialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override;
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
- const std::vector<std::string>& littleStrings) override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
- MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override;
+ const std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+ MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
private:
MEDCouplingCMesh();
MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy);
- ~MEDCouplingCMesh() override;
- void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override;
- std::string getVTKDataSetType() const override;
+ ~MEDCouplingCMesh();
+ void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
+ std::string getVTKDataSetType() const;
private:
DataArrayDouble *_x_array;
DataArrayDouble *_y_array;
// Author : Anthony Geay
#include "MEDCouplingCartesianAMRMesh.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "BoxSplittingOptions.hxx"
#include "MEDCouplingAMRAttribute.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingIMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingStructuredMesh.hxx"
#include "MEDCouplingUMesh.hxx"
-#include <algorithm>
-#include <cmath>
-#include <cstddef>
-#include <cstdlib>
-#include <functional>
-#include <iterator>
#include <limits>
-#include <ostream>
#include <sstream>
-#include <utility>
-#include <string>
-#include <vector>
+#include <numeric>
using namespace MEDCoupling;
const MEDCouplingCartesianAMRMeshGen *com(FindCommonAncestor(this,other,lev));//check that factors are OK
if(lev==0)
return isInMyNeighborhood(other,ghostLev);
- std::vector<mcIdType> const offset(ComputeOffsetFromTwoToOne(com,lev,this,other));
+ std::vector<mcIdType> offset(ComputeOffsetFromTwoToOne(com,lev,this,other));
const std::vector< std::pair<mcIdType,mcIdType> >& thisp(getBLTRRange());
std::vector< std::pair<mcIdType,mcIdType> > otherp(other->getBLTRRange());
otherp=MEDCouplingStructuredMesh::TranslateCompactFrmt(otherp,offset);
if(!fath)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF : not valid 2 !");
std::vector<mcIdType> factors(fath->getFactors());
- std::size_t const sz(ret.size());
+ std::size_t sz(ret.size());
for(std::size_t ii=0;ii<sz;ii++)
{
ret[ii].first*=factors[ii];
fath=oldFather->getFather();
while(fath)
{
- mcIdType const pos(fath->getPatchIdFromChildMesh(oldFather));
+ mcIdType pos(fath->getPatchIdFromChildMesh(oldFather));
const MEDCouplingCartesianAMRPatch *p(fath->getPatch(pos));
const std::vector< std::pair<mcIdType,mcIdType> >& tmp(p->getBLTRRange());
const std::vector<mcIdType>& factors2(fath->getFactors());
std::transform(factors.begin(),factors.end(),factors2.begin(),factors.begin(),std::multiplies<mcIdType>());
for(std::size_t ii=0;ii<sz;ii++)
{
- mcIdType const delta(ret[ii].second-ret[ii].first);
+ mcIdType delta(ret[ii].second-ret[ii].first);
ret[ii].first+=tmp[ii].first*factors[ii];
ret[ii].second=ret[ii].first+delta;
}
bool MEDCouplingCartesianAMRPatch::IsInMyNeighborhood(mcIdType ghostLev, const std::vector< std::pair<mcIdType,mcIdType> >& p1, const std::vector< std::pair<mcIdType,mcIdType> >& p2)
{
- std::size_t const thispsize(p1.size());
+ std::size_t thispsize(p1.size());
if(thispsize!=p2.size())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhood : the dimensions must be the same !");
for(std::size_t i=0;i<thispsize;i++)
{
std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > retTmp;
std::vector<const MEDCouplingCartesianAMRPatch *> p1Work2,p2Work2;
- for(auto it1 : p1Work)
+ for(std::vector<const MEDCouplingCartesianAMRPatch *>::const_iterator it1=p1Work.begin();it1!=p1Work.end();it1++)
{
- for(auto it2 : p2Work)
+ for(std::vector<const MEDCouplingCartesianAMRPatch *>::const_iterator it2=p2Work.begin();it2!=p2Work.end();it2++)
{
- if(it1->isInMyNeighborhoodExt(it2,ghostLev>0?1:0))//1 not ghostLev ! It is not a bug ( I hope :) ) ! Because as \a this is a refinement of \a other ghostLev is supposed to be <= factors
- retTmp.push_back(std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *>(it1,it2));
+ if((*it1)->isInMyNeighborhoodExt(*it2,ghostLev>0?1:0))//1 not ghostLev ! It is not a bug ( I hope :) ) ! Because as \a this is a refinement of \a other ghostLev is supposed to be <= factors
+ retTmp.push_back(std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *>(*it1,*it2));
}
- std::vector<const MEDCouplingCartesianAMRPatch *> tmp1(it1->getMesh()->getPatches());
+ std::vector<const MEDCouplingCartesianAMRPatch *> tmp1((*it1)->getMesh()->getPatches());
p1Work2.insert(p1Work2.end(),tmp1.begin(),tmp1.end());
}
- for(auto it2 : p2Work)
+ for(std::vector<const MEDCouplingCartesianAMRPatch *>::const_iterator it2=p2Work.begin();it2!=p2Work.end();it2++)
{
- std::vector<const MEDCouplingCartesianAMRPatch *> tmp2(it2->getMesh()->getPatches());
+ std::vector<const MEDCouplingCartesianAMRPatch *> tmp2((*it2)->getMesh()->getPatches());
p2Work2.insert(p2Work2.end(),tmp2.begin(),tmp2.end());
}
ret.push_back(retTmp);
while(!p1Work.empty())
{
std::vector<const MEDCouplingCartesianAMRPatch *> p1Work2;
- for(auto it0 : p1Work)
+ for(std::vector<const MEDCouplingCartesianAMRPatch *>::const_iterator it0=p1Work.begin();it0!=p1Work.end();it0++)
{
- if(it0->isInMyNeighborhoodDiffLev(p2,ghostLev))
- ret.push_back(std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *>(it0,p2));
- std::vector<const MEDCouplingCartesianAMRPatch *> tmp2(it0->getMesh()->getPatches());
+ if((*it0)->isInMyNeighborhoodDiffLev(p2,ghostLev))
+ ret.push_back(std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *>(*it0,p2));
+ std::vector<const MEDCouplingCartesianAMRPatch *> tmp2((*it0)->getMesh()->getPatches());
p1Work2.insert(p1Work2.end(),tmp2.begin(),tmp2.end());
}
p1Work=p1Work2;
std::vector< std::pair<mcIdType,mcIdType> > p2BLTR(p2->getBLTRRange());//p2BLTR=[(0,1),(0,5)]
mcIdType lev(0);
const MEDCouplingCartesianAMRMeshGen *ca(FindCommonAncestor(p1,p2,lev));
- std::vector<mcIdType> const offset(ComputeOffsetFromTwoToOne(ca,lev,p1,p2));//[12,4]
+ std::vector<mcIdType> offset(ComputeOffsetFromTwoToOne(ca,lev,p1,p2));//[12,4]
p2BLTR=MEDCouplingStructuredMesh::TranslateCompactFrmt(p2BLTR,offset);//p2BLTR=[(12,13),(4,9)]
UpdateNeighborsOfOneWithTwoInternal(ghostLev,p1->getMesh()->getFather()->getFactors(),p1BLTR,p2BLTR,dataOnP1,dataOnP2);
}
std::vector<mcIdType> dimsP2NotRefined(p2->computeCellGridSt());
std::vector<mcIdType> dimsP2Refined(dimsP2NotRefined);
std::transform(dimsP2NotRefined.begin(),dimsP2NotRefined.end(),factors.begin(),dimsP2Refined.begin(),std::multiplies<mcIdType>());
- std::vector< std::pair<mcIdType,mcIdType> > const p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined));
+ std::vector< std::pair<mcIdType,mcIdType> > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined));
std::vector<mcIdType> dimsP2RefinedGhost(dimsP2Refined.size());
std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind(std::plus<mcIdType>(),std::placeholders::_1,2*ghostLev));
MCAuto<DataArrayDouble> fineP2(DataArrayDouble::New()); fineP2->alloc(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(dimsP2RefinedGhost),dataOnP2->getNumberOfComponents());
MEDCouplingIMesh::SpreadCoarseToFineGhost(dataOnP2,dimsP2NotRefined,fineP2,p2RefinedAbs,factors,ghostLev);
if(isConservative)
{
- mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(factors));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(factors));
std::transform(fineP2->begin(),fineP2->end(),fineP2->getPointer(),std::bind(std::multiplies<double>(),std::placeholders::_1,1./((double)fact)));
}
//
* This method has 3 outputs. 2 two first are the resp the position of \a p1 and \a p2 relative to \a p1. And \a factToApplyOn2 is the coeff of refinement to be applied on \a p2 to be virtually
* on the same level as \a p1.
*/
-void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType /*ghostLev*/, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<mcIdType,mcIdType> >& p1Zone, std::vector< std::pair<mcIdType,mcIdType> >& p2Zone, std::vector<mcIdType>& factToApplyOn2)
+void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<mcIdType,mcIdType> >& p1Zone, std::vector< std::pair<mcIdType,mcIdType> >& p2Zone, std::vector<mcIdType>& factToApplyOn2)
{
std::vector<const MEDCouplingCartesianAMRMeshGen *> ancestorsOfThis;
- const MEDCouplingCartesianAMRMeshGen *work(p1->getMesh()),*work2(nullptr);
+ const MEDCouplingCartesianAMRMeshGen *work(p1->getMesh()),*work2(0);
ancestorsOfThis.push_back(work);
while(work)
{
if(work)
{
levOther++;
- auto const it(std::find(ancestorsOfThis.begin(),ancestorsOfThis.end(),work));
+ std::vector<const MEDCouplingCartesianAMRMeshGen *>::iterator it(std::find(ancestorsOfThis.begin(),ancestorsOfThis.end(),work));
if(it!=ancestorsOfThis.end())
{
levThis=std::distance(ancestorsOfThis.begin(),it);
const MEDCouplingCartesianAMRMeshGen *comAncestor(ancestorsOfThis[levThis]);
mcIdType idThis(comAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-1])),idOther(comAncestor->getPatchIdFromChildMesh(work2));
const MEDCouplingCartesianAMRPatch *thisp(comAncestor->getPatch(idThis)),*otherp(comAncestor->getPatch(idOther));
- std::vector<mcIdType> const offset(ComputeOffsetFromTwoToOne(comAncestor,ToIdType(levOther),thisp,otherp));
+ std::vector<mcIdType> offset(ComputeOffsetFromTwoToOne(comAncestor,ToIdType(levOther),thisp,otherp));
p1Zone=thisp->getBLTRRange(); p2Zone=MEDCouplingStructuredMesh::TranslateCompactFrmt(otherp->getBLTRRange(),offset);
factToApplyOn2.resize(p1Zone.size()); std::fill(factToApplyOn2.begin(),factToApplyOn2.end(),1);
//
- std::size_t const nbOfTurn(levThis-levOther);
+ std::size_t nbOfTurn(levThis-levOther);
for(std::size_t i=0;i<nbOfTurn;i++)
{
std::vector< std::pair<mcIdType,mcIdType> > tmp0;
curAncestor=ancestorsOfThis[levThis-1-i];
const std::vector<mcIdType>& factors(curAncestor->getFactors());
std::transform(factToApplyOn2.begin(),factToApplyOn2.end(),factors.begin(),factToApplyOn2.begin(),std::multiplies<mcIdType>());
- mcIdType const tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i]));
+ mcIdType tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i]));
p1Zone=curAncestor->getPatch(tmpId)->getBLTRRange();
}
}
{
const MEDCouplingCartesianAMRMeshGen *f1(p1->_mesh),*f2(p2->_mesh);
lev=0;
- while(f1!=f2 || f1==nullptr || f2==nullptr)
+ while(f1!=f2 || f1==0 || f2==0)
{
f1=f1->getFather(); f2=f2->getFather();
if(f1->getFactors()!=f2->getFactors())
return f1;
}
-std::vector<mcIdType> MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen * /*comAncestor*/, mcIdType lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2)
+std::vector<mcIdType> MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, mcIdType lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2)
{
if(lev<=0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne : this method is useful only for lev > 0 !");
- mcIdType const zeLev(lev-1);
- mcIdType const dim(p1->getMesh()->getSpaceDimension());
+ mcIdType zeLev(lev-1);
+ mcIdType dim(p1->getMesh()->getSpaceDimension());
if(p2->getMesh()->getSpaceDimension()!=dim)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne : dimension must be the same !");
std::vector< mcIdType > ret(dim,0);
for(mcIdType i=0;i<zeLev;i++)
{
const MEDCouplingCartesianAMRMeshGen *f1(p1->_mesh),*f2(p2->_mesh);
- const MEDCouplingCartesianAMRPatch *p1h(nullptr),*p2h(nullptr);
+ const MEDCouplingCartesianAMRPatch *p1h(0),*p2h(0);
for(mcIdType j=0;j<lev-i;j++)
{
const MEDCouplingCartesianAMRMeshGen *f1tmp(f1->getFather()),*f2tmp(f2->getFather());
void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoInternal(mcIdType ghostLev, const std::vector<mcIdType>& factors, const std::vector< std::pair<mcIdType,mcIdType> >&p1 ,const std::vector< std::pair<mcIdType,mcIdType> >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2)
{//p1=[(1,4),(2,4)] p2=[(4,5),(3,4)]
- mcIdType const dim(ToIdType(factors.size()));
+ mcIdType dim(ToIdType(factors.size()));
std::vector<mcIdType> dimsCoarse(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(p1));//[3,2]
std::transform(dimsCoarse.begin(),dimsCoarse.end(),factors.begin(),dimsCoarse.begin(),std::multiplies<mcIdType>());//[12,8]
std::transform(dimsCoarse.begin(),dimsCoarse.end(),dimsCoarse.begin(),std::bind(std::plus<mcIdType>(),std::placeholders::_1,2*ghostLev));//[14,10]
- std::vector< std::pair<mcIdType,mcIdType> > const rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)]
- std::vector<mcIdType> const fakeFactors(dim,1);
+ std::vector< std::pair<mcIdType,mcIdType> > rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)]
+ std::vector<mcIdType> fakeFactors(dim,1);
//
std::vector< std::pair<mcIdType,mcIdType> > tmp0,tmp1,tmp2;
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(p1,p2,tmp0,false);//tmp0=[(3,4),(1,2)]
ApplyFactorsOnCompactFrmt(tmp0,factors);//tmp0=[(12,16),(4,8)]
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(tmp0,ghostLev);//tmp0=[(13,17),(5,9)]
- std::vector< std::pair<mcIdType,mcIdType> > const interstRange(MEDCouplingStructuredMesh::IntersectRanges(tmp0,rangeCoarse));//interstRange=[(13,14),(5,9)]
+ std::vector< std::pair<mcIdType,mcIdType> > interstRange(MEDCouplingStructuredMesh::IntersectRanges(tmp0,rangeCoarse));//interstRange=[(13,14),(5,9)]
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(p2,p1,tmp1,false);//tmp1=[(-3,0),(-1,1)]
ApplyFactorsOnCompactFrmt(tmp1,factors);//tmp1=[(-12,-4),(-4,0)]
MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(tmp1,interstRange,tmp2,false);//tmp2=[(1,2),(1,5)]
*/
void MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt(std::vector< std::pair<mcIdType,mcIdType> >& partBeforeFact, const std::vector<mcIdType>& factors)
{
- std::size_t const sz(factors.size());
+ std::size_t sz(factors.size());
if(sz!=partBeforeFact.size())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt : size of input vectors must be the same !");
for(std::size_t i=0;i<sz;i++)
{
if(ghostSize<0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ApplyAllGhostOnCompactFrmt : ghost size must be >= 0 !");
- std::size_t const sz(partBeforeFact.size());
+ std::size_t sz(partBeforeFact.size());
for(std::size_t i=0;i<sz;i++)
{
partBeforeFact[i].first-=ghostSize;
mcIdType MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const
{
mcIdType ret(1);
- for(const auto & _patche : _patches)
- ret=std::max(ret,_patche->getMaxNumberOfLevelsRelativeToThis()+1);
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ ret=std::max(ret,(*it)->getMaxNumberOfLevelsRelativeToThis()+1);
return ret;
}
mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const
{
mcIdType ret=_mesh->getNumberOfCells();
- for(const auto & _patche : _patches)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
- ret+=_patche->getNumberOfCellsRecursiveWithOverlap();
+ ret+=(*it)->getNumberOfCellsRecursiveWithOverlap();
}
return ret;
}
mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const
{
mcIdType ret=_mesh->getNumberOfCells();
- for(const auto & _patche : _patches)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
- ret-=_patche->getNumberOfOverlapedCellsForFather();
- ret+=_patche->getNumberOfCellsRecursiveWithoutOverlap();
+ ret-=(*it)->getNumberOfOverlapedCellsForFather();
+ ret+=(*it)->getNumberOfCellsRecursiveWithoutOverlap();
}
return ret;
}
*/
const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatchAtPosition(const std::vector<mcIdType>& pos) const
{
- std::size_t const sz(pos.size());
+ std::size_t sz(pos.size());
if(sz==0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : empty input -> no patch by definition !");
- mcIdType const patchId(pos[0]);
+ mcIdType patchId(pos[0]);
const MEDCouplingCartesianAMRPatch *elt(getPatch(patchId));
if(sz==1)
return elt;
if(!elt || !elt->getMesh())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !");
- std::vector<mcIdType> const pos2(pos.begin()+1,pos.end());
+ std::vector<mcIdType> pos2(pos.begin()+1,pos.end());
return elt->getMesh()->getPatchAtPosition(pos2);
}
const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtPosition(const std::vector<mcIdType>& pos) const
{
- std::size_t const sz(pos.size());
+ std::size_t sz(pos.size());
if(sz==0)
return this;
- mcIdType const patchId(pos[0]);
+ mcIdType patchId(pos[0]);
const MEDCouplingCartesianAMRPatch *elt(getPatch(patchId));
if(sz==1)
{
}
if(!elt || !elt->getMesh())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !");
- std::vector<mcIdType> const pos2(pos.begin()+1,pos.end());
+ std::vector<mcIdType> pos2(pos.begin()+1,pos.end());
return elt->getMesh()->getMeshAtPosition(pos2);
}
MCAuto<MEDCouplingIMesh> mesh(static_cast<MEDCouplingIMesh *>(_mesh->buildStructuredSubPart(bottomLeftTopRight)));
mesh->refineWithFactor(factors);
MCAuto<MEDCouplingCartesianAMRMeshSub> zeMesh(new MEDCouplingCartesianAMRMeshSub(this,mesh));
- MCAuto<MEDCouplingCartesianAMRPatch> const elt(new MEDCouplingCartesianAMRPatch(zeMesh,bottomLeftTopRight));
+ MCAuto<MEDCouplingCartesianAMRPatch> elt(new MEDCouplingCartesianAMRPatch(zeMesh,bottomLeftTopRight));
_patches.push_back(elt);
declareAsNew();
}
class InternalPatch : public RefCountObjectOnly
{
public:
- InternalPatch() = default;
+ InternalPatch():_nb_of_true(0) { }
mcIdType getDimension() const { return ToIdType(_part.size()); }
double getEfficiency() const { return (double)_nb_of_true/(double)_crit.size(); }
mcIdType getNumberOfCells() const { return ToIdType(_crit.size()); }
MCAuto<InternalPatch> extractPart(const std::vector< std::pair<mcIdType,mcIdType> >&partInGlobal) const;
MCAuto<InternalPatch> deepCopy() const;
protected:
- ~InternalPatch() override = default;
+ ~InternalPatch() { }
private:
- mutable mcIdType _nb_of_true{0};
+ mutable mcIdType _nb_of_true;
std::vector<bool> _crit;
//! _part is global
std::vector< std::pair<mcIdType,mcIdType> > _part;
void InternalPatch::zipToFitOnCriterion(mcIdType minPatchLgth)
{
- std::vector<mcIdType> const cgs(computeCGS());
+ std::vector<mcIdType> cgs(computeCGS());
std::vector<bool> newCrit;
std::vector< std::pair<mcIdType,mcIdType> > newPart,newPart2;
- mcIdType const newNbOfTrue(MEDCouplingStructuredMesh::FindMinimalPartOf(minPatchLgth,cgs,_crit,newCrit,newPart));
+ mcIdType newNbOfTrue(MEDCouplingStructuredMesh::FindMinimalPartOf(minPatchLgth,cgs,_crit,newCrit,newPart));
MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(_part,newPart,newPart2);
if(newNbOfTrue!=_nb_of_true)
throw INTERP_KERNEL::Exception("InternalPatch::zipToFitOnCrit : internal error !");
MCAuto<InternalPatch> InternalPatch::extractPart(const std::vector< std::pair<mcIdType,mcIdType> >&partInGlobal) const
{
MCAuto<InternalPatch> ret(new InternalPatch);
- std::vector<mcIdType> const cgs(computeCGS());
+ std::vector<mcIdType> cgs(computeCGS());
std::vector< std::pair<mcIdType,mcIdType> > newPart;
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(_part,partInGlobal,newPart);
MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(cgs,_crit,newPart,ret->getCriterion());
void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType largestLength, mcIdType& cutPlace)
{
- mcIdType const minimumPatchLength(bso.getMinimumPatchLength());
+ mcIdType minimumPatchLength(bso.getMinimumPatchLength());
std::vector<double> ratio(largestLength-minimumPatchLength,std::numeric_limits<double>::max());
mcIdType index_min = -1;
double minSemiEfficiencyRatio(std::numeric_limits<double>::max());
bool FindHole(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType& cutPlace)
{
cutPlace=-1;
- mcIdType const minimumPatchLength(bso.getMinimumPatchLength());
+ mcIdType minimumPatchLength(bso.getMinimumPatchLength());
const mcIdType dim(patchToBeSplit->getDimension());
std::vector< std::vector<mcIdType> > signatures(patchToBeSplit->computeSignature());
for(mcIdType id=0;id<dim;id++)
{
const std::vector<mcIdType>& signature(signatures[id]);
std::vector<mcIdType> hole;
- std::vector<double> const distance;
- mcIdType const len(ToIdType(signature.size()));
+ std::vector<double> distance;
+ mcIdType len(ToIdType(signature.size()));
for(mcIdType i=minimumPatchLength-1;i<len-minimumPatchLength;i++)
if(signature[i]==0)
hole.push_back(i);
mcIdType closestHoleToMiddle(hole[0]);
mcIdType oldDistanceToMiddle(std::abs(hole[0]-len/2));
mcIdType newDistanceToMiddle(oldDistanceToMiddle);
- for(long const i : hole)
+ for(std::size_t i=0;i<hole.size();i++)
{
- newDistanceToMiddle=std::abs(i-len/2);
+ newDistanceToMiddle=std::abs(hole[i]-len/2);
if(newDistanceToMiddle < oldDistanceToMiddle)
{
oldDistanceToMiddle = newDistanceToMiddle;
- closestHoleToMiddle = i;
+ closestHoleToMiddle = hole[i];
}
}
cutPlace=closestHoleToMiddle+patchToBeSplit->getConstPart()[axisId].first;
}
if ( zero_cross.size() > 0 )
{
- mcIdType const max_cross=*max_element(edge.begin(),edge.end()) ;
+ mcIdType max_cross=*max_element(edge.begin(),edge.end()) ;
for (std::size_t i=0;i<edge.size();i++)
if (edge[i]==max_cross)
max_cross_list.push_back(zero_cross[i]+1) ;
- double const center(static_cast<double>(signature.size())/2.0);
- for (long const i : max_cross_list)
- distance.push_back(fabs(FromIdType<double>(i)+1-center));
+ double center(static_cast<double>(signature.size())/2.0);
+ for (std::size_t i=0;i<max_cross_list.size();i++)
+ distance.push_back(fabs(FromIdType<double>(max_cross_list[i])+1-center));
- double const distance_min=*min_element(distance.begin(),distance.end()) ;
- mcIdType const pos_distance_min=ToIdType(find(distance.begin(),distance.end(),distance_min)-distance.begin());
- mcIdType const best_place = max_cross_list[pos_distance_min] + part[id].first ;
+ double distance_min=*min_element(distance.begin(),distance.end()) ;
+ mcIdType pos_distance_min=ToIdType(find(distance.begin(),distance.end(),distance_min)-distance.begin());
+ mcIdType best_place = max_cross_list[pos_distance_min] + part[id].first ;
if ( max_cross >=0 )
{
zeroCrossDims[id] = best_place ;
if (zeroCrossVals[0]==max_cross_dims && zeroCrossVals[1]==max_cross_dims )
{
- mcIdType const nl_left(part[0].second-part[0].first);
- mcIdType const nc_left(part[1].second-part[1].first);
+ mcIdType nl_left(part[0].second-part[0].first);
+ mcIdType nc_left(part[1].second-part[1].first);
if ( nl_left >= nc_left )
max_cross_dims = 0 ;
else
void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, mcIdType cutPlace, std::vector<MCAuto<InternalPatch> >& listOfPatches)
{
MCAuto<InternalPatch> leftPart,rightPart;
- std::vector< std::pair<mcIdType,mcIdType> > const rect(patchToBeSplit->getConstPart());
+ std::vector< std::pair<mcIdType,mcIdType> > rect(patchToBeSplit->getConstPart());
std::vector< std::pair<mcIdType,mcIdType> > leftRect(rect),rightRect(rect);
leftRect[axisId].second=cutPlace+1;
rightRect[axisId].first=cutPlace+1;
*/
void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector<bool>& criterion, const std::vector<mcIdType>& factors)
{
- mcIdType const nbCells(getNumberOfCellsAtCurrentLevel());
+ mcIdType nbCells(getNumberOfCellsAtCurrentLevel());
if(nbCells!=ToIdType(criterion.size()))
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : the number of tuples of criterion array must be equal to the number of cells at the current level !");
_patches.clear();
- std::vector<mcIdType> const cgs(_mesh->getCellGridStructure());
+ std::vector<mcIdType> cgs(_mesh->getCellGridStructure());
std::vector< MCAuto<InternalPatch> > listOfPatches,listOfPatchesOK;
//
MCAuto<InternalPatch> p(new InternalPatch);
while(!listOfPatches.empty())
{
std::vector< MCAuto<InternalPatch> > listOfPatchesTmp;
- for(auto & listOfPatche : listOfPatches)
+ for(std::vector< MCAuto<InternalPatch> >::iterator it=listOfPatches.begin();it!=listOfPatches.end();it++)
{
//
int axisId;
mcIdType largestLength,cutPlace;
- MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt(listOfPatche->getConstPart(),axisId,largestLength);
- if(listOfPatche->getEfficiency()>=bso.getEfficiencyThreshold() && (listOfPatche->getNumberOfCells()>bso.getMaximumNbOfCellsInPatch() || largestLength>bso.getMaximumPatchLength()))
+ MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt((*it)->getConstPart(),axisId,largestLength);
+ if((*it)->getEfficiency()>=bso.getEfficiencyThreshold() && ((*it)->getNumberOfCells()>bso.getMaximumNbOfCellsInPatch() || largestLength>bso.getMaximumPatchLength()))
{
- DissectBigPatch(bso,listOfPatche,axisId,largestLength,cutPlace);
- DealWithCut(bso.getMinimumPatchLength(),listOfPatche,axisId,cutPlace,listOfPatchesTmp);
+ DissectBigPatch(bso,*it,axisId,largestLength,cutPlace);
+ DealWithCut(bso.getMinimumPatchLength(),*it,axisId,cutPlace,listOfPatchesTmp);
continue;
}//action 1
- if(FindHole(bso,listOfPatche,axisId,cutPlace))//axisId overwritten here if FindHole equal to true !
- { DealWithCut(bso.getMinimumPatchLength(),listOfPatche,axisId,cutPlace,listOfPatchesTmp); continue; }//action 2
- if(FindInflection(bso,listOfPatche,cutPlace,axisId))//axisId overwritten here if cutFound equal to true !
- { DealWithCut(bso.getMinimumPatchLength(),listOfPatche,axisId,cutPlace,listOfPatchesTmp); continue; }//action 3
- if(TryAction4(bso,listOfPatche,axisId,largestLength,cutPlace))
- { DealWithCut(bso.getMinimumPatchLength(),listOfPatche,axisId,cutPlace,listOfPatchesTmp); continue; }//action 4
+ if(FindHole(bso,*it,axisId,cutPlace))//axisId overwritten here if FindHole equal to true !
+ { DealWithCut(bso.getMinimumPatchLength(),*it,axisId,cutPlace,listOfPatchesTmp); continue; }//action 2
+ if(FindInflection(bso,*it,cutPlace,axisId))//axisId overwritten here if cutFound equal to true !
+ { DealWithCut(bso.getMinimumPatchLength(),*it,axisId,cutPlace,listOfPatchesTmp); continue; }//action 3
+ if(TryAction4(bso,*it,axisId,largestLength,cutPlace))
+ { DealWithCut(bso.getMinimumPatchLength(),*it,axisId,cutPlace,listOfPatchesTmp); continue; }//action 4
else
- listOfPatchesOK.push_back(DealWithNoCut(listOfPatche));
+ listOfPatchesOK.push_back(DealWithNoCut(*it));
}
listOfPatches=listOfPatchesTmp;
}
- for(const auto & it : listOfPatchesOK)
- addPatch(it->getConstPart(),factors);
+ for(std::vector< MCAuto<InternalPatch> >::const_iterator it=listOfPatchesOK.begin();it!=listOfPatchesOK.end();it++)
+ addPatch((*it)->getConstPart(),factors);
declareAsNew();
}
{
if(!criterion || !criterion->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : the criterion DataArrayByte instance must be allocated and not NULL !");
- std::vector<bool> const crit(criterion->toVectorOfBool());//check that criterion has one component.
+ std::vector<bool> crit(criterion->toVectorOfBool());//check that criterion has one component.
createPatchesFromCriterion(bso,crit,factors);
declareAsNew();
}
{
if(!criterion)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : null criterion pointer !");
- std::vector<bool> const inp(criterion->toVectorOfBool(eps));
+ std::vector<bool> inp(criterion->toVectorOfBool(eps));
createPatchesFromCriterion(bso,inp,factors);
}
mcIdType MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const
{
mcIdType ret(0);
- for(auto it=_patches.begin();it!=_patches.end();it++,ret++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ret++)
{
if((*it)->getMesh()==mesh)
return ret;
std::vector< const MEDCouplingCartesianAMRPatch *> MEDCouplingCartesianAMRMeshGen::getPatches() const
{
- std::size_t const sz(_patches.size());
+ std::size_t sz(_patches.size());
std::vector< const MEDCouplingCartesianAMRPatch *> ret(sz);
for(std::size_t i=0;i<sz;i++)
ret[i]=_patches[i];
MEDCouplingIMesh::SpreadCoarseToFine(cellFieldOnThis,_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors());
if(isConservative)
{
- mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind(std::multiplies<double>(),std::placeholders::_1,1./((double)fact)));
}
}
MEDCouplingIMesh::SpreadCoarseToFineGhost(cellFieldOnThis,_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),ghostLev);
if(isConservative)
{
- mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind(std::multiplies<double>(),std::placeholders::_1,1./((double)fact)));
}
}
*/
void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches, bool isConservative) const
{
- mcIdType const nbp(getNumberOfPatches());
+ mcIdType nbp(getNumberOfPatches());
if(nbp!=ToIdType(arrsOnPatches.size()))
{
std::ostringstream oss; oss << "MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchGhostAdv : there are " << nbp << " patches in this and " << arrsOnPatches.size() << " arrays in the last parameter !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- auto *theFieldToFill(const_cast<DataArrayDouble *>(arrsOnPatches[patchId]));
+ DataArrayDouble *theFieldToFill(const_cast<DataArrayDouble *>(arrsOnPatches[patchId]));
// first, do as usual
fillCellFieldOnPatchGhost(patchId,cellFieldOnThis,theFieldToFill,ghostLev,isConservative);
fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches);
*/
void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, const std::vector<const DataArrayDouble *>& arrsOnPatches) const
{
- mcIdType const nbp(getNumberOfPatches());
+ mcIdType nbp(getNumberOfPatches());
if(nbp!=ToIdType(arrsOnPatches.size()))
{
std::ostringstream oss; oss << "MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchOnlyGhostAdv : there are " << nbp << " patches in this and " << arrsOnPatches.size() << " arrays in the last parameter !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const MEDCouplingCartesianAMRPatch *refP(getPatch(patchId));
- auto *theFieldToFill(const_cast<DataArrayDouble *>(arrsOnPatches[patchId]));
- std::vector<mcIdType> const ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev));
- for(long const id : ids)
+ DataArrayDouble *theFieldToFill(const_cast<DataArrayDouble *>(arrsOnPatches[patchId]));
+ std::vector<mcIdType> ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev));
+ for(std::vector<mcIdType>::const_iterator it=ids.begin();it!=ids.end();it++)
{
- const MEDCouplingCartesianAMRPatch *otherP(getPatch(id));
- MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(ghostLev,_factors,refP,otherP,theFieldToFill,arrsOnPatches[id]);
+ const MEDCouplingCartesianAMRPatch *otherP(getPatch(*it));
+ MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(ghostLev,_factors,refP,otherP,theFieldToFill,arrsOnPatches[*it]);
}
}
MEDCouplingIMesh::CondenseFineToCoarse(_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),cellFieldOnThis);
if(!isConservative)
{
- mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
MEDCouplingStructuredMesh::MultiplyPartOf(_mesh->getCellGridStructure(),patch->getBLTRRange(),1./((double)fact),cellFieldOnThis);
}
}
MEDCouplingIMesh::CondenseFineToCoarseGhost(_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),cellFieldOnThis,ghostLev);
if(!isConservative)
{
- mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
+ mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors()));
MEDCouplingStructuredMesh::MultiplyPartOfByGhost(_mesh->getCellGridStructure(),patch->getBLTRRange(),ghostLev,1./((double)fact),cellFieldOnThis);
}
}
*/
DataArrayIdType *MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const
{
- mcIdType const nbp(getNumberOfPatches());
+ mcIdType nbp(getNumberOfPatches());
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
for(mcIdType i=0;i<nbp;i++)
{
{
MCAuto<MEDCouplingUMesh> part(_mesh->buildUnstructured());
std::vector<bool> bs(_mesh->getNumberOfCells(),false);
- std::vector<mcIdType> const cgs(_mesh->getCellGridStructure());
+ std::vector<mcIdType> cgs(_mesh->getCellGridStructure());
std::vector< MCAuto<MEDCouplingUMesh> > msSafe(_patches.size()+1);
std::size_t ii(0);
- for(auto it=_patches.begin();it!=_patches.end();it++,ii++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++)
{
MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs);
msSafe[ii+1]=(*it)->getMesh()->buildUnstructured();
{
std::vector<const MEDCoupling1SGTUMesh *> cells;
std::vector< MCAuto<MEDCoupling1SGTUMesh> > cellsSafe;
- for(const auto & _patche : _patches)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
- const MEDCouplingCartesianAMRPatch *patch(_patche);
+ const MEDCouplingCartesianAMRPatch *patch(*it);
if(patch)
{
- MCAuto<MEDCouplingIMesh> const cell(patch->getMesh()->getImageMesh()->asSingleCell());
+ MCAuto<MEDCouplingIMesh> cell(patch->getMesh()->getImageMesh()->asSingleCell());
MCAuto<MEDCoupling1SGTUMesh> cell1SGT(cell->build1SGTUnstructured());
cellsSafe.push_back(cell1SGT); cells.push_back(cell1SGT);
}
{
std::vector<const MEDCoupling1SGTUMesh *> patches;
std::vector< MCAuto<MEDCoupling1SGTUMesh> > patchesSafe;
- for(const auto & _patche : _patches)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
- const MEDCouplingCartesianAMRPatch *patch(_patche);
+ const MEDCouplingCartesianAMRPatch *patch(*it);
if(patch)
{
MCAuto<MEDCoupling1SGTUMesh> patchMesh(patch->getMesh()->getImageMesh()->build1SGTUnstructured());
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost : array is empty ! Should never happen !");
//
std::vector<bool> bs(_mesh->getNumberOfCells(),false);
- std::vector<mcIdType> const cgs(_mesh->getCellGridStructure());
+ std::vector<mcIdType> cgs(_mesh->getCellGridStructure());
std::vector< MCAuto<MEDCouplingFieldDouble> > msSafe(_patches.size()+1);
std::size_t ii(0);
- for(auto it=_patches.begin();it!=_patches.end();it++,ii++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++)
{
MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs);
- std::vector<const DataArrayDouble *> const tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs));
+ std::vector<const DataArrayDouble *> tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs));
msSafe[ii+1]=(*it)->getMesh()->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,tmpArrs);
}
MCAuto<DataArrayIdType> eltsOff(DataArrayIdType::BuildListOfSwitchedOff(bs));
std::vector<mcIdType> MEDCouplingCartesianAMRMeshGen::getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const
{
std::vector<mcIdType> ret;
- mcIdType const nbp(getNumberOfPatches());
+ mcIdType nbp(getNumberOfPatches());
//
for(mcIdType i=0;i<nbp;i++)
{
const MEDCouplingIMesh *mesh(other._mesh);
if(mesh)
_mesh=static_cast<MEDCouplingIMesh *>(mesh->deepCopy());
- std::size_t const sz(other._patches.size());
+ std::size_t sz(other._patches.size());
for(std::size_t i=0;i<sz;i++)
{
const MEDCouplingCartesianAMRPatch *patch(other._patches[i]);
void MEDCouplingCartesianAMRMeshGen::checkPatchId(mcIdType patchId) const
{
- mcIdType const sz(getNumberOfPatches());
+ mcIdType sz(getNumberOfPatches());
if(patchId<0 || patchId>=sz)
{
std::ostringstream oss; oss << "MEDCouplingCartesianAMRMeshGen::checkPatchId : invalid patchId (" << patchId << ") ! Must be in [0," << sz << ") !";
{
if(lev==0)
{
- const auto *thisc(dynamic_cast<const MEDCouplingCartesianAMRMesh *>(this));//tony
+ const MEDCouplingCartesianAMRMesh *thisc(dynamic_cast<const MEDCouplingCartesianAMRMesh *>(this));//tony
MCAuto<MEDCouplingCartesianAMRPatchGF> elt(new MEDCouplingCartesianAMRPatchGF(const_cast<MEDCouplingCartesianAMRMesh *>(thisc)));
grids.push_back(DynamicCastSafe<MEDCouplingCartesianAMRPatchGF,MEDCouplingCartesianAMRPatchGen>(elt));
}
else if(lev==1)
{
- for(const auto & _patche : _patches)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
- const MEDCouplingCartesianAMRPatch *pt(_patche);
+ const MEDCouplingCartesianAMRPatch *pt(*it);
if(pt)
{
- MCAuto<MEDCouplingCartesianAMRPatch> tmp1(_patche);
+ MCAuto<MEDCouplingCartesianAMRPatch> tmp1(*it);
grids.push_back(DynamicCastSafe<MEDCouplingCartesianAMRPatch,MEDCouplingCartesianAMRPatchGen>(tmp1));
}
}
}
else
{
- for(const auto & _patche : _patches)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
- const MEDCouplingCartesianAMRPatch *pt(_patche);
+ const MEDCouplingCartesianAMRPatch *pt(*it);
if(pt)
pt->getMesh()->retrieveGridsAtInternal(lev-1,grids);
}
else
{
ghostLevInPatchRef=(ghostLev-1)/factors[0]+1;
- for(long const factor : factors)
- ghostLevInPatchRef=std::max(ghostLevInPatchRef,(ghostLev-1)/factor+1);
+ for(std::size_t i=0;i<factors.size();i++)
+ ghostLevInPatchRef=std::max(ghostLevInPatchRef,(ghostLev-1)/factors[i]+1);
}
return ghostLevInPatchRef;
}
*/
std::vector<const DataArrayDouble *> MEDCouplingCartesianAMRMeshGen::extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector<const DataArrayDouble *>& all) const
{
- mcIdType const maxLev(getMaxNumberOfLevelsRelativeToThis());
+ mcIdType maxLev(getMaxNumberOfLevelsRelativeToThis());
std::vector<const DataArrayDouble *> ret;
std::vector<const MEDCouplingCartesianAMRMeshGen *> meshes(1,this);
std::size_t kk(0);
for(mcIdType i=0;i<maxLev;i++)
{
std::vector<const MEDCouplingCartesianAMRMeshGen *> meshesTmp;
- for(auto meshe : meshes)
+ for(std::vector<const MEDCouplingCartesianAMRMeshGen *>::const_iterator it=meshes.begin();it!=meshes.end();it++)
{
- if(meshe==head || head->isObjectInTheProgeny(meshe))
+ if((*it)==head || head->isObjectInTheProgeny(*it))
ret.push_back(all[kk]);
kk++;
- std::vector< const MEDCouplingCartesianAMRPatch *> const ps(meshe->getPatches());
- for(auto p : ps)
+ std::vector< const MEDCouplingCartesianAMRPatch *> ps((*it)->getPatches());
+ for(std::vector< const MEDCouplingCartesianAMRPatch *>::const_iterator it0=ps.begin();it0!=ps.end();it0++)
{
- const MEDCouplingCartesianAMRMeshGen *mesh(p->getMesh());
+ const MEDCouplingCartesianAMRMeshGen *mesh((*it0)->getMesh());
meshesTmp.push_back(mesh);
}
}
void MEDCouplingCartesianAMRMeshGen::dumpPatchesOf(const std::string& varName, std::ostream& oss) const
{
std::size_t j(0);
- for(const auto & _patche : _patches)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
- const MEDCouplingCartesianAMRPatch *patch(_patche);
+ const MEDCouplingCartesianAMRPatch *patch(*it);
if(patch)
{
std::ostringstream oss2; oss2 << varName << ".addPatch([";
const std::vector< std::pair<mcIdType,mcIdType> >& bltr(patch->getBLTRRange());
- std::size_t const sz(bltr.size());
+ std::size_t sz(bltr.size());
for(std::size_t i=0;i<sz;i++)
{
oss2 << "(" << bltr[i].first << "," << bltr[i].second << ")";
{
std::vector<const BigMemoryObject *> ret;
ret.push_back((const MEDCouplingIMesh *)_mesh);
- for(const auto & _patche : _patches)
- ret.push_back((const MEDCouplingCartesianAMRPatch*)_patche);
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ ret.push_back((const MEDCouplingCartesianAMRPatch*)*it);
return ret;
}
{
if((const MEDCouplingIMesh *)_mesh)
updateTimeWith(*_mesh);
- for(const auto & _patche : _patches)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
- const MEDCouplingCartesianAMRPatch *elt(_patche);
+ const MEDCouplingCartesianAMRPatch *elt(*it);
if(!elt)
continue;
const MEDCouplingCartesianAMRMeshGen *mesh(elt->getMesh());
void MEDCouplingCartesianAMRMeshSub::detachFromFather()
{
- _father=nullptr;
+ _father=0;
declareAsNew();
}
std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingCartesianAMRMeshSub::positionRelativeToGodFather(std::vector<mcIdType>& st) const
{
st=_father->getFactors();
- std::size_t const dim(st.size());
+ std::size_t dim(st.size());
std::vector<mcIdType> prev(st);
- mcIdType const id(_father->getPatchIdFromChildMesh(this));
+ mcIdType id(_father->getPatchIdFromChildMesh(this));
const MEDCouplingCartesianAMRPatch *p(_father->getPatch(id));
std::vector< std::pair<mcIdType,mcIdType> > ret(p->getBLTRRange());
std::vector<mcIdType> delta(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(ret)),start(dim);
const MEDCouplingCartesianAMRMeshGen *it(_father);
while(!dynamic_cast<const MEDCouplingCartesianAMRMesh *>(it))
{
- const auto *itc(static_cast<const MEDCouplingCartesianAMRMeshSub *>(it));
- mcIdType const id2(itc->_father->getPatchIdFromChildMesh(itc));
+ const MEDCouplingCartesianAMRMeshSub *itc(static_cast<const MEDCouplingCartesianAMRMeshSub *>(it));
+ mcIdType id2(itc->_father->getPatchIdFromChildMesh(itc));
const MEDCouplingCartesianAMRPatch *p2(itc->_father->getPatch(id2));
const std::vector< std::pair<mcIdType,mcIdType> >& start2(p2->getBLTRRange());
std::vector<mcIdType> tmp(dim);
{
if(this==ref)
return 0;
- if(_father==nullptr)
+ if(_father==0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshSub::getAbsoluteLevelRelativeTo : ref is not in the progeny of this !");
else
return _father->getAbsoluteLevelRelativeTo(ref)+1;
return ;
if(!_father)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal : ref is not in the progeny of this !");
- mcIdType const myId(_father->getPatchIdFromChildMesh(this));
+ mcIdType myId(_father->getPatchIdFromChildMesh(this));
ret.push_back(myId);
_father->getPositionRelativeToInternal(ref,ret);
}
const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMesh::getFather() const
{
//I'm god father ! No father !
- return nullptr;
+ return 0;
}
const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMesh::getGodFather() const
*/
void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector<const INTERP_KERNEL::BoxSplittingOptions *>& bso, const DataArrayDouble *criterion, const std::vector< std::vector<mcIdType> >& factors, double eps)
{
- std::size_t const nbOfLevs(bso.size());
+ std::size_t nbOfLevs(bso.size());
if(nbOfLevs!=factors.size())
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML : size of vectors must be the same !");
if(nbOfLevs==0)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML : presence of a NULL BoxSplittingOptions in input vector !");
//
std::vector<MEDCouplingCartesianAMRPatchGen *> elts(retrieveGridsAt(ToIdType((i))));
- std::size_t const sz(elts.size());
+ std::size_t sz(elts.size());
std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> > elts2(sz);
std::vector< MCAuto<DataArrayDouble> > elts3(sz);
for(std::size_t ii=0;ii<sz;ii++)
std::vector< std::pair<std::string,int> > fieldNames(1); fieldNames[0].first=TMP_STR; fieldNames[0].second=1;
MCAuto<MEDCouplingAMRAttribute> att(MEDCouplingAMRAttribute::New(this,fieldNames,0));
att->alloc();
- auto *tmpDa(const_cast<DataArrayDouble *>(att->getFieldOn(this,TMP_STR)));
+ DataArrayDouble *tmpDa(const_cast<DataArrayDouble *>(att->getFieldOn(this,TMP_STR)));
tmpDa->deepCopyFrom(*criterion);
att->synchronizeCoarseToFine();
for(std::size_t ii=0;ii<sz;ii++)
const DataArrayDouble *critOnLeaf(att->getFieldOn(const_cast<MEDCouplingCartesianAMRMeshGen *>(elts[ii]->getMesh()),TMP_STR));
elts3[ii]=const_cast<DataArrayDouble *>(critOnLeaf); elts3[ii]->incrRef();
}
- att=nullptr;
+ att=0;
for(std::size_t ii=0;ii<sz;ii++)
const_cast<MEDCouplingCartesianAMRMeshGen *>(elts[ii]->getMesh())->createPatchesFromCriterion(*bso[i],elts3[ii],factors[i],eps);
}
}
-MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other)
-= default;
+MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other):MEDCouplingCartesianAMRMeshGen(other)
+{
+}
MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop):MEDCouplingCartesianAMRMeshGen(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop)
}
MEDCouplingCartesianAMRMesh::~MEDCouplingCartesianAMRMesh()
-= default;
+{
+}
#include "MCType.hxx"
#include "BoxSplittingOptions.hxx"
-#include <vector>
-#include <utility>
-#include <string>
-#include <cstddef>
-#include <ostream>
+#include "InterpKernelException.hxx"
namespace MEDCoupling
{
const MEDCouplingCartesianAMRMeshGen *getMeshSafe() const;
MEDCouplingCartesianAMRMeshGen *getMeshSafe();
private:
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
protected:
MCAuto<MEDCouplingCartesianAMRMeshGen> _mesh;
};
public:
MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair<mcIdType,mcIdType> >& bottomLeftTopRight);
std::string getClassName() const override { return std::string("MEDCouplingCartesianAMRPatch"); }
- MEDCouplingCartesianAMRPatch *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const override;
+ MEDCouplingCartesianAMRPatch *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
// direct forward to _mesh
MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair<mcIdType,mcIdType> >& bottomLeftTopRight, const std::vector<mcIdType>& factors);
// end of direct forward to _mesh
private:
static void ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair<mcIdType,mcIdType> >& p1Zone, std::vector< std::pair<mcIdType,mcIdType> >& p2Zone, std::vector<mcIdType>& factToApplyOn2);
private:
- std::size_t getHeapMemorySizeWithoutChildren() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
static const MEDCouplingCartesianAMRMeshGen *FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, mcIdType& lev);
static std::vector<mcIdType> ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, mcIdType lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2);
static void UpdateNeighborsOfOneWithTwoInternal(mcIdType ghostLev, const std::vector<mcIdType>& factors, const std::vector< std::pair<mcIdType,mcIdType> >&p1 ,const std::vector< std::pair<mcIdType,mcIdType> >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2);
public:
MEDCouplingCartesianAMRPatchGF(MEDCouplingCartesianAMRMesh *mesh);
std::string getClassName() const override { return std::string("MEDCouplingCartesianAMRPatchGF"); }
- MEDCouplingCartesianAMRPatchGF *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const override;
+ MEDCouplingCartesianAMRPatchGF *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
private:
- std::size_t getHeapMemorySizeWithoutChildren() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
private:
MEDCouplingCartesianAMRPatchGF(const MEDCouplingCartesianAMRPatchGF& other, MEDCouplingCartesianAMRMeshGen *father);
};
public:
virtual void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const = 0;
protected:
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT void updateTime() const override;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT void updateTime() const;
protected:
MCAuto<MEDCouplingIMesh> _mesh;
std::vector< MCAuto<MEDCouplingCartesianAMRPatch> > _patches;
public:
MEDCouplingCartesianAMRMeshSub(MEDCouplingCartesianAMRMeshGen *father, MEDCouplingIMesh *mesh);
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingCartesianAMRMeshSub"); }
- MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const override;
- MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const override;
- MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const override;
- MEDCOUPLING_EXPORT void detachFromFather() override;
- MEDCOUPLING_EXPORT std::vector< std::pair<mcIdType,mcIdType> > positionRelativeToGodFather(std::vector<mcIdType>& st) const override;
- MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const override;
+ MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const;
+ MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const;
+ MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const;
+ MEDCOUPLING_EXPORT void detachFromFather();
+ MEDCOUPLING_EXPORT std::vector< std::pair<mcIdType,mcIdType> > positionRelativeToGodFather(std::vector<mcIdType>& st) const;
+ MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
private:
MEDCouplingCartesianAMRMeshSub(const MEDCouplingCartesianAMRMeshSub& other, MEDCouplingCartesianAMRMeshGen *father);
- MEDCouplingCartesianAMRMeshSub *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const override;
- void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const override;
+ MEDCouplingCartesianAMRMeshSub *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
+ void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const;
protected:
MEDCouplingCartesianAMRMeshGen *_father;
};
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop);
MEDCOUPLING_EXPORT static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh);
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingCartesianAMRMesh"); }
- MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const override;
- MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const override;
- MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const override;
- MEDCOUPLING_EXPORT void detachFromFather() override;
- MEDCOUPLING_EXPORT std::vector< std::pair<mcIdType,mcIdType> > positionRelativeToGodFather(std::vector<mcIdType>& st) const override;
- MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const override;
- MEDCOUPLING_EXPORT std::vector<MEDCouplingCartesianAMRPatchGen *> retrieveGridsAt(mcIdType absoluteLev) const override;
- MEDCouplingCartesianAMRMesh *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const override;
+ MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const;
+ MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const;
+ MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const;
+ MEDCOUPLING_EXPORT void detachFromFather();
+ MEDCOUPLING_EXPORT std::vector< std::pair<mcIdType,mcIdType> > positionRelativeToGodFather(std::vector<mcIdType>& st) const;
+ MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
+ MEDCOUPLING_EXPORT std::vector<MEDCouplingCartesianAMRPatchGen *> retrieveGridsAt(mcIdType absoluteLev) const;
+ MEDCouplingCartesianAMRMesh *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
MEDCOUPLING_EXPORT void createPatchesFromCriterionML(const std::vector<const INTERP_KERNEL::BoxSplittingOptions *>& bso, const DataArrayDouble *criterion, const std::vector< std::vector<mcIdType> >& factors, double eps);
private:
- void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const override;
+ void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<mcIdType>& ret) const;
MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other);
MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop);
MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh);
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- ~MEDCouplingCartesianAMRMesh() override;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ ~MEDCouplingCartesianAMRMesh();
};
}
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingCurveLinearMesh.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingPointSet.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingStructuredMesh.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include "MEDCouplingRefCountObject.hxx"
#include "VolSurfUser.txx"
#include "PointLocatorAlgos.txx"
-#include <cstddef>
#include <functional>
#include <algorithm>
-#include <iterator>
-#include <ostream>
#include <sstream>
-#include <string>
-#include <vector>
-#include <utility>
+#include <numeric>
using namespace MEDCoupling;
-MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh():_coords(nullptr),_structure(0)
+MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh():_coords(0),_structure(0)
{
}
}
MEDCouplingCurveLinearMesh::~MEDCouplingCurveLinearMesh()
-= default;
+{
+}
MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New()
{
MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New(const std::string& meshName)
{
- auto *ret=new MEDCouplingCurveLinearMesh;
+ MEDCouplingCurveLinearMesh *ret=new MEDCouplingCurveLinearMesh;
ret->setName(meshName);
return ret;
}
*/
void MEDCouplingCurveLinearMesh::copyTinyStringsFrom(const MEDCouplingMesh *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingCurveLinearMesh *>(other);
+ const MEDCouplingCurveLinearMesh *otherC=dynamic_cast<const MEDCouplingCurveLinearMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::copyTinyStringsFrom : meshes have not same type !");
MEDCouplingStructuredMesh::copyTinyStringsFrom(other);
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::isEqualIfNotWhy : input other pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCouplingCurveLinearMesh *>(other);
+ const MEDCouplingCurveLinearMesh *otherC=dynamic_cast<const MEDCouplingCurveLinearMesh *>(other);
if(!otherC)
{
reason="mesh given in input is not castable in MEDCouplingCurveLinearMesh !";
if(!MEDCouplingStructuredMesh::isEqualIfNotWhy(other,prec,reason))
return false;
std::ostringstream oss; oss.precision(15);
- if(((const DataArrayDouble *)_coords && ((const DataArrayDouble *)otherC->_coords)==nullptr) || (((const DataArrayDouble *)_coords)==nullptr && (const DataArrayDouble *)otherC->_coords))
+ if(((const DataArrayDouble *)_coords && ((const DataArrayDouble *)otherC->_coords)==0) || (((const DataArrayDouble *)_coords)==0 && (const DataArrayDouble *)otherC->_coords))
{
oss << "Only one CurveLinearMesh between the two this and other has its coordinates defined !";
reason=oss.str();
bool MEDCouplingCurveLinearMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingCurveLinearMesh *>(other);
+ const MEDCouplingCurveLinearMesh *otherC=dynamic_cast<const MEDCouplingCurveLinearMesh *>(other);
if(!otherC)
return false;
- if(((const DataArrayDouble *)_coords && ((const DataArrayDouble *)otherC->_coords)==nullptr) || (((const DataArrayDouble *)_coords)==nullptr && (const DataArrayDouble *)otherC->_coords))
+ if(((const DataArrayDouble *)_coords && ((const DataArrayDouble *)otherC->_coords)==0) || (((const DataArrayDouble *)_coords)==0 && (const DataArrayDouble *)otherC->_coords))
return false;
if((const DataArrayDouble *)_coords)
{
return true;
}
-void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec,
- DataArrayIdType *& /*cellCor*/, DataArrayIdType *& /*nodeCor*/) const
+void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalWith : Meshes are not the same !");
* Nothing is done here (except to check that the other is a MEDCoupling::MEDCouplingCurveLinearMesh instance too).
* The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingCurveLinearMesh, \a this and \a other are the same !
*/
-void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec,
- DataArrayIdType *& /*cellCor*/) const
+void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayIdType *&cellCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
mcIdType nbOfNodes=1;
if(sz<1)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : structure should have a lgth of size 1 at least !");
- for(auto it=_structure.begin();it!=_structure.end();it++,i++)
+ for(std::vector<mcIdType>::const_iterator it=_structure.begin();it!=_structure.end();it++,i++)
{
if((*it)<1)
{ std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : At pos #" << i << " of structure value is " << *it << "should be >= 1 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
}
}
-void MEDCouplingCurveLinearMesh::checkConsistency(double /*eps*/) const
+void MEDCouplingCurveLinearMesh::checkConsistency(double eps) const
{
checkConsistencyLight();
}
{
if(!((const DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCoordinatesOfNode : Coordinates not set !");
- std::size_t const nbOfCompo=_coords->getNumberOfComponents();
+ std::size_t nbOfCompo=_coords->getNumberOfComponents();
if(nodeId>=0 && nodeId<_coords->getNumberOfTuples())
coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo);
else
ret << "Curve linear mesh with name : \"" << getName() << "\"\n";
ret << "Description of mesh : \"" << getDescription() << "\"\n";
int tmpp1,tmpp2;
- double const tt=getTime(tmpp1,tmpp2);
+ double tt=getTime(tmpp1,tmpp2);
ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "The nodal structure of curve linear mesh is : [";
void MEDCouplingCurveLinearMesh::setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd)
{
- std::size_t const sz=std::distance(gridStructBg,gridStructEnd);
+ std::size_t sz=std::distance(gridStructBg,gridStructEnd);
if(sz>=1 && sz<=3)
{
_structure.resize(0);
MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const
{
checkConsistencyLight();
- int const dim(getSpaceDimension());
+ int dim(getSpaceDimension());
std::vector<mcIdType> dims(getMeshDimension());
if(dim!=ToIdType(cellPart.size()))
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
std::vector< std::pair<mcIdType,mcIdType> > nodePartFormat(cellPart);
- for(auto & it : nodePartFormat)
- it.second++;
+ for(std::vector< std::pair<mcIdType,mcIdType> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
+ (*it).second++;
MCAuto<DataArrayIdType> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
MCAuto<MEDCouplingCurveLinearMesh> ret(dynamic_cast<MEDCouplingCurveLinearMesh *>(deepCopy()));
const DataArrayDouble *coo(ret->getCoords());
MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs) const
{
checkConsistencyLight();
- int const meshDim=getMeshDimension();
+ int meshDim=getMeshDimension();
std::string name="MeasureOfMesh_"; name+=getName();
MCAuto<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
field->setName(name); field->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(this)); field->synchronizeTimeWithMesh();
*/
void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCouplingFieldDouble *field) const
{
- mcIdType const nbnodes=getNumberOfNodes();
- int const spaceDim=getSpaceDimension();
+ mcIdType nbnodes=getNumberOfNodes();
+ int spaceDim=getSpaceDimension();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
if(nbnodes==0)
{ arr->alloc(0,1); return; }
*/
void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const
{
- mcIdType const nbcells=getNumberOfCells();
- int const spaceDim=getSpaceDimension();
+ mcIdType nbcells=getNumberOfCells();
+ int spaceDim=getSpaceDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
arr->alloc(nbcells,1);
double *pt=arr->getPointer();
const double *coords=_coords->begin();
- mcIdType const nX=_structure[0]-1;
+ mcIdType nX=_structure[0]-1;
mcIdType conn[4];
for(mcIdType i=0;i<nbcells;i++,pt++)
{
*/
void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCouplingFieldDouble *field) const
{
- mcIdType const nbcells=getNumberOfCells();
- int const spaceDim=getSpaceDimension();
+ mcIdType nbcells=getNumberOfCells();
+ int spaceDim=getSpaceDimension();
if(spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3 : with meshDim 3 only space dimension 3 is possible !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
double *pt=arr->getPointer();
const double *coords=_coords->begin();
mcIdType nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
- mcIdType const nY1=_structure[0]*_structure[1];
+ mcIdType nY1=_structure[0]*_structure[1];
mcIdType conn[8];
for(mcIdType i=0;i<nbcells;i++,pt++)
{
- mcIdType const cz=i/nY;
- mcIdType const cy=(i-cz*nY)/nX;
- mcIdType const cx=(i-cz*nY)-nX*cy;
+ mcIdType cz=i/nY;
+ mcIdType cy=(i-cz*nY)/nX;
+ mcIdType cx=(i-cz*nY)-nX*cy;
conn[0]=cz*nY1+cy*(nX+1)+cx; conn[1]=cz*nY1+(cy+1)*(nX+1)+cx; conn[2]=cz*nY1+(cy+1)*(nX+1)+1+cx; conn[3]=cz*nY1+cy*(nX+1)+cx+1;
conn[4]=(cz+1)*nY1+cy*(nX+1)+cx; conn[5]=(cz+1)*nY1+(cy+1)*(nX+1)+cx; conn[6]=(cz+1)*nY1+(cy+1)*(nX+1)+1+cx; conn[7]=(cz+1)*nY1+cy*(nX+1)+cx+1;
*pt=INTERP_KERNEL::computeVolSurfOfCell2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3);
/*!
* not implemented yet !
*/
-MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureFieldOnNode(bool /*isAbs*/) const
+MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureFieldOnNode(bool isAbs) const
{
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldOnNode : not implemented yet !");
}
throw INTERP_KERNEL::Exception("Expected a cmesh with meshDim == 2 !");
MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
DataArrayDouble *array=DataArrayDouble::New();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
array->alloc(nbOfCells,3);
double *vals=array->getPointer();
for(mcIdType i=0;i<nbOfCells;i++)
public:
static const int MY_SPACEDIM=SPACEDIMM;
static const int MY_MESHDIM=8;
- using MyConnType = mcIdType;
+ typedef mcIdType MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
// begin
// useless, but for windows compilation ...
- const double* getCoordinatesPtr() const { return nullptr; }
- const mcIdType* getConnectivityPtr() const { return nullptr; }
- const mcIdType* getConnectivityIndexPtr() const { return nullptr; }
+ const double* getCoordinatesPtr() const { return 0; }
+ const mcIdType* getConnectivityPtr() const { return 0; }
+ const mcIdType* getConnectivityIndexPtr() const { return 0; }
INTERP_KERNEL::NormalizedCellType getTypeOfElement(mcIdType) const { return (INTERP_KERNEL::NormalizedCellType)0; }
// end
};
mcIdType MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double eps) const
{
checkConsistencyLight();
- int const spaceDim=getSpaceDimension();
+ int spaceDim=getSpaceDimension();
const double *coords=_coords->getConstPointer();
mcIdType nodeId=-1;
_coords->distanceToTuple(pos,pos+spaceDim,nodeId);
if(nodeId<0)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : internal problem 1 !");
mcIdType conn[8];
- mcIdType const nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfNodes=getNumberOfNodes();
if(nbOfNodes==1)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : No cells in this !");
switch(getMeshDimension())
{
if(spaceDim==3)
{
- mcIdType const nY=_structure[0]*_structure[1];
- mcIdType const nz=nodeId/_structure[1]; mcIdType const ny=(nodeId-nz*nY)/_structure[0]; mcIdType const nx=(nodeId-nz*nY)-_structure[0]*ny;
+ mcIdType nY=_structure[0]*_structure[1];
+ mcIdType nz=nodeId/_structure[1]; mcIdType ny=(nodeId-nz*nY)/_structure[0]; mcIdType nx=(nodeId-nz*nY)-_structure[0]*ny;
if(nx>0 && ny>0 && nz>0)
{
conn[0]=nx-1+_structure[0]*(ny-1)+nY*(nz-1); conn[1]=nx-1+_structure[2]*ny+nY*(nz-1); conn[2]=nx+_structure[2]*ny+nY*(nz-1); conn[3]=nx+_structure[0]*(ny-1)+nY*(nz-1);
{
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::rotate : no coordinates set !");
- int const spaceDim=getSpaceDimension();
- mcIdType const nbNodes(_coords->getNumberOfTuples());
+ int spaceDim=getSpaceDimension();
+ mcIdType nbNodes(_coords->getNumberOfTuples());
double *coords=_coords->getPointer();
if(spaceDim==3)
DataArrayDouble::Rotate3DAlg(center,vector,angle,nbNodes,coords,coords);
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::translate : no coordinates set !");
double *coords=_coords->getPointer();
- mcIdType const nbNodes=getNumberOfNodes();
- int const dim=getSpaceDimension();
+ mcIdType nbNodes=getNumberOfNodes();
+ int dim=getSpaceDimension();
for(mcIdType i=0; i<nbNodes; i++)
for(int idim=0; idim<dim;idim++)
coords[i*dim+idim]+=vector[idim];
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::scale : no coordinates set !");
double *coords=_coords->getPointer();
- mcIdType const nbNodes(_coords->getNumberOfTuples());
- std::size_t const dim(_coords->getNumberOfComponents());
+ mcIdType nbNodes(_coords->getNumberOfTuples());
+ std::size_t dim(_coords->getNumberOfComponents());
for(mcIdType i=0;i<nbNodes;i++)
{
std::transform(coords+i*dim,coords+(i+1)*dim,point,coords+i*dim,std::minus<double>());
updateTime();
}
-MEDCouplingMesh *MEDCouplingCurveLinearMesh::mergeMyselfWith(const MEDCouplingMesh * /*other*/) const
+MEDCouplingMesh *MEDCouplingCurveLinearMesh::mergeMyselfWith(const MEDCouplingMesh *other) const
{
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::mergeMyselfWith : not available for CurveLinear Mesh !");
}
DataArrayDouble *MEDCouplingCurveLinearMesh::getCoordinatesAndOwner() const
{
- auto *ret=const_cast<DataArrayDouble *>((const DataArrayDouble *)_coords);
+ DataArrayDouble *ret=const_cast<DataArrayDouble *>((const DataArrayDouble *)_coords);
if(ret)
ret->incrRef();
return ret;
{
checkConsistencyLight();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int const spaceDim=getSpaceDimension();
- int const meshDim=getMeshDimension();
- mcIdType const nbOfCells=getNumberOfCells();
+ int spaceDim=getSpaceDimension();
+ int meshDim=getMeshDimension();
+ mcIdType nbOfCells=getNumberOfCells();
ret->alloc(nbOfCells,spaceDim);
ret->copyStringInfoFrom(*getCoords());
switch(meshDim)
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble *bary) const
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
double *ptToFill=bary->getPointer();
const double *coor=_coords->getConstPointer();
if(getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3 : with meshDim 3 only space dimension 3 is possible !");
mcIdType nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
- mcIdType const nY1=_structure[0]*_structure[1];
+ mcIdType nY1=_structure[0]*_structure[1];
mcIdType conn[8];
for(mcIdType i=0;i<nbOfCells;i++)
{
- mcIdType const cz=i/nY;
- mcIdType const cy=(i-cz*nY)/nX;
- mcIdType const cx=(i-cz*nY)-nX*cy;
+ mcIdType cz=i/nY;
+ mcIdType cy=(i-cz*nY)/nX;
+ mcIdType cx=(i-cz*nY)-nX*cy;
conn[0]=cz*nY1+cy*(nX+1)+cx+1; conn[1]=cz*nY1+cy*(nX+1)+cx; conn[2]=cz*nY1+(cy+1)*(nX+1)+cx; conn[3]=cz*nY1+(cy+1)*(nX+1)+1+cx;
conn[4]=(cz+1)*nY1+cy*(nX+1)+cx+1; conn[5]=(cz+1)*nY1+cy*(nX+1)+cx; conn[6]=(cz+1)*nY1+(cy+1)*(nX+1)+cx; conn[7]=(cz+1)*nY1+(cy+1)*(nX+1)+1+cx;
INTERP_KERNEL::computeBarycenter2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill);
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble *bary) const
{
- mcIdType const nbcells=getNumberOfCells();
- int const spaceDim=getSpaceDimension();
+ mcIdType nbcells=getNumberOfCells();
+ int spaceDim=getSpaceDimension();
double *ptToFill=bary->getPointer();
const double *coor=_coords->getConstPointer();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !");
- mcIdType const nX=_structure[0]-1;
+ mcIdType nX=_structure[0]-1;
mcIdType conn[4];
for(mcIdType i=0;i<nbcells;i++)
{
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim1(DataArrayDouble *bary) const
{
- int const spaceDim=getSpaceDimension();
+ int spaceDim=getSpaceDimension();
std::transform(_coords->begin()+spaceDim,_coords->end(),_coords->begin(),bary->getPointer(),std::plus<double>());
std::transform(bary->begin(),bary->end(),bary->getPointer(),std::bind(std::multiplies<double>(),std::placeholders::_1,0.5));
}
-void MEDCouplingCurveLinearMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*check*/)
+void MEDCouplingCurveLinearMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for CurveLinear Mesh !");
}
std::copy(_coords->begin(),_coords->end(),a2->getPointer());
}
-void MEDCouplingCurveLinearMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType * /*a1*/, DataArrayDouble *a2,
+void MEDCouplingCurveLinearMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
setName(littleStrings[0]);
void MEDCouplingCurveLinearMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
{
std::ostringstream extent;
- std::size_t const meshDim=_structure.size();
+ std::size_t meshDim=_structure.size();
if(meshDim==0 || meshDim>3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::writeVTKLL : meshDim invalid ! must be in [1,2,3] !");
for(std::size_t i=0;i<3;i++)
- { mcIdType const val=i<meshDim?_structure[i]-1:0; extent << "0 " << val << " "; }
+ { mcIdType val=i<meshDim?_structure[i]-1:0; extent << "0 " << val << " "; }
ofs << " <" << getVTKDataSetType() << " WholeExtent=\"" << extent.str() << "\">\n";
ofs << " <Piece Extent=\"" << extent.str() << "\">\n";
ofs << " <PointData>\n" << pointData << std::endl;
{
stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << ". Name : \"" << getName() << "\".";
stream << " Nodal structure : [";
- std::size_t const s_size=_structure.size();
+ std::size_t s_size=_structure.size();
for(std::size_t i=0;i<s_size;i++)
{
- char const tmp=(char)((int)('X')+i);
+ char tmp=(char)((int)('X')+i);
stream << " " << tmp << "=" << _structure[i];
if(i!=s_size-1)
stream << ", ";
{ stream << std::endl << "No coordinates set !"; return ; }
if(!coo->isAllocated())
{ stream << std::endl << "Coordinates set but not allocated !"; return ; }
- std::size_t const nbOfCompo(coo->getNumberOfComponents());
+ std::size_t nbOfCompo(coo->getNumberOfComponents());
std::size_t nbOfCompoExp(-1);
try
{
#ifndef __PARAMEDMEM_MEDCOUPLINGCURVELINEARMESH_HXX__
#define __PARAMEDMEM_MEDCOUPLINGCURVELINEARMESH_HXX__
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMesh.hxx"
#include "MEDCouplingStructuredMesh.hxx"
#include "MCAuto.hxx"
-#include <string>
-#include <cstddef>
-#include <vector>
-#include <utility>
-#include <ostream>
namespace MEDCoupling
{
MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New();
MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingCurveLinearMesh"); }
- MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *deepCopy() const override;
- MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const override;
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return CURVE_LINEAR; }
- MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override;
+ MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *deepCopy() const;
+ MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return CURVE_LINEAR; }
+ MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor) const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const override;
- MEDCOUPLING_EXPORT int getSpaceDimension() const override;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const override;
- MEDCOUPLING_EXPORT std::string simpleRepr() const override;
- MEDCOUPLING_EXPORT std::string advancedRepr() const override;
- MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override;
+ DataArrayIdType *&cellCor) const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const;
+ MEDCOUPLING_EXPORT int getSpaceDimension() const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT std::string simpleRepr() const;
+ MEDCOUPLING_EXPORT std::string advancedRepr() const;
+ MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const;
MEDCOUPLING_EXPORT DataArrayDouble *getCoords();
MEDCOUPLING_EXPORT const DataArrayDouble *getCoords() const;
MEDCOUPLING_EXPORT void setCoords(const DataArrayDouble *coords);
MEDCOUPLING_EXPORT void setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd);
- MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeGridStructure() const override;
- MEDCOUPLING_EXPORT MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const override;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeGridStructure() const;
+ MEDCOUPLING_EXPORT MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const;
// tools
- MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override;
- MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const override;
- MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override;
- MEDCOUPLING_EXPORT void translate(const double *vector) override;
- MEDCOUPLING_EXPORT void scale(const double *point, double factor) override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override;
- MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override;
+ MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
+ MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
+ MEDCOUPLING_EXPORT void translate(const double *vector);
+ MEDCOUPLING_EXPORT void scale(const double *point, double factor);
+ MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
//some useful methods
- MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const override;
+ MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const;
//serialisation-unserialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override;
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
- const std::vector<std::string>& littleStrings) override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
- MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override;
+ const std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+ MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
private:
void getMeasureFieldMeshDim1(bool isAbs, MEDCouplingFieldDouble *field) const;
void getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const;
private:
MEDCouplingCurveLinearMesh();
MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCpy);
- ~MEDCouplingCurveLinearMesh() override;
- void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override;
- std::string getVTKDataSetType() const override;
+ ~MEDCouplingCurveLinearMesh();
+ void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
+ std::string getVTKDataSetType() const;
private:
MCAuto<DataArrayDouble> _coords;
std::vector<mcIdType> _structure;
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingDefinitionTime.hxx"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include <cmath>
-#include <vector>
-#include <ostream>
-#include <cstddef>
using namespace MEDCoupling;
}
}
-bool MEDCouplingDefinitionTimeSlice::isEqual(const MEDCouplingDefinitionTimeSlice& other, double /*eps*/) const
+bool MEDCouplingDefinitionTimeSlice::isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const
{
if(_mesh_id!=other._mesh_id)
return false;
MEDCouplingDefinitionTimeSlice::MEDCouplingDefinitionTimeSlice(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId):_mesh_id(meshId),_array_id(arrId),_field_id(fieldId)
{
int tmp1,tmp2;
- double const t1=f->getStartTime(tmp1,tmp2);
- double const t2=f->getEndTime(tmp1,tmp2);
+ double t1=f->getStartTime(tmp1,tmp2);
+ double t2=f->getEndTime(tmp1,tmp2);
if(t2<t1)
throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSlice : End time strictly before Start time ...");
}
bool MEDCouplingDefinitionTimeSlice::isFullyIncludedInMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const
{
- double const t1=getStartTime();
- double const t2=getEndTime();
- double const o1=other->getStartTime();
- double const o2=other->getEndTime();
+ double t1=getStartTime();
+ double t2=getEndTime();
+ double o1=other->getStartTime();
+ double o2=other->getEndTime();
return o1>t1-eps && o2<t2+eps;
}
bool MEDCouplingDefinitionTimeSlice::isOverllapingWithMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const
{
- double const t1=getStartTime();
- double const t2=getEndTime();
- double const o1=other->getStartTime();
- double const o2=other->getEndTime();
+ double t1=getStartTime();
+ double t2=getEndTime();
+ double o1=other->getStartTime();
+ double o2=other->getEndTime();
return (o1<t1+eps && o2<t1+eps) || (o1>t2-eps && o2>t2-eps);
}
bool MEDCouplingDefinitionTimeSlice::isAfterMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const
{
- double const t2=getEndTime();
- double const o1=other->getStartTime();
- double const o2=other->getEndTime();
+ double t2=getEndTime();
+ double o1=other->getStartTime();
+ double o2=other->getEndTime();
return (o1>t2-eps && o2>t2-eps);
}
bool MEDCouplingDefinitionTimeSlice::isBeforeMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const
{
- double const t1=getStartTime();
- double const o1=other->getStartTime();
- double const o2=other->getEndTime();
+ double t1=getStartTime();
+ double o1=other->getStartTime();
+ double o2=other->getEndTime();
return (o1<t1+eps && o2<t1+eps);
}
MEDCouplingDefinitionTimeSliceInst *MEDCouplingDefinitionTimeSliceInst::New(const std::vector<int>& tiI, const std::vector<double>& tiD)
{
- auto *ret=new MEDCouplingDefinitionTimeSliceInst;
+ MEDCouplingDefinitionTimeSliceInst *ret=new MEDCouplingDefinitionTimeSliceInst;
ret->unserialize(tiI,tiD);
return ret;
}
{
if(!MEDCouplingDefinitionTimeSlice::isEqual(other,eps))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingDefinitionTimeSliceInst *>(&other);
+ const MEDCouplingDefinitionTimeSliceInst *otherC=dynamic_cast<const MEDCouplingDefinitionTimeSliceInst *>(&other);
if(!otherC)
return false;
return fabs(otherC->_instant-_instant)<eps;
ret[0]=_instant;
}
-void MEDCouplingDefinitionTimeSliceInst::getIdsOnTime(double /*tm*/, double /*eps*/, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const
+void MEDCouplingDefinitionTimeSliceInst::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const
{
meshId=_mesh_id;
arrId=_array_id;
MEDCouplingDefinitionTimeSliceInst::MEDCouplingDefinitionTimeSliceInst(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId)
{
int tmp1,tmp2;
- double const t1=f->getStartTime(tmp1,tmp2);
- double const t2=f->getEndTime(tmp1,tmp2);
- double const eps=f->getTimeTolerance();
+ double t1=f->getStartTime(tmp1,tmp2);
+ double t2=f->getEndTime(tmp1,tmp2);
+ double eps=f->getTimeTolerance();
if(fabs(t1-t2)>eps)
throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSliceInst : times differs in this");
_instant=t1;
MEDCouplingDefinitionTimeSliceCstOnTI *MEDCouplingDefinitionTimeSliceCstOnTI::New(const std::vector<int>& tiI, const std::vector<double>& tiD)
{
- auto *ret=new MEDCouplingDefinitionTimeSliceCstOnTI;
+ MEDCouplingDefinitionTimeSliceCstOnTI *ret=new MEDCouplingDefinitionTimeSliceCstOnTI;
ret->unserialize(tiI,tiD);
return ret;
}
{
if(!MEDCouplingDefinitionTimeSlice::isEqual(other,eps))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingDefinitionTimeSliceCstOnTI *>(&other);
+ const MEDCouplingDefinitionTimeSliceCstOnTI *otherC=dynamic_cast<const MEDCouplingDefinitionTimeSliceCstOnTI *>(&other);
if(!otherC)
return false;
if(fabs(otherC->_start-_start)>eps)
ret[0]=(_start+_end)/2.;
}
-void MEDCouplingDefinitionTimeSliceCstOnTI::getIdsOnTime(double /*tm*/, double /*eps*/, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const
+void MEDCouplingDefinitionTimeSliceCstOnTI::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const
{
meshId=_mesh_id;
arrId=_array_id;
MEDCouplingDefinitionTimeSliceCstOnTI::MEDCouplingDefinitionTimeSliceCstOnTI(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId)
{
int tmp1,tmp2;
- double const t1=f->getStartTime(tmp1,tmp2);
- double const t2=f->getEndTime(tmp1,tmp2);
+ double t1=f->getStartTime(tmp1,tmp2);
+ double t2=f->getEndTime(tmp1,tmp2);
_start=t1;
_end=t2;
}
MEDCouplingDefinitionTimeSliceLT *MEDCouplingDefinitionTimeSliceLT::New(const std::vector<int>& tiI, const std::vector<double>& tiD)
{
- auto *ret=new MEDCouplingDefinitionTimeSliceLT;
+ MEDCouplingDefinitionTimeSliceLT *ret=new MEDCouplingDefinitionTimeSliceLT;
ret->unserialize(tiI,tiD);
return ret;
}
{
if(!MEDCouplingDefinitionTimeSlice::isEqual(other,eps))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingDefinitionTimeSliceLT *>(&other);
+ const MEDCouplingDefinitionTimeSliceLT *otherC=dynamic_cast<const MEDCouplingDefinitionTimeSliceLT *>(&other);
if(!otherC)
return false;
if(_array_id_end!=otherC->_array_id_end)
MEDCouplingDefinitionTimeSliceLT::MEDCouplingDefinitionTimeSliceLT(const MEDCouplingFieldDouble *f, int meshId, int arrId, int arr2Id, int fieldId):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId),_array_id_end(arr2Id)
{
int tmp1,tmp2;
- double const t1=f->getStartTime(tmp1,tmp2);
- double const t2=f->getEndTime(tmp1,tmp2);
+ double t1=f->getStartTime(tmp1,tmp2);
+ double t2=f->getEndTime(tmp1,tmp2);
_start=t1;
_end=t2;
}
MEDCouplingDefinitionTime::MEDCouplingDefinitionTime(const std::vector<const MEDCouplingFieldDouble *>& fs, const std::vector<int>& meshRefs, const std::vector<std::vector<int> >& arrRefs)
{
- std::size_t const sz=fs.size();
+ std::size_t sz=fs.size();
if(sz!=arrRefs.size())
throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime constructor : internal error ! should never happen !");
_slices.resize(sz);
void MEDCouplingDefinitionTime::assign(const MEDCouplingDefinitionTime& other)
{
- std::size_t const sz=other._slices.size();
+ std::size_t sz=other._slices.size();
_slices.resize(sz);
for(std::size_t i=0;i<sz;i++)
_slices[i]=other._slices[i]->copy();
bool MEDCouplingDefinitionTime::isEqual(const MEDCouplingDefinitionTime& other) const
{
- std::size_t const sz=_slices.size();
+ std::size_t sz=_slices.size();
if(sz!=other._slices.size())
return false;
for(std::size_t i=0;i<sz;i++)
{
std::vector<int> ids;
int id=0;
- for(auto it=_slices.begin();it!=_slices.end();it++,id++)
+ for(std::vector< MCAuto<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++,id++)
if((*it)->isContaining(tm,_eps))
ids.push_back(id);
if(ids.empty())
throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime::getIdsOnTime : No matching slice for such time !");
- std::size_t const sz=ids.size();
+ std::size_t sz=ids.size();
if(sz>2)
throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime::getIdsOnTime : Too many slices match this time !");
//
std::vector<double> MEDCouplingDefinitionTime::getHotSpotsTime() const
{
std::vector<double> ret;
- for(const auto & _slice : _slices)
+ for(std::vector< MCAuto<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++)
{
std::vector<double> tmp;
- _slice->getHotSpotsTime(tmp);
+ (*it)->getHotSpotsTime(tmp);
if(!ret.empty())
{
if(fabs(ret.back()-tmp.front())>_eps)
void MEDCouplingDefinitionTime::appendRepr(std::ostream& stream) const
{
stream << "Time definition :\n";
- for(const auto & _slice : _slices)
+ for(std::vector< MCAuto<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++)
{
stream << " - ";
- _slice->appendRepr(stream);
+ (*it)->appendRepr(stream);
stream << std::endl;
}
}
void MEDCouplingDefinitionTime::getTinySerializationInformation(std::vector<int>& tinyInfoI, std::vector<double>& tinyInfoD) const
{
- int const sz=(int)_slices.size();
+ int sz=(int)_slices.size();
tinyInfoD.resize(1);
tinyInfoD[0]=_eps;
tinyInfoI.resize(3*sz+2);
void MEDCouplingDefinitionTime::unserialize(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
{
- int const sz=tinyInfoI[0];
+ int sz=tinyInfoI[0];
_slices.resize(sz);
_eps=tinyInfoD[0];
int offset1=0;
int offset2=1;
for(int i=0;i<sz;i++)
{
- auto const ty=(TypeOfTimeDiscretization) tinyInfoI[i+2];
- int const sz1=tinyInfoI[i+sz+2];
- int const sz2=tinyInfoI[i+2*sz+2];
- std::vector<int> const tmp1(tinyInfoI.begin()+3*sz+2+offset1,tinyInfoI.begin()+3*sz+2+offset1+sz1);
- std::vector<double> const tmp2(tinyInfoD.begin()+offset2,tinyInfoD.begin()+offset2+sz2);
+ TypeOfTimeDiscretization ty=(TypeOfTimeDiscretization) tinyInfoI[i+2];
+ int sz1=tinyInfoI[i+sz+2];
+ int sz2=tinyInfoI[i+2*sz+2];
+ std::vector<int> tmp1(tinyInfoI.begin()+3*sz+2+offset1,tinyInfoI.begin()+3*sz+2+offset1+sz1);
+ std::vector<double> tmp2(tinyInfoD.begin()+offset2,tinyInfoD.begin()+offset2+sz2);
MEDCouplingDefinitionTimeSlice *pt=MEDCouplingDefinitionTimeSlice::New(ty,tmp1,tmp2);
_slices[i]=pt;
offset1+=sz1;
#ifndef __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__
#define __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__
-#include "MEDCoupling.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "MCAuto.hxx"
+#include "InterpKernelException.hxx"
-#include <ostream>
-#include <cstddef>
-#include <string>
#include <vector>
+#include <sstream>
namespace MEDCoupling
{
MEDCOUPLING_EXPORT virtual double getEndTime() const = 0;
MEDCOUPLING_EXPORT virtual void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const = 0;
MEDCOUPLING_EXPORT virtual TypeOfTimeDiscretization getTimeType() const = 0;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT bool isFullyIncludedInMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
MEDCOUPLING_EXPORT bool isOverllapingWithMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
MEDCOUPLING_EXPORT bool isAfterMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
public:
static MEDCouplingDefinitionTimeSliceInst *New(const std::vector<int>& tiI, const std::vector<double>& tiD);
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingDefinitionTimeSliceInst"); }
- MEDCouplingDefinitionTimeSlice *copy() const override;
- bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const override;
- void getHotSpotsTime(std::vector<double>& ret) const override;
- void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const override;
- bool isContaining(double tmp, double eps) const override;
- void appendRepr(std::ostream& stream) const override;
- double getStartTime() const override;
- double getEndTime() const override;
- void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const override;
+ MEDCouplingDefinitionTimeSlice *copy() const;
+ bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
+ void getHotSpotsTime(std::vector<double>& ret) const;
+ void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const;
+ bool isContaining(double tmp, double eps) const;
+ void appendRepr(std::ostream& stream) const;
+ double getStartTime() const;
+ double getEndTime() const;
+ void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const;
void unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD);
- TypeOfTimeDiscretization getTimeType() const override;
+ TypeOfTimeDiscretization getTimeType() const;
public:
MEDCouplingDefinitionTimeSliceInst(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId);
protected:
public:
static MEDCouplingDefinitionTimeSliceCstOnTI *New(const std::vector<int>& tiI, const std::vector<double>& tiD);
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingDefinitionTimeSliceCstOnTI"); }
- MEDCouplingDefinitionTimeSlice *copy() const override;
- bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const override;
- void getHotSpotsTime(std::vector<double>& ret) const override;
- void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const override;
- bool isContaining(double tmp, double eps) const override;
- void appendRepr(std::ostream& stream) const override;
- double getStartTime() const override;
- double getEndTime() const override;
- void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const override;
+ MEDCouplingDefinitionTimeSlice *copy() const;
+ bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
+ void getHotSpotsTime(std::vector<double>& ret) const;
+ void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const;
+ bool isContaining(double tmp, double eps) const;
+ void appendRepr(std::ostream& stream) const;
+ double getStartTime() const;
+ double getEndTime() const;
+ void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const;
void unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD);
- TypeOfTimeDiscretization getTimeType() const override;
+ TypeOfTimeDiscretization getTimeType() const;
public:
MEDCouplingDefinitionTimeSliceCstOnTI(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId);
protected:
public:
static MEDCouplingDefinitionTimeSliceLT *New(const std::vector<int>& tiI, const std::vector<double>& tiD);
std::string getClassName() const override { return std::string("MEDCouplingDefinitionTimeSliceLT"); }
- MEDCouplingDefinitionTimeSlice *copy() const override;
- bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const override;
- void getHotSpotsTime(std::vector<double>& ret) const override;
- void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const override;
- bool isContaining(double tmp, double eps) const override;
- void appendRepr(std::ostream& stream) const override;
- double getStartTime() const override;
- double getEndTime() const override;
- int getEndId() const override;
- void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const override;
+ MEDCouplingDefinitionTimeSlice *copy() const;
+ bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
+ void getHotSpotsTime(std::vector<double>& ret) const;
+ void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const;
+ bool isContaining(double tmp, double eps) const;
+ void appendRepr(std::ostream& stream) const;
+ double getStartTime() const;
+ double getEndTime() const;
+ int getEndId() const;
+ void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const;
void unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD);
- TypeOfTimeDiscretization getTimeType() const override;
+ TypeOfTimeDiscretization getTimeType() const;
public:
MEDCouplingDefinitionTimeSliceLT(const MEDCouplingFieldDouble *f, int meshId, int arrId, int arr2Id, int fieldId);
protected:
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingField.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
#include "MEDCouplingMesh.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingNatureOfField.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <set>
#include <sstream>
-#include <string>
-#include <vector>
using namespace MEDCoupling;
reason.insert(0,"Spatial discretizations differ :");
return false;
}
- if(_mesh==nullptr && other->_mesh==nullptr)
+ if(_mesh==0 && other->_mesh==0)
return true;
- if(_mesh==nullptr || other->_mesh==nullptr)
+ if(_mesh==0 || other->_mesh==0)
{
reason="Only one field between the two this and other has its underlying mesh defined !";
return false;
}
if(_mesh==other->_mesh)
return true;
- bool const ret=_mesh->isEqualIfNotWhy(other->_mesh,meshPrec,reason);
+ bool ret=_mesh->isEqualIfNotWhy(other->_mesh,meshPrec,reason);
if(!ret)
reason.insert(0,"Underlying meshes of fields differ for the following reason : ");
return ret;
return false;
if(_nature!=other->_nature)
return false;
- if(_mesh==nullptr && other->_mesh==nullptr)
+ if(_mesh==0 && other->_mesh==0)
return true;
- if(_mesh==nullptr || other->_mesh==nullptr)
+ if(_mesh==0 || other->_mesh==0)
return false;
if(_mesh==other->_mesh)
return true;
_mesh->decrRef();
}
-MEDCouplingField::MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature):_nature(nature),_mesh(nullptr),_type(type)
+MEDCouplingField::MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature):_nature(nature),_mesh(0),_type(type)
{
}
-MEDCouplingField::MEDCouplingField(TypeOfField type):_nature(NoNature),_mesh(nullptr),_type(MEDCouplingFieldDiscretization::New(type))
+MEDCouplingField::MEDCouplingField(TypeOfField type):_nature(NoNature),_mesh(0),_type(MEDCouplingFieldDiscretization::New(type))
{
}
MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy):RefCountObject(other),_name(other._name),_desc(other._desc),_nature(other._nature),
- _mesh(nullptr),_type(nullptr)
+ _mesh(0),_type(0)
{
if(other._mesh)
{
void MEDCouplingField::setDiscretization(MEDCouplingFieldDiscretization *newDisc)
{
- bool const needUpdate=(const MEDCouplingFieldDiscretization *)_type!=newDisc;
+ bool needUpdate=(const MEDCouplingFieldDiscretization *)_type!=newDisc;
_type=newDisc;
if(newDisc)
newDisc->incrRef();
#ifndef __PARAMEDMEM_MEDCOUPLINGFIELD_HXX__
#define __PARAMEDMEM_MEDCOUPLINGFIELD_HXX__
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
#include "MEDCouplingTimeLabel.hxx"
+#include "MEDCouplingNatureOfField.hxx"
#include "MEDCouplingRefCountObject.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "MCAuto.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
-#include "NormalizedGeometricTypes"
+#include "InterpKernelException.hxx"
-#include <set>
-#include <cstddef>
-#include <ostream>
#include <string>
#include <vector>
MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector<mcIdType>& cellIds) const;
MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
// for MED file RW
MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0;
MEDCOUPLING_EXPORT MEDCouplingField(TypeOfField type);
MEDCOUPLING_EXPORT MEDCouplingField(const MEDCouplingField& other, bool deepCopy=true);
MEDCOUPLING_EXPORT MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature=NoNature);
- MEDCOUPLING_EXPORT ~MEDCouplingField() override;
+ MEDCOUPLING_EXPORT virtual ~MEDCouplingField();
MEDCOUPLING_EXPORT bool isEqualIfNotWhyProtected(const MEDCouplingField *other, double meshPrec, std::string& reason) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStrProtected(const MEDCouplingField *other, double meshPrec) const;
protected:
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingFieldDiscretization.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MEDCouplingFieldDiscretizationOnNodesFE.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingGaussLocalization.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MCAuto.hxx"
#include "InterpKernelGaussCoords.hxx"
#include "InterpKernelMatrixTools.hxx"
#include "InterpKernelDenseMatrix.hxx"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <cmath>
-#include <cstdlib>
-#include <iterator>
-#include <ostream>
-#include <limits>
#include <set>
+#include <list>
+#include <limits>
#include <sstream>
#include <numeric>
#include <algorithm>
#include <functional>
-#include <string>
-#include <vector>
using namespace MEDCoupling;
/*!
* For all field discretization excepted GaussPts the [ \a startCellIds, \a endCellIds ) has no impact on the cloned instance.
*/
-MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePart(const mcIdType * /*startCellIds*/, const mcIdType * /*endCellIds*/) const
+MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const
{
return clone();
}
/*!
* For all field discretization excepted GaussPts the slice( \a beginCellId, \a endCellIds, \a stepCellId ) has no impact on the cloned instance.
*/
-MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePartRange(mcIdType /*beginCellIds*/, mcIdType /*endCellIds*/, mcIdType /*stepCellIds*/) const
+MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const
{
return clone();
}
void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
- std::size_t const nbOfCompo=arr->getNumberOfComponents();
- mcIdType const nbOfElems=getNumberOfTuples(mesh);
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
+ mcIdType nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr=arr->getConstPointer();
const double *volPtr=vol->getArray()->getConstPointer();
double deno=0.;
for(mcIdType i=0;i<nbOfElems;i++)
{
- double const v=fabs(volPtr[i]);
+ double v=fabs(volPtr[i]);
for(std::size_t j=0;j<nbOfCompo;j++)
res[j]+=fabs(arrPtr[i*nbOfCompo+j])*v;
deno+=v;
void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
- std::size_t const nbOfCompo=arr->getNumberOfComponents();
- mcIdType const nbOfElems=getNumberOfTuples(mesh);
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
+ mcIdType nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr=arr->getConstPointer();
const double *volPtr=vol->getArray()->getConstPointer();
double deno=0.;
for(mcIdType i=0;i<nbOfElems;i++)
{
- double const v=fabs(volPtr[i]);
+ double v=fabs(volPtr[i]);
for(std::size_t j=0;j<nbOfCompo;j++)
res[j]+=arrPtr[i*nbOfCompo+j]*arrPtr[i*nbOfCompo+j]*v;
deno+=v;
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::integral : input array is NULL !");
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,isWAbs);
- std::size_t const nbOfCompo(arr->getNumberOfComponents());
- mcIdType const nbOfElems(getNumberOfTuples(mesh));
+ std::size_t nbOfCompo(arr->getNumberOfComponents());
+ mcIdType nbOfElems(getNumberOfTuples(mesh));
if(nbOfElems!=arr->getNumberOfTuples())
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretization::integral : field is not correct ! number of tuples in array is " << arr->getNumberOfTuples();
*
* \sa MEDCouplingFieldDiscretization::buildSubMeshData
*/
-MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& /*beginOut*/, mcIdType& /*endOut*/, mcIdType& /*stepOut*/, DataArrayIdType *&di) const
+MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const
{
MCAuto<DataArrayIdType> da=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds);
return buildSubMeshData(mesh,da->begin(),da->end(),di);
void MEDCouplingFieldDiscretization::getSerializationIntArray(DataArrayIdType *& arr) const
{
- arr=nullptr;
+ arr=0;
}
/*!
{
}
-void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector<mcIdType>& /*tinyInfo*/, DataArrayIdType *& arr)
+void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *& arr)
{
- arr=nullptr;
+ arr=0;
}
/*!
{
}
-double MEDCouplingFieldDiscretization::getIJK(const MEDCouplingMesh * /*mesh*/, const DataArrayDouble * /*da*/, mcIdType /*cellId*/, mcIdType /*nodeIdInCell*/, int /*compoId*/) const
+double MEDCouplingFieldDiscretization::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const
{
throw INTERP_KERNEL::Exception("getIJK Invalid ! only for GaussPoint and GaussNE discretizations !");
}
-void MEDCouplingFieldDiscretization::setGaussLocalizationOnType(const MEDCouplingMesh * /*m*/, INTERP_KERNEL::NormalizedCellType /*type*/, const std::vector<double>& /*refCoo*/,
- const std::vector<double>& /*gsCoo*/, const std::vector<double>& /*wg*/)
+void MEDCouplingFieldDiscretization::setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
+ const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-void MEDCouplingFieldDiscretization::setGaussLocalizationOnCells(const MEDCouplingMesh * /*m*/, const mcIdType * /*begin*/, const mcIdType * /*end*/, const std::vector<double>& /*refCoo*/,
- const std::vector<double>& /*gsCoo*/, const std::vector<double>& /*wg*/)
+void MEDCouplingFieldDiscretization::setGaussLocalizationOnCells(const MEDCouplingMesh *m, const mcIdType *begin, const mcIdType *end, const std::vector<double>& refCoo,
+ const std::vector<double>& gsCoo, const std::vector<double>& wg)
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType /*locId*/)
+MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType locId)
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-const MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType /*locId*/) const
+const MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType locId) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneCell(mcIdType /*cellId*/) const
+mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneCell(mcIdType cellId) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType /*type*/) const
+mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-std::set<mcIdType> MEDCouplingFieldDiscretization::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType /*type*/) const
+std::set<mcIdType> MEDCouplingFieldDiscretization::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-void MEDCouplingFieldDiscretization::getCellIdsHavingGaussLocalization(mcIdType /*locId*/, std::vector<mcIdType>& /*cellIds*/) const
+void MEDCouplingFieldDiscretization::getCellIdsHavingGaussLocalization(mcIdType locId, std::vector<mcIdType>& cellIds) const
{
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
{
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !");
- mcIdType const oldNbOfElems=arr->getNumberOfTuples();
- std::size_t const nbOfComp=arr->getNumberOfComponents();
- mcIdType const newNbOfTuples=newNbOfEntity;
+ mcIdType oldNbOfElems=arr->getNumberOfTuples();
+ std::size_t nbOfComp=arr->getNumberOfComponents();
+ mcIdType newNbOfTuples=newNbOfEntity;
MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
arr->reAlloc(newNbOfTuples);
INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfComp];
for(mcIdType i=0;i<oldNbOfElems;i++)
{
- mcIdType const newNb=old2NewPtr[i];
+ mcIdType newNb=old2NewPtr[i];
if(newNb>=0)//if newNb<0 the node is considered as out.
{
if(std::find_if(ptToFill+newNb*nbOfComp,ptToFill+(newNb+1)*nbOfComp,std::bind(std::not_equal_to<double>(),std::placeholders::_1,std::numeric_limits<double>::max()))
}
}
-void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const mcIdType *new2OldPtr, mcIdType new2OldSz, DataArrayDouble *arr, const std::string& /*msg*/)
+void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const mcIdType *new2OldPtr, mcIdType new2OldSz, DataArrayDouble *arr, const std::string& msg)
{
- std::size_t const nbOfComp=arr->getNumberOfComponents();
+ std::size_t nbOfComp=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
arr->reAlloc(new2OldSz);
double *ptToFill=arr->getPointer();
for(mcIdType i=0;i<new2OldSz;i++)
{
- mcIdType const oldNb=new2OldPtr[i];
+ mcIdType oldNb=new2OldPtr[i];
std::copy(ptSrc+oldNb*nbOfComp,ptSrc+(oldNb+1)*nbOfComp,ptToFill+i*nbOfComp);
}
}
MEDCouplingFieldDiscretization::~MEDCouplingFieldDiscretization()
-= default;
+{
+}
TypeOfField MEDCouplingFieldDiscretizationP0::getEnum() const
{
return REPR;
}
-bool MEDCouplingFieldDiscretizationP0::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const
+bool MEDCouplingFieldDiscretizationP0::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
if(!other)
{
reason="other spatial discretization is NULL, and this spatial discretization (P0) is defined.";
return false;
}
- const auto *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationP0 *>(other);
- bool const ret=otherC!=nullptr;
+ const MEDCouplingFieldDiscretizationP0 *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationP0 *>(other);
+ bool ret=otherC!=0;
if(!ret)
reason="Spatial discrtization of this is ON_CELLS, which is not the case of other.";
return ret;
{
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
- mcIdType const nbOfSplit=ToIdType(idsPerType.size());
- mcIdType const nbOfTypes=ToIdType(code.size()/3);
+ mcIdType nbOfSplit=ToIdType(idsPerType.size());
+ mcIdType nbOfTypes=ToIdType(code.size()/3);
mcIdType ret=0;
for(mcIdType i=0;i<nbOfTypes;i++)
{
- mcIdType const nbOfEltInChunk=code[3*i+1];
+ mcIdType nbOfEltInChunk=code[3*i+1];
if(nbOfEltInChunk<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : invalid input code ! presence of negative value in a type !");
- mcIdType const pos=code[3*i+2];
+ mcIdType pos=code[3*i+2];
if(pos!=-1)
{
if(pos<0 || pos>=nbOfSplit)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getOffsetArr : NULL input mesh !");
- std::size_t const nbOfTuples=mesh->getNumberOfCells();
+ std::size_t nbOfTuples=mesh->getNumberOfCells();
DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(nbOfTuples+1,1);
ret->iota(0);
const mcIdType *array=old2NewBg;
if(check)
array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
- for(auto it : arrays)
+ for(std::vector<DataArray *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
{
- if(it)
- it->renumberInPlace(array);
+ if(*it)
+ (*it)->renumberInPlace(array);
}
if(check)
free(const_cast<mcIdType *>(array));
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOn : NULL input mesh !");
- mcIdType const id=mesh->getCellContainingPoint(loc,_precision);
+ mcIdType id=mesh->getCellContainingPoint(loc,_precision);
if(id==-1)
throw INTERP_KERNEL::Exception("Specified point is detected outside of mesh : unable to apply P0::getValueOn !");
arr->getTuple(id,res);
void MEDCouplingFieldDiscretizationP0::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const
{
- const auto *meshC=dynamic_cast<const MEDCouplingCMesh *>(mesh);
+ const MEDCouplingCMesh *meshC=dynamic_cast<const MEDCouplingCMesh *>(mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("P0::getValueOnPos is only accessible for structured meshes !");
- mcIdType const id=meshC->getCellIdFromPos(i,j,k);
+ mcIdType id=meshC->getCellIdFromPos(i,j,k);
arr->getTuple(id,res);
}
MCAuto<DataArrayIdType> eltsArr,eltsIndexArr;
mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr);
const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
- int const spaceDim=mesh->getSpaceDimension();
- std::size_t const nbOfComponents=arr->getNumberOfComponents();
+ int spaceDim=mesh->getSpaceDimension();
+ std::size_t nbOfComponents=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfPoints,nbOfComponents);
double *ptToFill=ret->getPointer();
{
}
-void MEDCouplingFieldDiscretizationP0::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh * /*mesh*/, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationP0::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const
{
RenumberEntitiesFromO2NArr(epsOnVals,old2New,newSz,arr,"Cell");
}
-void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingMesh * /*mesh*/, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const
{
RenumberEntitiesFromN2OArr(new2old,newSz,arr,"Cell");
}
* \return a newly allocated array containing ids to select into the DataArrayDouble of the field.
*
*/
-DataArrayIdType *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh * /*mesh*/, const mcIdType *startCellIds, const mcIdType *endCellIds) const
+DataArrayIdType *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const
{
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(std::distance(startCellIds,endCellIds),1);
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange : NULL input mesh !");
MCAuto<MEDCouplingMesh> ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds);
- di=nullptr; beginOut=beginCellIds; endOut=endCellIds; stepOut=stepCellIds;
+ di=0; beginOut=beginCellIds; endOut=endCellIds; stepOut=stepCellIds;
return ret.retn();
}
{
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
- mcIdType const nbOfSplit=ToIdType(idsPerType.size());
- mcIdType const nbOfTypes=ToIdType(code.size()/3);
+ mcIdType nbOfSplit=ToIdType(idsPerType.size());
+ mcIdType nbOfTypes=ToIdType(code.size()/3);
mcIdType ret=0;
for(mcIdType i=0;i<nbOfTypes;i++)
{
- mcIdType const nbOfEltInChunk=code[3*i+1];
+ mcIdType nbOfEltInChunk=code[3*i+1];
if(nbOfEltInChunk<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : invalid input code ! presence of negative value in a type !");
- mcIdType const pos=code[3*i+2];
+ mcIdType pos=code[3*i+2];
if(pos!=-1)
{
if(pos<0 || pos>=nbOfSplit)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getOffsetArr : NULL input mesh !");
- mcIdType const nbOfTuples=mesh->getNumberOfNodes();
+ mcIdType nbOfTuples=mesh->getNumberOfNodes();
DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(nbOfTuples+1,1);
ret->iota(0);
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : NULL input mesh !");
MCAuto<DataArrayIdType> ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd);
- const auto *meshc=dynamic_cast<const MEDCouplingUMesh *>(mesh);
+ const MEDCouplingUMesh *meshc=dynamic_cast<const MEDCouplingUMesh *>(mesh);
if(!meshc)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : trying to subpart field on nodes by node ids ! Your mesh has to be unstructured !");
MCAuto<MEDCouplingUMesh> meshPart=static_cast<MEDCouplingUMesh *>(meshc->buildPartOfMySelf(ret1->begin(),ret1->end(),true));
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::buildSubMeshData : NULL input mesh !");
- DataArrayIdType *diTmp=nullptr;
+ DataArrayIdType *diTmp=0;
MCAuto<MEDCouplingMesh> ret=mesh->buildPartAndReduceNodes(start,end,diTmp);
MCAuto<DataArrayIdType> diTmpSafe(diTmp);
MCAuto<DataArrayIdType> di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes());
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange : NULL input mesh !");
- DataArrayIdType *diTmp=nullptr;
+ DataArrayIdType *diTmp=0;
MCAuto<MEDCouplingMesh> ret=mesh->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,diTmp);
if(diTmp)
{
void MEDCouplingFieldDiscretizationOnNodes::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const
{
- const auto *meshC=dynamic_cast<const MEDCouplingCMesh *>(mesh);
+ const MEDCouplingCMesh *meshC=dynamic_cast<const MEDCouplingCMesh *>(mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("OnNodes::getValueOnPos(i,j,k) is only accessible for structured meshes !");
- mcIdType const id=meshC->getNodeIdFromPos(i,j,k);
+ mcIdType id=meshC->getNodeIdFromPos(i,j,k);
arr->getTuple(id,res);
}
return REPR;
}
-bool MEDCouplingFieldDiscretizationP1::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const
+bool MEDCouplingFieldDiscretizationP1::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
if(!other)
{
reason="other spatial discretization is NULL, and this spatial discretization (P1) is defined.";
return false;
}
- const auto *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationP1 *>(other);
- bool const ret=otherC!=nullptr;
+ const MEDCouplingFieldDiscretizationP1 *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationP1 *>(other);
+ bool ret=otherC!=0;
if(!ret)
reason="Spatial discrtization of this is ON_NODES, which is not the case of other.";
return ret;
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueOn : NULL input mesh !");
- mcIdType const id=mesh->getCellContainingPoint(loc,_precision);
+ mcIdType id=mesh->getCellContainingPoint(loc,_precision);
if(id==-1)
throw INTERP_KERNEL::Exception("Specified point is detected outside of mesh : unable to apply P1::getValueOn !");
- INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(id);
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(id);
if(type!=INTERP_KERNEL::NORM_SEG2 && type!=INTERP_KERNEL::NORM_TRI3 && type!=INTERP_KERNEL::NORM_TETRA4)
throw INTERP_KERNEL::Exception("P1 getValueOn is not specified for not simplex cells !");
getValueInCell(mesh,id,arr,loc,res);
std::vector<mcIdType> conn;
std::vector<double> coo;
mesh->getNodeIdsOfCell(cellId,conn);
- for(long const iter : conn)
- mesh->getCoordinatesOfNode(iter,coo);
- int const spaceDim=mesh->getSpaceDimension();
- std::size_t const nbOfNodes=conn.size();
+ for(std::vector<mcIdType>::const_iterator iter=conn.begin();iter!=conn.end();iter++)
+ mesh->getCoordinatesOfNode(*iter,coo);
+ int spaceDim=mesh->getSpaceDimension();
+ std::size_t nbOfNodes=conn.size();
std::vector<const double *> vec(nbOfNodes);
for(std::size_t i=0;i<nbOfNodes;i++)
vec[i]=&coo[i*spaceDim];
INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfNodes];
- INTERP_KERNEL::NormalizedCellType const ct(mesh->getTypeOfCell(cellId));
+ INTERP_KERNEL::NormalizedCellType ct(mesh->getTypeOfCell(cellId));
INTERP_KERNEL::barycentric_coords(ct,vec,loc,tmp);
- std::size_t const sz=arr->getNumberOfComponents();
+ std::size_t sz=arr->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> tmp2=new double[sz];
std::fill(res,res+sz,0.);
for(std::size_t i=0;i<nbOfNodes;i++)
MCAuto<DataArrayIdType> eltsArr,eltsIndexArr;
mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr);
const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
- int const spaceDim=mesh->getSpaceDimension();
- std::size_t const nbOfComponents=arr->getNumberOfComponents();
+ int spaceDim=mesh->getSpaceDimension();
+ std::size_t nbOfComponents=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfPoints,nbOfComponents);
double *ptToFill=ret->getPointer();
return EasyAggregate<MEDCouplingFieldDiscretizationP1>(fds);
}
-MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell():_discr_per_cell(nullptr)
+MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell():_discr_per_cell(0)
{
}
/*!
* This constructor deep copies MEDCoupling::DataArrayIdType instance from other (if any).
*/
-MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds):_discr_per_cell(nullptr)
+MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds):_discr_per_cell(0)
{
DataArrayIdType *arr=other._discr_per_cell;
if(arr)
{
- if(startCellIds==nullptr && endCellIds==nullptr)
+ if(startCellIds==0 && endCellIds==0)
_discr_per_cell=arr->deepCopy();
else
_discr_per_cell=arr->selectByTupleIdSafe(startCellIds,endCellIds);
}
}
-MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds):_discr_per_cell(nullptr)
+MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds):_discr_per_cell(0)
{
DataArrayIdType *arr=other._discr_per_cell;
if(arr)
std::size_t MEDCouplingFieldDiscretizationPerCell::getHeapMemorySizeWithoutChildren() const
{
- std::size_t const ret(MEDCouplingFieldDiscretization::getHeapMemorySizeWithoutChildren());
+ std::size_t ret(MEDCouplingFieldDiscretization::getHeapMemorySizeWithoutChildren());
return ret;
}
return ret;
}
-void MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray * /*da*/) const
+void MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has no discretization per cell !");
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween : NULL input mesh or DataArray !");
- mcIdType const nbOfTuples(_discr_per_cell->getNumberOfTuples());
+ mcIdType nbOfTuples(_discr_per_cell->getNumberOfTuples());
if(nbOfTuples!=mesh->getNumberOfCells())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has a discretization per cell but it's not matching the underlying mesh !");
}
-bool MEDCouplingFieldDiscretizationPerCell::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const
+bool MEDCouplingFieldDiscretizationPerCell::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
if(!other)
{
reason="other spatial discretization is NULL, and this spatial discretization (PerCell) is defined.";
return false;
}
- const auto *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationPerCell *>(other);
+ const MEDCouplingFieldDiscretizationPerCell *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationPerCell *>(other);
if(!otherC)
{
reason="Spatial discretization of this is ON_GAUSS, which is not the case of other.";
return false;
}
- if(_discr_per_cell==nullptr)
- return otherC->_discr_per_cell==nullptr;
- if(otherC->_discr_per_cell==nullptr)
+ if(_discr_per_cell==0)
+ return otherC->_discr_per_cell==0;
+ if(otherC->_discr_per_cell==0)
return false;
- bool const ret=_discr_per_cell->isEqualIfNotWhy(*otherC->_discr_per_cell,reason);
+ bool ret=_discr_per_cell->isEqualIfNotWhy(*otherC->_discr_per_cell,reason);
if(!ret)
reason.insert(0,"Field discretization per cell DataArrayIdType given the discid per cell :");
return ret;
}
-bool MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double /*eps*/) const
+bool MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationPerCell *>(other);
+ const MEDCouplingFieldDiscretizationPerCell *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationPerCell *>(other);
if(!otherC)
return false;
- if(_discr_per_cell==nullptr)
- return otherC->_discr_per_cell==nullptr;
- if(otherC->_discr_per_cell==nullptr)
+ if(_discr_per_cell==0)
+ return otherC->_discr_per_cell==0;
+ if(otherC->_discr_per_cell==0)
return false;
return _discr_per_cell->isEqualWithoutConsideringStr(*otherC->_discr_per_cell);
}
*/
void MEDCouplingFieldDiscretizationPerCell::renumberCells(const mcIdType *old2NewBg, bool check)
{
- mcIdType const nbCells=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbCells=_discr_per_cell->getNumberOfTuples();
const mcIdType *array=old2NewBg;
if(check)
array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells);
if(!_discr_per_cell)
{
_discr_per_cell=DataArrayIdType::New();
- mcIdType const nbTuples=mesh->getNumberOfCells();
+ mcIdType nbTuples=mesh->getNumberOfCells();
_discr_per_cell->alloc(nbTuples,1);
mcIdType *ptr=_discr_per_cell->getPointer();
std::fill(ptr,ptr+nbTuples,DFT_INVALID_LOCID_VALUE);
}
MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss()
-= default;
+{
+}
MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const mcIdType *startCellIds, const mcIdType *endCellIds):MEDCouplingFieldDiscretizationPerCell(other,startCellIds,endCellIds),_loc(other._loc)
{
reason="other spatial discretization is NULL, and this spatial discretization (Gauss) is defined.";
return false;
}
- const auto *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(other);
+ const MEDCouplingFieldDiscretizationGauss *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(other);
if(!otherC)
{
reason="Spatial discrtization of this is ON_GAUSS, which is not the case of other.";
reason="Gauss spatial discretization : localization sizes differ";
return false;
}
- std::size_t const sz=_loc.size();
+ std::size_t sz=_loc.size();
for(std::size_t i=0;i<sz;i++)
if(!_loc[i].isEqual(otherC->_loc[i],eps))
{
bool MEDCouplingFieldDiscretizationGauss::isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(other);
+ const MEDCouplingFieldDiscretizationGauss *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(other);
if(!otherC)
return false;
if(!MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(other,eps))
return false;
if(_loc.size()!=otherC->_loc.size())
return false;
- std::size_t const sz=_loc.size();
+ std::size_t sz=_loc.size();
for(std::size_t i=0;i<sz;i++)
if(!_loc[i].isEqual(otherC->_loc[i],eps))
return false;
}
oss << "Presence of " << _loc.size() << " localizations." << std::endl;
int i=0;
- for(auto it=_loc.begin();it!=_loc.end();it++,i++)
+ for(std::vector<MEDCouplingGaussLocalization>::const_iterator it=_loc.begin();it!=_loc.end();it++,i++)
{
oss << "+++++ Localization #" << i << " +++++" << std::endl;
oss << (*it).getStringRepr();
{
std::size_t ret(MEDCouplingFieldDiscretizationPerCell::getHeapMemorySizeWithoutChildren());
ret+=_loc.capacity()*sizeof(MEDCouplingGaussLocalization);
- for(const auto & it : _loc)
- ret+=it.getMemorySize();
+ for(std::vector<MEDCouplingGaussLocalization>::const_iterator it=_loc.begin();it!=_loc.end();it++)
+ ret+=(*it).getMemorySize();
return ret;
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode");
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
- mcIdType const nbOfSplit=ToIdType(idsPerType.size());
- mcIdType const nbOfTypes=ToIdType(code.size()/3);
+ mcIdType nbOfSplit=ToIdType(idsPerType.size());
+ mcIdType nbOfTypes=ToIdType(code.size()/3);
mcIdType ret(0);
for(mcIdType i=0;i<nbOfTypes;i++)
{
- mcIdType const nbOfEltInChunk=code[3*i+1];
+ mcIdType nbOfEltInChunk=code[3*i+1];
if(nbOfEltInChunk<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : invalid input code ! presence of negative value in a type !");
- mcIdType const pos=code[3*i+2];
+ mcIdType pos=code[3*i+2];
if(pos!=-1)
{
if(pos<0 || pos>=nbOfSplit)
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : input code points to " << ret << " cells whereas discretization percell array lgth is " << _discr_per_cell->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- return getNumberOfTuples(nullptr);//0 is not an error ! It is to be sure that input mesh is not used
+ return getNumberOfTuples(0);//0 is not an error ! It is to be sure that input mesh is not used
}
mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfTuples(const MEDCouplingMesh *) const
{
mcIdType ret=0;
- if (_discr_per_cell == nullptr)
+ if (_discr_per_cell == 0)
throw INTERP_KERNEL::Exception("Discretization is not initialized!");
const mcIdType *dcPtr=_discr_per_cell->getConstPointer();
- mcIdType const nbOfTuples=_discr_per_cell->getNumberOfTuples();
- mcIdType const maxSz=ToIdType(_loc.size());
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType maxSz=ToIdType(_loc.size());
for(const mcIdType *w=dcPtr;w!=dcPtr+nbOfTuples;w++)
{
if(*w>=0 && *w<maxSz)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : NULL input mesh !");
- mcIdType const nbOfTuples=mesh->getNumberOfCells();
+ mcIdType nbOfTuples=mesh->getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfTuples+1,1);
mcIdType *retPtr(ret->getPointer());
const mcIdType *start(_discr_per_cell->begin());
if(_discr_per_cell->getNumberOfTuples()!=nbOfTuples)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : mismatch between the mesh and the discretization ids array length !");
- mcIdType const maxPossible=ToIdType(_loc.size());
+ mcIdType maxPossible=ToIdType(_loc.size());
retPtr[0]=0;
for(mcIdType i=0;i<nbOfTuples;i++,start++)
{
const mcIdType *array=old2NewBg;
if(check)
array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
- mcIdType const nbOfCells=_discr_per_cell->getNumberOfTuples();
- mcIdType const nbOfTuples=getNumberOfTuples(nullptr);
+ mcIdType nbOfCells=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples(0);
const mcIdType *dcPtr=_discr_per_cell->getConstPointer();
- auto *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
- auto *array3=new mcIdType[nbOfCells];//store for each cell in present dcp array (already renumbered) the offset needed by each cell in new numbering.
+ mcIdType *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
+ mcIdType *array3=new mcIdType[nbOfCells];//store for each cell in present dcp array (already renumbered) the offset needed by each cell in new numbering.
array3[0]=0;
for(mcIdType i=1;i<nbOfCells;i++)
array3[i]=array3[i-1]+_loc[dcPtr[i-1]].getNumberOfGaussPt();
mcIdType j=0;
for(mcIdType i=0;i<nbOfCells;i++)
{
- mcIdType const nbOfGaussPt=_loc[dcPtr[array[i]]].getNumberOfGaussPt();
+ mcIdType nbOfGaussPt=_loc[dcPtr[array[i]]].getNumberOfGaussPt();
for(mcIdType k=0;k<nbOfGaussPt;k++,j++)
array2[j]=array3[array[i]]+k;
}
delete [] array3;
- for(auto array : arrays)
- if(array)
- array->renumberInPlace(array2);
+ for(std::vector<DataArray *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
+ if(*it)
+ (*it)->renumberInPlace(array2);
delete [] array2;
if(check)
free(const_cast<mcIdType*>(array));
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues : NULL input mesh !");
checkNoOrphanCells();
MCAuto<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
- mcIdType const nbOfTuples=getNumberOfTuples(mesh);
+ mcIdType nbOfTuples=getNumberOfTuples(mesh);
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int const spaceDim=mesh->getSpaceDimension();
+ int spaceDim=mesh->getSpaceDimension();
ret->alloc(nbOfTuples,spaceDim);
std::vector< mcIdType > locIds;
std::vector<DataArrayIdType *> parts=splitIntoSingleGaussDicrPerCellType(locIds);
INTERP_KERNEL::GaussCoords calculator;
//
const MEDCouplingGaussLocalization& cli(_loc[locIds[i]]);//curLocInfo
- INTERP_KERNEL::NormalizedCellType const typ(cli.getType());
+ INTERP_KERNEL::NormalizedCellType typ(cli.getType());
const std::vector<double>& wg(cli.getWeights());
calculator.addGaussInfo(typ,INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension(),
&cli.getGaussCoords()[0],ToIdType(wg.size()),&cli.getRefCoords()[0],
INTERP_KERNEL::CellModel::GetCellModel(typ).getNumberOfNodes());
//
- for(long const w : *parts2[i])
- calculator.calculateCoords(cli.getType(),coords,spaceDim,conn+connI[w]+1,valsToFill+spaceDim*(ptrOffsets[w]));
+ for(const mcIdType *w=parts2[i]->begin();w!=parts2[i]->end();w++)
+ calculator.calculateCoords(cli.getType(),coords,spaceDim,conn+connI[*w]+1,valsToFill+spaceDim*(ptrOffsets[*w]));
}
ret->copyStringInfoFrom(*umesh->getCoords());
return ret.retn();
tinyInfo.push_back(-1);
else
tinyInfo.push_back(_loc[0].getDimension());
- for(const auto & iter : _loc)
- iter.pushTinySerializationIntInfo(tinyInfo);
+ for(std::vector<MEDCouplingGaussLocalization>::const_iterator iter=_loc.begin();iter!=_loc.end();iter++)
+ (*iter).pushTinySerializationIntInfo(tinyInfo);
}
void MEDCouplingFieldDiscretizationGauss::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
{
- for(const auto & iter : _loc)
- iter.pushTinySerializationDblInfo(tinyInfo);
+ for(std::vector<MEDCouplingGaussLocalization>::const_iterator iter=_loc.begin();iter!=_loc.end();iter++)
+ (*iter).pushTinySerializationDblInfo(tinyInfo);
}
void MEDCouplingFieldDiscretizationGauss::getSerializationIntArray(DataArrayIdType *& arr) const
{
- arr=nullptr;
+ arr=0;
if(_discr_per_cell)
arr=_discr_per_cell;
}
void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *& arr)
{
- mcIdType const val=tinyInfo[0];
+ mcIdType val=tinyInfo[0];
if(val>=0)
{
_discr_per_cell=DataArrayIdType::New();
_discr_per_cell->alloc(val,1);
}
else
- _discr_per_cell=nullptr;
+ _discr_per_cell=0;
arr=_discr_per_cell;
commonUnserialization(tinyInfo);
}
void MEDCouplingFieldDiscretizationGauss::checkForUnserialization(const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *arr)
{
static const char MSG[]="MEDCouplingFieldDiscretizationGauss::checkForUnserialization : expect to have one not null DataArrayIdType !";
- mcIdType const val=tinyInfo[0];
+ mcIdType val=tinyInfo[0];
if(val>=0)
{
if(!arr)
_discr_per_cell->incrRef();
}
else
- _discr_per_cell=nullptr;
+ _discr_per_cell=0;
commonUnserialization(tinyInfo);
}
void MEDCouplingFieldDiscretizationGauss::finishUnserialization(const std::vector<double>& tinyInfo)
{
- auto *tmp=new double[tinyInfo.size()];
+ double *tmp=new double[tinyInfo.size()];
std::copy(tinyInfo.begin(),tinyInfo.end(),tmp);
const double *work=tmp;
- for(auto & iter : _loc)
- work=iter.fillWithValues(work);
+ for(std::vector<MEDCouplingGaussLocalization>::iterator iter=_loc.begin();iter!=_loc.end();iter++)
+ work=(*iter).fillWithValues(work);
delete [] tmp;
}
-double MEDCouplingFieldDiscretizationGauss::getIJK(const MEDCouplingMesh * /*mesh*/, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const
+double MEDCouplingFieldDiscretizationGauss::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const
{
- mcIdType const offset=getOffsetOfCell(cellId);
+ mcIdType offset=getOffsetOfCell(cellId);
return da->getIJ(offset+nodeIdInCell,compoId);
}
if(!mesh || !da)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween : NULL input mesh or DataArray !");
MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da);
- for(const auto & iter : _loc)
- iter.checkConsistencyLight();
- mcIdType const nbOfDesc=ToIdType(_loc.size());
- mcIdType const nbOfCells=mesh->getNumberOfCells();
+ for(std::vector<MEDCouplingGaussLocalization>::const_iterator iter=_loc.begin();iter!=_loc.end();iter++)
+ (*iter).checkConsistencyLight();
+ mcIdType nbOfDesc=ToIdType(_loc.size());
+ mcIdType nbOfCells=mesh->getNumberOfCells();
const mcIdType *dc=_discr_per_cell->getConstPointer();
for(mcIdType i=0;i<nbOfCells;i++)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- mcIdType const nbOfTuples(getNumberOfTuples(mesh));
+ mcIdType nbOfTuples(getNumberOfTuples(mesh));
if(nbOfTuples!=da->getNumberOfTuples())
{
std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " having " << da->getNumberOfTuples() << " !";
}
}
-MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(const MEDCouplingMesh *mesh, bool /*isAbs*/) const
+MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : mesh instance specified is NULL !");
ret->setArray(arr);
double *arrPtr=arr->getPointer();
const mcIdType *offsetPtr=offset->getConstPointer();
- mcIdType const maxGaussLoc=ToIdType(_loc.size());
+ mcIdType maxGaussLoc=ToIdType(_loc.size());
std::vector<mcIdType> locIds;
std::vector<DataArrayIdType *> ids=splitIntoSingleGaussDicrPerCellType(locIds);
std::vector< MCAuto<DataArrayIdType> > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin());
for(std::size_t i=0;i<locIds.size();i++)
{
const DataArrayIdType *curIds=ids[i];
- mcIdType const locId=locIds[i];
+ mcIdType locId=locIds[i];
if(locId>=0 && locId<maxGaussLoc)
{
const MEDCouplingGaussLocalization& loc=_loc[locId];
- mcIdType const nbOfGaussPt=loc.getNumberOfGaussPt();
- INTERP_KERNEL::AutoPtr<double> const weights=new double[nbOfGaussPt];
- for(long const curId : *curIds)
+ mcIdType nbOfGaussPt=loc.getNumberOfGaussPt();
+ INTERP_KERNEL::AutoPtr<double> weights=new double[nbOfGaussPt];
+ for(const mcIdType *cellId=curIds->begin();cellId!=curIds->end();cellId++)
{
std::vector<mcIdType> conn;
- umesh->getNodeIdsOfCell(curId,conn);
+ umesh->getNodeIdsOfCell(*cellId,conn);
std::vector<double> ptsInCell; ptsInCell.reserve(conn.size()*loc.getDimension());
std::for_each( conn.cbegin(), conn.cend(), [spaceDim,coordsOfMesh,&ptsInCell](mcIdType c) { ptsInCell.insert(ptsInCell.end(),coordsOfMesh+c*spaceDim,coordsOfMesh+(c+1)*spaceDim); } );
- std::size_t const nbPtsInCell(ptsInCell.size()/spaceDim);
+ std::size_t nbPtsInCell(ptsInCell.size()/spaceDim);
INTERP_KERNEL::DenseMatrix jacobian(spaceDim,meshDim);
MCAuto<DataArrayDouble> shapeFunc = loc.getDerivativeOfShapeFunctionValues();
for(mcIdType iGPt = 0 ; iGPt < nbOfGaussPt ; ++iGPt)
res += ptsInCell[spaceDim*k+i] * shapeFunc->getIJ(iGPt,meshDim*k+j);
jacobian[ i ][ j ] = res;
}
- arrPtr[offsetPtr[curId]+iGPt]=std::abs( jacobian.toJacobian() )*loc.getWeight(FromIdType<int>(iGPt));
+ arrPtr[offsetPtr[*cellId]+iGPt]=std::abs( jacobian.toJacobian() )*loc.getWeight(FromIdType<int>(iGPt));
}
}
}
return ret.retn();
}
-void MEDCouplingFieldDiscretizationGauss::getValueOn(const DataArrayDouble * /*arr*/, const MEDCouplingMesh * /*mesh*/, const double * /*loc*/, double * /*res*/) const
+void MEDCouplingFieldDiscretizationGauss::getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-void MEDCouplingFieldDiscretizationGauss::getValueOnPos(const DataArrayDouble * /*arr*/, const MEDCouplingMesh * /*mesh*/, mcIdType /*i*/, mcIdType /*j*/, mcIdType /*k*/, double * /*res*/) const
+void MEDCouplingFieldDiscretizationGauss::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const
{
throw INTERP_KERNEL::Exception("getValueOnPos(i,j,k) : Not applicable for Gauss points !");
}
-DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getValueOnMulti(const DataArrayDouble * /*arr*/, const MEDCouplingMesh * /*mesh*/, const double * /*loc*/, mcIdType /*nbOfPoints*/) const
+DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const
{
throw INTERP_KERNEL::Exception("getValueOnMulti : Not implemented yet for gauss points !");
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : NULL input mesh !");
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : no discretization array set !");
- di=nullptr; beginOut=0; endOut=0; stepOut=stepCellIds;
+ di=0; beginOut=0; endOut=0; stepOut=stepCellIds;
const char msg[]="MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : cell #";
- mcIdType const nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
const mcIdType *w=_discr_per_cell->begin();
- mcIdType const nbMaxOfLocId=ToIdType(_loc.size());
+ mcIdType nbMaxOfLocId=ToIdType(_loc.size());
for(mcIdType i=0;i<nbOfTuples;i++,w++)
{
if(*w!=DFT_INVALID_LOCID_VALUE)
{
if(*w>=0 && *w<nbMaxOfLocId)
{
- mcIdType const delta=_loc[*w].getNumberOfGaussPt();
+ mcIdType delta=_loc[*w].getNumberOfGaussPt();
if(i<beginCellIds)
beginOut+=delta;
endOut+=delta;
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : null mesh !");
MCAuto<DataArrayIdType> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer
- mcIdType const nbOfCells(mesh->getNumberOfCells());
+ mcIdType nbOfCells(mesh->getNumberOfCells());
if(_discr_per_cell->getNumberOfTuples()!=nbOfCells)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : mismatch of nb of tuples of cell ids array and number of cells !");
nbOfNodesPerCell->computeOffsetsFull();
{
}
-void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCells(double /*epsOnVals*/, const MEDCouplingMesh * /*mesh*/, const mcIdType * /*old2New*/, mcIdType /*newSz*/, DataArrayDouble * /*arr*/) const
+void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCellsR(const MEDCouplingMesh * /*mesh*/, const mcIdType * /*new2old*/, mcIdType /*newSz*/, DataArrayDouble * /*arr*/) const
+void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Number of cells has changed and becomes higher with some cells that have been split ! Unable to conserve the Gauss field !");
}
std::size_t i(0);
for(auto it=fds.begin();it!=fds.end();++it,++i)
{
- const auto *itc(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(*it));
+ const MEDCouplingFieldDiscretizationGauss *itc(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(*it));
if(!itc)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : same field discretization expected for all input discretizations !");
//
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
buildDiscrPerCellIfNecessary(mesh);
- mcIdType const id=ToIdType(_loc.size());
- MEDCouplingGaussLocalization const elt(type,refCoo,gsCoo,wg);
+ mcIdType id=ToIdType(_loc.size());
+ MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg);
_loc.push_back(elt);
mcIdType *ptr=_discr_per_cell->getPointer();
- mcIdType const nbCells=mesh->getNumberOfCells();
+ mcIdType nbCells=mesh->getNumberOfCells();
for(mcIdType i=0;i<nbCells;i++)
if(mesh->getTypeOfCell(i)==type)
ptr[i]=id;
buildDiscrPerCellIfNecessary(mesh);
if(std::distance(begin,end)<1)
throw INTERP_KERNEL::Exception("Size of [begin,end) must be equal or greater than 1 !");
- INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(*begin);
- MEDCouplingGaussLocalization const elt(type,refCoo,gsCoo,wg);
- mcIdType const id=ToIdType(_loc.size());
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(*begin);
+ MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg);
+ mcIdType id=ToIdType(_loc.size());
mcIdType *ptr=_discr_per_cell->getPointer();
for(const mcIdType *w=begin+1;w!=end;w++)
{
if(_discr_per_cell)
{
_discr_per_cell->decrRef();
- _discr_per_cell=nullptr;
+ _discr_per_cell=0;
}
_loc.clear();
}
{
if(locId<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalization : localization id has to be >=0 !");
- mcIdType const sz=ToIdType(_loc.size());
- MEDCouplingGaussLocalization const gLoc(INTERP_KERNEL::NORM_ERROR);
+ mcIdType sz=ToIdType(_loc.size());
+ MEDCouplingGaussLocalization gLoc(INTERP_KERNEL::NORM_ERROR);
if(locId>=sz)
_loc.resize(locId+1,gLoc);
_loc[locId]=loc;
{
if(newSz<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector : new size has to be >=0 !");
- MEDCouplingGaussLocalization const gLoc(INTERP_KERNEL::NORM_ERROR);
+ MEDCouplingGaussLocalization gLoc(INTERP_KERNEL::NORM_ERROR);
_loc.resize(newSz,gLoc);
}
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("No Gauss localization still set !");
- mcIdType const locId=_discr_per_cell->begin()[cellId];
+ mcIdType locId=_discr_per_cell->begin()[cellId];
if(locId<0)
throw INTERP_KERNEL::Exception("No Gauss localization set for the specified cell !");
return locId;
mcIdType MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const
{
- std::set<mcIdType> const ret=getGaussLocalizationIdsOfOneType(type);
+ std::set<mcIdType> ret=getGaussLocalizationIdsOfOneType(type);
if(ret.empty())
throw INTERP_KERNEL::Exception("No gauss discretization found for the specified type !");
if(ret.size()>1)
throw INTERP_KERNEL::Exception("No Gauss localization still set !");
std::set<mcIdType> ret;
mcIdType id=0;
- for(auto iter=_loc.begin();iter!=_loc.end();iter++,id++)
+ for(std::vector<MEDCouplingGaussLocalization>::const_iterator iter=_loc.begin();iter!=_loc.end();iter++,id++)
if((*iter).getType()==type)
ret.insert(id);
return ret;
{
if(locId<0 || locId>=ToIdType(_loc.size()))
throw INTERP_KERNEL::Exception("Invalid locId given : must be in range [0:getNbOfGaussLocalization()) !");
- mcIdType const nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
const mcIdType *ptr=_discr_per_cell->getConstPointer();
for(mcIdType i=0;i<nbOfTuples;i++)
if(ptr[i]==locId)
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField : no discretization array set !");
- mcIdType const nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
const mcIdType *w=_discr_per_cell->begin();
ret->alloc(nbOfTuples,1);
mcIdType *valsToFill=ret->getPointer();
- mcIdType const nbMaxOfLocId=ToIdType(_loc.size());
+ mcIdType nbMaxOfLocId=ToIdType(_loc.size());
for(mcIdType i=0;i<nbOfTuples;i++,w++)
if(*w!=DFT_INVALID_LOCID_VALUE)
{
void MEDCouplingFieldDiscretizationGauss::zipGaussLocalizations()
{
const mcIdType *start=_discr_per_cell->begin();
- mcIdType const nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[_loc.size()];
std::fill((mcIdType *)tmp,(mcIdType *)tmp+_loc.size(),-2);
for(const mcIdType *w=start;w!=start+nbOfTuples;w++)
void MEDCouplingFieldDiscretizationGauss::commonUnserialization(const std::vector<mcIdType>& tinyInfo)
{
- mcIdType const nbOfLoc=tinyInfo[1];
+ mcIdType nbOfLoc=tinyInfo[1];
_loc.clear();
- mcIdType const dim=tinyInfo[2];
+ mcIdType dim=tinyInfo[2];
mcIdType delta=-1;
if(nbOfLoc>0)
delta=(ToIdType(tinyInfo.size())-3)/nbOfLoc;
for(mcIdType i=0;i<nbOfLoc;i++)
{
- std::vector<mcIdType> const tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta);
- MEDCouplingGaussLocalization const elt=MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(dim,tmp);
+ std::vector<mcIdType> tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta);
+ MEDCouplingGaussLocalization elt=MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(dim,tmp);
_loc.push_back(elt);
}
}
MEDCouplingFieldDiscretizationGaussNE::MEDCouplingFieldDiscretizationGaussNE()
-= default;
+{
+}
TypeOfField MEDCouplingFieldDiscretizationGaussNE::getEnum() const
{
return REPR;
}
-bool MEDCouplingFieldDiscretizationGaussNE::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const
+bool MEDCouplingFieldDiscretizationGaussNE::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
if(!other)
{
reason="other spatial discretization is NULL, and this spatial discretization (GaussNE) is defined.";
return false;
}
- const auto *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationGaussNE *>(other);
- bool const ret=otherC!=nullptr;
+ const MEDCouplingFieldDiscretizationGaussNE *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationGaussNE *>(other);
+ bool ret=otherC!=0;
if(!ret)
reason="Spatial discrtization of this is ON_GAUSS_NE, which is not the case of other.";
return ret;
{
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
- mcIdType const nbOfSplit=ToIdType(idsPerType.size());
- mcIdType const nbOfTypes=ToIdType(code.size()/3);
+ mcIdType nbOfSplit=ToIdType(idsPerType.size());
+ mcIdType nbOfTypes=ToIdType(code.size()/3);
mcIdType ret(0);
for(mcIdType i=0;i<nbOfTypes;i++)
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : At pos #" << i << " the geometric type " << cm.getRepr() << " is dynamic ! There are not managed by GAUSS_NE field discretization !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType const nbOfEltInChunk=code[3*i+1];
+ mcIdType nbOfEltInChunk=code[3*i+1];
if(nbOfEltInChunk<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : invalid input code ! presence of negative value in a type !");
- mcIdType const pos=code[3*i+2];
+ mcIdType pos=code[3*i+2];
if(pos!=-1)
{
if(pos<0 || pos>=nbOfSplit)
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples : NULL input mesh !");
mcIdType ret=0;
- mcIdType const nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
{
- INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(i);
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(cm.isDynamic())
throw INTERP_KERNEL::Exception("Not implemented yet Gauss node on elements for polygons and polyedrons !");
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getOffsetArr : NULL input mesh !");
- mcIdType const nbOfTuples=mesh->getNumberOfCells();
+ mcIdType nbOfTuples=mesh->getNumberOfCells();
DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(nbOfTuples+1,1);
mcIdType *retPtr=ret->getPointer();
retPtr[0]=0;
for(mcIdType i=0;i<nbOfTuples;i++)
{
- INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(i);
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(cm.isDynamic())
throw INTERP_KERNEL::Exception("Not implemented yet Gauss node on elements for polygons and polyedrons !");
const mcIdType *array=old2NewBg;
if(check)
array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
- mcIdType const nbOfCells=mesh->getNumberOfCells();
- mcIdType const nbOfTuples=getNumberOfTuples(mesh);
- auto *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
- auto *array3=new mcIdType[nbOfCells];//store for each cell in after renumbering the offset needed by each cell in new numbering.
+ mcIdType nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfTuples=getNumberOfTuples(mesh);
+ mcIdType *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
+ mcIdType *array3=new mcIdType[nbOfCells];//store for each cell in after renumbering the offset needed by each cell in new numbering.
array3[0]=0;
for(mcIdType i=1;i<nbOfCells;i++)
{
- INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(ToIdType(std::distance(array,std::find(array,array+nbOfCells,i-1))));
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(ToIdType(std::distance(array,std::find(array,array+nbOfCells,i-1))));
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
array3[i]=array3[i-1]+cm.getNumberOfNodes();
}
mcIdType j=0;
for(mcIdType i=0;i<nbOfCells;i++)
{
- INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(i);
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
for(mcIdType k=0;k<ToIdType(cm.getNumberOfNodes());k++,j++)
array2[j]=array3[array[i]]+k;
}
delete [] array3;
- for(auto array : arrays)
- if(array)
- array->renumberInPlace(array2);
+ for(std::vector<DataArray *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
+ if(*it)
+ (*it)->renumberInPlace(array2);
delete [] array2;
if(check)
free(const_cast<mcIdType *>(array));
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues : NULL input mesh !");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
MCAuto<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
- mcIdType const nbOfTuples=getNumberOfTuples(umesh);
- int const spaceDim=mesh->getSpaceDimension();
+ mcIdType nbOfTuples=getNumberOfTuples(umesh);
+ int spaceDim=mesh->getSpaceDimension();
ret->alloc(nbOfTuples,spaceDim);
const double *coords=umesh->getCoords()->begin();
const mcIdType *connI=umesh->getNodalConnectivityIndex()->getConstPointer();
const mcIdType *conn=umesh->getNodalConnectivity()->getConstPointer();
- mcIdType const nbCells=umesh->getNumberOfCells();
+ mcIdType nbCells=umesh->getNumberOfCells();
double *retPtr=ret->getPointer();
for(mcIdType i=0;i<nbCells;i++,connI++)
for(const mcIdType *w=conn+connI[0]+1;w!=conn+connI[1];w++)
{
if(!mesh || !arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::integral : input mesh or array is null !");
- std::size_t const nbOfCompo=arr->getNumberOfComponents();
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
std::fill(res,res+nbOfCompo,0.);
//
MCAuto<MEDCouplingFieldDouble> vol=mesh->getMeasureField(isWAbs);
- std::set<INTERP_KERNEL::NormalizedCellType> const types=mesh->getAllGeoTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
MCAuto<DataArrayIdType> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
nbOfNodesPerCell->computeOffsetsFull();
const double *arrPtr=arr->begin(),*volPtr=vol->getArray()->begin();
- for(auto type : types)
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
{
std::size_t wArrSz=-1;
- const double *wArr=GetWeightArrayFromGeometricType(type,wArrSz);
+ const double *wArr=GetWeightArrayFromGeometricType(*it,wArrSz);
INTERP_KERNEL::AutoPtr<double> wArr2=new double[wArrSz];
- double const sum=std::accumulate(wArr,wArr+wArrSz,0.);
+ double sum=std::accumulate(wArr,wArr+wArrSz,0.);
std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind(std::multiplies<double>(),std::placeholders::_1,1./sum));
- MCAuto<DataArrayIdType> ids=mesh->giveCellsWithType(type);
+ MCAuto<DataArrayIdType> ids=mesh->giveCellsWithType(*it);
MCAuto<DataArrayIdType> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin();
- mcIdType const nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
+ mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
for(mcIdType i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++,ptIds2+=wArrSz)
{
for(std::size_t k=0;k<nbOfCompo;k++)
{
case INTERP_KERNEL::NORM_POINT1:
lgth=0;
- return nullptr;
+ return 0;
case INTERP_KERNEL::NORM_SEG2:
lgth=sizeof(REF_SEG2)/sizeof(double);
return REF_SEG2;
case INTERP_KERNEL::NORM_POINT1:
{
lgth=0;
- return nullptr;
+ return 0;
}
case INTERP_KERNEL::NORM_SEG2:
{
mcIdType offset=0;
for(mcIdType i=0;i<cellId;i++)
{
- INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(i);
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
offset+=cm.getNumberOfNodes();
}
void MEDCouplingFieldDiscretizationGaussNE::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const
{
- mcIdType const nbOfTuples(getNumberOfTuples(mesh));
+ mcIdType nbOfTuples(getNumberOfTuples(mesh));
if(nbOfTuples!=da->getNumberOfTuples())
{
std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " !";
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_GAUSS_NE);
ret->setMesh(mesh);
//
- std::set<INTERP_KERNEL::NormalizedCellType> const types=mesh->getAllGeoTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
MCAuto<DataArrayIdType> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
- mcIdType const nbTuples=nbOfNodesPerCell->accumulate((std::size_t)0);
+ mcIdType nbTuples=nbOfNodesPerCell->accumulate((std::size_t)0);
nbOfNodesPerCell->computeOffsetsFull();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); arr->alloc(nbTuples,1);
ret->setArray(arr);
double *arrPtr=arr->getPointer();
- for(auto type : types)
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
{
std::size_t wArrSz=-1;
- const double *wArr=GetWeightArrayFromGeometricType(type,wArrSz);
+ const double *wArr=GetWeightArrayFromGeometricType(*it,wArrSz);
INTERP_KERNEL::AutoPtr<double> wArr2=new double[wArrSz];
- double const sum=std::accumulate(wArr,wArr+wArrSz,0.);
+ double sum=std::accumulate(wArr,wArr+wArrSz,0.);
std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind(std::multiplies<double>(),std::placeholders::_1,1./sum));
- MCAuto<DataArrayIdType> ids=mesh->giveCellsWithType(type);
+ MCAuto<DataArrayIdType> ids=mesh->giveCellsWithType(*it);
MCAuto<DataArrayIdType> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin();
- mcIdType const nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
+ mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
for(mcIdType i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++)
for(std::size_t j=0;j<wArrSz;j++,ptIds2++)
arrPtr[*ptIds2]=wArr2[j]*volPtr[*ptIds];
return ret.retn();
}
-void MEDCouplingFieldDiscretizationGaussNE::getValueOn(const DataArrayDouble * /*arr*/, const MEDCouplingMesh * /*mesh*/, const double * /*loc*/, double * /*res*/) const
+void MEDCouplingFieldDiscretizationGaussNE::getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-void MEDCouplingFieldDiscretizationGaussNE::getValueOnPos(const DataArrayDouble * /*arr*/, const MEDCouplingMesh * /*mesh*/, mcIdType /*i*/, mcIdType /*j*/, mcIdType /*k*/, double * /*res*/) const
+void MEDCouplingFieldDiscretizationGaussNE::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const
{
throw INTERP_KERNEL::Exception("getValueOnPos(i,j,k) : Not applicable for Gauss points !");
}
-DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getValueOnMulti(const DataArrayDouble * /*arr*/, const MEDCouplingMesh * /*mesh*/, const double * /*loc*/, mcIdType /*nbOfPoints*/) const
+DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const
{
throw INTERP_KERNEL::Exception("getValueOnMulti : Not implemented for Gauss NE !");
}
return MEDCouplingFieldDiscretization::buildSubMeshDataRange(mesh,beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,di);
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : NULL input mesh !");
- mcIdType const nbOfCells=mesh->getNumberOfCells();
- di=nullptr; beginOut=0; endOut=0; stepOut=stepCellIds;
+ mcIdType nbOfCells=mesh->getNumberOfCells();
+ di=0; beginOut=0; endOut=0; stepOut=stepCellIds;
const char msg[]="MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : cell #";
for(mcIdType i=0;i<nbOfCells;i++)
{
- INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(i);
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(cm.isDynamic())
{ std::ostringstream oss; oss << msg << i << " presence of dynamic cell (polygons and polyedrons) ! Not implemented !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
- mcIdType const delta=cm.getNumberOfNodes();
+ mcIdType delta=cm.getNumberOfNodes();
if(i<beginCellIds)
beginOut+=delta;
endOut+=delta;
{
}
-void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCells(double /*epsOnVals*/, const MEDCouplingMesh * /*mesh*/, const mcIdType * /*old2New*/, mcIdType /*newSz*/, DataArrayDouble * /*arr*/) const
+void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
return EasyAggregate<MEDCouplingFieldDiscretizationGaussNE>(fds);
}
-void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCellsR(const MEDCouplingMesh * /*mesh*/, const mcIdType * /*new2old*/, mcIdType /*newSz*/, DataArrayDouble * /*arr*/) const
+void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
stream << "Gauss points on nodes per element spatial discretization.";
}
-MEDCouplingFieldDiscretizationGaussNE::MEDCouplingFieldDiscretizationGaussNE(const MEDCouplingFieldDiscretizationGaussNE& other)
-= default;
+MEDCouplingFieldDiscretizationGaussNE::MEDCouplingFieldDiscretizationGaussNE(const MEDCouplingFieldDiscretizationGaussNE& other):MEDCouplingFieldDiscretization(other)
+{
+}
TypeOfField MEDCouplingFieldDiscretizationKriging::getEnum() const
{
throw INTERP_KERNEL::Exception("Invalid nature for Kriging field : expected IntensiveMaximum !");
}
-bool MEDCouplingFieldDiscretizationKriging::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const
+bool MEDCouplingFieldDiscretizationKriging::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
if(!other)
{
reason="other spatial discretization is NULL, and this spatial discretization (Kriginig) is defined.";
return false;
}
- const auto *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationKriging *>(other);
- bool const ret=otherC!=nullptr;
+ const MEDCouplingFieldDiscretizationKriging *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationKriging *>(other);
+ bool ret=otherC!=0;
if(!ret)
reason="Spatial discrtization of this is ON_NODES_KR, which is not the case of other.";
return ret;
}
-MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationKriging::getMeasureField(const MEDCouplingMesh *mesh, bool /*isAbs*/) const
+MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationKriging::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getMeasureField : mesh instance specified is NULL !");
{
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !");
- mcIdType const nbOfRows=getNumberOfMeshPlaces(mesh);
+ mcIdType nbOfRows=getNumberOfMeshPlaces(mesh);
if(arr->getNumberOfTuples()!=nbOfRows)
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
mcIdType nbCols(-1);
- std::size_t const nbCompo=arr->getNumberOfComponents();
+ std::size_t nbCompo=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols));
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTargetPoints,nbCompo);
MCAuto<DataArrayDouble> matrixInv(computeInverseMatrix(mesh,isDrift,nbRows));
//
MCAuto<DataArrayDouble> coords=getLocalizationOfDiscValues(mesh);
- mcIdType const nbOfPts(coords->getNumberOfTuples());
- std::size_t const dimension(coords->getNumberOfComponents());
+ mcIdType nbOfPts(coords->getNumberOfTuples());
+ std::size_t dimension(coords->getNumberOfComponents());
MCAuto<DataArrayDouble> locArr=DataArrayDouble::New();
locArr->useArray(loc,false,DeallocType::CPP_DEALLOC,nbOfTargetPoints,dimension);
nbCols=nbOfPts;
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeMatrix : NULL input mesh !");
MCAuto<DataArrayDouble> coords(getLocalizationOfDiscValues(mesh));
- mcIdType const nbOfPts(coords->getNumberOfTuples());
+ mcIdType nbOfPts(coords->getNumberOfTuples());
MCAuto<DataArrayDouble> matrix(coords->buildEuclidianDistanceDenseMatrix());
operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfPts*nbOfPts,matrix->getPointer());
// Drift
{
for(mcIdType i=0;i<nbOfElems;i++)
{
- double const val=matrixPtr[i];
+ double val=matrixPtr[i];
matrixPtr[i]=val*val*val;
}
}
{
for(mcIdType i=0;i<nbOfElems;i++)
{
- double const val=matrixPtr[i];
+ double val=matrixPtr[i];
if(val!=0.)
matrixPtr[i]=val*val*log(val);
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input dense matrix ! Must be allocated not NULL and with exactly one component !");
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input array of coordiantes ! Must be allocated and not NULL !");
- std::size_t const spaceDimension(arr->getNumberOfComponents());
+ std::size_t spaceDimension(arr->getNumberOfComponents());
mcIdType nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples());
delta=ToIdType(spaceDimension)+1;
- mcIdType const nbOfCols(nbOfEltInMatrx/nbOfPts);
+ mcIdType nbOfCols(nbOfEltInMatrx/nbOfPts);
if(nbOfEltInMatrx%nbOfPts!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : size of input dense matrix and input arrays mismatch ! NbOfElems in matrix % nb of tuples in array must be equal to 0 !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfPts*(nbOfCols+delta));
*/
DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, mcIdType& delta) const
{
- std::size_t const spaceDimension(arr->getNumberOfComponents());
+ std::size_t spaceDimension(arr->getNumberOfComponents());
delta=ToIdType(spaceDimension)+1;
- mcIdType const szOfMatrix(arr->getNumberOfTuples());
+ mcIdType szOfMatrix(arr->getNumberOfTuples());
if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
#ifndef __PARAMEDMEM_MEDCOUPLINGFIELDDISCRETIZATION_HXX__
#define __PARAMEDMEM_MEDCOUPLINGFIELDDISCRETIZATION_HXX__
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
#include "MEDCouplingRefCountObject.hxx"
#include "InterpKernelException.hxx"
#include "MEDCouplingTimeLabel.hxx"
+#include "MEDCouplingNatureOfField.hxx"
#include "MEDCouplingGaussLocalization.hxx"
#include "MCAuto.hxx"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <ostream>
#include <set>
-#include <string>
#include <vector>
namespace MEDCoupling
MEDCOUPLING_EXPORT static MEDCouplingFieldDiscretization *New(TypeOfField type);
MEDCOUPLING_EXPORT double getPrecision() const { return _precision; }
MEDCOUPLING_EXPORT void setPrecision(double val) { _precision=val; }
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT static TypeOfField GetTypeOfFieldFromStringRepr(const std::string& repr);
MEDCOUPLING_EXPORT static std::string GetTypeOfFieldRepr(TypeOfField type);
MEDCOUPLING_EXPORT virtual TypeOfField getEnum() const = 0;
MEDCOUPLING_EXPORT virtual void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector<mcIdType>& cellIds) const;
MEDCOUPLING_EXPORT virtual const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const;
MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0;
- MEDCOUPLING_EXPORT ~MEDCouplingFieldDiscretization() override;
+ MEDCOUPLING_EXPORT virtual ~MEDCouplingFieldDiscretization();
protected:
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization();
MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const mcIdType *old2NewPtr, mcIdType newNbOfEntity, DataArrayDouble *arr, const std::string& msg);
class MEDCouplingFieldDiscretizationP0 : public MEDCouplingFieldDiscretization
{
public:
- MEDCOUPLING_EXPORT TypeOfField getEnum() const override;
+ MEDCOUPLING_EXPORT TypeOfField getEnum() const;
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationP0"); }
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override;
- MEDCOUPLING_EXPORT std::string getStringRepr() const override;
- MEDCOUPLING_EXPORT const char *getRepr() const override;
+ MEDCOUPLING_EXPORT std::string getStringRepr() const;
+ MEDCOUPLING_EXPORT const char *getRepr() const;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const override;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const mcIdType *old2NewBg, bool check) override;
- MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const override;
+ const mcIdType *old2NewBg, bool check);
+ MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override;
MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
- DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const override;
- MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override;
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const;
+ MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override;
- MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const override;
+ MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const;
MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const override;
+ MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
public:
static const char REPR[];
static constexpr TypeOfField TYPE = ON_CELLS;
class MEDCouplingFieldDiscretizationOnNodes : public MEDCouplingFieldDiscretization
{
public:
- MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const override;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const mcIdType *old2NewBg, bool check) override;
- MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const override;
+ const mcIdType *old2NewBg, bool check);
+ MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
- DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const override;
- MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const override;
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const;
+ MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const;
public:
- MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const override;
+ MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const;
};
class MEDCouplingFieldDiscretizationP1 : public MEDCouplingFieldDiscretizationOnNodes
{
public:
- MEDCOUPLING_EXPORT TypeOfField getEnum() const override;
+ MEDCOUPLING_EXPORT TypeOfField getEnum() const;
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationP1"); }
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override;
- MEDCOUPLING_EXPORT std::string getStringRepr() const override;
- MEDCOUPLING_EXPORT const char *getRepr() const override;
+ MEDCOUPLING_EXPORT std::string getStringRepr() const;
+ MEDCOUPLING_EXPORT const char *getRepr() const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override;
MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
public:
static const char REPR[];
MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds);
MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds);
MEDCouplingFieldDiscretizationPerCell(DataArrayIdType *dpc);
- ~MEDCouplingFieldDiscretizationPerCell() override;
- void updateTime() const override;
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override;
+ ~MEDCouplingFieldDiscretizationPerCell();
+ void updateTime() const;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override;
- bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const override;
- void renumberCells(const mcIdType *old2NewBg, bool check) override;
+ bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
+ void renumberCells(const mcIdType *old2NewBg, bool check);
protected:
void buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh);
protected:
{
public:
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationGauss();
- MEDCOUPLING_EXPORT TypeOfField getEnum() const override;
+ MEDCOUPLING_EXPORT TypeOfField getEnum() const;
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationGauss"); }
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const override;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const override;
- MEDCOUPLING_EXPORT std::string getStringRepr() const override;
- MEDCOUPLING_EXPORT const char *getRepr() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const override;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const;
+ MEDCOUPLING_EXPORT std::string getStringRepr() const;
+ MEDCOUPLING_EXPORT const char *getRepr() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const mcIdType *old2NewBg, bool check) override;
- MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const override;
+ const mcIdType *old2NewBg, bool check);
+ MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
- DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const override;
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<double>& tinyInfo) override;
- MEDCOUPLING_EXPORT void getSerializationIntArray(DataArrayIdType *& arr) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *& arr) override;
- MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *arr) override;
- MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const override;
- MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<double>& tinyInfo);
+ MEDCOUPLING_EXPORT void getSerializationIntArray(DataArrayIdType *& arr) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *& arr);
+ MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *arr);
+ MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const;
+ MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override;
- MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const override;
+ MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const;
MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const override;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
MEDCOUPLING_EXPORT void setGaussLocalizationOnType(const MEDCouplingMesh *mesh, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) override;
+ const std::vector<double>& gsCoo, const std::vector<double>& wg);
MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const mcIdType *begin, const mcIdType *end, const std::vector<double>& refCoo,
- const std::vector<double>& gsCoo, const std::vector<double>& wg) override;
- MEDCOUPLING_EXPORT void clearGaussLocalizations() override;
+ const std::vector<double>& gsCoo, const std::vector<double>& wg);
+ MEDCOUPLING_EXPORT void clearGaussLocalizations();
MEDCOUPLING_EXPORT void setGaussLocalization(mcIdType locId, const MEDCouplingGaussLocalization& loc);
MEDCOUPLING_EXPORT void resizeLocalizationVector(mcIdType newSz);
- MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) override;
- MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const override;
- MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const override;
- MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT std::set<mcIdType> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector<mcIdType>& cellIds) const override;
- MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const override;
+ MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId);
+ MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const;
+ MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT std::set<mcIdType> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector<mcIdType>& cellIds) const;
+ MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const;
MEDCOUPLING_EXPORT DataArrayIdType *buildNbOfGaussPointPerCellField() const;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
protected:
- MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const mcIdType *startCellIds=nullptr, const mcIdType *endCellIds=nullptr);
+ MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const mcIdType *startCellIds=0, const mcIdType *endCellIds=0);
MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds);
MEDCouplingFieldDiscretizationGauss(DataArrayIdType *dpc, const std::vector<MEDCouplingGaussLocalization>& loc):MEDCouplingFieldDiscretizationPerCell(dpc),_loc(loc) { }
void zipGaussLocalizations();
{
public:
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationGaussNE();
- MEDCOUPLING_EXPORT TypeOfField getEnum() const override;
+ MEDCOUPLING_EXPORT TypeOfField getEnum() const;
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationGaussNE"); }
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override;
- MEDCOUPLING_EXPORT std::string getStringRepr() const override;
- MEDCOUPLING_EXPORT const char *getRepr() const override;
+ MEDCOUPLING_EXPORT std::string getStringRepr() const;
+ MEDCOUPLING_EXPORT const char *getRepr() const;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const override;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const;
MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
- const mcIdType *old2NewBg, bool check) override;
- MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const override;
- MEDCOUPLING_EXPORT void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const override;
+ const mcIdType *old2NewBg, bool check);
+ MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
+ MEDCOUPLING_EXPORT void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const;
MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd,
- DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const override;
+ DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override;
- MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const override;
- MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override;
+ MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const;
+ MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override;
- MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const override;
+ MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const;
MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const override;
- MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const override;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const;
+ MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT static const double *GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth);
MEDCOUPLING_EXPORT static const double *GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth);
MEDCOUPLING_EXPORT static const double *GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth);
class MEDCouplingFieldDiscretizationKriging : public MEDCouplingFieldDiscretizationOnNodes
{
public:
- MEDCOUPLING_EXPORT TypeOfField getEnum() const override;
+ MEDCOUPLING_EXPORT TypeOfField getEnum() const;
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationKriging"); }
- MEDCOUPLING_EXPORT const char *getRepr() const override;
+ MEDCOUPLING_EXPORT const char *getRepr() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override;
- MEDCOUPLING_EXPORT std::string getStringRepr() const override;
+ MEDCOUPLING_EXPORT std::string getStringRepr() const;
MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override;
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override;
MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override;
MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldDiscretization> aggregate(std::vector<const MEDCouplingFieldDiscretization *>& fds) const override;
public://specific part
MEDCOUPLING_EXPORT DataArrayDouble *computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfTargetPoints, mcIdType& nbCols) const;
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingFieldDiscretizationOnNodesFE.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingGaussLocalization.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCType.hxx"
#include "MEDCouplingNormalizedUnstructuredMesh.txx"
-#include "BBTreeStandAlone.txx"
-#include "InterpKernelException.hxx"
#include "InterpKernelDenseMatrix.hxx"
#include "InterpKernelRootsMultiDim.hxx"
#include "MEDCouplingUMesh.hxx"
-#include "InterpKernelGaussCoords.hxx"
-#include "NormalizedGeometricTypes"
#include "InterpolationHelper.txx"
+#include "InterpKernelGaussCoords.hxx"
-#include <algorithm>
-#include <ostream>
-#include <cstddef>
-#include <limits>
-#include <functional>
-#include <string>
-#include <vector>
+#include <sstream>
using namespace MEDCoupling;
return EasyAggregate<MEDCouplingFieldDiscretizationOnNodesFE>(fds);
}
-bool MEDCouplingFieldDiscretizationOnNodesFE::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const
+bool MEDCouplingFieldDiscretizationOnNodesFE::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
if(!other)
{
reason="other spatial discretization is NULL, and this spatial discretization (Node FE) is defined.";
return false;
}
- const auto *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationOnNodesFE *>(other);
- bool const ret=otherC!=nullptr;
+ const MEDCouplingFieldDiscretizationOnNodesFE *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationOnNodesFE *>(other);
+ bool ret=otherC!=0;
if(!ret)
reason="Spatial discrtization of this is ON_NODES_FE, which is not the case of other.";
return ret;
throw INTERP_KERNEL::Exception("Invalid nature for NodeFE field : expected IntensiveMaximum !");
}
-MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationOnNodesFE::getMeasureField(const MEDCouplingMesh *mesh, bool /*isAbs*/) const
+MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationOnNodesFE::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodesFE::getMeasureField : mesh instance specified is NULL !");
_pts_in_cell(ptsInCell),_point(point) { }
std::vector<double> operator()(const std::vector<double>& x)
{
- MEDCouplingGaussLocalization const gl(_gl->getType(),_gl->getRefCoords(),x,{1.0});
+ MEDCouplingGaussLocalization gl(_gl->getType(),_gl->getRefCoords(),x,{1.0});
MCAuto<DataArrayDouble> shapeFunc = gl.getShapeFunctionValues();
const double *shapeFuncPtr( shapeFunc->begin() );
std::vector<double> ret(3,0);
bool IsInside3D(const MEDCouplingGaussLocalization& gl, const std::vector<double>& ptsInCell, const double locInReal[3], double locInRef[3])
{
constexpr double EPS_IN_OUT = 1e-12;
- std::size_t const nbPtsInCell(ptsInCell.size()/3);
+ std::size_t nbPtsInCell(ptsInCell.size()/3);
bool ret(false);
const double *refCoo(gl.getRefCoords().data());
- INTERP_KERNEL::NormalizedCellType const ct(gl.getType());
+ INTERP_KERNEL::NormalizedCellType ct(gl.getType());
Functor func(gl,nbPtsInCell,ptsInCell.data(),locInReal);
auto myJacobian = [&gl,nbPtsInCell,ptsInCell](const std::vector<double>& x, const std::vector<double>&, INTERP_KERNEL::DenseMatrix& jacobian)
{
- MEDCouplingGaussLocalization const mygl(gl.getType(),gl.getRefCoords(),x,{1.0});
+ MEDCouplingGaussLocalization mygl(gl.getType(),gl.getRefCoords(),x,{1.0});
MCAuto<DataArrayDouble> shapeFunc = mygl.getDerivativeOfShapeFunctionValues();
for(std::size_t i = 0 ; i < 3 ; ++i)
for(std::size_t j = 0 ; j < 3 ; ++j)
std::function<void(const MEDCouplingGaussLocalization&, const std::vector<mcIdType>&)> customFunc)
{
const double *coordsOfMesh( umesh->getCoords()->begin() );
- MEDCouplingNormalizedUnstructuredMesh<3,3> const mesh_wrapper(umesh);
- BBTreeStandAlone<3,mcIdType> tree( (INTERP_KERNEL::BuildBBTree( mesh_wrapper )) );
+ MEDCouplingNormalizedUnstructuredMesh<3,3> mesh_wrapper(umesh);
+ BBTreeStandAlone<3,mcIdType> tree( INTERP_KERNEL::BuildBBTree( mesh_wrapper ) );
for(mcIdType iPt = 0 ; iPt < nbOfPts ; ++iPt)
{
std::vector<mcIdType> elems;
bool found(false);
for(auto cellId = elems.cbegin() ; cellId != elems.cend() && !found ; ++cellId)
{
- INTERP_KERNEL::NormalizedCellType const gt( umesh->getTypeOfCell(*cellId) );
+ INTERP_KERNEL::NormalizedCellType gt( umesh->getTypeOfCell(*cellId) );
std::vector<mcIdType> conn;
umesh->getNodeIdsOfCell(*cellId,conn);
MCAuto<DataArrayDouble> refCoo( MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf(gt) );
- std::vector<double> const refCooCpp(refCoo->begin(),refCoo->end());
+ std::vector<double> refCooCpp(refCoo->begin(),refCoo->end());
std::vector<double> gsCoo(ptsCoo + iPt*3,ptsCoo + (iPt+1)*3);
MEDCouplingGaussLocalization gl(gt,refCooCpp,{0,0,0},{1.});
std::vector<double> ptsInCell; ptsInCell.reserve(conn.size()*gl.getDimension());
const MEDCouplingUMesh *MEDCouplingFieldDiscretizationOnNodesFE::checkConfig3D(const MEDCouplingMesh *mesh) const
{
- const auto *umesh( dynamic_cast<const MEDCouplingUMesh *>(mesh) );
+ const MEDCouplingUMesh *umesh( dynamic_cast<const MEDCouplingUMesh *>(mesh) );
if( !umesh )
THROW_IK_EXCEPTION("getValueOn : not implemented yet for type != MEDCouplingUMesh !");
if(umesh->getSpaceDimension() != 3 || umesh->getMeshDimension() != 3)
{
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("getValueOnMulti : input array is null or not allocated !");
- mcIdType const nbOfRows=getNumberOfMeshPlaces(mesh);
+ mcIdType nbOfRows=getNumberOfMeshPlaces(mesh);
if(arr->getNumberOfTuples()!=nbOfRows)
{
THROW_IK_EXCEPTION( "getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !")
}
const MEDCouplingUMesh *umesh = checkConfig3D(mesh);
- std::size_t const nbCompo( arr->getNumberOfComponents() );
+ std::size_t nbCompo( arr->getNumberOfComponents() );
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTargetPoints,nbCompo);
double *res( ret->getPointer() );
ret->alloc(nbOfPoints,3);
double *retPtr(ret->getPointer() );
- auto arrayFeeder = [&retPtr](const MEDCouplingGaussLocalization& gl, const std::vector<mcIdType>& /*conn*/)
+ auto arrayFeeder = [&retPtr](const MEDCouplingGaussLocalization& gl, const std::vector<mcIdType>& conn)
{
std::vector<double> resVector( gl.getGaussCoords() );
{
#pragma once
-#include "MEDCoupling.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingGaussLocalization.hxx"
#include <functional>
-#include <string>
-#include <ostream>
-#include <vector>
namespace MEDCoupling
{
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingFieldT.txx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingField.hxx"
-#include "MCIdType.hxx"
-#include "CellModel.hxx"
#include "MEDCouplingFieldTemplate.hxx"
+#include "MEDCouplingFieldT.txx"
#include "MEDCouplingFieldInt32.hxx"
#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingFieldFloat.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingPointSet.hxx"
-#include "MEDCouplingTraits.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingGaussLocalization.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingTimeDiscretization.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingVoronoi.hxx"
#include "MCAuto.txx"
+#include "MEDCouplingVoronoi.hxx"
+#include "MEDCouplingNatureOfField.hxx"
+#include "MEDCouplingMemArray.txx"
#include "InterpKernelAutoPtr.hxx"
#include "InterpKernelGaussCoords.hxx"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <set>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>
-#include <string>
-#include <vector>
using namespace MEDCoupling;
MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const
{
checkConsistencyLight();
- TypeOfField const tf(getTypeOfField());
+ TypeOfField tf(getTypeOfField());
if(tf!=ON_NODES)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::nodeToCellDiscretization : this field is expected to be on ON_NODES !");
MCAuto<MEDCouplingFieldDouble> ret(clone(false));
MCAuto<MEDCouplingFieldDiscretizationP0> nsp(new MEDCouplingFieldDiscretizationP0);
ret->setDiscretization(nsp);
const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call
- mcIdType const nbCells=ToIdType(m->getNumberOfCells());
+ mcIdType nbCells=ToIdType(m->getNumberOfCells());
std::vector<DataArrayDouble *> arrs(getArrays());
- std::size_t const sz(arrs.size());
+ std::size_t sz(arrs.size());
std::vector< MCAuto<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
for(std::size_t j=0;j<sz;j++)
{
- std::size_t const nbCompo(arrs[j]->getNumberOfComponents());
+ std::size_t nbCompo(arrs[j]->getNumberOfComponents());
outArrsSafe[j]=DataArrayDouble::New(); outArrsSafe[j]->alloc(nbCells,nbCompo);
outArrsSafe[j]->copyStringInfoFrom(*arrs[j]);
outArrs[j]=outArrsSafe[j];
std::vector<mcIdType> nodeIds;
m->getNodeIdsOfCell(i,nodeIds);
std::fill(pt,pt+nbCompo,0.);
- std::size_t const nbNodesInCell(nodeIds.size());
+ std::size_t nbNodesInCell(nodeIds.size());
for(std::size_t k=0;k<nbNodesInCell;k++)
std::transform(srcPt+nodeIds[k]*nbCompo,srcPt+(nodeIds[k]+1)*nbCompo,pt,pt,std::plus<double>());
if(nbNodesInCell!=0)
MEDCouplingFieldDouble *MEDCouplingFieldDouble::cellToNodeDiscretization() const
{
checkConsistencyLight();
- TypeOfField const tf(getTypeOfField());
+ TypeOfField tf(getTypeOfField());
if(tf!=ON_CELLS)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::cellToNodeDiscretization : this field is expected to be on ON_CELLS !");
MCAuto<MEDCouplingFieldDouble> ret(clone(false));
MCAuto<DataArrayIdType> rn(DataArrayIdType::New()),rni(DataArrayIdType::New());
m->getReverseNodalConnectivity(rn,rni);
MCAuto<DataArrayIdType> rni2(rni->deltaShiftIndex());
- MCAuto<DataArrayDouble> rni3(rni2->convertToDblArr()); rni2=nullptr;
+ MCAuto<DataArrayDouble> rni3(rni2->convertToDblArr()); rni2=0;
std::vector<DataArrayDouble *> arrs(getArrays());
- std::size_t const sz(arrs.size());
+ std::size_t sz(arrs.size());
std::vector< MCAuto<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
for(std::size_t j=0;j<sz;j++)
{
MCAuto<DataArrayDouble> tmp(arrs[j]->selectByTupleIdSafe(rn->begin(),rn->end()));
- outArrsSafe[j]=(tmp->accumulatePerChunck(rni->begin(),rni->end())); tmp=nullptr;
+ outArrsSafe[j]=(tmp->accumulatePerChunck(rni->begin(),rni->end())); tmp=0;
outArrsSafe[j]->divideEqual(rni3);
outArrsSafe[j]->copyStringInfoFrom(*arrs[j]);
outArrs[j]=outArrsSafe[j];
std::string MEDCouplingFieldDouble::writeVTK(const std::string& fileName, bool isBinary) const
{
- std::vector<const MEDCouplingFieldDouble *> const fs(1,this);
+ std::vector<const MEDCouplingFieldDouble *> fs(1,this);
return MEDCouplingFieldDouble::WriteVTK(fileName,fs,isBinary);
}
{
if(!MEDCouplingField::areCompatibleForMerge(other))
return false;
- const auto *otherC(dynamic_cast<const MEDCouplingFieldDouble *>(other));
+ const MEDCouplingFieldDouble *otherC(dynamic_cast<const MEDCouplingFieldDouble *>(other));
if(!otherC)
return false;
if(!timeDiscr()->areCompatible(otherC->timeDiscr()))
*/
void MEDCouplingFieldDouble::renumberNodes(const mcIdType *old2NewBg, double eps)
{
- const auto *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
+ const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Invalid mesh to apply renumberNodes on it !");
- mcIdType const nbOfNodes=meshC->getNumberOfNodes();
+ mcIdType nbOfNodes=meshC->getNumberOfNodes();
MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
- mcIdType const newNbOfNodes=*std::max_element(old2NewBg,old2NewBg+nbOfNodes)+1;
+ mcIdType newNbOfNodes=*std::max_element(old2NewBg,old2NewBg+nbOfNodes)+1;
renumberNodesWithoutMesh(old2NewBg,newNbOfNodes,eps);
meshC2->renumberNodes(old2NewBg,newNbOfNodes);
setMesh(meshC2);
throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !");
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
- for(auto array : arrays)
- if(array)
- _type->renumberValuesOnNodes(eps,old2NewBg,newNbOfNodes,array);
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
+ if(*iter)
+ _type->renumberValuesOnNodes(eps,old2NewBg,newNbOfNodes,*iter);
}
/*!
*/
DataArrayIdType *MEDCouplingFieldDouble::findIdsInRange(double vmin, double vmax) const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::findIdsInRange : no default array set !");
return getArray()->findIdsInRange(vmin,vmax);
}
{
MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*self));
int t1,t2;
- double const t0(self->getTime(t1,t2));
+ double t0(self->getTime(t1,t2));
MCAuto<typename Traits<U>::FieldType > ret(Traits<U>::FieldType::New(*tmp,self->getTimeDiscretization()));
ret->setTime(t0,t1,t2);
if(self->getArray())
*/
double MEDCouplingFieldDouble::accumulate(int compId) const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::accumulate : no default array defined !");
return getArray()->accumulate(compId);
}
*/
void MEDCouplingFieldDouble::accumulate(double *res) const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::accumulate : no default array defined !");
getArray()->accumulate(res);
}
timeDiscr()->getArrays(arrays);
double ret(-std::numeric_limits<double>::max());
bool isExistingArr=false;
- for(auto array : arrays)
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
- if(array)
+ if(*iter)
{
isExistingArr=true;
mcIdType loc;
- ret=std::max(ret,array->getMaxValue(loc));
+ ret=std::max(ret,(*iter)->getMaxValue(loc));
}
}
if(!isExistingArr)
timeDiscr()->getArrays(arrays);
double ret(-std::numeric_limits<double>::max());
bool isExistingArr=false;
- tupleIds=nullptr;
+ tupleIds=0;
MCAuto<DataArrayIdType> ret1;
- for(auto array : arrays)
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
- if(array)
+ if(*iter)
{
isExistingArr=true;
DataArrayIdType *tmp;
- ret=std::max(ret,array->getMaxValue2(tmp));
- MCAuto<DataArrayIdType> const tmpSafe(tmp);
+ ret=std::max(ret,(*iter)->getMaxValue2(tmp));
+ MCAuto<DataArrayIdType> tmpSafe(tmp);
if(!((const DataArrayIdType *)ret1))
ret1=tmpSafe;
}
timeDiscr()->getArrays(arrays);
double ret(std::numeric_limits<double>::max());
bool isExistingArr=false;
- for(auto array : arrays)
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
- if(array)
+ if(*iter)
{
isExistingArr=true;
mcIdType loc;
- ret=std::min(ret,array->getMinValue(loc));
+ ret=std::min(ret,(*iter)->getMinValue(loc));
}
}
if(!isExistingArr)
timeDiscr()->getArrays(arrays);
double ret(-std::numeric_limits<double>::max());
bool isExistingArr=false;
- tupleIds=nullptr;
+ tupleIds=0;
MCAuto<DataArrayIdType> ret1;
- for(auto array : arrays)
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
- if(array)
+ if(*iter)
{
isExistingArr=true;
DataArrayIdType *tmp;
- ret=std::max(ret,array->getMinValue2(tmp));
- MCAuto<DataArrayIdType> const tmpSafe(tmp);
+ ret=std::max(ret,(*iter)->getMinValue2(tmp));
+ MCAuto<DataArrayIdType> tmpSafe(tmp);
if(!((const DataArrayIdType *)ret1))
ret1=tmpSafe;
}
*/
double MEDCouplingFieldDouble::getAverageValue() const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getAverageValue : no default array defined !");
return getArray()->getAverageValue();
}
*/
double MEDCouplingFieldDouble::norm2() const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::norm2 : no default array defined !");
return getArray()->norm2();
}
*/
void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getWeightedAverageValue : no default array defined !");
MCAuto<MEDCouplingFieldDouble> w=buildMeasureField(isWAbs);
- double const deno=w->getArray()->accumulate((std::size_t)0);
+ double deno=w->getArray()->accumulate((std::size_t)0);
MCAuto<DataArrayDouble> arr=getArray()->deepCopy();
arr->multiplyEqual(w->getArray());
arr->accumulate(res);
- std::size_t const nCompo = getArray()->getNumberOfComponents();
+ std::size_t nCompo = getArray()->getNumberOfComponents();
std::transform(res,res+nCompo,res,std::bind(std::multiplies<double>(),std::placeholders::_1,1./deno));
}
*/
double MEDCouplingFieldDouble::getWeightedAverageValue(int compId, bool isWAbs) const
{
- std::size_t const nbComps=getArray()->getNumberOfComponents();
+ std::size_t nbComps=getArray()->getNumberOfComponents();
if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::getWeightedAverageValue : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL1 !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL1 !");
- std::size_t const nbComps=getArray()->getNumberOfComponents();
+ std::size_t nbComps=getArray()->getNumberOfComponents();
if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL1 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL2");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL2 !");
- std::size_t const nbComps=getArray()->getNumberOfComponents();
+ std::size_t nbComps=getArray()->getNumberOfComponents();
if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL2 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
*/
double MEDCouplingFieldDouble::normMax(int compId) const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !");
- std::size_t const nbComps=getArray()->getNumberOfComponents();
+ std::size_t nbComps=getArray()->getNumberOfComponents();
if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normMax : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
*/
void MEDCouplingFieldDouble::normMax(double *res) const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !");
getArray()->normMaxPerComponent(res);
}
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform integral");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform integral !");
- std::size_t const nbComps=getArray()->getNumberOfComponents();
+ std::size_t nbComps=getArray()->getNumberOfComponents();
if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::integral : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
*/
void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, double *res) const
{
- std::vector< const DataArrayDouble *> const arrs=timeDiscr()->getArraysForTime(time);
+ std::vector< const DataArrayDouble *> arrs=timeDiscr()->getArraysForTime(time);
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOn");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getValueOn !");
std::vector<double> res2;
- for(auto arr : arrs)
+ for(std::vector< const DataArrayDouble *>::const_iterator iter=arrs.begin();iter!=arrs.end();iter++)
{
- std::size_t const sz=res2.size();
- res2.resize(sz+arr->getNumberOfComponents());
- _type->getValueOn(arr,_mesh,spaceLoc,&res2[sz]);
+ std::size_t sz=res2.size();
+ res2.resize(sz+(*iter)->getNumberOfComponents());
+ _type->getValueOn(*iter,_mesh,spaceLoc,&res2[sz]);
}
timeDiscr()->getValueForTime(time,res2,res);
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::operator= : no mesh defined !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform operator = !");
- mcIdType const nbOfTuple=_type->getNumberOfTuples(_mesh);
+ mcIdType nbOfTuple=_type->getNumberOfTuples(_mesh);
timeDiscr()->setOrCreateUniformValueOnAllComponents(nbOfTuple,value);
return *this;
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::applyFunc : no mesh defined !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform applyFunc !");
- mcIdType const nbOfTuple=_type->getNumberOfTuples(_mesh);
+ mcIdType nbOfTuple=_type->getNumberOfTuples(_mesh);
timeDiscr()->setUniformValue(nbOfTuple,nbOfComp,val);
}
*/
std::size_t MEDCouplingFieldDouble::getNumberOfComponents() const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getNumberOfComponents : No array specified !");
return getArray()->getNumberOfComponents();
}
*/
mcIdType MEDCouplingFieldDouble::getNumberOfValues() const
{
- if(getArray()==nullptr)
+ if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getNumberOfValues : No array specified !");
return getArray()->getNbOfElems();
}
*/
void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps)
{
- if(_mesh==nullptr || other==nullptr)
+ if(_mesh==0 || other==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::changeUnderlyingMesh : is expected to operate on not null meshes !");
- DataArrayIdType *cellCor=nullptr,*nodeCor=nullptr;
+ DataArrayIdType *cellCor=0,*nodeCor=0;
other->checkGeoEquivalWith(_mesh,levOfCheck,precOnMesh,cellCor,nodeCor);
MCAuto<DataArrayIdType> cellCor2(cellCor),nodeCor2(nodeCor);
if(cellCor)
*/
bool MEDCouplingFieldDouble::mergeNodes(double eps, double epsOnVals)
{
- const auto *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
+ const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Invalid support mesh to apply mergeNodes on it : must be a MEDCouplingPointSet one !");
if(_type.isNull())
return ret;
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
- for(auto array : arrays)
- if(array)
- _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),array);
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
+ if(*iter)
+ _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),*iter);
setMesh(meshC2);
return true;
}
*/
bool MEDCouplingFieldDouble::mergeNodesCenter(double eps, double epsOnVals)
{
- const auto *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
+ const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Invalid support mesh to apply mergeNodes on it : must be a MEDCouplingPointSet one !");
if(_type.isNull())
return ret;
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
- for(auto array : arrays)
- if(array)
- _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),array);
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
+ if(*iter)
+ _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),*iter);
setMesh(meshC2);
return true;
}
*/
bool MEDCouplingFieldDouble::zipCoords(double epsOnVals)
{
- const auto *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
+ const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::zipCoords : Invalid support mesh to apply zipCoords on it : must be a MEDCouplingPointSet one !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipCoords !");
MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
- mcIdType const oldNbOfNodes=meshC2->getNumberOfNodes();
+ mcIdType oldNbOfNodes=meshC2->getNumberOfNodes();
MCAuto<DataArrayIdType> arr=meshC2->zipCoordsTraducer();
if(meshC2->getNumberOfNodes()!=oldNbOfNodes)
{
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
- for(auto array : arrays)
- if(array)
- _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),array);
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
+ if(*iter)
+ _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),*iter);
setMesh(meshC2);
return true;
}
*/
bool MEDCouplingFieldDouble::zipConnectivity(int compType, double epsOnVals)
{
- const auto *meshC=dynamic_cast<const MEDCouplingUMesh *>(_mesh);
+ const MEDCouplingUMesh *meshC=dynamic_cast<const MEDCouplingUMesh *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::zipConnectivity : Invalid support mesh to apply zipCoords on it : must be a MEDCouplingPointSet one !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipConnectivity !");
MCAuto<MEDCouplingUMesh> meshC2((MEDCouplingUMesh *)meshC->deepCopy());
- mcIdType const oldNbOfCells(meshC2->getNumberOfCells());
+ mcIdType oldNbOfCells(meshC2->getNumberOfCells());
MCAuto<DataArrayIdType> arr=meshC2->zipConnectivityTraducer(compType);
if(meshC2->getNumberOfCells()!=oldNbOfCells)
{
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
- for(auto array : arrays)
- if(array)
- _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),ToIdType(meshC2->getNumberOfCells()),array);
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
+ if(*iter)
+ _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),ToIdType(meshC2->getNumberOfCells()),*iter);
setMesh(meshC2);
return true;
}
const MCAuto<MEDCouplingUMesh> umesh(mesh->buildUnstructured());
MCAuto<MEDCouplingFieldDouble> ret(clone(false));
ret->setMesh(umesh);
- DataArrayIdType *cellIds=nullptr;
+ DataArrayIdType *cellIds=0;
MCAuto<MEDCouplingUMesh> mesh2=umesh->buildSlice3D(origin,vec,eps,cellIds);
- MCAuto<DataArrayIdType> const cellIds2=cellIds;
+ MCAuto<DataArrayIdType> cellIds2=cellIds;
ret->setMesh(mesh2);
- MCAuto<DataArrayIdType> const tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end());
+ MCAuto<DataArrayIdType> tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end());
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
int i=0;
throw INTERP_KERNEL::Exception("No underlying mesh on this field to perform simplexize !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform simplexize !");
- std::size_t const oldNbOfCells=_mesh->getNumberOfCells();
+ std::size_t oldNbOfCells=_mesh->getNumberOfCells();
MCAuto<MEDCouplingMesh> meshC2(_mesh->deepCopy());
MCAuto<DataArrayIdType> arr=meshC2->simplexize(policy);
- std::size_t const newNbOfCells=meshC2->getNumberOfCells();
+ std::size_t newNbOfCells=meshC2->getNumberOfCells();
if(oldNbOfCells==newNbOfCells)
return false;
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
- for(auto array : arrays)
- if(array)
- _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),ToIdType(arr->getNbOfElems()),array);
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
+ if(*iter)
+ _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),ToIdType(arr->getNbOfElems()),*iter);
setMesh(meshC2);
return true;
}
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::convertQuadraticCellsToLinear : null mesh !");
MCAuto<MEDCouplingUMesh> umesh(mesh->buildUnstructured());
- std::set<INTERP_KERNEL::NormalizedCellType> const gt(umesh->getAllGeoTypes());
+ std::set<INTERP_KERNEL::NormalizedCellType> gt(umesh->getAllGeoTypes());
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_GAUSS_PT));
//
const MEDCouplingFieldDiscretization *disc(getDiscretization());
- const auto *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
+ const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
if(!disc2)
throw INTERP_KERNEL::Exception("convertQuadraticCellsToLinear : Not a ON_GAUSS_PT field");
- std::set<INTERP_KERNEL::NormalizedCellType> const gt2(umesh->getAllGeoTypes());
+ std::set<INTERP_KERNEL::NormalizedCellType> gt2(umesh->getAllGeoTypes());
std::vector< MCAuto<DataArrayIdType> > cellIdsV;
std::vector< MCAuto<MEDCouplingUMesh> > meshesV;
std::vector< MEDCouplingGaussLocalization > glV;
bool isZipReq(false);
- for(auto it : gt)
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=gt.begin();it!=gt.end();it++)
{
- const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(it));
- MCAuto<DataArrayIdType> cellIds(umesh->giveCellsWithType(it));
+ const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(*it));
+ MCAuto<DataArrayIdType> cellIds(umesh->giveCellsWithType(*it));
cellIdsV.push_back(cellIds);
MCAuto<MEDCouplingUMesh> part(umesh->buildPartOfMySelf(cellIds->begin(),cellIds->end()));
- mcIdType const id(disc2->getGaussLocalizationIdOfOneType(it));
+ mcIdType id(disc2->getGaussLocalizationIdOfOneType(*it));
const MEDCouplingGaussLocalization& gl(disc2->getGaussLocalization(id));
if(!cm.isQuadratic())
{
{
isZipReq=true;
part->convertQuadraticCellsToLinear();
- INTERP_KERNEL::GaussInfo const gi(it,gl.getGaussCoords(),gl.getNumberOfGaussPt(),gl.getRefCoords(),gl.getNumberOfPtsInRefCell());
- INTERP_KERNEL::GaussInfo const gi2(gi.convertToLinear());
- MEDCouplingGaussLocalization const gl2(gi2.getGeoType(),gi2.getRefCoords(),gi2.getGaussCoords(),gl.getWeights());
+ INTERP_KERNEL::GaussInfo gi(*it,gl.getGaussCoords(),gl.getNumberOfGaussPt(),gl.getRefCoords(),gl.getNumberOfPtsInRefCell());
+ INTERP_KERNEL::GaussInfo gi2(gi.convertToLinear());
+ MEDCouplingGaussLocalization gl2(gi2.getGeoType(),gi2.getRefCoords(),gi2.getGaussCoords(),gl.getWeights());
glV.push_back(gl2);
}
meshesV.push_back(part);
umesh->zipCoords();
ret->setArray(const_cast<DataArrayDouble *>(getArray()));
ret->setMesh(umesh);
- for(const auto & it : glV)
- ret->setGaussLocalizationOnType(it.getType(),it.getRefCoords(),it.getGaussCoords(),it.getWeights());
+ for(std::vector< MEDCouplingGaussLocalization >::const_iterator it=glV.begin();it!=glV.end();it++)
+ ret->setGaussLocalizationOnType((*it).getType(),(*it).getRefCoords(),(*it).getGaussCoords(),(*it).getWeights());
ret->copyAllTinyAttrFrom(this);
ret->checkConsistencyLight();
return ret;
std::vector< MCAuto<MEDCouplingUMesh> > ms(a.size());
std::vector< const MEDCouplingUMesh *> ms2(a.size());
std::vector< const MEDCouplingTimeDiscretization *> tds(a.size());
- auto it=a.begin();
+ std::vector< const MEDCouplingFieldDouble *>::const_iterator it=a.begin();
std::vector<const MEDCouplingFieldDiscretization *> fds(a.size());
const MEDCouplingFieldDouble *ref((*it++));
if(!ref)
if(a[i]->getMesh())
{ ms[i]=a[i]->getMesh()->buildUnstructured(); ms2[i]=ms[i]; }
else
- { ms[i]=nullptr; ms2[i]=nullptr; }
+ { ms[i]=0; ms2[i]=0; }
tds[i]=a[i]->timeDiscr();
fds[i]=a[i]->getDiscretization();
}
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply DotFields on them! Check support mesh, and spatial and time discretisation.");
MEDCouplingTimeDiscretization *td(f1->timeDiscr()->dot(f2->timeDiscr()));
td->copyTinyAttrFrom(*f1->timeDiscr());
- auto *ret(new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()));
+ MEDCouplingFieldDouble *ret(new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()));
ret->setMesh(f1->getMesh());
return ret;
}
{
if(fs.empty())
return std::string();
- std::size_t const nfs=fs.size();
+ std::size_t nfs=fs.size();
if(!fs[0])
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::WriteVTK : 1st instance of field is NULL !");
const MEDCouplingMesh *m=fs[0]->getMesh();
for(std::size_t i=0;i<nfs;i++)
{
const MEDCouplingFieldDouble *cur=fs[i];
- std::string const name(cur->getName());
+ std::string name(cur->getName());
if(name.empty())
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::WriteVTK : Field in pos #" << i << " has no name !";
throw INTERP_KERNEL::Exception(oss.str());
}
- TypeOfField const typ=cur->getTypeOfField();
+ TypeOfField typ=cur->getTypeOfField();
if(typ==ON_CELLS)
cur->getArray()->writeVTK(coss,8,cur->getName(),byteArr);
else if(typ==ON_NODES)
MCAuto<MEDCouplingFieldDouble> fieldToWO;
const MEDCouplingMesh *inpMeshBase(getMesh());
MCAuto<MEDCouplingUMesh> inpMesh(inpMeshBase->buildUnstructured());
- std::string const meshName(inpMesh->getName());
+ std::string meshName(inpMesh->getName());
if(!inpMesh->isPresenceOfQuadratic())
fieldToWO=clone(false);
else
inpMeshBase=fieldToWO->getMesh();
inpMesh=inpMeshBase->buildUnstructured();
}
- mcIdType const nbCells(inpMesh->getNumberOfCells());
+ mcIdType nbCells(inpMesh->getNumberOfCells());
const MEDCouplingFieldDiscretization *disc(fieldToWO->getDiscretization());
- const auto *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
+ const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
if(!disc2)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::voronoize2D : Not a ON_GAUSS_PT field");
- mcIdType const nbLocs(disc2->getNbOfGaussLocalization());
+ mcIdType nbLocs(disc2->getNbOfGaussLocalization());
std::vector< MCAuto<MEDCouplingUMesh> > cells(nbCells);
for(mcIdType i=0;i<nbLocs;i++)
{
MCAuto<DataArrayDouble> coo2(DataArrayDouble::NewFromStdVector(coo));
coo2->rearrange(vor->getDimension());
//
- MCAuto<MEDCouplingUMesh> const coo3(MEDCouplingUMesh::Build0DMeshFromCoords(coo2));
+ MCAuto<MEDCouplingUMesh> coo3(MEDCouplingUMesh::Build0DMeshFromCoords(coo2));
//
MCAuto<MEDCouplingUMesh> vorCellsForCurDisc(vor->doIt(mesh,coo2,eps));
std::vector<mcIdType> ids;
MCAuto<MEDCouplingUMesh> subMesh(inpMesh->buildPartOfMySelf(&ids[0],&ids[0]+ids.size()));
ptsInReal=gl.localizePtsInRefCooForEachCell(vorCellsForCurDisc->getCoords(),subMesh);
}
- mcIdType const nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes());
+ mcIdType nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes());
for(mcIdType j=0;j<ToIdType(ids.size());j++)
{
MCAuto<MEDCouplingUMesh> elt(vorCellsForCurDisc->clone(false));
onCells->setTimeUnit(getTimeUnit());
{
int b,c;
- double const a(getTime(b,c));
+ double a(getTime(b,c));
onCells->setTime(a,b,c);
}
onCells->setName(getName());
{
MEDCouplingTimeDiscretizationTemplate<double> *ret(_time_discr);
if(!ret)
- return nullptr;
- auto *retc(dynamic_cast<MEDCouplingTimeDiscretization *>(ret));
+ return 0;
+ MEDCouplingTimeDiscretization *retc(dynamic_cast<MEDCouplingTimeDiscretization *>(ret));
if(!retc)
throw INTERP_KERNEL::Exception("Field Double Null invalid type of time discr !");
return retc;
{
const MEDCouplingTimeDiscretizationTemplate<double> *ret(_time_discr);
if(!ret)
- return nullptr;
- const auto *retc(dynamic_cast<const MEDCouplingTimeDiscretization *>(ret));
+ return 0;
+ const MEDCouplingTimeDiscretization *retc(dynamic_cast<const MEDCouplingTimeDiscretization *>(ret));
if(!retc)
throw INTERP_KERNEL::Exception("Field Double Null invalid type of time discr !");
return retc;
#ifndef __MEDCOUPLINGFIELDDOUBLE_HXX__
#define __MEDCOUPLINGFIELDDOUBLE_HXX__
-#include "MCType.hxx"
-#include "MCAuto.hxx"
#include "MEDCoupling.hxx"
-#include "MEDCouplingField.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
#include "MEDCouplingFieldT.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include <string>
-#include "MEDCouplingTraits.hxx"
-#include <vector>
-#include <cstddef>
-#include "MEDCouplingTimeDiscretization.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
namespace MEDCoupling
{
MEDCOUPLING_EXPORT void synchronizeTimeWithSupport();
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT std::string writeVTK(const std::string& fileName, bool isBinary=true) const;
- MEDCOUPLING_EXPORT bool areCompatibleForMerge(const MEDCouplingField *other) const override;
+ MEDCOUPLING_EXPORT bool areCompatibleForMerge(const MEDCouplingField *other) const;
MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingFieldDouble *other) const;
MEDCOUPLING_EXPORT void renumberNodes(const mcIdType *old2NewBg, double eps=1e-15);
MEDCOUPLING_EXPORT void renumberNodesWithoutMesh(const mcIdType *old2NewBg, mcIdType newNbOfNodes, double eps=1e-15);
MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(double vmin, double vmax) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *deepCopy() const;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *clone(bool recDeepCpy) const override;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *nodeToCellDiscretization() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const;
MEDCOUPLING_EXPORT std::size_t getNumberOfComponents() const;
MEDCOUPLING_EXPORT mcIdType getNumberOfTuples() const;
MEDCOUPLING_EXPORT mcIdType getNumberOfValues() const;
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
//
MEDCOUPLING_EXPORT void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
MEDCOUPLING_EXPORT void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
MEDCOUPLING_EXPORT const MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() const { return timeDiscr(); }
MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() { return timeDiscr(); }
protected:
- ~MEDCouplingFieldDouble() override = default;
+ ~MEDCouplingFieldDouble() { }
private:
MEDCOUPLING_EXPORT MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td);
#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldT.txx"
-#include "MEDCouplingFieldDiscretization.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingFieldInt32.hxx"
+#include "MEDCouplingFieldInt.hxx"
#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTimeDiscretization.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingTraits.hxx"
+#include "MEDCouplingMemArray.txx"
using namespace MEDCoupling;
#define __MEDCOUPLINGFIELDFLOAT_HXX__
#include "MEDCoupling.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
#include "MEDCouplingFieldT.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTraits.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingTimeDiscretization.hxx"
+#include "MEDCouplingMemArray.hxx"
#include <string>
MEDCOUPLING_EXPORT static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
MEDCOUPLING_EXPORT static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
MEDCOUPLING_EXPORT MEDCouplingFieldFloat *deepCopy() const;
- MEDCOUPLING_EXPORT MEDCouplingFieldFloat *clone(bool recDeepCpy) const override;
+ MEDCOUPLING_EXPORT MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *convertToIntField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *convertToInt64Field() const;
MEDCouplingFieldFloat(const MEDCouplingFieldFloat& other, bool deepCpy);
MEDCouplingFieldFloat(NatureOfField n, MEDCouplingTimeDiscretizationFloat *td, MEDCouplingFieldDiscretization *type);
MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td);
- ~MEDCouplingFieldFloat() override = default;
+ ~MEDCouplingFieldFloat() { }
};
}
// Author : Yann Pora (EDF R&D)
#include "MEDCouplingFieldInt32.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingFieldT.txx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTimeDiscretization.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingTraits.hxx"
+#include "MEDCouplingMemArray.txx"
using namespace MEDCoupling;
{
MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*self));
int t1,t2;
- double const t0(self->getTime(t1,t2));
+ double t0(self->getTime(t1,t2));
MCAuto<typename Traits<U>::FieldType > ret(Traits<U>::FieldType::New(*tmp,self->getTimeDiscretization()));
ret->setTime(t0,t1,t2);
if(self->getArray())
MEDCouplingFieldFloat *MEDCouplingFieldInt32::convertToFloatField() const
{
return ConvertToUField<float>(this);
-}
+}
\ No newline at end of file
#pragma once
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
#include "MEDCouplingFieldT.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTraits.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingTimeDiscretization.hxx"
+#include "MEDCouplingMemArray.hxx"
#include <string>
MEDCOUPLING_EXPORT static MEDCouplingFieldInt32 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
MEDCOUPLING_EXPORT static MEDCouplingFieldInt32 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *deepCopy() const;
- MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *clone(bool recDeepCpy) const override;
+ MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *clone(bool recDeepCpy) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldFloat *convertToFloatField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *convertToInt64Field() const;
MEDCouplingFieldInt32(const MEDCouplingFieldInt32& other, bool deepCopy);
MEDCouplingFieldInt32(NatureOfField n, MEDCouplingTimeDiscretizationInt32 *td, MEDCouplingFieldDiscretization *type);
MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td);
- ~MEDCouplingFieldInt32() override = default;
+ ~MEDCouplingFieldInt32() { }
};
}
#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingFieldT.txx"
-#include "MCType.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTimeDiscretization.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
+#include "MEDCouplingMemArray.txx"
using namespace MEDCoupling;
{
MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*this));
int t1,t2;
- double const t0(getTime(t1,t2));
+ double t0(getTime(t1,t2));
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*tmp,getTimeDiscretization()));
ret->setTime(t0,t1,t2);
if(getArray())
#pragma once
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
#include "MEDCouplingFieldT.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingTimeDiscretization.hxx"
+#include "MEDCouplingMemArray.hxx"
#include <string>
MEDCOUPLING_EXPORT static MEDCouplingFieldInt64 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
MEDCOUPLING_EXPORT static MEDCouplingFieldInt64 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *deepCopy() const;
- MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *clone(bool recDeepCpy) const override;
+ MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *clone(bool recDeepCpy) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const;
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldInt64"); }
protected:
MEDCouplingFieldInt64(const MEDCouplingFieldInt64& other, bool deepCopy);
MEDCouplingFieldInt64(NatureOfField n, MEDCouplingTimeDiscretizationInt64 *td, MEDCouplingFieldDiscretization *type);
MEDCouplingFieldInt64(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td);
- ~MEDCouplingFieldInt64() override = default;
+ ~MEDCouplingFieldInt64() { }
};
}
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingFieldOverTime.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingDefinitionTime.hxx"
#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingMultiFields.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include <cmath>
-#include <iterator>
-#include <sstream>
-#include <string>
-#include <vector>
using namespace MEDCoupling;
double MEDCouplingFieldOverTime::getTimeTolerance() const
{
- auto it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
if(_fs.empty())
throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : empty set !");
for(;it!=_fs.end();it++)
- if((const MEDCouplingFieldDouble *)(*it)!=nullptr)
+ if((const MEDCouplingFieldDouble *)(*it)!=0)
return (*it)->getTimeTolerance();
throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : only empty fields in this !");
}
void MEDCouplingFieldOverTime::checkConsistencyLight() const
{
MEDCouplingMultiFields::checkConsistencyLight();
- auto it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((*it)->getTimeDiscretization()==NO_TIME)
{
const MEDCouplingFieldDouble& ref=*(*(it++));
int tt1,tt2;
double reft=ref.getEndTime(tt1,tt2);
- double const eps=getTimeTolerance();
+ double eps=getTimeTolerance();
int id=1;
for(;it!=_fs.end();it++,id++)
{
std::ostringstream oss; oss << "Field slice at rank #" << id << " is not compatible with the first !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- double const curt=(*it)->getStartTime(tt1,tt2);
+ double curt=(*it)->getStartTime(tt1,tt2);
if(curt<reft-eps)
throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::checkConsistencyLight : fields are NOT sorted properly in ascending time !");
reft=(*it)->getEndTime(tt1,tt2);
{ ret << "Current instance is INVALID !\n"; }
try
{
- MEDCouplingDefinitionTime const dt=getDefinitionTimeZone();
+ MEDCouplingDefinitionTime dt=getDefinitionTimeZone();
dt.appendRepr(ret);
}
catch(INTERP_KERNEL::Exception& /*e*/)
{
if(!MEDCouplingMultiFields::isEqual(other,meshPrec,valsPrec))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingFieldOverTime *>(other);
+ const MEDCouplingFieldOverTime *otherC=dynamic_cast<const MEDCouplingFieldOverTime *>(other);
if(!otherC)
return false;
// to implement
{
if(!MEDCouplingMultiFields::isEqualWithoutConsideringStr(other,meshPrec,valsPrec))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingFieldOverTime *>(other);
+ const MEDCouplingFieldOverTime *otherC=dynamic_cast<const MEDCouplingFieldOverTime *>(other);
if(!otherC)
return false;
// to implement
{
std::vector< std::vector<int> > tmp;
getDifferentArrays(tmp);
- std::vector<const MEDCouplingFieldDouble *> const tmp2(_fs.begin(),_fs.end());
+ std::vector<const MEDCouplingFieldDouble *> tmp2(_fs.begin(),_fs.end());
std::vector<int> tmp3;
getDifferentMeshes(tmp3);
return MEDCouplingDefinitionTime(tmp2,tmp3,tmp);
}
MEDCouplingFieldOverTime::MEDCouplingFieldOverTime()
-= default;
+{
+}
#ifndef __PARAMEDMEM_MEDCOUPLINGFIELDOVERTIME_HXX__
#define __PARAMEDMEM_MEDCOUPLINGFIELDOVERTIME_HXX__
-#include "MEDCoupling.hxx"
#include "MEDCouplingMultiFields.hxx"
#include "MEDCouplingDefinitionTime.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include <string>
#include <vector>
namespace MEDCoupling
{
public:
MEDCOUPLING_EXPORT static MEDCouplingFieldOverTime *New(const std::vector<MEDCouplingFieldDouble *>& fs);
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT double getTimeTolerance() const;
- MEDCOUPLING_EXPORT std::string simpleRepr() const override;
- MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const override;
+ MEDCOUPLING_EXPORT std::string simpleRepr() const;
+ MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
//void getIdsToFetch(double time, int& fieldId, int& arrId, int& meshId) const;
//void setFieldOnId(int fieldId, MEDCouplingFieldDouble *f);
//void dispatchPointers();
- MEDCOUPLING_EXPORT std::vector<MEDCouplingMesh *> getMeshes() const override;
- MEDCOUPLING_EXPORT std::vector<MEDCouplingMesh *> getDifferentMeshes(std::vector<int>& refs) const override;
- MEDCOUPLING_EXPORT std::vector<DataArrayDouble *> getArrays() const override;
- MEDCOUPLING_EXPORT std::vector<DataArrayDouble *> getDifferentArrays(std::vector< std::vector<int> >& refs) const override;
+ MEDCOUPLING_EXPORT std::vector<MEDCouplingMesh *> getMeshes() const;
+ MEDCOUPLING_EXPORT std::vector<MEDCouplingMesh *> getDifferentMeshes(std::vector<int>& refs) const;
+ MEDCOUPLING_EXPORT std::vector<DataArrayDouble *> getArrays() const;
+ MEDCOUPLING_EXPORT std::vector<DataArrayDouble *> getDifferentArrays(std::vector< std::vector<int> >& refs) const;
MEDCOUPLING_EXPORT MEDCouplingDefinitionTime getDefinitionTimeZone() const;
protected:
MEDCOUPLING_EXPORT MEDCouplingFieldOverTime();
#pragma once
-#include "MEDCoupling.hxx"
-#include "MCType.hxx"
#include "MEDCouplingField.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
#include "MEDCouplingTraits.hxx"
#include "MEDCouplingTimeDiscretization.hxx"
-#include <cstddef>
-#include <ostream>
-#include <vector>
-#include <string>
+#include <sstream>
namespace MEDCoupling
{
MEDCouplingFieldT(const MEDCouplingField& other, MEDCouplingTimeDiscretizationTemplate<T> *timeDiscr, bool deepCopy=true);
MEDCouplingFieldT(TypeOfField type, MEDCouplingTimeDiscretizationTemplate<T> *timeDiscr);
MEDCouplingFieldT(MEDCouplingFieldDiscretization *type, NatureOfField n, MEDCouplingTimeDiscretizationTemplate<T> *timeDiscr);
- ~MEDCouplingFieldT() override;
+ ~MEDCouplingFieldT();
public:
MEDCOUPLING_EXPORT TypeOfTimeDiscretization getTimeDiscretization() const;
MEDCOUPLING_EXPORT virtual typename Traits<T>::FieldType *clone(bool recDeepCpy) const = 0;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT typename Traits<T>::FieldType *cloneWithMesh(bool recDeepCpy) const;
MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPart(const DataArrayIdType *part) const;
MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPart(const mcIdType *partBg, const mcIdType *partEnd) const;
MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingFieldT<T> *other, double meshPrec, T valsPrec) const;
MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingFieldT<T> *other, double meshPrec, T valsPrec, std::string& reason) const;
MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingFieldT<T> *other, double meshPrec, T valsPrec) const;
- MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingField *other) override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingField *other) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const override;
+ MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingField *other);
+ MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingField *other) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
// specific
MEDCOUPLING_EXPORT bool areCompatibleForMul(const MEDCouplingField *other) const;
MEDCOUPLING_EXPORT bool areCompatibleForDiv(const MEDCouplingField *other) const;
#ifndef __MEDCOUPLINGFIELDT_TXX__
#define __MEDCOUPLINGFIELDT_TXX__
-#include "MCAuto.hxx"
-#include "InterpKernelException.hxx"
-#include "MEDCouplingFieldT.hxx"
+#include "MEDCouplingTimeDiscretization.hxx"
#include "MEDCouplingMesh.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingNatureOfField.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingField.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTraits.hxx"
-
-#include <sstream>
-#include <vector>
-#include <string>
-#include <cstddef>
-#include <iostream>
namespace MEDCoupling
{
- class DataArray;
-
template<class T>
MEDCouplingFieldT<T>::MEDCouplingFieldT(const MEDCouplingFieldT<T>& other, bool deepCopy):MEDCouplingField(other,deepCopy),_time_discr(other._time_discr->performCopyOrIncrRef(deepCopy))
{
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingFieldTemplate.hxx"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingField.hxx"
-#include "MCType.hxx"
#include "MEDCouplingMesh.hxx"
#include "MEDCouplingFieldInt32.hxx"
#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingNatureOfField.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include <ostream>
#include <sstream>
-#include <string>
-#include <vector>
using namespace MEDCoupling;
void MEDCouplingFieldTemplate::checkConsistencyLight() const
{
- if(_mesh==nullptr)
+ if(_mesh==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldTemplate::checkConsistencyLight : Empty mesh !");
}
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
- dataInt=nullptr;
- std::vector<mcIdType> const tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end());
+ dataInt=0;
+ std::vector<mcIdType> tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end());
_type->resizeForUnserialization(tinyInfoITmp,dataInt);
}
void MEDCouplingFieldTemplate::reprQuickOverview(std::ostream& stream) const
{
stream << "MEDCouplingFieldTemplate C++ instance at " << this << ". Name : \"" << _name << "\"." << std::endl;
- const char *nat=nullptr;
+ const char *nat=0;
try
{
nat=MEDCouplingNatureOfField::GetRepr(_nature);
{
std::ostringstream oss;
_mesh->reprQuickOverview(oss);
- std::string const tmp(oss.str());
+ std::string tmp(oss.str());
stream << "\nMesh info : " << tmp.substr(0,tmp.find('\n'));
}
}
MCAuto<MEDCouplingFieldTemplate> MEDCouplingFieldTemplate::clone(bool recDeepCpy) const
{
- MCAuto<MEDCouplingFieldTemplate> const ret(new MEDCouplingFieldTemplate(*this,recDeepCpy));
+ MCAuto<MEDCouplingFieldTemplate> ret(new MEDCouplingFieldTemplate(*this,recDeepCpy));
return ret;
}
#pragma once
-#include "MEDCoupling.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
#include "MEDCouplingField.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include <string>
-#include <vector>
-#include <ostream>
namespace MEDCoupling
{
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldTemplate> clone(bool recDeepCpy) const;
//
MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&dataInt) const;
//
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
private:
MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f, bool isChecked=true);
MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f, bool isChecked=true);
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingGaussLocalization.hxx"
-#include "InterpKernelException.hxx"
#include "InterpKernelGaussCoords.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MEDCoupling1GTUMesh.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingUMesh.hxx"
#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
#include <cmath>
-#include <cstddef>
-#include <ostream>
-#include <iterator>
-#include <functional>
+#include <numeric>
#include <sstream>
+#include <iterator>
#include <algorithm>
-#include <string>
-#include <vector>
using namespace MEDCoupling;
void MEDCouplingGaussLocalization::checkConsistencyLight() const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
- int const nbNodes=cm.getNumberOfNodes();
- int const dim=cm.getDimension();
+ int nbNodes=cm.getNumberOfNodes();
+ int dim=cm.getDimension();
if(!cm.isDynamic())
{
if(ToIdType(_ref_coord.size())!=nbNodes*dim)
const INTERP_KERNEL::CellModel& cm = INTERP_KERNEL::CellModel::GetCellModel(_type);
return ((int)_ref_coord.size()) / ((int)cm.getDimension());
}
- int const dim( getDimension() );
+ int dim( getDimension() );
return (int)_ref_coord.size()/dim;
}
double MEDCouplingGaussLocalization::getRefCoord(int ptIdInCell, int comp) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
- int const nbNodes=cm.getNumberOfNodes();
- int const dim=cm.getDimension();
+ int nbNodes=cm.getNumberOfNodes();
+ int dim=cm.getDimension();
if(ptIdInCell<0 || ptIdInCell>=nbNodes)
throw INTERP_KERNEL::Exception("ptIdInCell specified is invalid : must be in [0;nbNodesPerCell) !");
if(comp<0 || comp>=dim)
double MEDCouplingGaussLocalization::getGaussCoord(int gaussPtIdInCell, int comp) const
{
- int const dim=checkCoherencyOfRequest(gaussPtIdInCell,comp);
+ int dim=checkCoherencyOfRequest(gaussPtIdInCell,comp);
return _gauss_coord[gaussPtIdInCell*dim+comp];
}
ptsInRefCoo->checkAllocated();
mesh->checkConsistencyLight();
//
- mcIdType const nbCells=mesh->getNumberOfCells();
+ mcIdType nbCells=mesh->getNumberOfCells();
const double *coords(mesh->getCoords()->begin());
const mcIdType *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin());
//
- mcIdType const nbPts(ptsInRefCoo->getNumberOfTuples());
- INTERP_KERNEL::NormalizedCellType const typ(getType());
+ mcIdType nbPts(ptsInRefCoo->getNumberOfTuples());
+ INTERP_KERNEL::NormalizedCellType typ(getType());
int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()),outDim(mesh->getSpaceDimension());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbPts*nbCells,outDim);
double *retPtr(ret->getPointer());
for(int iGaussPt = 0 ; iGaussPt < nbGaussPt ; ++iGaussPt)
{
- std::vector<double> const curGaussPt(_gauss_coord.begin()+iGaussPt*dim,_gauss_coord.begin()+(iGaussPt+1)*dim);
+ std::vector<double> curGaussPt(_gauss_coord.begin()+iGaussPt*dim,_gauss_coord.begin()+(iGaussPt+1)*dim);
INTERP_KERNEL::GaussInfo gi(_type,curGaussPt,1,_ref_coord,nbPtsRefCell);
gi.initLocalInfo();
const double *funcVal( gi.getFunctionValues(0) );
double *retPtr(ret->getPointer());
for(int iGaussPt = 0 ; iGaussPt < nbGaussPt ; ++iGaussPt)
{
- std::vector<double> const curGaussPt(_gauss_coord.begin()+iGaussPt*dim,_gauss_coord.begin()+(iGaussPt+1)*dim);
+ std::vector<double> curGaussPt(_gauss_coord.begin()+iGaussPt*dim,_gauss_coord.begin()+(iGaussPt+1)*dim);
INTERP_KERNEL::GaussInfo gi(_type,curGaussPt,1,_ref_coord,nbPtsRefCell);
gi.initLocalInfo();
const double *devOfFuncVal( gi.getDerivativeOfShapeFunctionAt(0) );
void MEDCouplingGaussLocalization::setRefCoord(int ptIdInCell, int comp, double newVal)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
- int const nbNodes=cm.getNumberOfNodes();
- int const dim=cm.getDimension();
+ int nbNodes=cm.getNumberOfNodes();
+ int dim=cm.getDimension();
if(ptIdInCell<0 || ptIdInCell>=nbNodes)
throw INTERP_KERNEL::Exception("ptIdInCell specified is invalid : must be in [0;nbNodesPerCell) !");
if(comp<0 || comp>=dim)
void MEDCouplingGaussLocalization::setGaussCoord(int gaussPtIdInCell, int comp, double newVal)
{
- int const dim=checkCoherencyOfRequest(gaussPtIdInCell,comp);
+ int dim=checkCoherencyOfRequest(gaussPtIdInCell,comp);
_gauss_coord[gaussPtIdInCell*dim+comp]=newVal;
}
int MEDCouplingGaussLocalization::checkCoherencyOfRequest(mcIdType gaussPtIdInCell, int comp) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
- int const dim=cm.getDimension();
- mcIdType const nbGsPts=getNumberOfGaussPt();
+ int dim=cm.getDimension();
+ mcIdType nbGsPts=getNumberOfGaussPt();
if(gaussPtIdInCell<0 || gaussPtIdInCell>=nbGsPts)
throw INTERP_KERNEL::Exception("gaussPtIdInCell specified is invalid : must be in [0:nbGsPts) !");
if(comp<0 || comp>=dim)
bool MEDCouplingGaussLocalization::AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps)
{
- std::size_t const sz=v1.size();
+ std::size_t sz=v1.size();
if(sz!=v2.size())
return false;
std::vector<double> tmp(sz);
std::vector<double> retCpp(INTERP_KERNEL::GaussInfo::GetDefaultReferenceCoordinatesOf(type));
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
auto nbDim(cm.getDimension());
- std::size_t const sz(retCpp.size());
+ std::size_t sz(retCpp.size());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
if( sz%std::size_t(nbDim) != 0 )
THROW_IK_EXCEPTION("GetDefaultReferenceCoordinatesOf : unexpected size of defaut array : " << sz << " % " << nbDim << " != 0 !");
#ifndef __PARAMEDMEM_MEDCOUPLINGGAUSSLOCALIZATION_HXX__
#define __PARAMEDMEM_MEDCOUPLINGGAUSSLOCALIZATION_HXX__
-#include "MCType.hxx"
-#include "MCAuto.hxx"
#include "MEDCoupling.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "NormalizedGeometricTypes"
+#include "InterpKernelException.hxx"
-#include <string>
-#include <cstddef>
#include <vector>
namespace MEDCoupling
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingIMesh.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingMemArray.txx"
+#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingStructuredMesh.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include <cmath>
-#include <cstddef>
#include <functional>
#include <algorithm>
-#include <iterator>
-#include <ostream>
#include <sstream>
#include <numeric>
-#include <vector>
-#include <utility>
using namespace MEDCoupling;
}
MEDCouplingIMesh::~MEDCouplingIMesh()
-= default;
+{
+}
MEDCouplingIMesh *MEDCouplingIMesh::New()
{
if(ghostLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::buildWithGhost : the ghostLev must be >= 0 !");
checkConsistencyLight();
- int const spaceDim(getSpaceDimension());
+ int spaceDim(getSpaceDimension());
double origin[3],dxyz[3];
mcIdType structure[3];
for(int i=0;i<spaceDim;i++)
void MEDCouplingIMesh::setNodeStruct(const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop)
{
checkSpaceDimension();
- auto sz((mcIdType)std::distance(nodeStrctStart,nodeStrctStop));
+ mcIdType sz((mcIdType)std::distance(nodeStrctStart,nodeStrctStop));
if(sz!=_space_dim)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setNodeStruct : input vector of node structure has not the right size ! Or change space dimension before calling it !");
std::copy(nodeStrctStart,nodeStrctStop,_structure);
void MEDCouplingIMesh::setOrigin(const double *originStart, const double *originStop)
{
checkSpaceDimension();
- mcIdType const sz(ToIdType(std::distance(originStart,originStop)));
+ mcIdType sz(ToIdType(std::distance(originStart,originStop)));
if(sz!=_space_dim)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setOrigin : input vector of origin vector has not the right size ! Or change space dimension before calling it !");
std::copy(originStart,originStop,_origin);
void MEDCouplingIMesh::setDXYZ(const double *dxyzStart, const double *dxyzStop)
{
checkSpaceDimension();
- mcIdType const sz(ToIdType(std::distance(dxyzStart,dxyzStop)));
+ mcIdType sz(ToIdType(std::distance(dxyzStart,dxyzStop)));
if(sz!=_space_dim)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setDXYZ : input vector of dxyz vector has not the right size ! Or change space dimension before calling it !");
std::copy(dxyzStart,dxyzStop,_dxyz);
double MEDCouplingIMesh::getMeasureOfAnyCell() const
{
checkConsistencyLight();
- int const dim(getSpaceDimension());
+ int dim(getSpaceDimension());
double ret(1.);
for(int i=0;i<dim;i++)
ret*=fabs(_dxyz[i]);
try
{ ret->copyTinyInfoFrom(this); }
catch(INTERP_KERNEL::Exception& ) { }
- int const spaceDim(getSpaceDimension());
+ int spaceDim(getSpaceDimension());
std::vector<std::string> infos(buildInfoOnComponents());
for(int i=0;i<spaceDim;i++)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::refineWithFactor : factor for axis #" << i << " (" << factors[i] << ")is invalid ! Must be > 0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType const factAbs(std::abs(factors[i]));
- double const fact2(1./(double)factors[i]);
+ mcIdType factAbs(std::abs(factors[i]));
+ double fact2(1./(double)factors[i]);
structure[i]=(_structure[i]-1)*factAbs+1;
dxyz[i]=fact2*_dxyz[i];
}
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : All input vectors (dimension) must have the same size !");
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !");
- std::size_t const meshDim(coarseSt.size());
+ std::size_t meshDim(coarseSt.size());
mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
- std::size_t const nbCompo=fineDA->getNumberOfComponents();
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType const nbTuplesFine(fineDA->getNumberOfTuples());
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples());
if(nbOfTuplesInFineExp==0)
{
if(nbTuplesFine==0)
}
if(nbTuplesFine%nbOfTuplesInFineExp!=0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : Invalid nb of tuples in fine DataArray regarding its structure !");
- mcIdType const fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<mcIdType>()));
+ mcIdType fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<mcIdType>()));
if(nbTuplesFine!=fact*nbOfTuplesInFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Invalid number of tuples (" << nbTuplesFine << ") of fine dataarray is invalid ! Must be " << fact*nbOfTuplesInFineExp << "!";
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the parameters 1 or 3 are NULL or not allocated !");
std::vector<mcIdType> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind(std::plus<mcIdType>(),std::placeholders::_1,2*ghostSize));
- std::size_t const meshDim(coarseSt.size());
- mcIdType const nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- std::size_t const nbCompo(fineDA->getNumberOfComponents());
+ std::size_t meshDim(coarseSt.size());
+ mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
+ std::size_t nbCompo(fineDA->getNumberOfComponents());
if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
}
case 2:
{
- mcIdType const nxwg(coarseSt[0]+2*ghostSize);
+ mcIdType nxwg(coarseSt[0]+2*ghostSize);
mcIdType kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)),fact1(facts[1]),fact0(facts[0]);
inPtr+=(dims[0]*fact0+2*ghostSize)*ghostSize*nbCompo;
for(int j=0;j<dims[1];j++)
inPtr+=ghostSize*(dims[0]*fact0+2*ghostSize)*nbCompo;
for(int j=0;j<dims[1];j++)
{
- mcIdType const kky(j*nxwg);
+ mcIdType kky(j*nxwg);
for(mcIdType jfact=0;jfact<fact1;jfact++)
{
inPtr+=ghostSize*nbCompo;
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : All input vectors (dimension) must have the same size !");
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !");
- std::size_t const meshDim(coarseSt.size());
+ std::size_t meshDim(coarseSt.size());
mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
- std::size_t const nbCompo=fineDA->getNumberOfComponents();
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType const nbTuplesFine(fineDA->getNumberOfTuples());
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples());
if(nbTuplesFine%nbOfTuplesInFineExp!=0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : Invalid nb of tuples in fine DataArray regarding its structure !");
- mcIdType const fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<mcIdType>()));
+ mcIdType fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<mcIdType>()));
if(nbTuplesFine!=fact*nbOfTuplesInFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Invalid number of tuples (" << nbTuplesFine << ") of fine dataarray is invalid ! Must be " << fact*nbOfTuplesInFineExp << "!";
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the parameters 1 or 3 are NULL or not allocated !");
std::vector<mcIdType> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind(std::plus<mcIdType>(),std::placeholders::_1,2*ghostSize));
- std::size_t const meshDim(coarseSt.size());
- mcIdType const nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- std::size_t const nbCompo=fineDA->getNumberOfComponents();
+ std::size_t meshDim(coarseSt.size());
+ mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the parameters 1 or 3 are NULL or not allocated !");
std::vector<mcIdType> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind(std::plus<mcIdType>(),std::placeholders::_1,2*ghostSize));
- std::size_t const meshDim(coarseSt.size());
- mcIdType const nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- std::size_t const nbCompo=fineDA->getNumberOfComponents();
+ std::size_t meshDim(coarseSt.size());
+ mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
*/
void MEDCouplingIMesh::copyTinyStringsFrom(const MEDCouplingMesh *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingIMesh *>(other);
+ const MEDCouplingIMesh *otherC=dynamic_cast<const MEDCouplingIMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::copyTinyStringsFrom : meshes have not same type !");
MEDCouplingStructuredMesh::copyTinyStringsFrom(other);
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::isEqualIfNotWhy : input other pointer is null !");
- const auto *otherC(dynamic_cast<const MEDCouplingIMesh *>(other));
+ const MEDCouplingIMesh *otherC(dynamic_cast<const MEDCouplingIMesh *>(other));
if(!otherC)
{
reason="mesh given in input is not castable in MEDCouplingIMesh !";
bool MEDCouplingIMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingIMesh *>(other);
+ const MEDCouplingIMesh *otherC=dynamic_cast<const MEDCouplingIMesh *>(other);
if(!otherC)
return false;
std::string tmp;
bool MEDCouplingIMesh::isEqualWithoutConsideringStrInternal(const MEDCouplingMesh *other, double prec, std::string& reason) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingIMesh *>(other);
+ const MEDCouplingIMesh *otherC=dynamic_cast<const MEDCouplingIMesh *>(other);
if(!otherC)
return false;
if(_space_dim!=otherC->_space_dim)
return true;
}
-void MEDCouplingIMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec,
- DataArrayIdType *& /*cellCor*/, DataArrayIdType *& /*nodeCor*/) const
+void MEDCouplingIMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalWith : Meshes are not the same !");
* Nothing is done here (except to check that the other is a MEDCoupling::MEDCouplingIMesh instance too).
* The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingIMesh, \a this and \a other are the same !
*/
-void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec,
- DataArrayIdType *& /*cellCor*/) const
+void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayIdType *&cellCor) const
{
if(!isEqualWithoutConsideringStr(other,prec))
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
}
}
-void MEDCouplingIMesh::checkConsistency(double /*eps*/) const
+void MEDCouplingIMesh::checkConsistency(double eps) const
{
checkConsistencyLight();
}
MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const
{
checkConsistencyLight();
- int const dim(getSpaceDimension());
+ int dim(getSpaceDimension());
if(dim!=ToIdType(cellPart.size()))
{
std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
for(int i=0;i<dim;i++)
{
mcIdType startNode(cellPart[i].first),endNode(cellPart[i].second+1);
- mcIdType const myDelta(endNode-startNode);
+ mcIdType myDelta(endNode-startNode);
if(startNode<0 || startNode>=_structure[i])
{
std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : At dimension #" << i << " the start node id is " << startNode << " it should be in [0," << _structure[i] << ") !";
void MEDCouplingIMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const
{
mcIdType tmp[3];
- int const spaceDim(getSpaceDimension());
+ int spaceDim(getSpaceDimension());
getSplitNodeValues(tmp);
mcIdType tmp2[3];
GetPosFromId(nodeId,spaceDim,tmp,tmp2);
ret << "Image grid with name : \"" << getName() << "\"\n";
ret << "Description of mesh : \"" << getDescription() << "\"\n";
int tmpp1,tmpp2;
- double const tt(getTime(tmpp1,tmpp2));
- int const spaceDim(_space_dim);
+ double tt(getTime(tmpp1,tmpp2));
+ int spaceDim(_space_dim);
ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Space dimension : " << spaceDim << "\n";
void MEDCouplingIMesh::getBoundingBox(double *bbox) const
{
checkConsistencyLight();
- int const dim(getSpaceDimension());
+ int dim(getSpaceDimension());
for(int idim=0; idim<dim; idim++)
{
bbox[2*idim]=_origin[idim];
* and one time . The caller is to delete this field using decrRef() as it is no
* more needed.
*/
-MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureField(bool /*isAbs*/) const
+MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureField(bool isAbs) const
{
checkConsistencyLight();
std::string name="MeasureOfMesh_";
name+=getName();
- std::size_t const nbelem=getNumberOfCells();
+ std::size_t nbelem=getNumberOfCells();
MEDCouplingFieldDouble *field(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
field->setName(name);
DataArrayDouble* array(DataArrayDouble::New());
/*!
* not implemented yet !
*/
-MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureFieldOnNode(bool /*isAbs*/) const
+MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureFieldOnNode(bool isAbs) const
{
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::getMeasureFieldOnNode : not implemented yet !");
//return 0;
}
-mcIdType MEDCouplingIMesh::getCellContainingPoint(const double *pos, double /*eps*/) const
+mcIdType MEDCouplingIMesh::getCellContainingPoint(const double *pos, double eps) const
{
mcIdType dim(getSpaceDimension()),ret(0),coeff(1);
for(mcIdType i=0;i<dim;i++)
{
- mcIdType const nbOfCells(_structure[i]-1);
- double const ref(pos[i]);
- mcIdType const tmp(ToIdType((ref-_origin[i])/_dxyz[i]));
+ mcIdType nbOfCells(_structure[i]-1);
+ double ref(pos[i]);
+ mcIdType tmp(ToIdType((ref-_origin[i])/_dxyz[i]));
if(tmp>=0 && tmp<nbOfCells)
{
ret+=coeff*tmp;
void MEDCouplingIMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
{
- mcIdType const ret(getCellContainingPoint(pos,eps));
+ mcIdType ret(getCellContainingPoint(pos,eps));
elts.push_back(ret);
}
-void MEDCouplingIMesh::rotate(const double * /*center*/, const double * /*vector*/, double /*angle*/)
+void MEDCouplingIMesh::rotate(const double *center, const double *vector, double angle)
{
throw INTERP_KERNEL::Exception("No rotation available on IMesh : Traduce it to unstructured mesh to apply it !");
}
void MEDCouplingIMesh::translate(const double *vector)
{
checkSpaceDimension();
- int const dim(getSpaceDimension());
+ int dim(getSpaceDimension());
std::transform(_origin,_origin+dim,vector,_origin,std::plus<double>());
declareAsNew();
}
void MEDCouplingIMesh::scale(const double *point, double factor)
{
checkSpaceDimension();
- int const dim(getSpaceDimension());
+ int dim(getSpaceDimension());
std::transform(_origin,_origin+dim,point,_origin,std::minus<double>());
std::transform(_origin,_origin+dim,_origin,std::bind(std::multiplies<double>(),std::placeholders::_1,factor));
std::transform(_dxyz,_dxyz+dim,_dxyz,std::bind(std::multiplies<double>(),std::placeholders::_1,factor));
declareAsNew();
}
-MEDCouplingMesh *MEDCouplingIMesh::mergeMyselfWith(const MEDCouplingMesh * /*other*/) const
+MEDCouplingMesh *MEDCouplingIMesh::mergeMyselfWith(const MEDCouplingMesh *other) const
{
//not implemented yet !
- return nullptr;
+ return 0;
}
/*!
{
checkConsistencyLight();
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- int const spaceDim(getSpaceDimension());
- mcIdType const nbNodes(getNumberOfNodes());
+ int spaceDim(getSpaceDimension());
+ mcIdType nbNodes(getNumberOfNodes());
ret->alloc(nbNodes,spaceDim);
double *pt(ret->getPointer());
ret->setInfoOnComponents(buildInfoOnComponents());
{
checkConsistencyLight();
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- int const spaceDim(getSpaceDimension());
+ int spaceDim(getSpaceDimension());
mcIdType nbCells(ToIdType(getNumberOfCells())),tmp[3],tmp2[3];
ret->alloc(nbCells,spaceDim);
double *pt(ret->getPointer()),shiftOrigin[3];
return MEDCouplingIMesh::computeCellCenterOfMass();
}
-void MEDCouplingIMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*check*/)
+void MEDCouplingIMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for IMesh !");
}
void MEDCouplingIMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
- double const time(getTime(it,order));
+ double time(getTime(it,order));
tinyInfo.clear();
tinyInfoD.clear();
littleStrings.clear();
tinyInfoD.insert(tinyInfoD.end(),_origin,_origin+3);
}
-void MEDCouplingIMesh::resizeForUnserialization(const std::vector<mcIdType>& /*tinyInfo*/, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& /*littleStrings*/) const
+void MEDCouplingIMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
a1->alloc(0,1);
a2->alloc(0,1);
a2->alloc(0,1);
}
-void MEDCouplingIMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType * /*a1*/, DataArrayDouble * /*a2*/,
+void MEDCouplingIMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
setName(littleStrings[0]);
declareAsNew();
}
-void MEDCouplingIMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte * /*byteData*/) const
+void MEDCouplingIMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
{
checkConsistencyLight();
std::ostringstream extent,origin,spacing;
bool isPb(false);
for(int i=0;i<_space_dim;i++)
{
- char const tmp=(char)((int)('X')+i);
- mcIdType const tmpNodes(_structure[i]);
+ char tmp=(char)((int)('X')+i);
+ mcIdType tmpNodes(_structure[i]);
stream1 << "- Axis " << tmp << " : " << tmpNodes << " nodes (orig=" << _origin[i] << ", inter=" << _dxyz[i] << ").";
if(i!=_space_dim-1)
stream1 << std::endl;
std::vector<std::string> MEDCouplingIMesh::buildInfoOnComponents() const
{
checkSpaceDimension();
- int const dim(getSpaceDimension());
+ int dim(getSpaceDimension());
std::vector<std::string> ret(dim);
for(int i=0;i<dim;i++)
{
std::ostringstream oss;
- char const tmp=(char)((int)('X')+i); oss << tmp;
+ char tmp=(char)((int)('X')+i); oss << tmp;
ret[i]=DataArray::BuildInfoFromVarAndUnit(oss.str(),_axis_unit);
}
return ret;
return val;
if(order!=2 && order!=3)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::FindIntRoot : the order available are 0,1,2 or 3 !");
- auto const valf((double)val);
+ double valf((double)val);
if(order==2)
{
- double const retf(sqrt(valf));
- int const ret((int)retf);
+ double retf(sqrt(valf));
+ int ret((int)retf);
if(ret*ret!=val)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::FindIntRoot : the input val is not a perfect square root !");
return ret;
}
else//order==3
{
- double const retf(std::pow(val,0.3333333333333333));
+ double retf(std::pow(val,0.3333333333333333));
int ret((int)retf),ret2(ret+1);
if(ret*ret*ret!=val && ret2*ret2*ret2!=val)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::FindIntRoot : the input val is not a perfect cublic root !");
{
for(mcIdType ig=0;ig<ghostSize;ig++)
outPtr2=std::copy(inPtr+kk*nbCompo,inPtr+(kk+1)*nbCompo,outPtr2);
- mcIdType const kk0(kk+1+dims[0]);//1 not ghost. We make the hypothesis that factors is >= ghostlev
+ mcIdType kk0(kk+1+dims[0]);//1 not ghost. We make the hypothesis that factors is >= ghostlev
outPtr2+=fact0*nbCompo*dims[0];
for(mcIdType ig=0;ig<ghostSize;ig++)
outPtr2=std::copy(inPtr+kk0*nbCompo,inPtr+(kk0+1)*nbCompo,outPtr2);
#ifndef __PARAMEDMEM_MEDCOUPLINGIMESH_HXX__
#define __PARAMEDMEM_MEDCOUPLINGIMESH_HXX__
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingStructuredMesh.hxx"
-#include <string>
-#include <vector>
-#include <utility>
-#include <cstddef>
-#include <ostream>
namespace MEDCoupling
{
MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize);
MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<mcIdType>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<mcIdType,mcIdType> >& fineLocInCoarse, const std::vector<mcIdType>& facts, mcIdType ghostSize);
//
- MEDCOUPLING_EXPORT MEDCouplingIMesh *deepCopy() const override;
- MEDCOUPLING_EXPORT MEDCouplingIMesh *clone(bool recDeepCpy) const override;
- MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override;
+ MEDCOUPLING_EXPORT MEDCouplingIMesh *deepCopy() const;
+ MEDCOUPLING_EXPORT MEDCouplingIMesh *clone(bool recDeepCpy) const;
+ MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const;
MEDCOUPLING_EXPORT MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const;
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return IMAGE_GRID; }
- MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return IMAGE_GRID; }
+ MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor) const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override;
- MEDCOUPLING_EXPORT int getSpaceDimension() const override;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const override;
- MEDCOUPLING_EXPORT std::string simpleRepr() const override;
- MEDCOUPLING_EXPORT std::string advancedRepr() const override;
+ DataArrayIdType *&cellCor) const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
+ MEDCOUPLING_EXPORT int getSpaceDimension() const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT std::string simpleRepr() const;
+ MEDCOUPLING_EXPORT std::string advancedRepr() const;
// tools
- MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override;
- MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const override;
- MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override;
- MEDCOUPLING_EXPORT void translate(const double *vector) override;
- MEDCOUPLING_EXPORT void scale(const double *point, double factor) override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override;
- MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override;
+ MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
+ MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
+ MEDCOUPLING_EXPORT void translate(const double *vector);
+ MEDCOUPLING_EXPORT void scale(const double *point, double factor);
+ MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
//some useful methods
- MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const override;
- MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeGridStructure() const override;
- MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const override;
+ MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getNodeGridStructure() const;
+ MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const;
//serialisation-unserialization
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override;
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
- const std::vector<std::string>& littleStrings) override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
- MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override;
+ const std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+ MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
private:
MEDCouplingIMesh();
MEDCouplingIMesh(const MEDCouplingIMesh& other, bool deepCopy);
- ~MEDCouplingIMesh() override;
- void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override;
- std::string getVTKDataSetType() const override;
+ ~MEDCouplingIMesh();
+ void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
+ std::string getVTKDataSetType() const;
bool isEqualWithoutConsideringStrInternal(const MEDCouplingMesh *other, double prec, std::string& reason) const;
std::vector<std::string> buildInfoOnComponents() const;
void checkSpaceDimension() const;
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingMap.txx"
-#include "MCIdType.hxx"
using namespace MEDCoupling;
#ifndef __MEDCOUPLING_MEDCOUPLINGMAP_HXX__
#define __MEDCOUPLING_MEDCOUPLINGMAP_HXX__
+#include "MEDCoupling.hxx"
#include "MCAuto.hxx"
#include "MCType.hxx"
#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingRefCountObject.hxx"
+#include "InterpKernelException.hxx"
-#include <cstddef>
#include <map>
-#include <string>
-#include <vector>
namespace MEDCoupling
{
std::string getClassName() const override { return std::string("MapKeyVal"); }
std::map<ID,T>& data() { return _m; }
const std::map<ID,T>& data() const { return _m; }
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject*> getDirectChildrenWithNull() const override;
- void updateTime() const override { }
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject*> getDirectChildrenWithNull() const;
+ void updateTime() const { }
private:
MapKeyVal() { }
- ~MapKeyVal() override = default;
+ ~MapKeyVal() { }
private:
std::map<ID,T> _m;
};
#ifndef __MEDCOUPLING_MEDCOUPLINGMAP_TXX__
#define __MEDCOUPLING_MEDCOUPLINGMAP_TXX__
-#include "MCAuto.hxx"
#include "MEDCouplingMap.hxx"
-#include <cstddef>
-#include <utility>
-#include <vector>
-#include "MEDCouplingRefCountObject.hxx"
namespace MEDCoupling
{
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingMappedExtrudedMesh.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCIdType.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingMemArray.hxx"
#include "CellModel.hxx"
#include "InterpolationUtils.hxx"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
#include <limits>
-#include <list>
#include <algorithm>
#include <functional>
#include <iterator>
-#include <ostream>
#include <sstream>
#include <cmath>
+#include <list>
#include <set>
-#include <vector>
-#include <string>
using namespace MEDCoupling;
*/
void MEDCouplingMappedExtrudedMesh::copyTinyStringsFrom(const MEDCouplingMesh *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingMappedExtrudedMesh *>(other);
+ const MEDCouplingMappedExtrudedMesh *otherC=dynamic_cast<const MEDCouplingMappedExtrudedMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::copyTinyStringsFrom : meshes have not same type !");
MEDCouplingMesh::copyTinyStringsFrom(other);
}
MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId)
-try:_mesh2D(const_cast<MEDCouplingUMesh *>(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(nullptr),_cell_2D_id(cell2DId)
+try:_mesh2D(const_cast<MEDCouplingUMesh *>(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId)
{
if(_mesh2D.isNotNull())
_mesh2D->incrRef();
throw e;
}
-MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D):_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(nullptr),_cell_2D_id(0)
+MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D):_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(0)
{
if(!mesh3D)
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh contrct : null input pointer !");
setName(mesh3D->getName()); setDescription(mesh3D->getDescription());
}
-MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh():_mesh2D(nullptr),_mesh1D(nullptr),_mesh3D_ids(nullptr),_cell_2D_id(-1)
+MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh():_mesh2D(0),_mesh1D(0),_mesh3D_ids(0),_cell_2D_id(-1)
{
}
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::isEqualIfNotWhy : input other pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCouplingMappedExtrudedMesh *>(other);
+ const MEDCouplingMappedExtrudedMesh *otherC=dynamic_cast<const MEDCouplingMappedExtrudedMesh *>(other);
std::ostringstream oss;
if(!otherC)
{
bool MEDCouplingMappedExtrudedMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingMappedExtrudedMesh *>(other);
+ const MEDCouplingMappedExtrudedMesh *otherC=dynamic_cast<const MEDCouplingMappedExtrudedMesh *>(other);
if(!otherC)
return false;
if(!_mesh2D->isEqualWithoutConsideringStr(otherC->_mesh2D,prec))
return true;
}
-void MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith(const MEDCouplingMesh * /*other*/, int /*cellCompPol*/, double /*prec*/,
- DataArrayIdType *& /*cellCor*/, DataArrayIdType *& /*nodeCor*/) const
+void MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith : not implemented yet !");
}
-void MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh * /*other*/, int /*cellCompPol*/, double /*prec*/,
- DataArrayIdType *& /*cellCor*/) const
+void MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
+ DataArrayIdType *&cellCor) const
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith : not implemented yet !");
}
INTERP_KERNEL::NormalizedCellType MEDCouplingMappedExtrudedMesh::getTypeOfCell(mcIdType cellId) const
{
const mcIdType *ids(_mesh3D_ids->begin());
- std::size_t const nbOf3DCells(_mesh3D_ids->getNumberOfTuples());
+ std::size_t nbOf3DCells(_mesh3D_ids->getNumberOfTuples());
const mcIdType *where(std::find(ids,ids+nbOf3DCells,cellId));
if(where==ids+nbOf3DCells)
throw INTERP_KERNEL::Exception("Invalid cellId specified >= getNumberOfCells() !");
- std::size_t const nbOfCells2D(_mesh2D->getNumberOfCells());
- std::size_t const locId((std::distance(ids,where))%nbOfCells2D);
- INTERP_KERNEL::NormalizedCellType const tmp(_mesh2D->getTypeOfCell(ToIdType(locId)));
+ std::size_t nbOfCells2D(_mesh2D->getNumberOfCells());
+ std::size_t locId((std::distance(ids,where))%nbOfCells2D);
+ INTERP_KERNEL::NormalizedCellType tmp(_mesh2D->getTypeOfCell(ToIdType(locId)));
return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType();
}
std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingMappedExtrudedMesh::getAllGeoTypes() const
{
- std::set<INTERP_KERNEL::NormalizedCellType> const ret2D(_mesh2D->getAllGeoTypes());
+ std::set<INTERP_KERNEL::NormalizedCellType> ret2D(_mesh2D->getAllGeoTypes());
std::set<INTERP_KERNEL::NormalizedCellType> ret;
- for(auto it : ret2D)
- ret.insert(INTERP_KERNEL::CellModel::GetCellModel(it).getExtrudedType());
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=ret2D.begin();it!=ret2D.end();it++)
+ ret.insert(INTERP_KERNEL::CellModel::GetCellModel(*it).getExtrudedType());
return ret;
}
DataArrayIdType *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
- INTERP_KERNEL::NormalizedCellType const revExtTyp(cm.getReverseExtrudedType());
+ INTERP_KERNEL::NormalizedCellType revExtTyp(cm.getReverseExtrudedType());
MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
if(revExtTyp==INTERP_KERNEL::NORM_ERROR)
{
return ret.retn();
}
MCAuto<DataArrayIdType> tmp(_mesh2D->giveCellsWithType(revExtTyp));
- mcIdType const nbOfLevs=_mesh1D->getNumberOfCells();
- mcIdType const nbOfCells2D=_mesh2D->getNumberOfCells();
- mcIdType const nbOfTuples(tmp->getNumberOfTuples());
+ mcIdType nbOfLevs=_mesh1D->getNumberOfCells();
+ mcIdType nbOfCells2D=_mesh2D->getNumberOfCells();
+ mcIdType nbOfTuples(tmp->getNumberOfTuples());
ret->alloc(nbOfLevs*nbOfTuples,1);
mcIdType *pt(ret->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfTuples)
DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const
{
MCAuto<DataArrayIdType> ret2D(_mesh2D->computeNbOfNodesPerCell());
- mcIdType const nbOfLevs=_mesh1D->getNumberOfCells();
- mcIdType const nbOfCells2D=_mesh2D->getNumberOfCells();
+ mcIdType nbOfLevs=_mesh1D->getNumberOfCells();
+ mcIdType nbOfCells2D=_mesh2D->getNumberOfCells();
MCAuto<DataArrayIdType> ret3D(DataArrayIdType::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
mcIdType *pt(ret3D->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const
{
MCAuto<DataArrayIdType> ret2D(_mesh2D->computeNbOfNodesPerCell());
- mcIdType const nbOfLevs=_mesh1D->getNumberOfCells();
- mcIdType const nbOfCells2D=_mesh2D->getNumberOfCells();
+ mcIdType nbOfLevs=_mesh1D->getNumberOfCells();
+ mcIdType nbOfCells2D=_mesh2D->getNumberOfCells();
MCAuto<DataArrayIdType> ret3D(DataArrayIdType::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
mcIdType *pt(ret3D->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
mcIdType MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
mcIdType ret(0);
- mcIdType const nbOfCells2D(_mesh2D->getNumberOfCells());
+ mcIdType nbOfCells2D(_mesh2D->getNumberOfCells());
for(mcIdType i=0;i<nbOfCells2D;i++)
{
- INTERP_KERNEL::NormalizedCellType const t(_mesh2D->getTypeOfCell(i));
+ INTERP_KERNEL::NormalizedCellType t(_mesh2D->getTypeOfCell(i));
if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type)
ret++;
}
void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const
{
- mcIdType const nbOfCells2D(_mesh2D->getNumberOfCells());
- mcIdType const nbOfNodes2D(_mesh2D->getNumberOfNodes());
- mcIdType const locId(cellId%nbOfCells2D);
- mcIdType const lev(cellId/nbOfCells2D);
+ mcIdType nbOfCells2D(_mesh2D->getNumberOfCells());
+ mcIdType nbOfNodes2D(_mesh2D->getNumberOfNodes());
+ mcIdType locId(cellId%nbOfCells2D);
+ mcIdType lev(cellId/nbOfCells2D);
std::vector<mcIdType> tmp,tmp2;
_mesh2D->getNodeIdsOfCell(locId,tmp);
tmp2=tmp;
void MEDCouplingMappedExtrudedMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const
{
- mcIdType const nbOfNodes2D(_mesh2D->getNumberOfNodes());
- mcIdType const locId(nodeId%nbOfNodes2D);
- mcIdType const lev(nodeId/nbOfNodes2D);
+ mcIdType nbOfNodes2D(_mesh2D->getNumberOfNodes());
+ mcIdType locId(nodeId%nbOfNodes2D);
+ mcIdType lev(nodeId/nbOfNodes2D);
std::vector<double> tmp,tmp2;
_mesh2D->getCoordinatesOfNode(locId,tmp);
tmp2=tmp;
- int const spaceDim(_mesh1D->getSpaceDimension());
+ int spaceDim(_mesh1D->getSpaceDimension());
const double *z(_mesh1D->getCoords()->begin());
std::transform(tmp.begin(),tmp.end(),z+lev*spaceDim,tmp.begin(),std::plus<double>());
std::transform(tmp2.begin(),tmp2.end(),z+(lev+1)*spaceDim,tmp2.begin(),std::plus<double>());
ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n";
ret << "Description of mesh : \"" << getDescription() << "\"\n";
int tmpp1,tmpp2;
- double const tt=getTime(tmpp1,tmpp2);
+ double tt=getTime(tmpp1,tmpp2);
ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n";
ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n";
ret << "Description of mesh : \"" << getDescription() << "\"\n";
int tmpp1,tmpp2;
- double const tt=getTime(tmpp1,tmpp2);
+ double tt=getTime(tmpp1,tmpp2);
ret << "Time attached to the mesh (unit) : " << tt << " (" << getTimeUnit() << ")\n";
ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n";
{
}
-void MEDCouplingMappedExtrudedMesh::checkConsistency(double /*eps*/) const
+void MEDCouplingMappedExtrudedMesh::checkConsistency(double eps) const
{
checkConsistencyLight();
}
double bbox2D[6];
_mesh2D->getBoundingBox(bbox2D);
const double *nodes1D(_mesh1D->getCoords()->begin());
- mcIdType const nbOfNodes1D(_mesh1D->getNumberOfNodes());
+ mcIdType nbOfNodes1D(_mesh1D->getNumberOfNodes());
double bbox1DMin[3],bbox1DMax[3],tmp[3];
std::fill(bbox1DMin,bbox1DMin+3,std::numeric_limits<double>::max());
std::fill(bbox1DMax,bbox1DMax+3,-(std::numeric_limits<double>::max()));
std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast<const double& (*)(const double&, const double&)>(std::max<double>));
}
std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus<double>());
- mcIdType const id=ToIdType(std::distance(tmp,std::max_element(tmp,tmp+3)));
+ mcIdType id=ToIdType(std::distance(tmp,std::max_element(tmp,tmp+3)));
bbox[0]=bbox1DMin[0]; bbox[1]=bbox1DMax[0];
bbox[2]=bbox1DMin[1]; bbox[3]=bbox1DMax[1];
bbox[4]=bbox1DMin[2]; bbox[5]=bbox1DMax[2];
updateTimeWith(*_mesh1D);
}
-void MEDCouplingMappedExtrudedMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*check*/)
+void MEDCouplingMappedExtrudedMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
throw INTERP_KERNEL::Exception("Functionality of renumbering cells unavailable for ExtrudedMesh");
}
return ret.retn();
}
-MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureFieldOnNode(bool /*isAbs*/) const
+MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureFieldOnNode(bool isAbs) const
{
//not implemented yet
- return nullptr;
+ return 0;
}
MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::buildOrthogonalField() const
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::buildOrthogonalField : This method has no sense for MEDCouplingMappedExtrudedMesh that is 3D !");
}
-mcIdType MEDCouplingMappedExtrudedMesh::getCellContainingPoint(const double * /*pos*/, double /*eps*/) const
+mcIdType MEDCouplingMappedExtrudedMesh::getCellContainingPoint(const double *pos, double eps) const
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::getCellContainingPoint : not implemented yet !");
}
-void MEDCouplingMappedExtrudedMesh::getCellsContainingPoint(const double * /*pos*/, double /*eps*/, std::vector<mcIdType>& /*elts*/) const
+void MEDCouplingMappedExtrudedMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::getCellsContainingPoint : not implemented yet !");
}
MEDCouplingMappedExtrudedMesh::~MEDCouplingMappedExtrudedMesh()
-= default;
+{
+}
void MEDCouplingMappedExtrudedMesh::computeExtrusion(const MEDCouplingUMesh *mesh3D)
{
const char errMsg1[]="2D mesh is empty unable to compute extrusion !";
const char errMsg2[]="Coords between 2D and 3D meshes are not the same ! Try MEDCouplingPointSet::tryToShareSameCoords method";
const char errMsg3[]="No chance to find extrusion pattern in mesh3D,mesh2D couple because nbCells3D%nbCells2D!=0 !";
- if(_mesh2D.isNull() || mesh3D==nullptr)
+ if(_mesh2D.isNull() || mesh3D==0)
throw INTERP_KERNEL::Exception(errMsg1);
if(_mesh2D->getCoords()!=mesh3D->getCoords())
throw INTERP_KERNEL::Exception(errMsg2);
const mcIdType *revDesc3D, const mcIdType *revDescIndx3D,
bool computeMesh1D)
{
- mcIdType const nbOf2DCells=_mesh2D->getNumberOfCells();
+ mcIdType nbOf2DCells=_mesh2D->getNumberOfCells();
mcIdType start(revDescIndx3D[idIn3DDesc]);
mcIdType end(revDescIndx3D[idIn3DDesc+1]);
if(end-start!=1)
const mcIdType *desc3D, const mcIdType *descIndx3D,
const mcIdType *conn2D, const mcIdType *conn2DIndx)
{
- mcIdType const start(descIndx3D[current3DCell]);
- mcIdType const end(descIndx3D[current3DCell+1]);
- bool const found=false;
+ mcIdType start(descIndx3D[current3DCell]);
+ mcIdType end(descIndx3D[current3DCell+1]);
+ bool found=false;
for(const mcIdType *candidate2D=desc3D+start;candidate2D!=desc3D+end && !found;candidate2D++)
{
if(*candidate2D!=current2DCell)
double *zoneToUpdate(_mesh1D->getCoords()->getPointer()+lev1DId*3);
std::fill(zoneToUpdate,zoneToUpdate+3,0.);
const double *coords(_mesh2D->getCoords()->begin());
- for(long const iter : nodalConnec)
- std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*iter,zoneToUpdate,std::plus<double>());
+ for(std::vector<mcIdType>::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++)
+ std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus<double>());
std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind(std::multiplies<double>(),std::placeholders::_1,(1./(double)nodalConnec.size())));
}
mcIdType MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector<mcIdType>& nodalConnec, const mcIdType *revNodalPtr, const mcIdType *revNodalIndxPtr)
{
- auto iter=nodalConnec.begin();
+ std::vector<mcIdType>::const_iterator iter=nodalConnec.begin();
std::set<mcIdType> s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
iter++;
for(;iter!=nodalConnec.end();iter++)
{
- std::set<mcIdType> const s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
+ std::set<mcIdType> s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
std::set<mcIdType> s3;
std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set<mcIdType> >(s3,s3.end()));
s1=s3;
m1->getCoordinatesOfNode(c[0],ref);
m1->getCoordinatesOfNode(c[1],ref2);
std::transform(ref2.begin(),ref2.end(),ref.begin(),v,std::minus<double>());
- double const n=INTERP_KERNEL::norm<3>(v);
+ double n=INTERP_KERNEL::norm<3>(v);
std::transform(v,v+3,v,std::bind(std::multiplies<double>(),std::placeholders::_1,1/n));
m1->project1D(&ref[0],v,eps,m1r->getCoords()->getPointer());
m2->project1D(&ref[0],v,eps,m2r->getCoords()->getPointer());
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-DataArrayIdType *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector<mcIdType>& /*code*/, const std::vector<const DataArrayIdType *>& /*idsPerType*/) const
+DataArrayIdType *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayIdType * /*profile*/, std::vector<mcIdType>& /*code*/, std::vector<DataArrayIdType *>& /*idsInPflPerType*/, std::vector<DataArrayIdType *>& /*idsPerType*/, bool /*smartPflKiller*/) const
+void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPart(const mcIdType * /*start*/, const mcIdType * /*end*/) const
+MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPart(const mcIdType *start, const mcIdType *end) const
{
// not implemented yet !
- return nullptr;
+ return 0;
}
-MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPartAndReduceNodes(const mcIdType * /*start*/, const mcIdType * /*end*/, DataArrayIdType*& /*arr*/) const
+MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const
{
// not implemented yet !
- return nullptr;
+ return 0;
}
-DataArrayIdType *MEDCouplingMappedExtrudedMesh::simplexize(int /*policy*/)
+DataArrayIdType *MEDCouplingMappedExtrudedMesh::simplexize(int policy)
{
throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::simplexize : unavailable for such a type of mesh : Extruded !");
}
-MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::mergeMyselfWith(const MEDCouplingMesh * /*other*/) const
+MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::mergeMyselfWith(const MEDCouplingMesh *other) const
{
// not implemented yet !
- return nullptr;
+ return 0;
}
DataArrayDouble *MEDCouplingMappedExtrudedMesh::getCoordinatesAndOwner() const
const DataArrayDouble *arr1D(_mesh1D->getCoords());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(getNumberOfNodes(),3);
- mcIdType const nbOf1DLev(_mesh1D->getNumberOfNodes());
- mcIdType const nbOf2DNodes(_mesh2D->getNumberOfNodes());
+ mcIdType nbOf1DLev(_mesh1D->getNumberOfNodes());
+ mcIdType nbOf2DNodes(_mesh2D->getNumberOfNodes());
const double *ptSrc(arr2D->begin());
double *pt(ret->getPointer());
std::copy(ptSrc,ptSrc+3*nbOf2DNodes,pt);
void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D)
{
_mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1);
- mcIdType const nbOf1DLev=mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells();
+ mcIdType nbOf1DLev=mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells();
_mesh1D->setMeshDimension(1);
_mesh1D->allocateCells(nbOf1DLev);
mcIdType tmpConn[2];
const mcIdType *revNodalIndx2DPtr(revNodalIndx2D->begin());
const mcIdType *descP(desc->begin()),*descIndxP(descIndx->begin()),*revDescP(revDesc->begin()),*revDescIndxP(revDescIndx->begin());
//
- mcIdType const nbOf2DCells=_mesh2D->getNumberOfCells();
+ mcIdType nbOf2DCells=_mesh2D->getNumberOfCells();
for(mcIdType i=0;i<nbOf2DCells;i++)
{
mcIdType idInSubMesh;
- std::vector<mcIdType> const nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]);
+ std::vector<mcIdType> nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]);
try
{
idInSubMesh=FindCorrespCellByNodalConn(nodalConnec,revNodal2DPtr,revNodalIndx2DPtr);
}
}
-void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector<double>& /*tinyInfoD*/, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
std::vector<mcIdType> tinyInfo1;
std::vector<std::string> ls1;
void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
- std::size_t const sz=tinyInfo.size();
- mcIdType const sz1=tinyInfo[sz-2];
- std::vector<mcIdType> const ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
- std::vector<mcIdType> const ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3);
+ std::size_t sz=tinyInfo.size();
+ mcIdType sz1=tinyInfo[sz-2];
+ std::vector<mcIdType> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
+ std::vector<mcIdType> ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3);
MEDCouplingUMesh *um=MEDCouplingUMesh::New();
DataArrayIdType *a1tmp=DataArrayIdType::New();
DataArrayDouble *a2tmp=DataArrayDouble::New();
void MEDCouplingMappedExtrudedMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
a1=DataArrayIdType::New(); a2=DataArrayDouble::New();
- DataArrayIdType *a1_1=nullptr,*a1_2=nullptr;
- DataArrayDouble *a2_1=nullptr,*a2_2=nullptr;
+ DataArrayIdType *a1_1=0,*a1_2=0;
+ DataArrayDouble *a2_1=0,*a2_2=0;
_mesh2D->serialize(a1_1,a2_1);
_mesh1D->serialize(a1_2,a2_2);
a1->alloc(a1_1->getNbOfElems()+a1_2->getNbOfElems()+_mesh3D_ids->getNbOfElems(),1);
a2_2->decrRef();
}
-void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector<double>& /*tinyInfoD*/, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
+void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
setName(littleStrings[littleStrings.size()-2]);
setDescription(littleStrings.back());
- std::size_t const sz=tinyInfo.size();
- mcIdType const sz1=tinyInfo[sz-2];
+ std::size_t sz=tinyInfo.size();
+ mcIdType sz1=tinyInfo[sz-2];
_cell_2D_id=tinyInfo[sz-3];
- std::vector<mcIdType> const ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
- std::vector<mcIdType> const ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3);
+ std::vector<mcIdType> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
+ std::vector<mcIdType> ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3);
DataArrayIdType *a1tmp=DataArrayIdType::New();
DataArrayDouble *a2tmp=DataArrayDouble::New();
const mcIdType *a1Ptr=a1->begin();
a2Ptr+=a2tmp->getNbOfElems();
a1Ptr+=a1tmp->getNbOfElems();
ls2.insert(ls2.end(),littleStrings.begin(),littleStrings.begin()+ls1.size());
- std::vector<double> const d1(1);
+ std::vector<double> d1(1);
_mesh2D->unserialization(d1,ti1,a1tmp,a2tmp,ls2);
a1tmp->decrRef(); a2tmp->decrRef();
//
a1tmp->decrRef(); a2tmp->decrRef();
//
_mesh3D_ids=DataArrayIdType::New();
- mcIdType const szIds=ToIdType(std::distance(a1Ptr,a1->begin()))+a1->getNbOfElems();
+ mcIdType szIds=ToIdType(std::distance(a1Ptr,a1->begin()))+a1->getNbOfElems();
_mesh3D_ids->alloc(szIds,1);
std::copy(a1Ptr,a1Ptr+szIds,_mesh3D_ids->getPointer());
}
#ifndef __PARAMEDMEM_MEDCOUPLINGEXTRUDEDMESH_HXX__
#define __PARAMEDMEM_MEDCOUPLINGEXTRUDEDMESH_HXX__
-#include "MCType.hxx"
-#include "MCAuto.hxx"
#include "MEDCoupling.hxx"
#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "NormalizedGeometricTypes"
-#include <set>
-#include <string>
-#include <cstddef>
-#include <ostream>
#include <vector>
namespace MEDCoupling
MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D);
MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New();
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingMappedExtrudedMesh"); }
- MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const override;
- MEDCOUPLING_EXPORT int getSpaceDimension() const override;
- MEDCOUPLING_EXPORT int getMeshDimension() const override;
- MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *deepCopy() const override;
- MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *clone(bool recDeepCpy) const override;
- MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override;
+ MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const;
+ MEDCOUPLING_EXPORT int getSpaceDimension() const;
+ MEDCOUPLING_EXPORT int getMeshDimension() const;
+ MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *deepCopy() const;
+ MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *clone(bool recDeepCpy) const;
+ MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const;
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor) const override;
- MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const override;
- MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const override;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const override;
- MEDCOUPLING_EXPORT std::string simpleRepr() const override;
- MEDCOUPLING_EXPORT std::string advancedRepr() const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override;
- MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override;
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override;
+ DataArrayIdType *&cellCor) const;
+ MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
+ MEDCOUPLING_EXPORT std::string simpleRepr() const;
+ MEDCOUPLING_EXPORT std::string advancedRepr() const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
+ MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh2D() const { return _mesh2D.iAmATrollConstCast(); }
MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh1D() const { return _mesh1D.iAmATrollConstCast(); }
MEDCOUPLING_EXPORT DataArrayIdType *getMesh3DIds() const { return _mesh3D_ids.iAmATrollConstCast(); }
MEDCOUPLING_EXPORT MEDCouplingUMesh *build3DUnstructuredMesh() const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override;
- MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const override;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
MEDCOUPLING_EXPORT static mcIdType FindCorrespCellByNodalConn(const std::vector<mcIdType>& nodalConnec,
const mcIdType *revNodalPtr, const mcIdType *revNodalIndxPtr);
MEDCOUPLING_EXPORT static void Project1DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps,
MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r, double *v);
- MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override;
- MEDCOUPLING_EXPORT void translate(const double *vector) override;
- MEDCOUPLING_EXPORT void scale(const double *point, double factor) override;
- MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const override;
- MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override;
- MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override;
+ MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
+ MEDCOUPLING_EXPORT void translate(const double *vector);
+ MEDCOUPLING_EXPORT void scale(const double *point, double factor);
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
+ MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
//Serialization unserialisation
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override;
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
- const std::vector<std::string>& littleStrings) override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
- MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override;
+ const std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+ MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
MEDCOUPLING_EXPORT mcIdType get2DCellIdForExtrusion() const { return _cell_2D_id; }
private:
MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId);
const mcIdType *desc3D, const mcIdType *descIndx3D,
const mcIdType *conn2D, const mcIdType *conn2DIndx);
void computeBaryCenterOfFace(const std::vector<mcIdType>& nodalConnec, mcIdType lev1DId);
- ~MEDCouplingMappedExtrudedMesh() override;
- void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override;
- std::string getVTKDataSetType() const override;
+ ~MEDCouplingMappedExtrudedMesh();
+ void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
+ std::string getVTKDataSetType() const;
private:
MCAuto<MEDCouplingUMesh> _mesh2D;
MCAuto<MEDCouplingUMesh> _mesh1D;
#include "MEDCouplingMatrix.hxx"
#include "InterpKernelMatrixTools.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCIdType.hxx"
-
-#include <cstddef>
-#include <algorithm>
-#include <cstdlib>
+
#include <sstream>
-#include <vector>
-#include <utility>
-#include <string>
using namespace MEDCoupling;
}
DenseMatrix::~DenseMatrix()
-= default;
+{
+}
DenseMatrix::DenseMatrix(mcIdType nbRows, mcIdType nbCols):_nb_rows(nbRows),_nb_cols(nbCols),_data(DataArrayDouble::New())
{
if(_nb_rows<0 || _nb_cols<0)
throw INTERP_KERNEL::Exception("constructor of DenseMatrix : number of rows and number of cols must be > 0 both !");
- mcIdType const nbOfTuples(_nb_rows*_nb_cols);
+ mcIdType nbOfTuples(_nb_rows*_nb_cols);
_data->alloc(nbOfTuples,1);
}
#ifndef __PARAMEDMEM_MEDCOUPLINGMATRIX_HXX__
#define __PARAMEDMEM_MEDCOUPLINGMATRIX_HXX__
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MCAuto.hxx"
-#include <string>
-#include <cstddef>
-#include <vector>
+#include "InterpKernelException.hxx"
namespace MEDCoupling
{
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("DenseMatrix"); }
MEDCOUPLING_EXPORT DenseMatrix *deepCopy() const;
MEDCOUPLING_EXPORT DenseMatrix *shallowCpy() const;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT void updateTime() const override;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT void updateTime() const;
//
MEDCOUPLING_EXPORT mcIdType getNumberOfRows() const { return _nb_rows; }
MEDCOUPLING_EXPORT mcIdType getNumberOfCols() const { return _nb_cols; }
MEDCOUPLING_EXPORT const DataArrayDouble *getData() const { return _data; }
MEDCOUPLING_EXPORT DataArrayDouble *getData() { return _data; }
private:
- ~DenseMatrix() override;
+ ~DenseMatrix();
DenseMatrix(mcIdType nbRows, mcIdType nbCols);
DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols);
mcIdType getNumberOfRowsExt(mcIdType nbRows) const;
#include "MEDCouplingMemArray.txx"
#include "BBTree.txx"
-#include "BBTreePts.txx"
#include "GenMathFormulae.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "InterpKernelException.hxx"
#include "InterpKernelExprParser.hxx"
+#include "InterpKernelAutoPtr.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
+#include "InterpKernelAutoPtr.hxx"
#include "InterpKernelGeo2DNode.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
-#include "MEDCoupling.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCAuto.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
-#include "InterpolationUtils.hxx"
-
-#include <cstddef>
-#include <ostream>
-#include <iterator>
-#include <cstdint>
+
#include <set>
#include <cmath>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>
-#include <string>
-#include <vector>
-#include <sstream>
-using MYFUNCPTR = double (*)(double);
+typedef double (*MYFUNCPTR)(double);
using namespace MEDCoupling;
void DataArrayDouble::findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, mcIdType limitNodeId, double prec, DataArrayIdType *c, DataArrayIdType *cI) const
{
const double *coordsPtr=getConstPointer();
- BBTreePts<SPACEDIM,mcIdType> const myTree(bbox,nullptr,0,nbNodes,prec);
+ BBTreePts<SPACEDIM,mcIdType> myTree(bbox,0,0,nbNodes,prec);
std::vector<bool> isDone(nbNodes);
for(mcIdType i=0;i<nbNodes;i++)
{
if(intersectingElems.size()>1)
{
std::vector<mcIdType> commonNodes;
- for(long const intersectingElem : intersectingElems)
- if(intersectingElem!=i)
- if(intersectingElem>=limitNodeId)
+ for(std::vector<mcIdType>::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++)
+ if(*it!=i)
+ if(*it>=limitNodeId)
{
- commonNodes.push_back(intersectingElem);
- isDone[intersectingElem]=true;
+ commonNodes.push_back(*it);
+ isDone[*it]=true;
}
if(!commonNodes.empty())
{
}
template<int SPACEDIM>
-void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts<SPACEDIM,mcIdType>& myTree, const double *pos, mcIdType nbOfTuples, double /*eps*/,
+void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts<SPACEDIM,mcIdType>& myTree, const double *pos, mcIdType nbOfTuples, double eps,
DataArrayIdType *c, DataArrayIdType *cI)
{
for(mcIdType i=0;i<nbOfTuples;i++)
std::vector<mcIdType> intersectingElems;
myTree.getElementsAroundPoint(pos+i*SPACEDIM,intersectingElems);
std::vector<mcIdType> commonNodes;
- for(long const intersectingElem : intersectingElems)
- commonNodes.push_back(intersectingElem);
+ for(std::vector<mcIdType>::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++)
+ commonNodes.push_back(*it);
cI->pushBackSilent(cI->back()+ToIdType(commonNodes.size()));
c->insertAtTheEnd(commonNodes.begin(),commonNodes.end());
}
}
template<int SPACEDIM>
-void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts<SPACEDIM,mcIdType>& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double * /*thisPt*/, mcIdType /*thisNbOfTuples*/, mcIdType *res)
+void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts<SPACEDIM,mcIdType>& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double *thisPt, mcIdType thisNbOfTuples, mcIdType *res)
{
double distOpt = std::max(dist, std::numeric_limits<double>::epsilon());
const double *p(pos);
while(true)
{
mcIdType elem=-1;
- double const ret=myTree.getElementsAroundPoint2(p,distOpt,elem);
+ double ret=myTree.getElementsAroundPoint2(p,distOpt,elem);
if(ret!=std::numeric_limits<double>::max())
{
distOpt=std::max(ret,1e-4);
std::size_t DataArray::getHeapMemorySizeWithoutChildren() const
{
- std::size_t const sz1=_name.capacity();
- std::size_t const sz2=_info_on_compo.capacity();
+ std::size_t sz1=_name.capacity();
+ std::size_t sz2=_info_on_compo.capacity();
std::size_t sz3=0;
- for(const auto & it : _info_on_compo)
- sz3+=it.capacity();
+ for(std::vector<std::string>::const_iterator it=_info_on_compo.begin();it!=_info_on_compo.end();it++)
+ sz3+=(*it).capacity();
return sz1+sz2+sz3;
}
void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector<std::size_t>& compoIds)
{
- std::size_t const nbOfCompoOth=other.getNumberOfComponents();
- std::size_t const newNbOfCompo=compoIds.size();
+ std::size_t nbOfCompoOth=other.getNumberOfComponents();
+ std::size_t newNbOfCompo=compoIds.size();
for(std::size_t i=0;i<newNbOfCompo;i++)
if(compoIds[i]>=nbOfCompoOth)
{
{
if(compoIds.size()!=other.getNumberOfComponents())
throw INTERP_KERNEL::Exception("Given compoIds has not the same size as number of components of given array !");
- std::size_t const partOfCompoToSet=compoIds.size();
- std::size_t const nbOfCompo=getNumberOfComponents();
+ std::size_t partOfCompoToSet=compoIds.size();
+ std::size_t nbOfCompo=getNumberOfComponents();
for(std::size_t i=0;i<partOfCompoToSet;i++)
if(compoIds[i]>=nbOfCompo)
{
if(_info_on_compo!=other._info_on_compo)
{
oss << "Components DataArray mismatch : \nThis components=";
- for(const auto & it : _info_on_compo)
- oss << "\"" << it << "\",";
+ for(std::vector<std::string>::const_iterator it=_info_on_compo.begin();it!=_info_on_compo.end();it++)
+ oss << "\"" << *it << "\",";
oss << "\nOther components=";
- for(const auto & it : other._info_on_compo)
- oss << "\"" << it << "\",";
+ for(std::vector<std::string>::const_iterator it=other._info_on_compo.begin();it!=other._info_on_compo.end();it++)
+ oss << "\"" << *it << "\",";
reason=oss.str();
return false;
}
{
stream << "Number of components : "<< getNumberOfComponents() << "\n";
stream << "Info of these components : ";
- for(const auto & iter : _info_on_compo)
- stream << "\"" << iter << "\" ";
+ for(std::vector<std::string>::const_iterator iter=_info_on_compo.begin();iter!=_info_on_compo.end();iter++)
+ stream << "\"" << *iter << "\" ";
stream << "\n";
}
{
if(!aBase)
throw INTERP_KERNEL::Exception("DataArray::setPartOfValuesBase3 : input aBase object is NULL !");
- auto *this1(dynamic_cast<DataArrayDouble *>(this));
- auto *this2(dynamic_cast<DataArrayIdType *>(this));
- auto *this3(dynamic_cast<DataArrayChar *>(this));
- const auto *a1(dynamic_cast<const DataArrayDouble *>(aBase));
- const auto *a2(dynamic_cast<const DataArrayIdType *>(aBase));
- const auto *a3(dynamic_cast<const DataArrayChar *>(aBase));
+ DataArrayDouble *this1(dynamic_cast<DataArrayDouble *>(this));
+ DataArrayIdType *this2(dynamic_cast<DataArrayIdType *>(this));
+ DataArrayChar *this3(dynamic_cast<DataArrayChar *>(this));
+ const DataArrayDouble *a1(dynamic_cast<const DataArrayDouble *>(aBase));
+ const DataArrayIdType *a2(dynamic_cast<const DataArrayIdType *>(aBase));
+ const DataArrayChar *a3(dynamic_cast<const DataArrayChar *>(aBase));
if(this1 && a1)
{
this1->setPartOfValues3(a1,bgTuples,endTuples,bgComp,endComp,stepComp,strictCompoCompare);
std::vector<std::string> DataArray::getVarsOnComponent() const
{
- std::size_t const nbOfCompo=_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::vector<std::string> ret(nbOfCompo);
for(std::size_t i=0;i<nbOfCompo;i++)
ret[i]=getVarOnComponent(i);
std::vector<std::string> DataArray::getUnitsOnComponent() const
{
- std::size_t const nbOfCompo=_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::vector<std::string> ret(nbOfCompo);
for(std::size_t i=0;i<nbOfCompo;i++)
ret[i]=getUnitOnComponent(i);
*/
std::vector<std::string> DataArray::SplitStringInChuncks(const std::string st, std::size_t sz)
{
- std::size_t const len = st.length();
- std::size_t const nbOfCompo(len/sz);
+ std::size_t len = st.length();
+ std::size_t nbOfCompo(len/sz);
if( nbOfCompo*sz != len)
{
THROW_IK_EXCEPTION("DataArray::SplitStringInChuncks : Length of input string (" << len << ") is not equal to " << nbOfCompo << "*" << sz << " !");
for(std::size_t i = 0 ; i < nbOfCompo ; ++i)
{
std::string part = st.substr(i*sz,sz);
- std::size_t const p3=part.find_last_not_of(" \t");
+ std::size_t p3=part.find_last_not_of(" \t");
part = part.substr(0,p3+1);
ret[i] = part;
}
*/
std::string DataArray::GetVarNameFromInfo(const std::string& info)
{
- std::size_t const p1=info.find_last_of('[');
- std::size_t const p2=info.find_last_of(']');
+ std::size_t p1=info.find_last_of('[');
+ std::size_t p2=info.find_last_of(']');
if(p1==std::string::npos || p2==std::string::npos)
return info;
if(p1>p2)
return info;
if(p1==0)
return std::string();
- std::size_t const p3=info.find_last_not_of(' ',p1-1);
+ std::size_t p3=info.find_last_not_of(' ',p1-1);
return info.substr(0,p3+1);
}
*/
std::string DataArray::GetUnitFromInfo(const std::string& info)
{
- std::size_t const p1=info.find_last_of('[');
- std::size_t const p2=info.find_last_of(']');
+ std::size_t p1=info.find_last_of('[');
+ std::size_t p2=info.find_last_of(']');
if(p1==std::string::npos || p2==std::string::npos)
return std::string();
if(p1>p2)
DataArray *DataArray::Aggregate(const std::vector<const DataArray *>& arrs)
{
std::vector<const DataArray *> arr2;
- for(auto arr : arrs)
- if(arr)
- arr2.push_back(arr);
+ for(std::vector<const DataArray *>::const_iterator it=arrs.begin();it!=arrs.end();it++)
+ if(*it)
+ arr2.push_back(*it);
if(arr2.empty())
throw INTERP_KERNEL::Exception("DataArray::Aggregate : only null instance in input vector !");
std::vector<const DataArrayDouble *> arrd;
std::vector<const DataArrayIdType *> arri;
std::vector<const DataArrayChar *> arrc;
- for(auto it : arr2)
+ for(std::vector<const DataArray *>::const_iterator it=arr2.begin();it!=arr2.end();it++)
{
- const auto *a=dynamic_cast<const DataArrayDouble *>(it);
+ const DataArrayDouble *a=dynamic_cast<const DataArrayDouble *>(*it);
if(a)
{ arrd.push_back(a); continue; }
- const auto *b=dynamic_cast<const DataArrayIdType *>(it);
+ const DataArrayIdType *b=dynamic_cast<const DataArrayIdType *>(*it);
if(b)
{ arri.push_back(b); continue; }
- const auto *c=dynamic_cast<const DataArrayChar *>(it);
+ const DataArrayChar *c=dynamic_cast<const DataArrayChar *>(*it);
if(c)
{ arrc.push_back(c); continue; }
throw INTERP_KERNEL::Exception("DataArray::Aggregate : presence of not null instance in inuput that is not in [DataArrayDouble, DataArrayInt, DataArrayChar] !");
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::isMonotonic : only supported with 'this' array with ONE component !");
- mcIdType const nbOfElements(getNumberOfTuples());
+ mcIdType nbOfElements(getNumberOfTuples());
const double *ptr=getConstPointer();
if(nbOfElements==0)
return true;
double ref=ptr[0];
- double const absEps=fabs(eps);
+ double absEps=fabs(eps);
if(increasing)
{
for(mcIdType i=1;i<nbOfElements;i++)
{
static const char SPACE[4]={' ',' ',' ',' '};
checkAllocated();
- std::string const idt(indent,' ');
+ std::string idt(indent,' ');
ofs.precision(17);
ofs << idt << "<DataArray type=\"Float32\" Name=\"" << nameInFile << "\" NumberOfComponents=\"" << getNumberOfComponents() << "\"";
//
bool areAllEmpty(true);
- for(const auto & it : _info_on_compo)
- if(!it.empty())
+ for(std::vector<std::string>::const_iterator it=_info_on_compo.begin();it!=_info_on_compo.end();it++)
+ if(!(*it).empty())
areAllEmpty=false;
if(!areAllEmpty)
for(std::size_t i=0;i<_info_on_compo.size();i++)
for(const double *src=begin();src!=end();src++,pt++)
*pt=float(*src);
const char *data(reinterpret_cast<const char *>((float *)tmp));
- std::size_t const sz(getNbOfElems()*sizeof(float));
+ std::size_t sz(getNbOfElems()*sizeof(float));
byteArr->insertAtTheEnd(data,data+sz);
byteArr->insertAtTheEnd(SPACE,SPACE+4);
}
void DataArrayDouble::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- mcIdType const nbTuples=getNumberOfTuples();
- std::size_t const nbComp=getNumberOfComponents();
+ mcIdType nbTuples=getNumberOfTuples();
+ std::size_t nbComp=getNumberOfComponents();
const double *data(getConstPointer());
stream.precision(17);
stream << "DataArrayDouble *" << varName << "=DataArrayDouble::New();" << std::endl;
stream << "DataArrayDouble C++ instance at " << this << ". ";
if(isAllocated())
{
- std::size_t const nbOfCompo(_info_on_compo.size());
+ std::size_t nbOfCompo(_info_on_compo.size());
if(nbOfCompo>=1)
{
- mcIdType const nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayDouble::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const double *data=begin();
- mcIdType const nbOfTuples(getNumberOfTuples());
- std::size_t const nbOfCompo(_info_on_compo.size());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(_info_on_compo.size());
std::ostringstream oss2; oss2 << "[";
oss2.precision(17);
std::string oss2Str(oss2.str());
else
oss2 << *data++;
if(i!=nbOfTuples-1) oss2 << ", ";
- std::string const oss3Str(oss2.str());
+ std::string oss3Str(oss2.str());
if(oss3Str.length()<maxNbOfByteInRepr)
oss2Str=oss3Str;
else
if(getNumberOfComponents()!=other->getNumberOfComponents())
throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : the number of components does not match !");
MCAuto<DataArrayDouble> a=DataArrayDouble::Aggregate(this,other);
- DataArrayIdType *c=nullptr,*ci=nullptr;
+ DataArrayIdType *c=0,*ci=0;
a->findCommonTuples(prec,getNumberOfTuples(),c,ci);
MCAuto<DataArrayIdType> cSafe(c),ciSafe(ci);
mcIdType newNbOfTuples=-1;
void DataArrayDouble::findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const
{
checkAllocated();
- std::size_t const nbOfCompo=getNumberOfComponents();
+ std::size_t nbOfCompo=getNumberOfComponents();
if ((nbOfCompo<1) || (nbOfCompo>4)) //test before work
throw INTERP_KERNEL::Exception("DataArrayDouble::findCommonTuples : Unexpected spacedim of coords. Must be 1, 2, 3 or 4.");
- mcIdType const nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
//
MCAuto<DataArrayIdType> c(DataArrayIdType::New()),cI(DataArrayIdType::New()); c->alloc(0,1); cI->pushBackSilent(0);
switch(nbOfCompo)
double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const
{
MCAuto<DataArrayIdType> part1=findClosestTupleId(other);
- std::size_t const nbOfCompo=getNumberOfComponents();
- mcIdType const otherNbTuples=other->getNumberOfTuples();
+ std::size_t nbOfCompo=getNumberOfComponents();
+ mcIdType otherNbTuples=other->getNumberOfTuples();
const double *thisPt(begin()),*otherPt(other->begin());
const mcIdType *part1Pt(part1->begin());
double ret=std::numeric_limits<double>::max();
if(!other)
throw INTERP_KERNEL::Exception("DataArrayDouble::findClosestTupleId : other instance is NULL !");
checkAllocated(); other->checkAllocated();
- std::size_t const nbOfCompo(getNumberOfComponents());
+ std::size_t nbOfCompo(getNumberOfComponents());
if(nbOfCompo!=other->getNumberOfComponents())
{
std::ostringstream oss; oss << "DataArrayDouble::findClosestTupleId : number of components in this is " << nbOfCompo;
oss << ", whereas number of components in other is " << other->getNumberOfComponents() << "! Should be equal !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType const nbOfTuples(other->getNumberOfTuples());
- mcIdType const thisNbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(other->getNumberOfTuples());
+ mcIdType thisNbOfTuples(getNumberOfTuples());
MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1);
double bounds[6];
getMinMaxPerComponent(bounds);
{
double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])),zDelta(fabs(bounds[5]-bounds[4]));
double delta=std::max(xDelta,yDelta); delta=std::max(delta,zDelta);
- double const characSize=pow((delta*delta*delta)/((double)thisNbOfTuples),1./3.);
- BBTreePts<3,mcIdType> const myTree(begin(),nullptr,0,getNumberOfTuples(),characSize*1e-12);
+ double characSize=pow((delta*delta*delta)/((double)thisNbOfTuples),1./3.);
+ BBTreePts<3,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
FindClosestTupleIdAlg<3>(myTree,3.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer());
break;
}
case 2:
{
double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2]));
- double const delta=std::max(xDelta,yDelta);
- double const characSize=sqrt(delta/(double)thisNbOfTuples);
- BBTreePts<2,mcIdType> const myTree(begin(),nullptr,0,getNumberOfTuples(),characSize*1e-12);
+ double delta=std::max(xDelta,yDelta);
+ double characSize=sqrt(delta/(double)thisNbOfTuples);
+ BBTreePts<2,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
FindClosestTupleIdAlg<2>(myTree,2.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer());
break;
}
case 1:
{
- double const characSize=fabs(bounds[1]-bounds[0])/FromIdType<double>(thisNbOfTuples);
- BBTreePts<1,mcIdType> const myTree(begin(),nullptr,0,getNumberOfTuples(),characSize*1e-12);
+ double characSize=fabs(bounds[1]-bounds[0])/FromIdType<double>(thisNbOfTuples);
+ BBTreePts<1,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
FindClosestTupleIdAlg<1>(myTree,1.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer());
break;
}
throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : input array is NULL !");
if(!isAllocated() || !otherBBoxFrmt->isAllocated())
throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : this and input array must be allocated !");
- std::size_t const nbOfComp(getNumberOfComponents());
- mcIdType const nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
if(nbOfComp!=otherBBoxFrmt->getNumberOfComponents())
{
std::ostringstream oss; oss << "DataArrayDouble::computeNbOfInteractionsWith : this number of components (" << nbOfComp << ") must be equal to the number of components of input array (" << otherBBoxFrmt->getNumberOfComponents() << ") !";
{
case 3:
{
- BBTree<3,mcIdType> bbt(otherBBoxFrmt->begin(),nullptr,0,otherBBoxFrmt->getNumberOfTuples(),eps);
+ BBTree<3,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
for(mcIdType i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
*retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
break;
}
case 2:
{
- BBTree<2,mcIdType> bbt(otherBBoxFrmt->begin(),nullptr,0,otherBBoxFrmt->getNumberOfTuples(),eps);
+ BBTree<2,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
for(mcIdType i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
*retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
break;
}
case 1:
{
- BBTree<1,mcIdType> bbt(otherBBoxFrmt->begin(),nullptr,0,otherBBoxFrmt->getNumberOfTuples(),eps);
+ BBTree<1,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
for(mcIdType i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
*retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
break;
DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, mcIdType limitTupleId) const
{
checkAllocated();
- DataArrayIdType *c0=nullptr,*cI0=nullptr;
+ DataArrayIdType *c0=0,*cI0=0;
findCommonTuples(prec,limitTupleId,c0,cI0);
MCAuto<DataArrayIdType> c(c0),cI(cI0);
mcIdType newNbOfTuples=-1;
throw INTERP_KERNEL::Exception("DataArrayDouble::setSelectedComponents : input DataArrayDouble is NULL !");
checkAllocated();
copyPartOfStringInfoFrom2(compoIds,*a);
- std::size_t const partOfCompoSz=compoIds.size();
- std::size_t const nbOfCompo=getNumberOfComponents();
- mcIdType const nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples());
+ std::size_t partOfCompoSz=compoIds.size();
+ std::size_t nbOfCompo=getNumberOfComponents();
+ mcIdType nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples());
const double *ac=a->getConstPointer();
double *nc=getPointer();
for(mcIdType i=0;i<nbOfTuples;i++)
void DataArrayDouble::checkNoNullValues() const
{
const double *tmp=getConstPointer();
- mcIdType const nbOfElems=getNbOfElems();
+ mcIdType nbOfElems=getNbOfElems();
const double *where=std::find(tmp,tmp+nbOfElems,0.);
if(where!=tmp+nbOfElems)
throw INTERP_KERNEL::Exception("A value 0.0 have been detected !");
void DataArrayDouble::getMinMaxPerComponent(double *bounds) const
{
checkAllocated();
- std::size_t const dim=getNumberOfComponents();
+ std::size_t dim=getNumberOfComponents();
for (std::size_t idim=0; idim<dim; idim++)
{
bounds[idim*2]=std::numeric_limits<double>::max();
bounds[idim*2+1]=-std::numeric_limits<double>::max();
}
const double *ptr=getConstPointer();
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
for(mcIdType i=0;i<nbOfTuples;i++)
{
for(std::size_t idim=0;idim<dim;idim++)
{
checkAllocated();
const double *dataPtr=getConstPointer();
- std::size_t const nbOfCompo=getNumberOfComponents();
- mcIdType const nbTuples=getNumberOfTuples();
+ std::size_t nbOfCompo=getNumberOfComponents();
+ mcIdType nbTuples=getNumberOfTuples();
MCAuto<DataArrayDouble> bbox=DataArrayDouble::New();
bbox->alloc(nbTuples,2*nbOfCompo);
double *bboxPtr=bbox->getPointer();
throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : input pointer other is null !");
checkAllocated();
other->checkAllocated();
- std::size_t const nbOfCompo=getNumberOfComponents();
- std::size_t const otherNbOfCompo=other->getNumberOfComponents();
+ std::size_t nbOfCompo=getNumberOfComponents();
+ std::size_t otherNbOfCompo=other->getNumberOfComponents();
if(nbOfCompo!=otherNbOfCompo)
throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : number of components should be equal between this and other !");
- mcIdType const nbOfTuplesOther=other->getNumberOfTuples();
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuplesOther=other->getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
MCAuto<DataArrayIdType> cArr(DataArrayIdType::New()),cIArr(DataArrayIdType::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0);
switch(nbOfCompo)
{
case 3:
{
- BBTreePts<3,mcIdType> const myTree(begin(),nullptr,0,nbOfTuples,eps);
+ BBTreePts<3,mcIdType> myTree(begin(),0,0,nbOfTuples,eps);
FindTupleIdsNearTuplesAlg<3>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
break;
}
case 2:
{
- BBTreePts<2,mcIdType> const myTree(begin(),nullptr,0,nbOfTuples,eps);
+ BBTreePts<2,mcIdType> myTree(begin(),0,0,nbOfTuples,eps);
FindTupleIdsNearTuplesAlg<2>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
break;
}
case 1:
{
- BBTreePts<1,mcIdType> const myTree(begin(),nullptr,0,nbOfTuples,eps);
+ BBTreePts<1,mcIdType> myTree(begin(),0,0,nbOfTuples,eps);
FindTupleIdsNearTuplesAlg<1>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
break;
}
void DataArrayDouble::recenterForMaxPrecision(double eps)
{
checkAllocated();
- std::size_t const dim=getNumberOfComponents();
+ std::size_t dim=getNumberOfComponents();
std::vector<double> bounds(2*dim);
getMinMaxPerComponent(&bounds[0]);
for(std::size_t i=0;i<dim;i++)
{
- double const delta=bounds[2*i+1]-bounds[2*i];
- double const offset=(bounds[2*i]+bounds[2*i+1])/2.;
+ double delta=bounds[2*i+1]-bounds[2*i];
+ double offset=(bounds[2*i]+bounds[2*i+1])/2.;
if(delta>eps)
applyLin(1./delta,-offset/delta,i);
else
double DataArrayDouble::getMaxValue2(DataArrayIdType*& tupleIds) const
{
mcIdType tmp;
- tupleIds=nullptr;
- double const ret=getMaxValue(tmp);
+ tupleIds=0;
+ double ret=getMaxValue(tmp);
tupleIds=findIdsInRange(ret,ret);
return ret;
}
double DataArrayDouble::getMinValue2(DataArrayIdType*& tupleIds) const
{
mcIdType tmp;
- tupleIds=nullptr;
- double const ret=getMinValue(tmp);
+ tupleIds=0;
+ double ret=getMinValue(tmp);
tupleIds=findIdsInRange(ret,ret);
return ret;
}
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::count : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
const double *vals=begin();
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
for(mcIdType i=0;i<nbOfTuples;i++,vals++)
if(fabs(*vals-value)<=eps)
ret++;
{
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::getAverageValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
- mcIdType const nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getAverageValue : array exists but number of tuples must be > 0 !");
const double *vals=getConstPointer();
- double const ret=std::accumulate(vals,vals+nbOfTuples,0.);
+ double ret=std::accumulate(vals,vals+nbOfTuples,0.);
return ret/FromIdType<double>(nbOfTuples);
}
{
checkAllocated();
double ret=0.;
- std::size_t const nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
const double *pt=getConstPointer();
for(std::size_t i=0;i<nbOfElems;i++,pt++)
ret+=(*pt)*(*pt);
{
checkAllocated();
double ret(-1.);
- std::size_t const nbOfElems(getNbOfElems());
+ std::size_t nbOfElems(getNbOfElems());
const double *pt(getConstPointer());
for(std::size_t i=0;i<nbOfElems;i++,pt++)
{
- double const val(std::abs(*pt));
+ double val(std::abs(*pt));
if(val>ret)
ret=val;
}
void DataArrayDouble::normMaxPerComponent(double * res) const
{
checkAllocated();
- mcIdType const nbOfTuples(getNumberOfTuples());
- std::size_t const nbOfCompos(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfCompos(getNumberOfComponents());
std::fill(res, res+nbOfCompos, -1.0);
const double *pt(getConstPointer());
for(mcIdType i=0;i<nbOfTuples;i++)
for (std::size_t j=0; j<nbOfCompos; j++, pt++)
{
- double const val(std::abs(*pt));
+ double val(std::abs(*pt));
if(val>res[j])
res[j]=val;
}
{
checkAllocated();
double ret(std::numeric_limits<double>::max());
- std::size_t const nbOfElems(getNbOfElems());
+ std::size_t nbOfElems(getNbOfElems());
const double *pt(getConstPointer());
for(std::size_t i=0;i<nbOfElems;i++,pt++)
{
- double const val(std::abs(*pt));
+ double val(std::abs(*pt));
if(val<ret)
ret=val;
}
{
checkAllocated();
const double *ptr=getConstPointer();
- mcIdType const nbTuple(getNumberOfTuples());
- std::size_t const nbComps(getNumberOfComponents());
+ mcIdType nbTuple(getNumberOfTuples());
+ std::size_t nbComps(getNumberOfComponents());
std::fill(res,res+nbComps,0.);
for(mcIdType i=0;i<nbTuple;i++)
std::transform(ptr+i*nbComps,ptr+(i+1)*nbComps,res,res,std::plus<double>());
double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, mcIdType& tupleId) const
{
checkAllocated();
- mcIdType const nbTuple(getNumberOfTuples());
- std::size_t const nbComps(getNumberOfComponents());
+ mcIdType nbTuple(getNumberOfTuples());
+ std::size_t nbComps(getNumberOfComponents());
if(nbComps!=(std::size_t)std::distance(tupleBg,tupleEnd))
{ std::ostringstream oss; oss << "DataArrayDouble::distanceToTuple : size of input tuple is " << std::distance(tupleBg,tupleEnd) << " should be equal to the number of components in this : " << nbComps << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
if(nbTuple==0)
{
checkAllocated();
const double *ptr=getConstPointer();
- mcIdType const nbTuple(getNumberOfTuples());
- std::size_t const nbComps(getNumberOfComponents());
+ mcIdType nbTuple(getNumberOfTuples());
+ std::size_t nbComps(getNumberOfComponents());
if(compId>=nbComps)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulate : Invalid compId specified : No such nb of components !");
double ret=0.;
if(!bgOfIndex || !endOfIndex)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : input pointer NULL !");
checkAllocated();
- std::size_t const nbCompo(getNumberOfComponents());
- mcIdType const nbOfTuples(getNumberOfTuples());
+ std::size_t nbCompo(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
std::size_t sz=std::distance(bgOfIndex,endOfIndex);
if(sz<1)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : invalid size of input index array !");
{
checkAllocated();
checkNbOfComps(1,"DataArrayDouble::cumSum : this is expected to be single component");
- mcIdType const nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple(getNumberOfTuples());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuple+1,1);
double *ptr(ret->getPointer());
ptr[0]=0.;
DataArrayDouble *DataArrayDouble::fromPolarToCart() const
{
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromPolarToCart : must be an array with exactly 2 components !");
- mcIdType const nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple(getNumberOfTuples());
DataArrayDouble *ret(DataArrayDouble::New());
ret->alloc(nbOfTuple,2);
double *w(ret->getPointer());
DataArrayDouble *DataArrayDouble::fromCylToCart() const
{
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCylToCart : must be an array with exactly 3 components !");
- mcIdType const nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple(getNumberOfTuples());
DataArrayDouble *ret(DataArrayDouble::New());
ret->alloc(getNumberOfTuples(),3);
double *w(ret->getPointer());
DataArrayDouble *DataArrayDouble::fromSpherToCart() const
{
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromSpherToCart : must be an array with exactly 3 components !");
- mcIdType const nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple(getNumberOfTuples());
DataArrayDouble *ret(DataArrayDouble::New());
ret->alloc(getNumberOfTuples(),3);
double *w(ret->getPointer());
DataArrayDouble *DataArrayDouble::cartesianize(MEDCouplingAxisType atOfThis) const
{
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
MCAuto<DataArrayDouble> ret;
switch(atOfThis)
{
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
- mcIdType const nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfComp!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToPolar : must be an array with exactly 2 components !");
ret->alloc(nbTuples,2);
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
- mcIdType const nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCyl : must be an array with exactly 3 components !");
ret->alloc(nbTuples,3);
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
- mcIdType const nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToSpher : must be an array with exactly 3 components !");
ret->alloc(nbTuples,3);
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : input coords are NULL !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated(); coords->checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
- mcIdType const nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : must be an array with exactly 3 components !");
if(coords->getNumberOfComponents()!=3)
if(coords->getNumberOfTuples()!=nbTuples)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : coords array must have the same number of tuples !");
ret->alloc(nbTuples,nbOfComp);
- double const magOfVect(sqrt(vect[0]*vect[0]+vect[1]*vect[1]+vect[2]*vect[2]));
+ double magOfVect(sqrt(vect[0]*vect[0]+vect[1]*vect[1]+vect[2]*vect[2]));
if(magOfVect<1e-12)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : magnitude of vect is too low !");
double Ur[3],Uteta[3],Uz[3],*retPtr(ret->getPointer());
{
std::transform(coo,coo+3,center,Ur,std::minus<double>());
Uteta[0]=Uz[1]*Ur[2]-Uz[2]*Ur[1]; Uteta[1]=Uz[2]*Ur[0]-Uz[0]*Ur[2]; Uteta[2]=Uz[0]*Ur[1]-Uz[1]*Ur[0];
- double const magOfTeta(sqrt(Uteta[0]*Uteta[0]+Uteta[1]*Uteta[1]+Uteta[2]*Uteta[2]));
+ double magOfTeta(sqrt(Uteta[0]*Uteta[0]+Uteta[1]*Uteta[1]+Uteta[2]*Uteta[2]));
std::transform(Uteta,Uteta+3,Uteta,std::bind(std::multiplies<double>(),std::placeholders::_1,1./magOfTeta));
Ur[0]=Uteta[1]*Uz[2]-Uteta[2]*Uz[1]; Ur[1]=Uteta[2]*Uz[0]-Uteta[0]*Uz[2]; Ur[2]=Uteta[0]*Uz[1]-Uteta[1]*Uz[0];
retPtr[0]=Ur[0]*vectField[0]+Ur[1]*vectField[1]+Ur[2]*vectField[2];
DataArrayDouble *DataArrayDouble::doublyContractedProduct() const
{
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::doublyContractedProduct : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- mcIdType const nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
{
checkAllocated();
DataArrayDouble *ret=DataArrayDouble::New();
- mcIdType const nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
DataArrayDouble *DataArrayDouble::eigenValues() const
{
checkAllocated();
- std::size_t const nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::eigenValues : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- mcIdType const nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,3);
const double *src=getConstPointer();
double *dest=ret->getPointer();
DataArrayDouble *DataArrayDouble::eigenVectors() const
{
checkAllocated();
- std::size_t const nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::eigenVectors : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- mcIdType const nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,9);
const double *src=getConstPointer();
double *dest=ret->getPointer();
DataArrayDouble *DataArrayDouble::inverse() const
{
checkAllocated();
- std::size_t const nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6 && nbOfComp!=9 && nbOfComp!=4)
throw INTERP_KERNEL::Exception("DataArrayDouble::inversion : must be an array with 4,6 or 9 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- mcIdType const nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,nbOfComp);
const double *src=getConstPointer();
double *dest=ret->getPointer();
if(nbOfComp==6)
for(mcIdType i=0;i<nbOfTuple;i++,dest+=6,src+=6)
{
- double const det=src[0]*src[1]*src[2]+2.*src[4]*src[5]*src[3]-src[0]*src[4]*src[4]-src[2]*src[3]*src[3]-src[1]*src[5]*src[5];
+ double det=src[0]*src[1]*src[2]+2.*src[4]*src[5]*src[3]-src[0]*src[4]*src[4]-src[2]*src[3]*src[3]-src[1]*src[5]*src[5];
dest[0]=(src[1]*src[2]-src[4]*src[4])/det;
dest[1]=(src[0]*src[2]-src[5]*src[5])/det;
dest[2]=(src[0]*src[1]-src[3]*src[3])/det;
else if(nbOfComp==4)
for(mcIdType i=0;i<nbOfTuple;i++,dest+=4,src+=4)
{
- double const det=src[0]*src[3]-src[1]*src[2];
+ double det=src[0]*src[3]-src[1]*src[2];
dest[0]=src[3]/det;
dest[1]=-src[1]/det;
dest[2]=-src[2]/det;
else
for(mcIdType i=0;i<nbOfTuple;i++,dest+=9,src+=9)
{
- double const det=src[0]*src[4]*src[8]+src[1]*src[5]*src[6]+src[2]*src[3]*src[7]-src[0]*src[5]*src[7]-src[1]*src[3]*src[8]-src[2]*src[4]*src[6];
+ double det=src[0]*src[4]*src[8]+src[1]*src[5]*src[6]+src[2]*src[3]*src[7]-src[0]*src[5]*src[7]-src[1]*src[3]*src[8]-src[2]*src[4]*src[6];
dest[0]=(src[4]*src[8]-src[7]*src[5])/det;
dest[1]=(src[7]*src[2]-src[1]*src[8])/det;
dest[2]=(src[1]*src[5]-src[4]*src[2])/det;
DataArrayDouble *DataArrayDouble::trace() const
{
checkAllocated();
- std::size_t const nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6 && nbOfComp!=9 && nbOfComp!=4)
throw INTERP_KERNEL::Exception("DataArrayDouble::trace : must be an array with 4,6 or 9 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- mcIdType const nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
DataArrayDouble *DataArrayDouble::deviator() const
{
checkAllocated();
- std::size_t const nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::deviator : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- mcIdType const nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,6);
const double *src=getConstPointer();
double *dest=ret->getPointer();
for(mcIdType i=0;i<nbOfTuple;i++,dest+=6,src+=6)
{
- double const tr=(src[0]+src[1]+src[2])/3.;
+ double tr=(src[0]+src[1]+src[2])/3.;
dest[0]=src[0]-tr;
dest[1]=src[1]-tr;
dest[2]=src[2]-tr;
DataArrayDouble *DataArrayDouble::magnitude() const
{
checkAllocated();
- std::size_t const nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
DataArrayDouble *ret=DataArrayDouble::New();
- mcIdType const nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
DataArrayDouble *DataArrayDouble::operatePerTuple(std::function<double(const double *bg, const double *endd)> func) const
{
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- mcIdType const nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple(getNumberOfTuples());
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayIdType* &compoIdOfMaxPerTuple) const
{
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
MCAuto<DataArrayDouble> ret0=DataArrayDouble::New();
MCAuto<DataArrayIdType> ret1=DataArrayIdType::New();
- mcIdType const nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=getNumberOfTuples();
ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret0->getPointer(); mcIdType *dest1=ret1->getPointer();
DataArrayDouble *DataArrayDouble::buildEuclidianDistanceDenseMatrix() const
{
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
- mcIdType const nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
const double *inData=getConstPointer();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuples*nbOfTuples,1);
{
double dist=0.;
for(std::size_t k=0;k<nbOfComp;k++)
- { double const delta=inData[i*nbOfComp+k]-inData[j*nbOfComp+k]; dist+=delta*delta; }
+ { double delta=inData[i*nbOfComp+k]-inData[j*nbOfComp+k]; dist+=delta*delta; }
dist=sqrt(dist);
outData[i*nbOfTuples+j]=dist;
outData[j*nbOfTuples+i]=dist;
throw INTERP_KERNEL::Exception("DataArrayDouble::buildEuclidianDistanceDenseMatrixWith : input parameter is null !");
checkAllocated();
other->checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
- std::size_t const otherNbOfComp(other->getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
+ std::size_t otherNbOfComp(other->getNumberOfComponents());
if(nbOfComp!=otherNbOfComp)
{
std::ostringstream oss; oss << "DataArrayDouble::buildEuclidianDistanceDenseMatrixWith : this nb of compo=" << nbOfComp << " and other nb of compo=" << otherNbOfComp << ". It should match !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType const nbOfTuples(getNumberOfTuples());
- mcIdType const otherNbOfTuples(other->getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ mcIdType otherNbOfTuples(other->getNumberOfTuples());
const double *inData=getConstPointer();
const double *inDataOther=other->getConstPointer();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
{
double dist=0.;
for(std::size_t k=0;k<nbOfComp;k++)
- { double const delta=inDataOther[k]-inData[j*nbOfComp+k]; dist+=delta*delta; }
+ { double delta=inDataOther[k]-inData[j*nbOfComp+k]; dist+=delta*delta; }
dist=sqrt(dist);
outData[i*nbOfTuples+j]=dist;
}
void DataArrayDouble::asArcOfCircle(double center[2], double& radius, double& ang) const
{
checkAllocated();
- INTERP_KERNEL::QuadraticPlanarPrecision const arcPrec(1e-14);
+ INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(1e-14);
if(getNumberOfTuples()!=3 && getNumberOfComponents()!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble::asArcCircle : this method expects");
const double *pt(begin());
MCAuto<INTERP_KERNEL::Node> n0(new INTERP_KERNEL::Node(pt[0],pt[1])),n1(new INTERP_KERNEL::Node(pt[2],pt[3])),n2(new INTERP_KERNEL::Node(pt[4],pt[5]));
{
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::EdgeLin> e1(new INTERP_KERNEL::EdgeLin(n0,n2)),e2(new INTERP_KERNEL::EdgeLin(n2,n1));
- INTERP_KERNEL::SegSegIntersector const inters(*e1,*e2);
- bool const colinearity(inters.areColinears());
+ INTERP_KERNEL::SegSegIntersector inters(*e1,*e2);
+ bool colinearity(inters.areColinears());
if(colinearity)
throw INTERP_KERNEL::Exception("DataArrayDouble::asArcOfCircle : 3 points in this have been detected as colinear !");
}
{
checkAllocated();
double *pt=getPointer();
- mcIdType const nbOfTuple(getNumberOfTuples());
- std::size_t const nbOfComp(getNumberOfComponents());
+ mcIdType nbOfTuple(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
if(asc)
for(mcIdType i=0;i<nbOfTuple;i++,pt+=nbOfComp)
std::sort(pt,pt+nbOfComp);
{
checkAllocated();
double *ptr=getPointer();
- std::size_t const nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
for(std::size_t i=0;i<nbOfElems;i++,ptr++)
{
if(std::abs(*ptr)>std::numeric_limits<double>::min())
{
checkAllocated();
double *ptr=getPointer();
- std::size_t const nbOfElems=getNbOfElems();
- int const val2=(int)val;
- bool const isInt=((double)val2)==val;
+ std::size_t nbOfElems=getNbOfElems();
+ int val2=(int)val;
+ bool isInt=((double)val2)==val;
if(!isInt)
{
for(std::size_t i=0;i<nbOfElems;i++,ptr++)
if(val<0.)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyRPow : the input value has to be >= 0 !");
double *ptr=getPointer();
- std::size_t const nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
for(std::size_t i=0;i<nbOfElems;i++,ptr++)
*ptr=pow(val,*ptr);
declareAsNew();
{
checkAllocated();
DataArrayDouble *newArr=DataArrayDouble::New();
- mcIdType const nbOfTuples(getNumberOfTuples());
- std::size_t const oldNbOfComp(getNumberOfComponents());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t oldNbOfComp(getNumberOfComponents());
newArr->alloc(nbOfTuples,nbOfComp);
const double *ptr=getConstPointer();
double *ptrToFill=newArr->getPointer();
expr.parse();
std::set<std::string> vars;
expr.getTrueSetOfVars(vars);
- std::vector<std::string> const varsV(vars.begin(),vars.end());
+ std::vector<std::string> varsV(vars.begin(),vars.end());
return applyFuncNamedCompo(nbOfComp,varsV,func,isSafe);
}
*/
DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe) const
{
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFunc : output number of component must be > 0 !");
checkAllocated();
- mcIdType const nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
MCAuto<DataArrayDouble> newArr(DataArrayDouble::New());
newArr->alloc(nbOfTuples,nbOfComp);
INTERP_KERNEL::ExprParser expr(func);
newArr->rearrange(nbOfComp);
return newArr.retn();
}
- std::vector<std::string> const vars2(vars.begin(),vars.end());
+ std::vector<std::string> vars2(vars.begin(),vars.end());
double buff,*ptrToFill(newArr->getPointer());
const double *ptr(begin());
std::vector<double> stck;
*/
void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe)
{
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncOnThis : output number of component must be > 0 !");
checkAllocated();
- mcIdType const nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
std::set<std::string> vars;
if(vars.empty())
{
expr.prepareFastEvaluator();
- std::vector<std::string> const compInfo(getInfoOnComponents());
+ std::vector<std::string> compInfo(getInfoOnComponents());
rearrange(1);
fillWithValue(expr.evaluateDouble());
rearrange(nbOfComp);
setInfoOnComponents(compInfo);
return ;
}
- std::vector<std::string> const vars2(vars.begin(),vars.end());
+ std::vector<std::string> vars2(vars.begin(),vars.end());
double buff,*ptrToFill(getPointer());
const double *ptr(begin());
std::vector<double> stck;
if(nbOfComp<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncNamedCompo : output number of component must be > 0 !");
std::vector<std::string> varsOrder2(varsOrder);
- std::size_t const oldNbOfComp(getNumberOfComponents());
+ std::size_t oldNbOfComp(getNumberOfComponents());
for(std::size_t i=varsOrder.size();i<oldNbOfComp;i++)
varsOrder2.push_back(std::string());
checkAllocated();
- mcIdType const nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
std::set<std::string> vars;
*((void **)&funcPtr)=funcStr;//he he...
//
double *ptr=getPointer();
- std::size_t const nbOfComp=getNumberOfComponents();
- mcIdType const nbOfTuples=getNumberOfTuples();
- std::size_t const nbOfElems=nbOfTuples*nbOfComp;
+ std::size_t nbOfComp=getNumberOfComponents();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfElems=nbOfTuples*nbOfComp;
for(std::size_t i=0;i<nbOfElems;i++,ptr++)
*ptr=funcPtr(*ptr);
declareAsNew();
*((void **)&funcPtr)=funcStr;//he he...
//
double *ptr=getPointer();
- std::size_t const nbOfComp=getNumberOfComponents();
- mcIdType const nbOfTuples=getNumberOfTuples();
- std::size_t const nbOfElems=nbOfTuples*nbOfComp;
+ std::size_t nbOfComp=getNumberOfComponents();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfElems=nbOfTuples*nbOfComp;
for(std::size_t i=0;i<nbOfElems;i++,ptr++)
*ptr=funcPtr(*ptr);
declareAsNew();
checkAllocated();
if(getNumberOfComponents()!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::symmetry3DPlane : this is excepted to have 3 components !");
- mcIdType const nbTuples(getNumberOfTuples());
+ mcIdType nbTuples(getNumberOfTuples());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbTuples,3);
Symmetry3DPlane(point,normalVector,nbTuples,begin(),ret->getPointer());
throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsInRange : this must have exactly one component !");
const double *cptr(begin());
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
- mcIdType const nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<=vmax)
ret->pushBackSilent(i);
throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsNotInRange : this must have exactly one component !");
const double *cptr(begin());
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
- mcIdType const nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr<vmin || *cptr>vmax)
ret->pushBackSilent(i);
DataArrayDouble *DataArrayDouble::Aggregate(const std::vector<const DataArrayDouble *>& arr)
{
std::vector<const DataArrayDouble *> a;
- for(auto it4 : arr)
- if(it4)
- a.push_back(it4);
+ for(std::vector<const DataArrayDouble *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
+ if(*it4)
+ a.push_back(*it4);
if(a.empty())
throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : input list must contain at least one NON EMPTY DataArrayDouble !");
std::vector<const DataArrayDouble *>::const_iterator it=a.begin();
- std::size_t const nbOfComp((*it)->getNumberOfComponents());
+ std::size_t nbOfComp((*it)->getNumberOfComponents());
mcIdType nbt=(*it++)->getNumberOfTuples();
for(mcIdType i=1;it!=a.end();it++,i++)
{
throw INTERP_KERNEL::Exception("DataArrayDouble::Dot : input DataArrayDouble instance is NULL !");
a1->checkAllocated();
a2->checkAllocated();
- std::size_t const nbOfComp(a1->getNumberOfComponents());
+ std::size_t nbOfComp(a1->getNumberOfComponents());
if(nbOfComp!=a2->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Nb of components mismatch for array Dot !");
- mcIdType const nbOfTuple(a1->getNumberOfTuples());
+ mcIdType nbOfTuple(a1->getNumberOfTuples());
if(nbOfTuple!=a2->getNumberOfTuples())
throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Dot !");
DataArrayDouble *ret=DataArrayDouble::New();
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayDouble::CrossProduct : input DataArrayDouble instance is NULL !");
- std::size_t const nbOfComp(a1->getNumberOfComponents());
+ std::size_t nbOfComp(a1->getNumberOfComponents());
if(nbOfComp!=a2->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Nb of components mismatch for array crossProduct !");
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("Nb of components must be equal to 3 for array crossProduct !");
- mcIdType const nbOfTuple(a1->getNumberOfTuples());
+ mcIdType nbOfTuple(a1->getNumberOfTuples());
if(nbOfTuple!=a2->getNumberOfTuples())
throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array crossProduct !");
DataArrayDouble *ret=DataArrayDouble::New();
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayDouble::Max : input DataArrayDouble instance is NULL !");
- std::size_t const nbOfComp(a1->getNumberOfComponents());
+ std::size_t nbOfComp(a1->getNumberOfComponents());
if(nbOfComp!=a2->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Nb of components mismatch for array Max !");
- mcIdType const nbOfTuple(a1->getNumberOfTuples());
+ mcIdType nbOfTuple(a1->getNumberOfTuples());
if(nbOfTuple!=a2->getNumberOfTuples())
throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Max !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTuple,nbOfComp);
double *retPtr(ret->getPointer());
const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin());
- std::size_t const nbElem(nbOfTuple*nbOfComp);
+ std::size_t nbElem(nbOfTuple*nbOfComp);
for(std::size_t i=0;i<nbElem;i++)
retPtr[i]=std::max(a1Ptr[i],a2Ptr[i]);
ret->copyStringInfoFrom(*a1);
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayDouble::Min : input DataArrayDouble instance is NULL !");
- std::size_t const nbOfComp(a1->getNumberOfComponents());
+ std::size_t nbOfComp(a1->getNumberOfComponents());
if(nbOfComp!=a2->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Nb of components mismatch for array min !");
- mcIdType const nbOfTuple(a1->getNumberOfTuples());
+ mcIdType nbOfTuple(a1->getNumberOfTuples());
if(nbOfTuple!=a2->getNumberOfTuples())
throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array min !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTuple,nbOfComp);
double *retPtr(ret->getPointer());
const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin());
- std::size_t const nbElem(nbOfTuple*nbOfComp);
+ std::size_t nbElem(nbOfTuple*nbOfComp);
for(std::size_t i=0;i<nbElem;i++)
retPtr[i]=std::min(a1Ptr[i],a2Ptr[i]);
ret->copyStringInfoFrom(*a1);
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : at least one of input instances is null !");
- mcIdType const nbOfTuple=a1->getNumberOfTuples();
- mcIdType const nbOfTuple2=a2->getNumberOfTuples();
- std::size_t const nbOfComp=a1->getNumberOfComponents();
- std::size_t const nbOfComp2=a2->getNumberOfComponents();
+ mcIdType nbOfTuple=a1->getNumberOfTuples();
+ mcIdType nbOfTuple2=a2->getNumberOfTuples();
+ std::size_t nbOfComp=a1->getNumberOfComponents();
+ std::size_t nbOfComp2=a2->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of tuples mismatches !");
if(nbOfComp!=1 || nbOfComp2!=1)
{
if(!other)
throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : input instance is null !");
- mcIdType const nbOfTuple=getNumberOfTuples();
- mcIdType const nbOfTuple2=other->getNumberOfTuples();
- std::size_t const nbOfComp=getNumberOfComponents();
- std::size_t const nbOfComp2=other->getNumberOfComponents();
+ mcIdType nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple2=other->getNumberOfTuples();
+ std::size_t nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp2=other->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of tuples mismatches !");
if(nbOfComp!=1 || nbOfComp2!=1)
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::toVectorOfBool : must be applied on single component array !");
- mcIdType const nbt(getNumberOfTuples());
+ mcIdType nbt(getNumberOfTuples());
std::vector<bool> ret(nbt);
const double *pt(begin());
for(mcIdType i=0;i<nbt;i++)
{
if(isAllocated())
{
- std::size_t const nbOfCompo(getNumberOfComponents());
+ std::size_t nbOfCompo(getNumberOfComponents());
tinyInfo.resize(nbOfCompo+1);
tinyInfo[0]=getName();
for(std::size_t i=0;i<nbOfCompo;i++)
*/
bool DataArrayDouble::resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI)
{
- mcIdType const nbOfTuple=tinyInfoI[0];
- mcIdType const nbOfComp=tinyInfoI[1];
+ mcIdType nbOfTuple=tinyInfoI[0];
+ mcIdType nbOfComp=tinyInfoI[1];
if(nbOfTuple!=-1 || nbOfComp!=-1)
{
alloc(nbOfTuple,nbOfComp);
/*!
* Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
*/
-void DataArrayDouble::finishUnserialization(const std::vector<mcIdType>& /*tinyInfoI*/, const std::vector<std::string>& tinyInfoS)
+void DataArrayDouble::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
{
setName(tinyInfoS[0]);
if(isAllocated())
{
- std::size_t const nbOfCompo(getNumberOfComponents());
+ std::size_t nbOfCompo(getNumberOfComponents());
for(std::size_t i=0;i<nbOfCompo;i++)
setInfoOnComponent(i,tinyInfoS[i+1]);
}
{
if(!center || !vect)
throw INTERP_KERNEL::Exception("DataArrayDouble::Rotate3DAlg : null vector in input !");
- double const sina(sin(angle));
- double const cosa(cos(angle));
+ double sina(sin(angle));
+ double cosa(cos(angle));
double vectorNorm[3];
double matrix[9];
double matrixTmp[9];
- double const norm(sqrt(vect[0]*vect[0]+vect[1]*vect[1]+vect[2]*vect[2]));
+ double norm(sqrt(vect[0]*vect[0]+vect[1]*vect[1]+vect[2]*vect[2]));
if(norm<std::numeric_limits<double>::min())
throw INTERP_KERNEL::Exception("DataArrayDouble::Rotate3DAlg : magnitude of input vector is too close of 0. !");
std::transform(vect,vect+3,vectorNorm,std::bind(std::multiplies<double>(),std::placeholders::_1,1/norm));
*/
void DataArrayDouble::Rotate2DAlg(const double *center, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut)
{
- double const cosa=cos(angle);
- double const sina=sin(angle);
+ double cosa=cos(angle);
+ double sina=sin(angle);
double matrix[4];
matrix[0]=cosa; matrix[1]=-sina; matrix[2]=sina; matrix[3]=cosa;
double tmp[2];
#include "MEDCouplingMap.hxx"
#include "BBTreePts.txx"
-#include <cstddef>
-#include <ostream>
#include <string>
-#include <utility>
#include <vector>
+#include <iterator>
#include <functional>
namespace MEDCoupling
class MEDCouplingPointer
{
public:
- MEDCouplingPointer():_internal(nullptr),_external(nullptr) { }
+ MEDCouplingPointer():_internal(0),_external(0) { }
void null() { _internal=0; _external=0; }
bool isNull() const { return _internal==0 && _external==0; }
void setInternal(T *pointer);
void setExternal(const T *pointer);
const T *getConstPointer() const { if(_internal) return _internal; else return _external; }
const T *getConstPointerLoc(std::size_t offset) const { if(_internal) return _internal+offset; else return _external+offset; }
- T *getPointer() { if(_internal) return _internal; if(_external) throw INTERP_KERNEL::Exception("Trying to write on an external pointer."); else return nullptr; }
+ T *getPointer() { if(_internal) return _internal; if(_external) throw INTERP_KERNEL::Exception("Trying to write on an external pointer."); else return 0; }
private:
T *_internal;
const T *_external;
class MemArray
{
public:
- using Deallocator = void (*)(void *, void *);
+ typedef void (*Deallocator)(void *,void *);
public:
- MemArray() = default;
+ MemArray():_nb_of_elem(0),_nb_of_elem_alloc(0),_ownership(false),_dealloc(0),_param_for_deallocator(0) { }
MemArray(const MemArray<T>& other);
bool isNull() const { return _pointer.isNull(); }
const T *getConstPointerLoc(std::size_t offset) const { return _pointer.getConstPointerLoc(offset); }
static void DestroyPointer(T *pt, Deallocator dealloc, void *param);
static Deallocator BuildFromType(DeallocType type);
private:
- std::size_t _nb_of_elem{0};
- std::size_t _nb_of_elem_alloc{0};
- bool _ownership{false};
+ std::size_t _nb_of_elem;
+ std::size_t _nb_of_elem_alloc;
+ bool _ownership;
MEDCouplingPointer<T> _pointer;
- Deallocator _dealloc{nullptr};
- void *_param_for_deallocator{nullptr};
+ Deallocator _dealloc;
+ void *_param_for_deallocator;
};
template <class T> class DataArrayTools
class MEDCOUPLING_EXPORT DataArray : public RefCountObject, public TimeLabel
{
public:
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
void setName(const std::string& name);
void copyStringInfoFrom(const DataArray& other);
void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<std::size_t>& compoIds);
virtual void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const = 0;
protected:
DataArray() { }
- ~DataArray() override = default;
+ ~DataArray() { }
protected:
static void CheckValueInRange(mcIdType ref, mcIdType value, const std::string& msg);
static void CheckValueInRangeEx(mcIdType value, mcIdType start, mcIdType end, const std::string& msg);
class DataArrayTemplate : public DataArray
{
public:
- using Type = T;
+ typedef T Type;
public:
static MCAuto< typename Traits<T>::ArrayTypeCh > NewFromStdVector(const typename std::vector<T>& v);
static MCAuto< typename Traits<T>::ArrayTypeCh > NewFromArray(const T *arrBegin, const T *arrEnd);
std::for_each(this->begin(),this->end(),[&comma,&oss](const T& elt) { oss << comma << elt; comma[0]=','; } );
oss << std::endl;
}
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- void updateTime() const override { }
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ void updateTime() const { }
//
- mcIdType getNumberOfTuples() const override { return ToIdType(_info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents()); }
- mcIdType getNbOfElems() const override { return ToIdType(_mem.getNbOfElem()); }
+ mcIdType getNumberOfTuples() const { return ToIdType(_info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents()); }
+ mcIdType getNbOfElems() const { return ToIdType(_mem.getNbOfElem()); }
bool empty() const;
- void *getVoidStarPointer() override { return getPointer(); }
+ void *getVoidStarPointer() { return getPointer(); }
const T *getConstPointer() const { return _mem.getConstPointer(); }
const T *begin() const { return getConstPointer(); }
const T *end() const { return getConstPointer()+getNbOfElems(); }
T *rwBegin() { return getPointer(); }
T *rwEnd() { return getPointer()+getNbOfElems(); }
- void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1) override;
+ void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1);
void useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfTuple, std::size_t nbOfCompo);
void useExternalArrayWithRWAccess(const T *array, std::size_t nbOfTuple, std::size_t nbOfCompo);
T getIJSafe(std::size_t tupleId, std::size_t compoId) const;
T *getPointerSilent() { return _mem.getPointer(); }
void pack() const;
bool isAllocated() const override;
- void checkAllocated() const override;
- void desallocate() override;
+ void checkAllocated() const;
+ void desallocate();
void reserve(std::size_t nbOfElems);
- void rearrange(std::size_t newNbOfCompo) override;
+ void rearrange(std::size_t newNbOfCompo);
void transpose();
void pushBackSilent(T val);
template<class InputIterator>
T popBackSilent();
T front() const;
T back() const;
- std::size_t getNbOfElemAllocated() const override { return _mem.getNbOfElemAllocated(); }
+ std::size_t getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
void allocIfNecessary(std::size_t nbOfTuple, std::size_t nbOfCompo);
void deepCopyFrom(const DataArrayTemplate<T>& other);
void reverse();
void fillWithValue(T val);
- void reAlloc(std::size_t newNbOfTuple) override;
- void renumberInPlace(const mcIdType *old2New) override;
- void renumberInPlaceR(const mcIdType *new2Old) override;
+ void reAlloc(std::size_t newNbOfTuple);
+ void renumberInPlace(const mcIdType *old2New);
+ void renumberInPlaceR(const mcIdType *new2Old);
void sort(bool asc=true);
typename Traits<T>::ArrayType *renumber(const mcIdType *old2New) const;
typename Traits<T>::ArrayType *renumberR(const mcIdType *new2Old) const;
typename Traits<T>::ArrayType *changeNbOfComponents(std::size_t newNbOfComp, T dftValue) const;
typename Traits<T>::ArrayType *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const;
MCAuto<typename Traits<T>::ArrayTypeCh> selectPartDef(const PartDefinition* pd) const;
- void circularPermutation(mcIdType nbOfShift=1) override;
- void circularPermutationPerTuple(mcIdType nbOfShift=1) override;
- void reversePerTuple() override;
+ void circularPermutation(mcIdType nbOfShift=1);
+ void circularPermutationPerTuple(mcIdType nbOfShift=1);
+ void reversePerTuple();
void setPartOfValues1(const typename Traits<T>::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true);
void setPartOfValuesSimple1(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp);
void setPartOfValues2(const typename Traits<T>::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true);
void setPartOfValues4(const typename Traits<T>::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true);
void setPartOfValuesSimple4(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp);
void setPartOfValuesAdv(const typename Traits<T>::ArrayType *a, const DataArrayIdType *tuplesSelec);
- void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec) override;
- void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step) override;
+ void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec);
+ void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step);
T getMaxValue(mcIdType& tupleId) const;
T getMaxValueInArray() const;
T getMaxAbsValue(std::size_t& tupleId) const;
typename Traits<T>::ArrayType *performCopyOrIncrRef(bool dCpy) const;
typename Traits<T>::ArrayType *sumPerTuple() const;
void iota(T init=(T)0);
- void reprStream(std::ostream& stream) const override;
- void reprZipStream(std::ostream& stream) const override;
+ void reprStream(std::ostream& stream) const;
+ void reprZipStream(std::ostream& stream) const;
void reprNotTooLongStream(std::ostream& stream) const;
- void reprWithoutNameStream(std::ostream& stream) const override;
- void reprZipWithoutNameStream(std::ostream& stream) const override;
+ void reprWithoutNameStream(std::ostream& stream) const;
+ void reprZipWithoutNameStream(std::ostream& stream) const;
void reprNotTooLongWithoutNameStream(std::ostream& stream) const;
std::string repr() const;
std::string reprZip() const;
public:
static DataArrayFloat *New();
public:// abstract method overload
- DataArrayFloat *deepCopy() const override;
+ DataArrayFloat *deepCopy() const;
DataArrayFloat *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); }
std::string getClassName() const override { return std::string("DataArrayFloat"); }
- DataArrayFloat *buildNewEmptyInstance() const override { return DataArrayFloat::New(); }
- DataArrayFloat *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const override { return DataArrayTemplateFP<float>::mySelectByTupleRanges(ranges); }
- DataArrayFloat *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const override { return DataArrayTemplateFP<float>::myKeepSelectedComponents(compoIds); }
- DataArrayFloat *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
- DataArrayFloat *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return DataArrayTemplateFP<float>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- DataArrayFloat *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return DataArrayTemplateFP<float>::mySelectByTupleIdSafeSlice(bg,end2,step); }
- void reprCppStream(const std::string& varName, std::ostream& stream) const override;
- void reprQuickOverview(std::ostream& stream) const override;
- void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override;
+ DataArrayFloat *buildNewEmptyInstance() const { return DataArrayFloat::New(); }
+ DataArrayFloat *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return DataArrayTemplateFP<float>::mySelectByTupleRanges(ranges); }
+ DataArrayFloat *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return DataArrayTemplateFP<float>::myKeepSelectedComponents(compoIds); }
+ DataArrayFloat *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
+ DataArrayFloat *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP<float>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ DataArrayFloat *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP<float>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+ void reprCppStream(const std::string& varName, std::ostream& stream) const;
+ void reprQuickOverview(std::ostream& stream) const;
+ void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
public:// non abstract but essential
bool isEqual(const DataArrayFloat& other, float prec) const;
bool isEqualIfNotWhy(const DataArrayFloat& other, float prec, std::string& reason) const;
public:
DataArrayFloatIterator *iterator();
private:
- ~DataArrayFloat() override = default;
+ ~DataArrayFloat() { }
DataArrayFloat() { }
};
}
public:
static DataArrayDouble *New();
double doubleValue() const;
- DataArrayDouble *deepCopy() const override;
+ DataArrayDouble *deepCopy() const;
DataArrayDouble *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); }
std::string getClassName() const override { return std::string("DataArrayDouble"); }
- DataArrayDouble *buildNewEmptyInstance() const override { return DataArrayDouble::New(); }
+ DataArrayDouble *buildNewEmptyInstance() const { return DataArrayDouble::New(); }
void checkMonotonic(bool increasing, double eps) const;
bool isMonotonic(bool increasing, double eps) const;
void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& nameInFile, DataArrayByte *byteArr) const;
- void reprCppStream(const std::string& varName, std::ostream& stream) const override;
- void reprQuickOverview(std::ostream& stream) const override;
- void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override;
+ void reprCppStream(const std::string& varName, std::ostream& stream) const;
+ void reprQuickOverview(std::ostream& stream) const;
+ void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
bool isEqual(const DataArrayDouble& other, double prec) const;
bool isEqualIfNotWhy(const DataArrayDouble& other, double prec, std::string& reason) const;
bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const;
- DataArrayDouble *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
+ DataArrayDouble *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
DataArrayDouble *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
- DataArrayDouble *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return DataArrayTemplateFP<double>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- DataArrayDouble *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const override { return DataArrayTemplateFP<double>::myKeepSelectedComponents(compoIds); }
- DataArrayDouble *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return DataArrayTemplateFP<double>::mySelectByTupleIdSafeSlice(bg,end2,step); }
- DataArrayDouble *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const override { return DataArrayTemplateFP<double>::mySelectByTupleRanges(ranges); }
+ DataArrayDouble *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP<double>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ DataArrayDouble *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return DataArrayTemplateFP<double>::myKeepSelectedComponents(compoIds); }
+ DataArrayDouble *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP<double>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+ DataArrayDouble *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return DataArrayTemplateFP<double>::mySelectByTupleRanges(ranges); }
bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayIdType *&tupleIds) const;
void findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const;
double minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const;
private:
DataArrayDouble *operatePerTuple(std::function<double(const double *bg, const double *endd)> func) const;
private:
- ~DataArrayDouble() override = default;
+ ~DataArrayDouble() { }
DataArrayDouble() { }
};
}
void checkStrictlyMonotonic(bool increasing) const;
bool isStrictlyMonotonic(bool increasing) const;
mcIdType getHashCode() const;
- void reprCppStream(const std::string& varName, std::ostream& stream) const override;
- void reprQuickOverview(std::ostream& stream) const override;
- void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override;
+ void reprCppStream(const std::string& varName, std::ostream& stream) const;
+ void reprQuickOverview(std::ostream& stream) const;
+ void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const;
void transformWithIndArr(const T *indArrBg, const T *indArrEnd);
void transformWithIndArr(const MapKeyVal<T, T>& m);
template<class ALG>
void switchOnTupleAlg(T val, std::vector<bool>& vec, ALG algo) const;
protected:
- ~DataArrayDiscrete() override = default;
+ ~DataArrayDiscrete() { }
};
template<class T>
public:
bool isFittingWith(const std::vector<bool>& v) const;
protected:
- ~DataArrayDiscreteSigned() override = default;
+ ~DataArrayDiscreteSigned() { }
};
class DataArrayInt32Iterator;
{
friend class DataArrayDiscrete<Int32>;
public:
- DataArrayInt32 *deepCopy() const override;
+ DataArrayInt32 *deepCopy() const;
DataArrayInt32 *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); }
- DataArrayInt32 *buildNewEmptyInstance() const override { return DataArrayInt32::New(); }
+ DataArrayInt32 *buildNewEmptyInstance() const { return DataArrayInt32::New(); }
MCAuto<DataArrayInt64> convertToInt64Arr() const;
public:
- DataArrayInt32 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
+ DataArrayInt32 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
DataArrayInt32 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
- DataArrayInt32 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- DataArrayInt32 *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const override { return this->myKeepSelectedComponents(compoIds); }
- DataArrayInt32 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return this->mySelectByTupleIdSafeSlice(bg,end2,step); }
- DataArrayInt32 *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const override { return this->mySelectByTupleRanges(ranges); }
+ DataArrayInt32 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ DataArrayInt32 *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return this->myKeepSelectedComponents(compoIds); }
+ DataArrayInt32 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return this->mySelectByTupleIdSafeSlice(bg,end2,step); }
+ DataArrayInt32 *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return this->mySelectByTupleRanges(ranges); }
std::string getClassName() const override { return std::string("DataArrayInt32"); }
public:
DataArrayInt32Iterator *iterator();
private:
- ~DataArrayInt32() override = default;
+ ~DataArrayInt32() { }
DataArrayInt32() { }
};
{
friend class DataArrayDiscrete<Int64>;
public:
- DataArrayInt64 *deepCopy() const override;
+ DataArrayInt64 *deepCopy() const;
DataArrayInt64 *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); }
- DataArrayInt64 *buildNewEmptyInstance() const override { return DataArrayInt64::New(); }//ok
+ DataArrayInt64 *buildNewEmptyInstance() const { return DataArrayInt64::New(); }//ok
MCAuto<DataArrayInt32> convertToInt32Arr() const;
public:
- DataArrayInt64 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
+ DataArrayInt64 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
DataArrayInt64 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
- DataArrayInt64 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return DataArrayTemplate<Int64>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- DataArrayInt64 *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const override { return DataArrayTemplate<Int64>::myKeepSelectedComponents(compoIds); }
- DataArrayInt64 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return DataArrayTemplate<Int64>::mySelectByTupleIdSafeSlice(bg,end2,step); }
- DataArrayInt64 *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const override { return DataArrayTemplate<Int64>::mySelectByTupleRanges(ranges); }
+ DataArrayInt64 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate<Int64>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ DataArrayInt64 *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return DataArrayTemplate<Int64>::myKeepSelectedComponents(compoIds); }
+ DataArrayInt64 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate<Int64>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+ DataArrayInt64 *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return DataArrayTemplate<Int64>::mySelectByTupleRanges(ranges); }
std::string getClassName() const override { return std::string("DataArrayInt64"); }
public:
DataArrayInt64Iterator *iterator();
private:
- ~DataArrayInt64() override = default;
+ ~DataArrayInt64() { }
DataArrayInt64() { }
};
}
std::string repr() const;
std::string reprZip() const;
DataArrayInt *convertToIntArr() const;
- DataArrayChar *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
+ DataArrayChar *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
DataArrayChar *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
- DataArrayChar *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return DataArrayTemplate<char>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
- DataArrayChar *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const override { return DataArrayTemplate<char>::myKeepSelectedComponents(compoIds); }
- DataArrayChar *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return DataArrayTemplate<char>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+ DataArrayChar *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate<char>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ DataArrayChar *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return DataArrayTemplate<char>::myKeepSelectedComponents(compoIds); }
+ DataArrayChar *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate<char>::mySelectByTupleIdSafeSlice(bg,end2,step); }
bool isUniform(char val) const;
void meldWith(const DataArrayChar *other);
- DataArray *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const override { return DataArrayTemplate<char>::mySelectByTupleRanges(ranges); }
+ DataArray *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return DataArrayTemplate<char>::mySelectByTupleRanges(ranges); }
DataArrayIdType *findIdsEqual(char val) const;
DataArrayIdType *findIdsNotEqual(char val) const;
mcIdType findIdSequence(const std::vector<char>& vals) const;
{
public:
static DataArrayByte *New();
- DataArrayChar *buildEmptySpecializedDAChar() const override;
+ DataArrayChar *buildEmptySpecializedDAChar() const;
DataArrayByteIterator *iterator();
- DataArrayByte *deepCopy() const override;
+ DataArrayByte *deepCopy() const;
DataArrayByte *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); }
DataArrayByte *performCopyOrIncrRef(bool deepCopy) const;
- DataArrayByte *buildNewEmptyInstance() const override { return DataArrayByte::New(); }
+ DataArrayByte *buildNewEmptyInstance() const { return DataArrayByte::New(); }
char byteValue() const;
- void reprStream(std::ostream& stream) const override;
- void reprZipStream(std::ostream& stream) const override;
- void reprWithoutNameStream(std::ostream& stream) const override;
- void reprZipWithoutNameStream(std::ostream& stream) const override;
- void reprCppStream(const std::string& varName, std::ostream& stream) const override;
- void reprQuickOverview(std::ostream& stream) const override;
- void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override;
- bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const override;
+ void reprStream(std::ostream& stream) const;
+ void reprZipStream(std::ostream& stream) const;
+ void reprWithoutNameStream(std::ostream& stream) const;
+ void reprZipWithoutNameStream(std::ostream& stream) const;
+ void reprCppStream(const std::string& varName, std::ostream& stream) const;
+ void reprQuickOverview(std::ostream& stream) const;
+ void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
+ bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
std::vector<bool> toVectorOfBool() const;
std::string getClassName() const override { return std::string("DataArrayByte"); }
private:
- ~DataArrayByte() override = default;
+ ~DataArrayByte() { }
DataArrayByte() { }
};
static DataArrayAsciiChar *New();
static DataArrayAsciiChar *New(const std::string& st);
static DataArrayAsciiChar *New(const std::vector<std::string>& vst, char defaultChar);
- DataArrayChar *buildEmptySpecializedDAChar() const override;
+ DataArrayChar *buildEmptySpecializedDAChar() const;
DataArrayAsciiCharIterator *iterator();
- DataArrayAsciiChar *deepCopy() const override;
+ DataArrayAsciiChar *deepCopy() const;
DataArrayAsciiChar *copySorted(bool asc=true) const override { (void)asc;throw INTERP_KERNEL::Exception("DataArrayAsciiChar::copySorted : not implemented for DataArrayByte"); }
DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const;
- DataArrayAsciiChar *buildNewEmptyInstance() const override { return DataArrayAsciiChar::New(); }
+ DataArrayAsciiChar *buildNewEmptyInstance() const { return DataArrayAsciiChar::New(); }
char asciiCharValue() const;
- void reprStream(std::ostream& stream) const override;
- void reprZipStream(std::ostream& stream) const override;
- void reprWithoutNameStream(std::ostream& stream) const override;
- void reprZipWithoutNameStream(std::ostream& stream) const override;
- void reprCppStream(const std::string& varName, std::ostream& stream) const override;
- void reprQuickOverview(std::ostream& stream) const override;
- void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override;
- bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const override;
+ void reprStream(std::ostream& stream) const;
+ void reprZipStream(std::ostream& stream) const;
+ void reprWithoutNameStream(std::ostream& stream) const;
+ void reprZipWithoutNameStream(std::ostream& stream) const;
+ void reprCppStream(const std::string& varName, std::ostream& stream) const;
+ void reprQuickOverview(std::ostream& stream) const;
+ void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
+ bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
std::string getClassName() const override { return std::string("DataArrayAsciiChar"); }
private:
- ~DataArrayAsciiChar() override = default;
+ ~DataArrayAsciiChar() { }
DataArrayAsciiChar() { }
DataArrayAsciiChar(const std::string& st);
DataArrayAsciiChar(const std::vector<std::string>& vst, char defaultChar);
{
public:
DataArrayDoubleIterator(DataArrayDouble *da);
- ~DataArrayDoubleIterator() = default;
+ ~DataArrayDoubleIterator() { }
};
class MEDCOUPLING_EXPORT DataArrayDoubleTuple : public DataArrayTuple<double>
{
public:
DataArrayFloatIterator(DataArrayFloat *da);
- ~DataArrayFloatIterator() = default;
+ ~DataArrayFloatIterator() { }
};
class MEDCOUPLING_EXPORT DataArrayFloatTuple : public DataArrayTuple<float>
{
public:
DataArrayInt32Iterator(DataArrayInt32 *da);
- ~DataArrayInt32Iterator() = default;
+ ~DataArrayInt32Iterator() { }
};
class MEDCOUPLING_EXPORT DataArrayInt64Iterator : public DataArrayIterator<Int64>
{
public:
DataArrayInt64Iterator(DataArrayInt64 *da);
- ~DataArrayInt64Iterator() = default;
+ ~DataArrayInt64Iterator() { }
};
class MEDCOUPLING_EXPORT DataArrayInt32Tuple : public DataArrayTuple<Int32>
DataArrayInt64 *buildDAInt(std::size_t nbOfTuples, std::size_t nbOfCompo) const;
};
- using DataArrayIntTuple = DataArrayInt32Tuple;
+ typedef DataArrayInt32Tuple DataArrayIntTuple;
class DataArrayAsciiCharTuple;
#ifndef __PARAMEDMEM_MEDCOUPLINGMEMARRAY_TXX__
#define __PARAMEDMEM_MEDCOUPLINGMEMARRAY_TXX__
-#include "MCType.hxx"
-#include "MEDCouplingMap.txx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTraits.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "InterpKernelException.hxx"
+#include "InterpolationUtils.hxx"
#include "MEDCouplingPartDefinition.hxx"
#include "InterpKernelAutoPtr.hxx"
#include "MCAuto.hxx"
+#include "MEDCouplingMap.txx"
-#include <ostream>
-#include <iterator>
-#include <cstdint>
-#include <limits>
-#include <functional>
-#include <map>
#include <set>
-#include <cstddef>
#include <sstream>
#include <cstdlib>
#include <numeric>
#include <algorithm>
-#include <string>
-#include <vector>
-#include <utility>
+#include <iterator>
namespace MEDCoupling
{
void MEDCouplingPointer<T>::setInternal(T *pointer)
{
_internal=pointer;
- _external=nullptr;
+ _external=0;
}
template<class T>
}
template<class T>
- MemArray<T>::MemArray(const MemArray<T>& other)
+ MemArray<T>::MemArray(const MemArray<T>& other):_nb_of_elem(0),_nb_of_elem_alloc(0),_ownership(false),_dealloc(0),_param_for_deallocator(0)
{
if(!other._pointer.isNull())
{
stream << "No data";
stream << "\n";
stream << "Data content :\n";
- bool const ret=!_pointer.isNull();
+ bool ret=!_pointer.isNull();
if(!ret)
stream << "No data !\n";
return ret;
const T *data=getConstPointer();
if(_nb_of_elem!=0 && sl!=0)
{
- std::size_t const nbOfTuples=_nb_of_elem/std::abs(sl);
+ std::size_t nbOfTuples=_nb_of_elem/std::abs(sl);
for(std::size_t i=0;i<nbOfTuples;i++)
{
stream << "Tuple #" << i << " : ";
{
if(_nb_of_elem!=0 && sl!=0)
{
- std::size_t const nbOfTuples=_nb_of_elem/std::abs(sl);
+ std::size_t nbOfTuples=_nb_of_elem/std::abs(sl);
for(std::size_t i=0;i<nbOfTuples;i++)
{
stream << "|";
std::sort(pt,pt+_nb_of_elem);
else
{
- typename std::reverse_iterator<T *> const it1(pt+_nb_of_elem);
- typename std::reverse_iterator<T *> const it2(pt);
+ typename std::reverse_iterator<T *> it1(pt+_nb_of_elem);
+ typename std::reverse_iterator<T *> it2(pt);
std::sort(it1,it2);
}
}
_nb_of_elem_alloc=newNbOfElements;
_ownership=true;
_dealloc=CDeallocator;
- _param_for_deallocator=nullptr;
+ _param_for_deallocator=0;
}
/*!
_nb_of_elem_alloc=newNbOfElements;
_ownership=true;
_dealloc=CDeallocator;
- _param_for_deallocator=nullptr;
+ _param_for_deallocator=0;
}
template<class T>
- void MemArray<T>::CPPDeallocator(void *pt, void * /*param*/)
+ void MemArray<T>::CPPDeallocator(void *pt, void *param)
{
delete [] reinterpret_cast<T*>(pt);
}
template<class T>
- void MemArray<T>::CDeallocator(void *pt, void * /*param*/)
+ void MemArray<T>::CDeallocator(void *pt, void *param)
{
free(pt);
}
template<class T>
void MemArray<T>::COffsetDeallocator(void *pt, void *param)
{
- auto *offset(reinterpret_cast<int64_t *>(param));
+ int64_t *offset(reinterpret_cast<int64_t *>(param));
char *ptcast(reinterpret_cast<char *>(pt));
free(ptcast+*offset);
}
DestroyPointer(const_cast<T *>(_pointer.getConstPointer()),_dealloc,_param_for_deallocator);//Do not use getPointer because in case of _external
_pointer.null();
_ownership=false;
- _dealloc=nullptr;
- _param_for_deallocator=nullptr;
+ _dealloc=NULL;
+ _param_for_deallocator=NULL;
_nb_of_elem=0;
_nb_of_elem_alloc=0;
}
if(_tuple_id<_nb_tuple)
{
_tuple_id++;
- auto *ret=new typename Traits<T>::ArrayTuple(_pt,_nb_comp);
+ typename Traits<T>::ArrayTuple *ret=new typename Traits<T>::ArrayTuple(_pt,_nb_comp);
_pt+=_nb_comp;
return ret;
}
template<class T>
bool DataArrayTemplate<T>::isAllocated() const
{
- return getConstPointer()!=nullptr;
+ return getConstPointer()!=0;
}
/*!
mcIdType nbOfTuples(other.getNumberOfTuples());
std::size_t nbOfComp(other.getNumberOfComponents());
allocIfNecessary(nbOfTuples,nbOfComp);
- std::size_t const nbOfElems(nbOfTuples*nbOfComp);
+ std::size_t nbOfElems(nbOfTuples*nbOfComp);
T *pt(getPointer());
const T *ptI(other.begin());
for(std::size_t i=0;i<nbOfElems;i++)
void DataArrayTemplate<T>::renumberInPlace(const mcIdType *old2New)
{
checkAllocated();
- mcIdType const nbTuples(getNumberOfTuples());
- std::size_t const nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(getNumberOfComponents());
T *tmp(new T[nbTuples*nbOfCompo]);
const T *iptr(begin());
for(mcIdType i=0;i<nbTuples;i++)
{
- mcIdType const v=old2New[i];
+ mcIdType v=old2New[i];
if(v>=0 && v<nbTuples)
std::copy(iptr+nbOfCompo*i,iptr+nbOfCompo*(i+1),tmp+nbOfCompo*v);
else
void DataArrayTemplate<T>::renumberInPlaceR(const mcIdType *new2Old)
{
checkAllocated();
- mcIdType const nbTuples(getNumberOfTuples());
- std::size_t const nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(getNumberOfComponents());
T *tmp(new T[nbTuples*nbOfCompo]);
const T *iptr(begin());
for(mcIdType i=0;i<nbTuples;i++)
{
- mcIdType const v=new2Old[i];
+ mcIdType v=new2Old[i];
if(v>=0 && v<nbTuples)
std::copy(iptr+nbOfCompo*v,iptr+nbOfCompo*(v+1),tmp+nbOfCompo*i);
else
T *optr=ret->getPointer();
for(mcIdType i=0;i<nbTuples;i++)
{
- mcIdType const w=old2New[i];
+ mcIdType w=old2New[i];
if(w>=0)
std::copy(iptr+i*nbOfCompo,iptr+(i+1)*nbOfCompo,optr+w*nbOfCompo);
}
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- std::size_t const nbComp(getNumberOfComponents());
+ std::size_t nbComp(getNumberOfComponents());
ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp);
ret->copyStringInfoFrom(*this);
T *pt(ret->getPointer());
if(!pd)
throw INTERP_KERNEL::Exception("DataArrayTemplate<T>::selectPartDef : null input pointer !");
MCAuto<typename Traits<T>::ArrayTypeCh> ret(Traits<T>::ArrayTypeCh::New());
- const auto *spd(dynamic_cast<const SlicePartDefinition *>(pd));
+ const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(pd));
if(spd)
{
mcIdType a,b,c;
return DynamicCastSafe<DataArray,typename Traits<T>::ArrayTypeCh>(ret2);
}
}
- const auto *dpd(dynamic_cast<const DataArrayPartDefinition *>(pd));
+ const DataArrayPartDefinition *dpd(dynamic_cast<const DataArrayPartDefinition *>(pd));
if(dpd)
{
MCAuto<DataArrayIdType> arr(dpd->toDAI());
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- std::size_t const nbComp(getNumberOfComponents());
- mcIdType const oldNbOfTuples(getNumberOfTuples());
+ std::size_t nbComp(getNumberOfComponents());
+ mcIdType oldNbOfTuples(getNumberOfTuples());
ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp);
ret->copyStringInfoFrom(*this);
T *pt(ret->getPointer());
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::rearrange : input newNbOfCompo must be > 0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::size_t const nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
if(nbOfElems%newNbOfCompo!=0)
{
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::rearrange : nbOfElems%newNbOfCompo!=0 !";
T *nc(ret->getPointer());
mcIdType nbOfTuples=getNumberOfTuples();
std::size_t oldNbOfComp=getNumberOfComponents();
- std::size_t const dim(std::min(oldNbOfComp,newNbOfComp));
+ std::size_t dim(std::min(oldNbOfComp,newNbOfComp));
for(mcIdType i=0;i<nbOfTuples;i++)
{
std::size_t j=0;
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- std::size_t const newNbOfCompo=compoIds.size();
- std::size_t const oldNbOfCompo=getNumberOfComponents();
- for(unsigned long const compoId : compoIds)
- if(compoId>=oldNbOfCompo) // (*it) >= 0 (it is a size_t)
+ std::size_t newNbOfCompo=compoIds.size();
+ std::size_t oldNbOfCompo=getNumberOfComponents();
+ for(std::vector<std::size_t>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
+ if((*it)>=oldNbOfCompo) // (*it) >= 0 (it is a size_t)
{
- std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::keepSelectedComponents : invalid requested component : " << compoId << " whereas it should be in [0," << oldNbOfCompo << ") !";
+ std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::keepSelectedComponents : invalid requested component : " << *it << " whereas it should be in [0," << oldNbOfCompo << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType const nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples(getNumberOfTuples());
ret->alloc(nbOfTuples,newNbOfCompo);
ret->copyPartOfStringInfoFrom(*this,compoIds);
const T *oldc(getConstPointer());
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- std::size_t const nbComp(getNumberOfComponents());
+ std::size_t nbComp(getNumberOfComponents());
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::selectByTupleIdSafeSlice : ";
- mcIdType const newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str()));
+ mcIdType newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str()));
ret->alloc(newNbOfTuples,nbComp);
T *pt(ret->getPointer());
const T *srcPt(getConstPointer()+bg*nbComp);
{
const char msg[]="DataArrayTemplate::setPartOfValuesSimple1";
checkAllocated();
- mcIdType const newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
- mcIdType const newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
+ mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
+ mcIdType newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
std::size_t nbComp(getNumberOfComponents());
mcIdType nbOfTuples(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
{
const char msg[]="DataArrayTemplate::setPartOfValuesSimple3";
checkAllocated();
- std::size_t const newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
+ std::size_t newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
std::size_t nbComp(getNumberOfComponents());
mcIdType nbOfTuples(getNumberOfTuples());
DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value");
{
const char msg[]="DataArrayTemplate::setPartOfValuesSimple4";
checkAllocated();
- mcIdType const newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
+ mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
std::size_t nbComp(getNumberOfComponents());
for(const mcIdType *z=bgComp;z!=endComp;z++)
DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id");
{
if(!aBase || !tuplesSelec)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : input DataArray is NULL !");
- const auto *a(dynamic_cast<const typename Traits<T>::ArrayType *>(aBase));
+ const typename Traits<T>::ArrayType *a(dynamic_cast<const typename Traits<T>::ArrayType *>(aBase));
if(!a)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : input DataArray aBase is not a DataArrayDouble !");
checkAllocated();
a->checkAllocated();
tuplesSelec->checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=a->getNumberOfComponents())
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : This and a do not have the same number of components !");
if(tuplesSelec->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : Expecting to have a tuple selector DataArrayInt instance with exactly 1 component !");
- mcIdType const thisNt(getNumberOfTuples());
- mcIdType const aNt(a->getNumberOfTuples());
- mcIdType const nbOfTupleToWrite(tuplesSelec->getNumberOfTuples());
+ mcIdType thisNt(getNumberOfTuples());
+ mcIdType aNt(a->getNumberOfTuples());
+ mcIdType nbOfTupleToWrite(tuplesSelec->getNumberOfTuples());
T *valsToSet(getPointer()+tupleIdStart*nbOfComp);
if(tupleIdStart+nbOfTupleToWrite>thisNt)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : invalid number range of values to write !");
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::setContigPartOfSelectedValuesSlice : input DataArray is NULL !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- const auto *a(dynamic_cast<const typename Traits<T>::ArrayType *>(aBase));
+ const typename Traits<T>::ArrayType *a(dynamic_cast<const typename Traits<T>::ArrayType *>(aBase));
if(!a)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : input DataArray aBase is not a DataArrayDouble !");
checkAllocated();
a->checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
const char msg[]="DataArrayDouble::setContigPartOfSelectedValuesSlice";
- mcIdType const nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg));
+ mcIdType nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg));
if(nbOfComp!=a->getNumberOfComponents())
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : This and a do not have the same number of components !");
- mcIdType const thisNt(getNumberOfTuples());
- mcIdType const aNt(a->getNumberOfTuples());
+ mcIdType thisNt(getNumberOfTuples());
+ mcIdType aNt(a->getNumberOfTuples());
T *valsToSet(getPointer()+tupleIdStart*nbOfComp);
if(tupleIdStart+nbOfTupleToWrite>thisNt)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : invalid number range of values to write !");
typename Traits<T>::ArrayType *DataArrayTemplate<T>::mySelectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const
{
checkAllocated();
- std::size_t const nbOfComp(getNumberOfComponents());
- mcIdType const nbOfTuplesThis(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents());
+ mcIdType nbOfTuplesThis(getNumberOfTuples());
if(ranges.empty())
{
MCAuto<DataArray> ret0(buildNewEmptyInstance());
}
mcIdType ref(ranges.front().first),nbOfTuples(0);
bool isIncreasing(true);
- for(auto it=ranges.begin();it!=ranges.end();it++)
+ for(std::vector<std::pair<mcIdType,mcIdType> >::const_iterator it=ranges.begin();it!=ranges.end();it++)
{
if((*it).first<=(*it).second)
{
ret->copyStringInfoFrom(*this);
const T *src(getConstPointer());
T *work(ret->getPointer());
- for(const auto & range : ranges)
- work=std::copy(src+range.first*nbOfComp,src+range.second*nbOfComp,work);
+ for(std::vector<std::pair<mcIdType,mcIdType> >::const_iterator it=ranges.begin();it!=ranges.end();it++)
+ work=std::copy(src+(*it).first*nbOfComp,src+(*it).second*nbOfComp,work);
return ret.retn();
}
void DataArrayTemplate<T>::circularPermutation(mcIdType nbOfShift)
{
checkAllocated();
- std::size_t const nbOfCompo(getNumberOfComponents());
- mcIdType const nbTuples(getNumberOfTuples());
- mcIdType const effNbSh(EffectiveCircPerm(nbOfShift,nbTuples));
+ std::size_t nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ mcIdType effNbSh(EffectiveCircPerm(nbOfShift,nbTuples));
if(effNbSh==0)
return ;
T *work(getPointer());
void DataArrayTemplate<T>::circularPermutationPerTuple(mcIdType nbOfShift)
{
checkAllocated();
- std::size_t const nbOfCompo(getNumberOfComponents());
- mcIdType const nbTuples(getNumberOfTuples());
- mcIdType const effNbSh(EffectiveCircPerm(nbOfShift,ToIdType(nbOfCompo)));
+ std::size_t nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ mcIdType effNbSh(EffectiveCircPerm(nbOfShift,ToIdType(nbOfCompo)));
if(effNbSh==0)
return ;
T *work(getPointer());
void DataArrayTemplate<T>::reversePerTuple()
{
checkAllocated();
- std::size_t const nbOfCompo(getNumberOfComponents());
- mcIdType const nbTuples(getNumberOfTuples());
+ std::size_t nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
if(nbOfCompo<=1)
return ;
T *work(getPointer());
mcIdType *retToFill(ret->getPointer());
for(mcIdType i=0;i<nbTuple;i++)
{
- auto it=mm.find(ToIdType(pt[i]));
+ std::map<mcIdType,mcIdType>::const_iterator it=mm.find(ToIdType(pt[i]));
if(it==mm.end())
{
std::ostringstream oss; oss << "DataArrayInt::buildPermutationArr : Arrays mismatch : element (" << pt[i] << ") in 'other' not findable in 'this' !";
throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : some elements appears more than once !");
for(mcIdType i=0;i<nbTuples;i++,retPt++,pt++)
{
- auto it(m.find(ToIdType(*pt)));
+ std::map<mcIdType,mcIdType>::const_iterator it(m.find(ToIdType(*pt)));
if(it!=m.end())
*retPt=(*it).second;
else
template<class T>
void DataArrayDiscrete<T>::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- mcIdType const nbTuples(this->getNumberOfTuples());
- std::size_t const nbComp(this->getNumberOfComponents());
+ mcIdType nbTuples(this->getNumberOfTuples());
+ std::size_t nbComp(this->getNumberOfComponents());
const T *data(this->getConstPointer());
stream << Traits<T>::ArrayTypeName << " *" << varName << "=" << Traits<T>::ArrayTypeName << "::New();" << std::endl;
if(nbTuples*nbComp>=1)
stream << Traits<T>::ArrayTypeName << " C++ instance at " << this << ". ";
if(this->isAllocated())
{
- std::size_t const nbOfCompo(this->getNumberOfComponents());
+ std::size_t nbOfCompo(this->getNumberOfComponents());
if(nbOfCompo>=1)
{
- mcIdType const nbOfTuples(this->getNumberOfTuples());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayDiscrete<T>::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const T *data(this->begin());
- mcIdType const nbOfTuples(this->getNumberOfTuples());
- std::size_t const nbOfCompo(this->getNumberOfComponents());
+ mcIdType nbOfTuples(this->getNumberOfTuples());
+ std::size_t nbOfCompo(this->getNumberOfComponents());
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
else
oss2 << *data++;
if(i!=nbOfTuples-1) oss2 << ", ";
- std::string const oss3Str(oss2.str());
+ std::string oss3Str(oss2.str());
if(oss3Str.length()<maxNbOfByteInRepr)
oss2Str=oss3Str;
else
{
rintstart res=std::find_if(bg,end2,std::bind(std::less_equal<T>(),std::placeholders::_1,work[i]));
std::size_t pos=std::distance(bg,res);
- std::size_t const pos2=nbOfCast-pos;
+ std::size_t pos2=nbOfCast-pos;
if(pos2<nbOfCast)
{
ret1Ptr[i]=static_cast<T>(pos2);
MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
ret->alloc(nbOfTuples,1);
mcIdType *retPtr=ret->getPointer();
- for(const auto & it1 : tmp)
- retPtr=std::copy(it1.begin(),it1.end(),retPtr);
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++)
+ retPtr=std::copy((*it1).begin(),(*it1).end(),retPtr);
arr=ret.retn();
arrI=retI.retn();
}
this->checkAllocated();
a->checkAllocated();
this->copyPartOfStringInfoFrom2(compoIds,*a);
- std::size_t const partOfCompoSz=compoIds.size();
+ std::size_t partOfCompoSz=compoIds.size();
std::size_t nbOfCompo = this->getNumberOfComponents();
mcIdType nbOfTuples=std::min(this->getNumberOfTuples(),a->getNumberOfTuples());
const T *ac=a->getConstPointer();
tmp[*w]=true;
else
throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : an element is not in valid range : [0,nbOfElement) !");
- std::size_t const nbOfRetVal=std::count(tmp.begin(),tmp.end(),false);
+ std::size_t nbOfRetVal=std::count(tmp.begin(),tmp.end(),false);
DataArrayIdType *ret=DataArrayIdType::New();
ret->alloc(nbOfRetVal,1);
mcIdType j=0;
this->setName(tinyInfoS[0]);
if(this->isAllocated())
{
- mcIdType const nbOfCompo=tinyInfoI[1];
+ mcIdType nbOfCompo=tinyInfoI[1];
for(mcIdType i=0;i<nbOfCompo;i++)
this->setInfoOnComponent(i,tinyInfoS[i+1]);
}
mcIdType *DataArrayDiscrete<T>::CheckAndPreparePermutation(const T *start, const T *end)
{
std::size_t sz=std::distance(start,end);
- auto *ret=(mcIdType *)malloc(sz*sizeof(mcIdType));
+ mcIdType *ret=(mcIdType *)malloc(sz*sizeof(mcIdType));
T *work=new T[sz];
std::copy(start,end,work);
std::sort(work,work+sz);
arrIn->checkAllocated(); arrIndxIn->checkAllocated();
if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : input arrays must have exactly one component !");
- std::size_t const sz=std::distance(idsOfSelectBg,idsOfSelectEnd);
+ std::size_t sz=std::distance(idsOfSelectBg,idsOfSelectEnd);
const T *arrInPtr=arrIn->begin();
const mcIdType *arrIndxPtr=arrIndxIn->begin();
- mcIdType const nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
if(nbOfGrps<0)
throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !");
mcIdType maxSizeOfArr(arrIn->getNumberOfTuples());
arrIn->checkAllocated(); arrIndxIn->checkAllocated();
if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : input arrays must have exactly one component !");
- mcIdType const sz=DataArray::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice ");
+ mcIdType sz=DataArray::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice ");
const T *arrInPtr=arrIn->begin();
const mcIdType *arrIndxPtr=arrIndxIn->begin();
- mcIdType const nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
if(nbOfGrps<0)
throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !");
mcIdType maxSizeOfArr(arrIn->getNumberOfTuples());
const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex,
DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut)
{
- if(arrIn==0 || arrIndxIn==nullptr || srcArr==0 || srcArrIndex==nullptr)
+ if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : presence of null pointer in input parameter !");
MCAuto<DataArrayType> arro=DataArrayType::New();
MCAuto<DataArrayIdType> arrIo=DataArrayIdType::New();
- mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
std::vector<bool> v(nbOfTuples,true);
mcIdType offset=0;
const mcIdType *arrIndxInPtr=arrIndxIn->begin();
}
else
{
- std::size_t const pos=std::distance(idsOfSelectBg,std::find(idsOfSelectBg,idsOfSelectEnd,ii));
+ std::size_t pos=std::distance(idsOfSelectBg,std::find(idsOfSelectBg,idsOfSelectEnd,ii));
arroPtr=std::copy(srcArrPtr+srcArrIndexPtr[pos],srcArrPtr+srcArrIndexPtr[pos+1],arroPtr);
*arrIoPtr=arrIoPtr[-1]+(srcArrIndexPtr[pos+1]-srcArrIndexPtr[pos]);
}
const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex,
DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut)
{
- if(arrIn==0 || arrIndxIn==nullptr || srcArr==0 || srcArrIndex==nullptr)
+ if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSlice : presence of null pointer in input parameter !");
MCAuto<DataArrayType> arro=DataArrayType::New();
MCAuto<DataArrayIdType> arrIo=DataArrayIdType::New();
- mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
mcIdType offset=0;
const mcIdType *arrIndxInPtr=arrIndxIn->begin();
const mcIdType *srcArrIndexPtr=srcArrIndex->begin();
- mcIdType const nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSlice : ");
+ mcIdType nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSlice : ");
mcIdType it=start;
for(mcIdType i=0;i<nbOfElemsToSet;i++,srcArrIndexPtr++,it+=step)
{
T *arroPtr=arro->getPointer();
for(mcIdType ii=0;ii<nbOfTuples;ii++,arrIoPtr++)
{
- mcIdType const pos=DataArray::GetPosOfItemGivenBESRelativeNoThrow(ii,start,end,step);
+ mcIdType pos=DataArray::GetPosOfItemGivenBESRelativeNoThrow(ii,start,end,step);
if(pos<0)
{
arroPtr=std::copy(arrInPtr+arrIndxInPtr[ii],arrInPtr+arrIndxInPtr[ii+1],arroPtr);
DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn,
const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex)
{
- if(arrInOut==0 || arrIndxIn==nullptr || srcArr==0 || srcArrIndex==nullptr)
+ if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : presence of null pointer in input parameter !");
- mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
const mcIdType *arrIndxInPtr=arrIndxIn->begin();
const mcIdType *srcArrIndexPtr=srcArrIndex->begin();
T *arrInOutPtr=arrInOut->getPointer();
DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn,
const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex)
{
- if(arrInOut==0 || arrIndxIn==nullptr || srcArr==0 || srcArrIndex==nullptr)
+ if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : presence of null pointer in input parameter !");
- mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
const mcIdType *arrIndxInPtr=arrIndxIn->begin();
const mcIdType *srcArrIndexPtr=srcArrIndex->begin();
T *arrInOutPtr=arrInOut->getPointer();
const T *srcArrPtr=srcArr->begin();
- mcIdType const nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : ");
+ mcIdType nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : ");
mcIdType it=start;
for(mcIdType i=0;i<nbOfElemsToSet;i++,srcArrIndexPtr++,it+=step)
{
if(offsetForRemoval<0)
throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : offsetForRemoval should be >=0 !");
std::set<T> s(idsToRemoveBg,idsToRemoveEnd);
- mcIdType const nbOfGrps=arrIndx->getNumberOfTuples()-1;
+ mcIdType nbOfGrps=arrIndx->getNumberOfTuples()-1;
mcIdType *arrIPtr=arrIndx->getPointer();
*arrIPtr++=0;
mcIdType previousArrI=0;
ret->alloc(nbOfOldTuples,1);
mcIdType *pt=ret->getPointer();
std::fill(pt,pt+nbOfOldTuples,-1);
- mcIdType const nbOfGrps=ToIdType(std::distance(arrIBg,arrIEnd))-1;
+ mcIdType nbOfGrps=ToIdType(std::distance(arrIBg,arrIEnd))-1;
const mcIdType *cIPtr=arrIBg;
for(mcIdType i=0;i<nbOfGrps;i++)
pt[arr[cIPtr[i]]]=-(i+2);
pt[iNode]=newNb++;
else
{
- mcIdType const grpId=-(pt[iNode]+2);
+ mcIdType grpId=-(pt[iNode]+2);
for(mcIdType j=cIPtr[grpId];j<cIPtr[grpId+1];j++)
{
if(arr[j]>=0 && arr[j]<nbOfOldTuples)
{
const T *ptr=(*iter)->getConstPointer();
std::size_t nbOfElem=(*iter)->getNbOfElems();
- mcIdType const sfid=fid;
+ mcIdType sfid=fid;
for(mcIdType j=0;j<sfid;j++)
{
bool found=false;
class OpSwitchedOn
{
public:
- OpSwitchedOn(T *pt):_pt(pt) { }
+ OpSwitchedOn(T *pt):_pt(pt),_cnt(0) { }
void operator()(const bool& b) { if(b) *_pt++=FromIdType<T>(_cnt); _cnt++; }
private:
T *_pt;
- MEDCoupling::mcIdType _cnt{0};
+ MEDCoupling::mcIdType _cnt;
};
template <class T>
class OpSwitchedOff
{
public:
- OpSwitchedOff(T *pt):_pt(pt) { }
+ OpSwitchedOff(T *pt):_pt(pt),_cnt(0) { }
void operator()(const bool& b) { if(!b) *_pt++=FromIdType<T>(_cnt); _cnt++; }
private:
T *_pt;
- MEDCoupling::mcIdType _cnt{0};
+ MEDCoupling::mcIdType _cnt;
};
}
/// @endcond
const T *w(this->begin()),*end2(this->end());
T refVal=-std::numeric_limits<T>::max();
T i=0;
- auto it(v.begin());
+ std::vector<bool>::const_iterator it(v.begin());
for(;it!=v.end();it++,i++)
{
if(*it)
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingMemArray.txx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include <cstddef>
-#include <cstdlib>
-#include <iterator>
-#include <ostream>
#include <set>
#include <cmath>
+#include <limits>
#include <numeric>
#include <algorithm>
-#include <string>
-#include <sstream>
-#include <vector>
+#include <functional>
using namespace MEDCoupling;
mcIdType DataArrayChar::getHashCode() const
{
checkAllocated();
- std::size_t const nbOfElems=getNbOfElems();
- std::size_t const ret=nbOfElems*65536;
+ std::size_t nbOfElems=getNbOfElems();
+ std::size_t ret=nbOfElems*65536;
std::size_t delta=3;
if(nbOfElems>48)
delta=nbOfElems/8;
checkAllocated();
DataArrayInt *ret=DataArrayInt::New();
ret->alloc(getNumberOfTuples(),getNumberOfComponents());
- std::size_t const nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
const char *src=getConstPointer();
int *dest=ret->getPointer();
std::copy(src,src+nbOfVals,dest);
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::isUniform : must be applied on DataArrayChar with only one component, you can call 'rearrange' method before !");
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
const char *w=getConstPointer();
const char *end2=w+nbOfTuples;
for(;w!=end2;w++)
throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : DataArrayChar pointer in input is NULL !");
checkAllocated();
other->checkAllocated();
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
if(nbOfTuples!=other->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : mismatch of number of tuples !");
- std::size_t const nbOfComp1=getNumberOfComponents();
- std::size_t const nbOfComp2=other->getNumberOfComponents();
+ std::size_t nbOfComp1=getNumberOfComponents();
+ std::size_t nbOfComp2=other->getNumberOfComponents();
char *newArr=(char *)malloc(nbOfTuples*(nbOfComp1+nbOfComp2)*sizeof(char));
char *w=newArr;
const char *inp1=getConstPointer();
throw INTERP_KERNEL::Exception("DataArrayChar::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr==val)
ret->pushBackSilent(i);
throw INTERP_KERNEL::Exception("DataArrayChar::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr!=val)
ret->pushBackSilent(i);
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdSequence : works only for DataArrayChar instance with one component !");
const char *cptr=getConstPointer();
- std::size_t const nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
const char *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end());
if(loc!=cptr+nbOfVals)
return ToIdType(std::distance(cptr,loc));
mcIdType DataArrayChar::findIdFirstEqualTuple(const std::vector<char>& tupl) const
{
checkAllocated();
- std::size_t const nbOfCompo=getNumberOfComponents();
+ std::size_t nbOfCompo=getNumberOfComponents();
if(nbOfCompo==0)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqualTuple : 0 components in 'this' !");
if(nbOfCompo!=tupl.size())
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const char *cptr=getConstPointer();
- std::size_t const nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
for(const char *work=cptr;work!=cptr+nbOfVals;)
{
work=std::search(work,cptr+nbOfVals,tupl.begin(),tupl.end());
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
const char *ret=std::find(cptr,cptr+nbOfTuples,value);
if(ret!=cptr+nbOfTuples)
return ToIdType(std::distance(cptr,ret));
throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqual : the array must have only one component, you can call 'rearrange' method before !");
std::set<char> vals2(vals.begin(),vals.end());
const char *cptr=getConstPointer();
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
for(const char *w=cptr;w!=cptr+nbOfTuples;w++)
if(vals2.find(*w)!=vals2.end())
return ToIdType(std::distance(cptr,w));
throw INTERP_KERNEL::Exception("DataArrayChar::findIdsInRange : this must have exactly one component !");
const char *cptr=getConstPointer();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<vmax)
ret->pushBackSilent(i);
DataArrayChar *DataArrayChar::Aggregate(const std::vector<const DataArrayChar *>& arr)
{
std::vector<const DataArrayChar *> a;
- for(auto it4 : arr)
- if(it4)
- a.push_back(it4);
+ for(std::vector<const DataArrayChar *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
+ if(*it4)
+ a.push_back(*it4);
if(a.empty())
throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : input list must be NON EMPTY !");
std::vector<const DataArrayChar *>::const_iterator it=a.begin();
- std::size_t const nbOfComp((*it)->getNumberOfComponents());
+ std::size_t nbOfComp((*it)->getNumberOfComponents());
mcIdType nbt=(*it++)->getNumberOfTuples();
for(;it!=a.end();it++)
{
DataArrayChar *DataArrayChar::Meld(const std::vector<const DataArrayChar *>& arr)
{
std::vector<const DataArrayChar *> a;
- for(auto it4 : arr)
- if(it4)
- a.push_back(it4);
+ for(std::vector<const DataArrayChar *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
+ if(*it4)
+ a.push_back(*it4);
if(a.empty())
throw INTERP_KERNEL::Exception("DataArrayChar::Meld : array must be NON empty !");
std::vector<const DataArrayChar *>::const_iterator it;
for(it=a.begin();it!=a.end();it++)
(*it)->checkAllocated();
it=a.begin();
- mcIdType const nbOfTuples=(*it)->getNumberOfTuples();
+ mcIdType nbOfTuples=(*it)->getNumberOfTuples();
std::vector<std::size_t> nbc(a.size());
std::vector<const char *> pts(a.size());
nbc[0]=(*it)->getNumberOfComponents();
nbc[i]=(*it)->getNumberOfComponents();
pts[i]=(*it)->getConstPointer();
}
- std::size_t const totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),(std::size_t)0);
+ std::size_t totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),(std::size_t)0);
DataArrayChar *ret=a[0]->buildEmptySpecializedDAChar();
ret->alloc(nbOfTuples,totalNbOfComp);
char *retPtr=ret->getPointer();
if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream))
{
const char *data=begin();
- mcIdType const nbOfTuples=getNumberOfTuples();
- std::size_t const nbCompo=getNumberOfComponents();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbCompo=getNumberOfComponents();
for(mcIdType i=0;i<nbOfTuples;i++,data+=nbCompo)
{
stream << "Tuple #" << i << " : ";
void DataArrayByte::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- mcIdType const nbTuples=getNumberOfTuples();
- std::size_t const nbComp=getNumberOfComponents();
+ mcIdType nbTuples=getNumberOfTuples();
+ std::size_t nbComp=getNumberOfComponents();
const char *data=getConstPointer();
stream << "DataArrayByte *" << varName << "=DataArrayByte::New();" << std::endl;
if(nbTuples*nbComp>=1)
stream << "DataArrayByte C++ instance at " << this << ". ";
if(isAllocated())
{
- std::size_t const nbOfCompo=_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const char *data=begin();
- mcIdType const nbOfTuples=getNumberOfTuples();
- std::size_t const nbOfCompo=_info_on_compo.size();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
else
{ oss2 << (int)*data; data++; }
if(i!=nbOfTuples-1) oss2 << ", ";
- std::string const oss3Str(oss2.str());
+ std::string oss3Str(oss2.str());
if(oss3Str.length()<maxNbOfByteInRepr)
oss2Str=oss3Str;
else
bool DataArrayByte::isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const
{
- const auto *otherC=dynamic_cast<const DataArrayByte *>(&other);
+ const DataArrayByte *otherC=dynamic_cast<const DataArrayByte *>(&other);
if(!otherC)
{ reason="this is of type DataArrayByte whereas other is not a DataArrayByte instance"; return false; }
return DataArrayChar::isEqualIfNotWhy(other,reason);
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayByte::toVectorOfBool : this method can be used only if this has one component !");
- mcIdType const nbt(getNumberOfTuples());
+ mcIdType nbt(getNumberOfTuples());
std::vector<bool> ret(nbt,false);
const char *pt(begin());
for(mcIdType i=0;i<nbt;i++,pt++)
return ret;
}
-DataArrayByteIterator::DataArrayByteIterator(DataArrayByte *da):_da(da),_pt(nullptr),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
+DataArrayByteIterator::DataArrayByteIterator(DataArrayByte *da):_da(da),_pt(0),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
{
if(_da)
{
if(_tuple_id<_nb_tuple)
{
_tuple_id++;
- auto *ret=new DataArrayByteTuple(_pt,_nb_comp);
+ DataArrayByteTuple *ret=new DataArrayByteTuple(_pt,_nb_comp);
_pt+=_nb_comp;
return ret;
}
else
- return nullptr;
+ return 0;
}
DataArrayByteTuple::DataArrayByteTuple(char *pt, std::size_t nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
*/
DataArrayAsciiChar::DataArrayAsciiChar(const std::string& st)
{
- std::size_t const lgth=st.length();
+ std::size_t lgth=st.length();
if(lgth==0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar constructor with string ! Size of input string is null !");
alloc(1,lgth);
if(vst.empty())
throw INTERP_KERNEL::Exception("DataArrayAsciiChar constructor with vector of strings ! Empty array !");
std::size_t nbCompo=0;
- for(const auto & it : vst)
- nbCompo=std::max(nbCompo,it.length());
+ for(std::vector<std::string>::const_iterator it=vst.begin();it!=vst.end();it++)
+ nbCompo=std::max(nbCompo,(*it).length());
if(nbCompo==0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar constructor with vector of strings ! All strings in not empty vector are empty !");
- std::size_t const nbTuples=vst.size();
+ std::size_t nbTuples=vst.size();
alloc(nbTuples,nbCompo);
char *pt=getPointer();
for(std::size_t i=0;i<nbTuples;i++,pt+=nbCompo)
{
const std::string& tmp=vst[i];
- std::size_t const sz=tmp.length();
+ std::size_t sz=tmp.length();
std::copy(tmp.begin(),tmp.begin()+sz,pt);
std::fill(pt+sz,pt+nbCompo,defaultChar);
}
if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream))
{
const char *data=begin();
- mcIdType const nbOfTuples=getNumberOfTuples();
- std::size_t const nbCompo=getNumberOfComponents();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbCompo=getNumberOfComponents();
for(mcIdType i=0;i<nbOfTuples;i++,data+=nbCompo)
{
stream << "Tuple #" << i << " : \"";
void DataArrayAsciiChar::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- mcIdType const nbTuples=getNumberOfTuples();
- std::size_t const nbComp=getNumberOfComponents();
+ mcIdType nbTuples=getNumberOfTuples();
+ std::size_t nbComp=getNumberOfComponents();
const char *data=getConstPointer();
stream << "DataArrayAsciiChar *" << varName << "=DataArrayAsciiChar::New();" << std::endl;
if(nbTuples*nbComp>=1)
stream << "DataArrayAsciiChar C++ instance at " << this << ". ";
if(isAllocated())
{
- std::size_t const nbOfCompo=_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const char *data=begin();
- mcIdType const nbOfTuples=getNumberOfTuples();
- std::size_t const nbOfCompo=_info_on_compo.size();
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
oss2 << ")";
}
if(i!=nbOfTuples-1) oss2 << ", ";
- std::string const oss3Str(oss2.str());
+ std::string oss3Str(oss2.str());
if(oss3Str.length()<maxNbOfByteInRepr)
oss2Str=oss3Str;
else
bool DataArrayAsciiChar::isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const
{
- const auto *otherC=dynamic_cast<const DataArrayAsciiChar *>(&other);
+ const DataArrayAsciiChar *otherC=dynamic_cast<const DataArrayAsciiChar *>(&other);
if(!otherC)
{ reason="this is of type DataArrayAsciiChar whereas other is not a DataArrayAsciiChar instance"; return false; }
return DataArrayChar::isEqualIfNotWhy(other,reason);
}
-DataArrayAsciiCharIterator::DataArrayAsciiCharIterator(DataArrayAsciiChar *da):_da(da),_pt(nullptr),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
+DataArrayAsciiCharIterator::DataArrayAsciiCharIterator(DataArrayAsciiChar *da):_da(da),_pt(0),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
{
if(_da)
{
if(_tuple_id<_nb_tuple)
{
_tuple_id++;
- auto *ret=new DataArrayAsciiCharTuple(_pt,_nb_comp);
+ DataArrayAsciiCharTuple *ret=new DataArrayAsciiCharTuple(_pt,_nb_comp);
_pt+=_nb_comp;
return ret;
}
else
- return nullptr;
+ return 0;
}
DataArrayAsciiCharTuple::DataArrayAsciiCharTuple(char *pt, std::size_t nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingMemArray.txx"
-#include "MCType.hxx"
-#include <string>
-#include <ostream>
-#include <cstddef>
-#include <algorithm>
-#include <iterator>
-#include <sstream>
using namespace MEDCoupling;
void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- mcIdType const nbTuples(getNumberOfTuples());
- std::size_t const nbComp(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbComp(getNumberOfComponents());
const float *data(begin());
stream.precision(7);
stream << "DataArrayFloat *" << varName << "=DataArrayFloat::New();" << std::endl;
stream << "DataArrayFloat C++ instance at " << this << ". ";
if(isAllocated())
{
- std::size_t const nbOfCompo=_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- mcIdType const nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const float *data(begin());
- mcIdType const nbOfTuples(getNumberOfTuples());
- std::size_t const nbOfCompo=_info_on_compo.size();
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfCompo=_info_on_compo.size();
std::ostringstream oss2; oss2 << "[";
oss2.precision(7);
std::string oss2Str(oss2.str());
else
oss2 << *data++;
if(i!=nbOfTuples-1) oss2 << ", ";
- std::string const oss3Str(oss2.str());
+ std::string oss3Str(oss2.str());
if(oss3Str.length()<maxNbOfByteInRepr)
oss2Str=oss3Str;
else
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
-#include "CellModel.hxx"
-#include "MCIdType.hxx"
#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
#include "MCAuto.hxx"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <algorithm>
-#include <ostream>
-#include <ios>
#include <set>
#include <cmath>
#include <sstream>
#include <fstream>
-#include <vector>
+#include <iterator>
using namespace MEDCoupling;
return getType()==CARTESIAN;
}
-bool MEDCouplingMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double /*prec*/, std::string& reason) const
+bool MEDCouplingMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingMesh::isEqualIfNotWhy : other instance is NULL !");
void MEDCouplingMesh::checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec,
DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
{
- cellCor=nullptr;
- nodeCor=nullptr;
+ cellCor=0;
+ nodeCor=0;
if(this==other)
return ;
switch(levOfCheck)
{
std::vector<mcIdType> crest;
std::set<mcIdType> p(partBg,partEnd);
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
{
std::vector<mcIdType> conn;
/*!
* This method checks fastly that \a this and \a other are equal. All common checks are done here.
*/
-void MEDCouplingMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double /*prec*/) const
+void MEDCouplingMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingMesh::checkFastEquivalWith : input mesh is null !");
{
if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1)
{
- auto *ret(const_cast<MEDCouplingMesh *>(this));
+ MEDCouplingMesh *ret(const_cast<MEDCouplingMesh *>(this));
ret->incrRef();
return ret;
}
*
* \sa MEDCouplingMesh::buildPartAndReduceNodes
*/
-MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& /*beginOut*/, mcIdType& /*endOut*/, mcIdType& /*stepOut*/, DataArrayIdType*& arr) const
+MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const
{
MCAuto<DataArrayIdType> cellIds=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds);
return buildPartAndReduceNodes(cellIds->begin(),cellIds->end(),arr);
{
eltsIndex=DataArrayIdType::New(); elts=DataArrayIdType::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1);
mcIdType *eltsIndexPtr(eltsIndex->getPointer());
- int const spaceDim(getSpaceDimension());
+ int spaceDim(getSpaceDimension());
const double *work(pos);
for(mcIdType i=0;i<nbOfPoints;i++,work+=spaceDim)
{
MCAuto<DataArrayDouble> volXCenter( DataArrayDouble::Multiply(cellCenters,vol->getArray()) );
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(1, this->getSpaceDimension());
volXCenter->accumulate( ret->getPointer() );
- double const volOfMesh(vol->accumulate(0));
+ double volOfMesh(vol->accumulate(0));
ret->applyLin(1.0/volOfMesh,0.0);
return ret;
}
void MEDCouplingMesh::SplitExtension(const std::string& fileName, std::string& baseName, std::string& extension)
{
- std::size_t const pos(fileName.find_last_of('.'));
+ std::size_t pos(fileName.find_last_of('.'));
if(pos==std::string::npos)
{
baseName=fileName;
#include "MCType.hxx"
#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingRefCountObject.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "MCAuto.hxx"
-#include "NormalizedGeometricTypes"
+#include "InterpKernelException.hxx"
-#include <cstddef>
-#include <ostream>
#include <set>
-#include <string>
#include <vector>
namespace MEDCoupling
class MEDCouplingMesh : public RefCountObject, public TimeLabel
{
public:
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT void setName(const std::string& name) { _name=name; }
MEDCOUPLING_EXPORT std::string getName() const { return _name; }
MEDCOUPLING_EXPORT void setDescription(const std::string& descr) { _description=descr; }
MEDCOUPLING_EXPORT MEDCouplingMesh();
MEDCOUPLING_EXPORT MEDCouplingMesh(const MEDCouplingMesh& other);
MEDCOUPLING_EXPORT virtual std::string getVTKDataSetType() const = 0;
- MEDCOUPLING_EXPORT ~MEDCouplingMesh() override = default;
+ MEDCOUPLING_EXPORT virtual ~MEDCouplingMesh() { }
private:
std::string _name;
std::string _description;
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingMultiFields.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
+#include "MCAuto.hxx"
-#include <cstddef>
-#include <iterator>
#include <sstream>
#include <algorithm>
-#include <string>
-#include <vector>
using namespace MEDCoupling;
return new MEDCouplingMultiFields(*this);
}
-bool MEDCouplingMultiFields::isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const
+bool MEDCouplingMultiFields::isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const
{
- std::size_t const sz=_fs.size();
+ std::size_t sz=_fs.size();
if(sz!=other->_fs.size())
return false;
for(std::size_t i=0;i<sz;i++)
const MEDCouplingFieldDouble *f2=other->_fs[i];
if(f1!=f2)
{
- if(f1==nullptr || f2==nullptr)
+ if(f1==0 || f2==0)
return false;
if(!_fs[i]->isEqual(other->_fs[i],meshPrec,valsPrec))
return false;
}
}
std::vector<int> refs1,refs2;
- std::vector<MEDCouplingMesh *> const ms1=getDifferentMeshes(refs1);
- std::vector<MEDCouplingMesh *> const ms2=other->getDifferentMeshes(refs2);
+ std::vector<MEDCouplingMesh *> ms1=getDifferentMeshes(refs1);
+ std::vector<MEDCouplingMesh *> ms2=other->getDifferentMeshes(refs2);
if(ms1.size()!=ms2.size())
return false;
if(refs1!=refs2)
return false;
std::vector< std::vector<int> > refs3,refs4;
- std::vector<DataArrayDouble *> const das1=getDifferentArrays(refs3);
- std::vector<DataArrayDouble *> const das2=getDifferentArrays(refs4);
+ std::vector<DataArrayDouble *> das1=getDifferentArrays(refs3);
+ std::vector<DataArrayDouble *> das2=getDifferentArrays(refs4);
if(das1.size()!=das2.size())
return false;
if(refs3!=refs4)
std::string MEDCouplingMultiFields::getName() const
{
- auto it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
return (*it)->getName();
std::string MEDCouplingMultiFields::getDescription() const
{
- auto it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
return (*it)->getDescription();
std::string MEDCouplingMultiFields::getTimeUnit() const
{
- auto it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
return (*it)->getTimeUnit();
double MEDCouplingMultiFields::getTimeResolution() const
{
- auto it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
return (*it)->getTimeTolerance();
return simpleRepr();
}
-bool MEDCouplingMultiFields::isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const
+bool MEDCouplingMultiFields::isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const
{
- std::size_t const sz=_fs.size();
+ std::size_t sz=_fs.size();
if(sz!=other->_fs.size())
return false;
for(std::size_t i=0;i<sz;i++)
void MEDCouplingMultiFields::updateTime() const
{
- auto it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
(*it)->updateTime();
std::vector<const BigMemoryObject *> MEDCouplingMultiFields::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _f : _fs)
- ret.push_back((const MEDCouplingFieldDouble *)_f);
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
+ ret.push_back((const MEDCouplingFieldDouble *)*it);
return ret;
}
std::vector<MEDCouplingMesh *> MEDCouplingMultiFields::getMeshes() const
{
std::vector<MEDCouplingMesh *> ms;
- for(const auto & _f : _fs)
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
{
- const MEDCouplingMesh *m=nullptr;
- if((const MEDCouplingFieldDouble *)_f)
- m=_f->getMesh();
+ const MEDCouplingMesh *m=0;
+ if((const MEDCouplingFieldDouble *)(*it))
+ m=(*it)->getMesh();
ms.push_back(const_cast<MEDCouplingMesh *>(m));
}
return ms;
refs.resize(_fs.size());
std::vector<MEDCouplingMesh *> ms;
int id=0;
- for(auto it=_fs.begin();it!=_fs.end();it++,id++)
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++)
{
- const MEDCouplingMesh *m=nullptr;
+ const MEDCouplingMesh *m=0;
if((const MEDCouplingFieldDouble *)(*it))
m=(*it)->getMesh();
if(m)
{
- auto const it2=std::find(ms.begin(),ms.end(),m);
+ std::vector<MEDCouplingMesh *>::iterator it2=std::find(ms.begin(),ms.end(),m);
if(it2==ms.end())
{
ms.push_back(const_cast<MEDCouplingMesh *>(m));
std::vector<DataArrayDouble *> MEDCouplingMultiFields::getArrays() const
{
std::vector<DataArrayDouble *> tmp;
- for(const auto & _f : _fs)
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
{
- std::vector<DataArrayDouble *> tmp2=_f->getArrays();
+ std::vector<DataArrayDouble *> tmp2=(*it)->getArrays();
tmp.insert(tmp.end(),tmp2.begin(),tmp2.end());
}
return tmp;
refs.resize(_fs.size());
int id=0;
std::vector<DataArrayDouble *> ret;
- for(auto it=_fs.begin();it!=_fs.end();it++,id++)
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++)
{
std::vector<DataArrayDouble *> tmp2;
if((const MEDCouplingFieldDouble *)(*it))
{
if(*it2)
{
- auto const it3=std::find(ret.begin(),ret.end(),*it2);
+ std::vector<DataArrayDouble *>::iterator it3=std::find(ret.begin(),ret.end(),*it2);
if(it3==ret.end())
{
ret.push_back(*it2);
void MEDCouplingMultiFields::checkConsistencyLight() const
{
- auto it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
{
- if((const MEDCouplingFieldDouble *)(*it)==nullptr)
+ if((const MEDCouplingFieldDouble *)(*it)==0)
throw INTERP_KERNEL::Exception("MEDCouplingMultiFields::checkConsistencyLight : There is an empty Field in array...");
(*it)->checkConsistencyLight();
}
MEDCouplingMultiFields::MEDCouplingMultiFields(const std::vector<MEDCouplingFieldDouble *>& fs):_fs(fs.size())
{
int id=0;
- for(auto it=fs.begin();it!=fs.end();it++,id++)
+ for(std::vector< MEDCouplingFieldDouble * >::const_iterator it=fs.begin();it!=fs.end();it++,id++)
{
if(*it)
(*it)->incrRef();
*/
MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& other):RefCountObject(other)
{
- std::size_t const sz=other._fs.size();
+ std::size_t sz=other._fs.size();
_fs.resize(sz);
std::vector<int> refs;
std::vector< std::vector<int> > refs2;
std::vector<MEDCouplingMesh *> ms=other.getDifferentMeshes(refs);
- std::size_t const msLgh=ms.size();
+ std::size_t msLgh=ms.size();
std::vector< MCAuto<MEDCouplingMesh> > ms2(msLgh);
for(std::size_t i=0;i<msLgh;i++)
ms2[i]=ms[i]->deepCopy();
std::vector<DataArrayDouble *> das=other.getDifferentArrays(refs2);
- std::size_t const dasLgth=das.size();
+ std::size_t dasLgth=das.size();
std::vector< MCAuto<DataArrayDouble> > das2(dasLgth);
for(std::size_t i=0;i<dasLgth;i++)
das2[i]=das[i]->deepCopy();
tmp->decrRef();
if(refs[i]!=-1)
_fs[i]->setMesh(ms2[refs[i]]);
- std::size_t const nbOfArr=refs2[i].size();
+ std::size_t nbOfArr=refs2[i].size();
std::vector<DataArrayDouble *> tmp2(nbOfArr);
for(std::size_t j=0;j<nbOfArr;j++)
{
if(refs2[i][j]!=-1)
tmp2[j]=das2[refs2[i][j]];
else
- tmp2[j]=nullptr;
+ tmp2[j]=0;
}
_fs[i]->setArrays(tmp2);
std::vector<mcIdType> tinyInfo;
}
MEDCouplingMultiFields::MEDCouplingMultiFields()
-= default;
+{
+}
void MEDCouplingMultiFields::getTinySerializationInformation(std::vector<mcIdType>& tinyInfo, std::vector<double>& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const
{
std::vector<int> refs;
- std::vector<MEDCouplingMesh *> const ms=getDifferentMeshes(refs);
+ std::vector<MEDCouplingMesh *> ms=getDifferentMeshes(refs);
nbOfDiffMeshes=(int)ms.size();
std::vector< std::vector<int> > refs2;
- std::vector<DataArrayDouble *> const fs=getDifferentArrays(refs2);
+ std::vector<DataArrayDouble *> fs=getDifferentArrays(refs2);
nbOfDiffArr=(int)fs.size();
//
- mcIdType const sz=ToIdType(refs.size());//==_fs.size()
+ mcIdType sz=ToIdType(refs.size());//==_fs.size()
mcIdType sz2=0;
for(mcIdType i=0;i<sz;i++)
sz2+=ToIdType(refs2[i].size());
//
tinyInfo2.clear();
- std::vector<int> const doubleDaInd(sz);
+ std::vector<int> doubleDaInd(sz);
std::vector<int> timeDiscrInt;
tinyInfo.resize(sz2+5*sz+3);
tinyInfo[0]=sz;
tinyInfo2.insert(tinyInfo2.end(),tmp.begin(),tmp.end());
timeDiscrInt.insert(timeDiscrInt.end(),tmp2.begin(),tmp2.end());
}
- mcIdType const sz3=ToIdType(timeDiscrInt.size());
+ mcIdType sz3=ToIdType(timeDiscrInt.size());
tinyInfo[2]=sz3;
//
for(mcIdType i=0;i<sz;i++)
const std::vector<MEDCouplingFieldTemplate *>& ft, const std::vector<MEDCouplingMesh *>& ms,
const std::vector<DataArrayDouble *>& das)
{
- mcIdType const sz=tinyInfoI[0];
+ mcIdType sz=tinyInfoI[0];
_fs.resize(sz);
- mcIdType const sz2=tinyInfoI[1];
+ mcIdType sz2=tinyInfoI[1];
// dealing with ft with no mesh set.
for(mcIdType i=0;i<sz;i++)
{
- mcIdType const meshId=tinyInfoI[3+i];
+ mcIdType meshId=tinyInfoI[3+i];
if(meshId!=-1)
ft[i]->setMesh(ms[meshId]);
}
for(mcIdType i=0;i<sz;i++)
{
_fs[i]=MEDCouplingFieldDouble::New(*ft[i],(TypeOfTimeDiscretization)tinyInfoI[2*sz+3+i]);
- mcIdType const sz3=tinyInfoI[sz+i+3];
+ mcIdType sz3=tinyInfoI[sz+i+3];
std::vector<DataArrayDouble *> tmp(sz3);
for(mcIdType j=0;j<sz3;j++,k++)
{
- mcIdType const daId=tinyInfoI[5*sz+k+3];
+ mcIdType daId=tinyInfoI[5*sz+k+3];
if(daId!=-1)
tmp[j]=das[daId];
else
- tmp[j]=nullptr;
+ tmp[j]=0;
}
_fs[i]->setArrays(tmp);
// time discr tiny info
- mcIdType const lgthI=tinyInfoI[4*sz+3+i];
- mcIdType const lgthD=tinyInfoI[3*sz+3+i];
+ mcIdType lgthI=tinyInfoI[4*sz+3+i];
+ mcIdType lgthD=tinyInfoI[3*sz+3+i];
//
- std::vector<mcIdType> const tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI);
- std::vector<double> const tdInfoD(tinyInfoD.begin()+offD,tinyInfoD.begin()+offD+lgthD);
+ std::vector<mcIdType> tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI);
+ std::vector<double> tdInfoD(tinyInfoD.begin()+offD,tinyInfoD.begin()+offD+lgthD);
_fs[i]->getTimeDiscretizationUnderGround()->finishUnserialization2(tdInfoI,tdInfoD);
//
offI+=lgthI;
#ifndef __PARAMEDMEM_MEDCOUPLINGMULTIFIELDS_HXX__
#define __PARAMEDMEM_MEDCOUPLINGMULTIFIELDS_HXX__
-#include "MEDCoupling.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingTimeLabel.hxx"
#include "MCAuto.hxx"
#include "MCType.hxx"
+#include "InterpKernelException.hxx"
-#include <string>
-#include <cstddef>
#include <vector>
namespace MEDCoupling
MEDCOUPLING_EXPORT virtual std::vector<MEDCouplingMesh *> getDifferentMeshes(std::vector<int>& refs) const;
MEDCOUPLING_EXPORT virtual std::vector<DataArrayDouble *> getArrays() const;
MEDCOUPLING_EXPORT virtual std::vector<DataArrayDouble *> getDifferentArrays(std::vector< std::vector<int> >& refs) const;
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<mcIdType>& tinyInfo, std::vector<double>& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const;
MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD,
const std::vector<MEDCouplingFieldTemplate *>& ft, const std::vector<MEDCouplingMesh *>& ms,
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingNatureOfField.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "InterpKernelException.hxx"
#include <algorithm>
-#include <cstddef>
-#include <iterator>
#include <sstream>
-#include <string>
namespace MEDCoupling
{
oss << GetAllPossibilitiesStr() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::size_t const pos2=std::distance(POS_OF_NATUREOFFIELD,pos);
+ std::size_t pos2=std::distance(POS_OF_NATUREOFFIELD,pos);
return REPR_OF_NATUREOFFIELD[pos2];
}
const int *pos=std::find(POS_OF_NATUREOFFIELD,POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES,(int)nat);
if(pos==POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES)
return std::string("Unrecognized nature of field !");
- std::size_t const pos2=std::distance(POS_OF_NATUREOFFIELD,pos);
+ std::size_t pos2=std::distance(POS_OF_NATUREOFFIELD,pos);
return std::string(REPR_OF_NATUREOFFIELD[pos2]);
}
#include "MEDCoupling.hxx"
#include "MEDCouplingNatureOfFieldEnum"
-#include <string>
+#include "InterpKernelException.hxx"
namespace MEDCoupling
{
#ifndef __PARAMEDMEM_MEDCOUPLINGNORMALIZEDCARTESIANMESH_HXX__
#define __PARAMEDMEM_MEDCOUPLINGNORMALIZEDCARTESIANMESH_HXX__
-#include "MCIdType.hxx"
#include "NormalizedUnstructuredMesh.hxx"
namespace MEDCoupling
public:
static const int MY_SPACEDIM=SPACEDIM;
static const int MY_MESHDIM=SPACEDIM;
- using MyConnType = int;
+ typedef mcIdType MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
public:
MEDCouplingNormalizedCartesianMesh(const MEDCoupling::MEDCouplingCMesh *mesh);
// Author : Edward AGAPOV (eap)
//
-#include "MCIdType.hxx"
#include "MEDCouplingNormalizedCartesianMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingMemArray.hxx"
template<int SPACEDIM>
MEDCouplingNormalizedCartesianMesh<SPACEDIM>::MEDCouplingNormalizedCartesianMesh(const MEDCoupling::MEDCouplingCMesh *mesh):_mesh(mesh)
#ifndef __PARAMEDMEM_MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_HXX__
#define __PARAMEDMEM_MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_HXX__
-#include "MCIdType.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include "NormalizedGeometricTypes"
+#include "MCType.hxx"
namespace MEDCoupling
{
#define __MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_TXX__
#include "MEDCouplingNormalizedUnstructuredMesh.hxx"
-
-#include "MCIdType.hxx"
#include "InterpKernelAssert.hxx"
+
#include "MEDCouplingUMesh.hxx"
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "NormalizedGeometricTypes"
-#include <algorithm>
#include <limits>
template<int SPACEDIM,int MESHDIM>
{
delete [] _conn_for_interp;
delete [] _conn_index_for_interp;
- _conn_for_interp=nullptr;
- _conn_index_for_interp=nullptr;
+ _conn_for_interp=0;
+ _conn_index_for_interp=0;
}
template<int SPACEDIM,int MESHDIM>
void MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::prepare()
{
IKAssert(_mesh->getSpaceDimension()==SPACEDIM);
- const auto *m1(dynamic_cast<const MEDCoupling::MEDCouplingUMesh *>(_mesh));
+ const MEDCoupling::MEDCouplingUMesh *m1(dynamic_cast<const MEDCoupling::MEDCouplingUMesh *>(_mesh));
if(m1)
{
- mcIdType const nbOfCell=ToIdType(m1->getNumberOfCells());
- mcIdType const initialConnSize=ToIdType(m1->getNodalConnectivity()->getNbOfElems());
+ mcIdType nbOfCell=ToIdType(m1->getNumberOfCells());
+ mcIdType initialConnSize=ToIdType(m1->getNodalConnectivity()->getNbOfElems());
_conn_for_interp=new mcIdType[initialConnSize-nbOfCell];
_conn_index_for_interp=new mcIdType[nbOfCell+1];
_conn_index_for_interp[0]=0;
mcIdType *work_conn_index_for_interp=_conn_index_for_interp;
for(mcIdType i=0;i<nbOfCell;i++)
{
- mcIdType const nbOfValsToCopy=work_conn_index[1]-work_conn_index[0]-1;
+ mcIdType nbOfValsToCopy=work_conn_index[1]-work_conn_index[0]-1;
work_conn_for_interp=std::copy(work_conn,work_conn+nbOfValsToCopy,work_conn_for_interp);
work_conn_index_for_interp[1]=work_conn_index_for_interp[0]+nbOfValsToCopy;
work_conn_index++;
}
return ;
}
- const auto *m2(dynamic_cast<const MEDCoupling::MEDCoupling1DGTUMesh *>(_mesh));
+ const MEDCoupling::MEDCoupling1DGTUMesh *m2(dynamic_cast<const MEDCoupling::MEDCoupling1DGTUMesh *>(_mesh));
if(m2)
{
- mcIdType const nbOfCell=ToIdType(m2->getNumberOfCells());
+ mcIdType nbOfCell=ToIdType(m2->getNumberOfCells());
_conn_index_for_interp=new mcIdType[nbOfCell+1];
const mcIdType *conni(m2->getNodalConnectivityIndex()->begin());
std::copy(conni,conni+nbOfCell+1,_conn_index_for_interp);
std::copy(m2->getNodalConnectivity()->begin(),m2->getNodalConnectivity()->end(),_conn_for_interp);
return ;
}
- const auto *m3(dynamic_cast<const MEDCoupling::MEDCoupling1SGTUMesh *>(_mesh));
+ const MEDCoupling::MEDCoupling1SGTUMesh *m3(dynamic_cast<const MEDCoupling::MEDCoupling1SGTUMesh *>(_mesh));
if(m3)
{
mcIdType nbOfCell=ToIdType(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell());
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingPartDefinition.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMemArray.hxx"
-
-#include <algorithm>
-#include <cstddef>
+
#include <functional>
#include <sstream>
-#include <vector>
-#include <string>
using namespace MEDCoupling;
}
PartDefinition::~PartDefinition()
-= default;
+{
+}
DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayIdType *listOfIds)
{
what="DataArrayPartDefinition::isEqual : other is null, this is not null !";
return false;
}
- const auto *otherC(dynamic_cast<const DataArrayPartDefinition *>(other));
+ const DataArrayPartDefinition *otherC(dynamic_cast<const DataArrayPartDefinition *>(other));
if(!otherC)
{
what="DataArrayPartDefinition::isEqual : other is not DataArrayPartDefinition !";
return false;
}
std::string what1;
- bool const ret(arr0->isEqualIfNotWhy(*arr1,what1));
+ bool ret(arr0->isEqualIfNotWhy(*arr1,what1));
if(!ret)
{
what=std::string("DataArrayPartDefinition::isEqual : arrays are not equal :\n")+what1;
const PartDefinition *otherPt(&other);
if(!otherPt)
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::operator+ : NULL input !");
- const auto *other1(dynamic_cast<const DataArrayPartDefinition *>(otherPt));
+ const DataArrayPartDefinition *other1(dynamic_cast<const DataArrayPartDefinition *>(otherPt));
if(other1)
return add1(other1);
- const auto *other2(dynamic_cast<const SlicePartDefinition *>(otherPt));
+ const SlicePartDefinition *other2(dynamic_cast<const SlicePartDefinition *>(otherPt));
if(other2)
return add2(other2);
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::operator+ : unrecognized type in input !");
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::composeWith : input PartDef must be not NULL !");
checkConsistencyLight();
other->checkConsistencyLight();
- const auto *spd(dynamic_cast<const SlicePartDefinition *>(other));
+ const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(other));
if(spd)
{//special case for optim
mcIdType a(0),b(0),c(0);
}
}
-void DataArrayPartDefinition::serialize(std::vector<mcIdType>& /*tinyInt*/, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const
+void DataArrayPartDefinition::serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const
{
bigArraysI.push_back(_arr);
}
{
checkInternalArrayOK();
const DataArrayIdType *arr(_arr);
- auto *arr2(const_cast<DataArrayIdType *>(arr));
+ DataArrayIdType *arr2(const_cast<DataArrayIdType *>(arr));
arr2->incrRef();
return arr2;
}
}
DataArrayPartDefinition::~DataArrayPartDefinition()
-= default;
+{
+}
SlicePartDefinition *SlicePartDefinition::New(mcIdType start, mcIdType stop, mcIdType step)
{
what="SlicePartDefinition::isEqual : other is null, this is not null !";
return false;
}
- const auto *otherC(dynamic_cast<const SlicePartDefinition *>(other));
+ const SlicePartDefinition *otherC(dynamic_cast<const SlicePartDefinition *>(other));
if(!otherC)
{
what="SlicePartDefinition::isEqual : other is not SlicePartDefinition !";
return false;
}
- bool const ret((_start==otherC->_start) && (_stop==otherC->_stop) && (_step==otherC->_step));
+ bool ret((_start==otherC->_start) && (_stop==otherC->_stop) && (_step==otherC->_step));
if(!ret)
{
what="SlicePartDefinition::isEqual : values are not the same !";
const PartDefinition *otherPt(&other);
if(!otherPt)
throw INTERP_KERNEL::Exception("DataArrayPartDefinition::operator+ : NULL input !");
- const auto *other1(dynamic_cast<const DataArrayPartDefinition *>(otherPt));
+ const DataArrayPartDefinition *other1(dynamic_cast<const DataArrayPartDefinition *>(otherPt));
if(other1)
return add1(other1);
- const auto *other2(dynamic_cast<const SlicePartDefinition *>(otherPt));
+ const SlicePartDefinition *other2(dynamic_cast<const SlicePartDefinition *>(otherPt));
if(other2)
return add2(other2);
throw INTERP_KERNEL::Exception("SlicePartDefinition::operator+ : unrecognized type in input !");
return ret;
}
-void SlicePartDefinition::serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& /*bigArraysI*/) const
+void SlicePartDefinition::serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const
{
tinyInt.push_back(_start);
tinyInt.push_back(_stop);
mcIdType SlicePartDefinition::getEffectiveStop() const
{
- mcIdType const nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop"));
+ mcIdType nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop"));
return _start+nbElems*_step;
}
}
SlicePartDefinition::~SlicePartDefinition()
-= default;
+{
+}
#pragma once
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTimeLabel.hxx"
-#include <vector>
-#include <string>
-#include <cstddef>
namespace MEDCoupling
{
MEDCOUPLING_EXPORT virtual PartDefinition *tryToSimplify() const = 0;
MEDCOUPLING_EXPORT virtual void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const = 0;
protected:
- ~PartDefinition() override;
+ virtual ~PartDefinition();
};
class SlicePartDefinition;
public:
MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayIdType *listOfIds);
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("DataArrayPartDefinition"); }
- MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const override;
- MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCopy() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const override;
- MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const override;
- MEDCOUPLING_EXPORT std::string getRepr() const override;
- MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const override;
- MEDCOUPLING_EXPORT void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const override;
+ MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const;
+ MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCopy() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const;
+ MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const;
+ MEDCOUPLING_EXPORT std::string getRepr() const;
+ MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const;
+ MEDCOUPLING_EXPORT void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
private:
DataArrayPartDefinition(DataArrayIdType *listOfIds);
void checkInternalArrayOK() const;
static void CheckInternalArrayOK(const DataArrayIdType *listOfIds);
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
DataArrayPartDefinition *add1(const DataArrayPartDefinition *other) const;
DataArrayPartDefinition *add2(const SlicePartDefinition *other) const;
- ~DataArrayPartDefinition() override;
+ virtual ~DataArrayPartDefinition();
private:
MCAuto<DataArrayIdType> _arr;
};
public:
MEDCOUPLING_EXPORT static SlicePartDefinition *New(mcIdType start, mcIdType stop, mcIdType step);
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("SlicePartDefinition"); }
- MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const override;
- MEDCOUPLING_EXPORT SlicePartDefinition *deepCopy() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const override;
- MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const override;
- MEDCOUPLING_EXPORT std::string getRepr() const override;
- MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const override;
- MEDCOUPLING_EXPORT void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const override;
+ MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const;
+ MEDCOUPLING_EXPORT SlicePartDefinition *deepCopy() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const;
+ MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const;
+ MEDCOUPLING_EXPORT std::string getRepr() const;
+ MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const;
+ MEDCOUPLING_EXPORT void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
//specific method
MEDCOUPLING_EXPORT mcIdType getEffectiveStop() const;
MEDCOUPLING_EXPORT void getSlice(mcIdType& start, mcIdType& stop, mcIdType& step) const;
private:
SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step);
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
DataArrayPartDefinition *add1(const DataArrayPartDefinition *other) const;
PartDefinition *add2(const SlicePartDefinition *other) const;
- ~SlicePartDefinition() override;
+ virtual ~SlicePartDefinition();
private:
mcIdType _start;
mcIdType _stop;
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingPointSet.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MEDCoupling1GTUMesh.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
#include "PlanarIntersector.txx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
#include "InterpKernelGeo2DNode.hxx"
#include "DirectedBoundingBox.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include <algorithm>
#include <cmath>
-#include <cstddef>
-#include <functional>
-#include <iterator>
#include <limits>
+#include <numeric>
#include <sstream>
-#include <vector>
-#include <string>
using namespace MEDCoupling;
-MEDCouplingPointSet::MEDCouplingPointSet():_coords(nullptr)
+MEDCouplingPointSet::MEDCouplingPointSet():_coords(0)
{
}
-MEDCouplingPointSet::MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy):MEDCouplingMesh(other),_coords(nullptr)
+MEDCouplingPointSet::MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy):MEDCouplingMesh(other),_coords(0)
{
if(other._coords)
_coords=other._coords->performCopyOrIncrRef(deepCpy);
void MEDCouplingPointSet::copyTinyStringsFrom(const MEDCouplingMesh *other)
{
MEDCouplingMesh::copyTinyStringsFrom(other);
- const auto *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
+ const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::copyTinyStringsFrom : meshes have not same type !");
if(_coords && otherC->_coords)
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::isEqualIfNotWhy : null mesh instance in input !");
- const auto *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
+ const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
if(!otherC)
{
reason="mesh given in input is not castable in MEDCouplingPointSet !";
*/
bool MEDCouplingPointSet::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
+ const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
if(!otherC)
return false;
if(!areCoordsEqualWithoutConsideringStr(*otherC,prec))
bool MEDCouplingPointSet::areCoordsEqualIfNotWhy(const MEDCouplingPointSet& other, double prec, std::string& reason) const
{
- if(_coords==nullptr && other._coords==nullptr)
+ if(_coords==0 && other._coords==0)
return true;
- if(_coords==nullptr || other._coords==nullptr)
+ if(_coords==0 || other._coords==0)
{
reason="Only one PointSet between the two this and other has coordinate defined !";
return false;
}
if(_coords==other._coords)
return true;
- bool const ret=_coords->isEqualIfNotWhy(*other._coords,prec,reason);
+ bool ret=_coords->isEqualIfNotWhy(*other._coords,prec,reason);
if(!ret)
reason.insert(0,"Coordinates DataArray do not match : ");
return ret;
*/
bool MEDCouplingPointSet::areCoordsEqualWithoutConsideringStr(const MEDCouplingPointSet& other, double prec) const
{
- if(_coords==nullptr && other._coords==nullptr)
+ if(_coords==0 && other._coords==0)
return true;
- if(_coords==nullptr || other._coords==nullptr)
+ if(_coords==0 || other._coords==0)
return false;
if(_coords==other._coords)
return true;
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCoordinatesOfNode : no coordinates array set !");
- mcIdType const nbNodes=getNumberOfNodes();
+ mcIdType nbNodes=getNumberOfNodes();
if(nodeId>=0 && nodeId<nbNodes)
{
const double *cooPtr=_coords->getConstPointer();
- std::size_t const spaceDim=getSpaceDimension();
+ std::size_t spaceDim=getSpaceDimension();
coo.insert(coo.end(),cooPtr+spaceDim*nodeId,cooPtr+spaceDim*(nodeId+1));
}
else
{
DataArrayIdType *comm,*commI;
findCommonNodes(precision,limitNodeId,comm,commI);
- mcIdType const oldNbOfNodes=getNumberOfNodes();
+ mcIdType oldNbOfNodes=getNumberOfNodes();
MCAuto<DataArrayIdType> ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes);
areNodesMerged=(oldNbOfNodes!=newNbOfNodes);
comm->decrRef();
*/
DataArrayIdType *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double eps) const
{
- DataArrayIdType *c=nullptr,*cI=nullptr;
+ DataArrayIdType *c=0,*cI=0;
getNodeIdsNearPoints(pos,1,eps,c,cI);
- MCAuto<DataArrayIdType> const cITmp(cI);
+ MCAuto<DataArrayIdType> cITmp(cI);
return c;
}
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getNodeIdsNearPoint : no coordiantes set !");
- std::size_t const spaceDim=getSpaceDimension();
+ std::size_t spaceDim=getSpaceDimension();
MCAuto<DataArrayDouble> points=DataArrayDouble::New();
points->useArray(pos,false,DeallocType::CPP_DEALLOC,nbOfPoints,spaceDim);
_coords->computeTupleIdsNearTuples(points,eps,c,cI);
{
DataArrayDouble *newCoords=DataArrayDouble::New();
std::vector<mcIdType> div(newNbOfNodes);
- std::size_t const spaceDim=getSpaceDimension();
+ std::size_t spaceDim=getSpaceDimension();
newCoords->alloc(newNbOfNodes,spaceDim);
newCoords->copyStringInfoFrom(*_coords);
newCoords->fillWithZero();
- mcIdType const oldNbOfNodes=getNumberOfNodes();
+ mcIdType oldNbOfNodes=getNumberOfNodes();
double *ptToFill=newCoords->getPointer();
const double *oldCoordsPtr=_coords->getConstPointer();
for(mcIdType i=0;i<oldNbOfNodes;i++)
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCaracteristicDimension : Coordinates not set !");
const double *coords=_coords->getConstPointer();
- std::size_t const nbOfValues=_coords->getNbOfElems();
+ std::size_t nbOfValues=_coords->getNbOfElems();
return std::abs(*std::max_element(coords,coords+nbOfValues,MEDCouplingCompAbs()));
}
*/
void MEDCouplingPointSet::rotate(const double *center, const double *vector, double angle)
{
- std::size_t const spaceDim=getSpaceDimension();
+ std::size_t spaceDim=getSpaceDimension();
if(spaceDim==3)
rotate3D(center,vector,angle);
else if(spaceDim==2)
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::translate : no coordinates set !");
double *coords=_coords->getPointer();
- mcIdType const nbNodes=getNumberOfNodes();
- std::size_t const dim=getSpaceDimension();
+ mcIdType nbNodes=getNumberOfNodes();
+ std::size_t dim=getSpaceDimension();
for(mcIdType i=0; i<nbNodes; i++)
for(std::size_t idim=0; idim<dim;idim++)
coords[i*dim+idim]+=vector[idim];
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::scale : no coordinates set !");
double *coords=_coords->getPointer();
- mcIdType const nbNodes=getNumberOfNodes();
- std::size_t const dim=getSpaceDimension();
+ mcIdType nbNodes=getNumberOfNodes();
+ std::size_t dim=getSpaceDimension();
for(mcIdType i=0;i<nbNodes;i++)
{
std::transform(coords+i*dim,coords+(i+1)*dim,point,coords+i*dim,std::minus<double>());
*/
void MEDCouplingPointSet::changeSpaceDimension(int newSpaceDim, double dftValue)
{
- if(getCoords()==nullptr)
+ if(getCoords()==0)
throw INTERP_KERNEL::Exception("changeSpaceDimension must be called on an MEDCouplingPointSet instance with coordinates set !");
if(newSpaceDim<1)
throw INTERP_KERNEL::Exception("changeSpaceDimension must be called a newSpaceDim >=1 !");
- int const oldSpaceDim=getSpaceDimension();
+ int oldSpaceDim=getSpaceDimension();
if(newSpaceDim==oldSpaceDim)
return ;
DataArrayDouble *newCoords=getCoords()->changeNbOfComponents(newSpaceDim,dftValue);
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : NULL point pointer specified !");
if(!vec)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : NULL vector pointer specified !");
- mcIdType const nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfNodes=getNumberOfNodes();
double a=vec[0],b=vec[1],c=vec[2],d=-pt[0]*vec[0]-pt[1]*vec[1]-pt[2]*vec[2];
- double const deno=sqrt(a*a+b*b+c*c);
+ double deno=sqrt(a*a+b*b+c*c);
if(deno<std::numeric_limits<double>::min())
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : vector pointer specified has norm equal to 0. !");
const double *work=_coords->getConstPointer();
*/
void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector<mcIdType>& nodes) const
{
- std::size_t const spaceDim=getSpaceDimension();
+ std::size_t spaceDim=getSpaceDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : Invalid spacedim to be applied on this ! Must be equal to 2 or 3 !");
if(!pt)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : NULL point pointer specified !");
if(!vec)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : NULL vector pointer specified !");
- mcIdType const nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfNodes=getNumberOfNodes();
double den=0.;
for(std::size_t i=0;i<spaceDim;i++)
den+=vec[i]*vec[i];
- double const deno=sqrt(den);
+ double deno=sqrt(den);
if(deno<10.*eps)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : Invalid given direction vector ! Norm is too small !");
INTERP_KERNEL::AutoPtr<double> vecn=new double[spaceDim];
{
for(mcIdType i=0;i<nbOfNodes;i++)
{
- double const a=vecn[0]*(work[1]-pt[1])-vecn[1]*(work[0]-pt[0]);
- double const b=vecn[1]*(work[2]-pt[2])-vecn[2]*(work[1]-pt[1]);
- double const c=vecn[2]*(work[0]-pt[0])-vecn[0]*(work[2]-pt[2]);
+ double a=vecn[0]*(work[1]-pt[1])-vecn[1]*(work[0]-pt[0]);
+ double b=vecn[1]*(work[2]-pt[2])-vecn[2]*(work[1]-pt[1]);
+ double c=vecn[2]*(work[0]-pt[0])-vecn[0]*(work[2]-pt[2]);
if(std::sqrt(a*a+b*b+c*c)<eps)
nodes.push_back(i);
work+=3;
*/
DataArrayDouble *MEDCouplingPointSet::MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2)
{
- int const spaceDim=m1->getSpaceDimension();
+ int spaceDim=m1->getSpaceDimension();
if(spaceDim!=m2->getSpaceDimension())
throw INTERP_KERNEL::Exception("Mismatch in SpaceDim during call of MergeNodesArray !");
return DataArrayDouble::Aggregate(m1->getCoords(),m2->getCoords());
{
if(ms.empty())
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::MergeNodesArray : input array must be NON EMPTY !");
- auto it=ms.begin();
+ std::vector<const MEDCouplingPointSet *>::const_iterator it=ms.begin();
std::vector<const DataArrayDouble *> coo(ms.size());
- int const spaceDim=(*it)->getSpaceDimension();
+ int spaceDim=(*it)->getSpaceDimension();
coo[0]=(*it++)->getCoords();
if(!coo[0]->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::MergeNodesArray : first element in coordinates is not allocated !");
void MEDCouplingPointSet::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
{
int it,order;
- double const time=getTime(it,order);
+ double time=getTime(it,order);
if(_coords)
{
int spaceDim=getSpaceDimension();
/*!
* Third and final step of serialization process.
*/
-void MEDCouplingPointSet::serialize(DataArrayIdType *& /*a1*/, DataArrayDouble *&a2) const
+void MEDCouplingPointSet::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
{
if(_coords)
{
a2->incrRef();
}
else
- a2=nullptr;
+ a2=0;
}
/*!
* Second step of serialization process.
* @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
*/
-void MEDCouplingPointSet::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType * /*a1*/, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCouplingPointSet::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
{
* Second and final unserialization process.
* @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
*/
-void MEDCouplingPointSet::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType * /*a1*/, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
+void MEDCouplingPointSet::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
{
*/
bool MEDCouplingPointSet::intersectsBoundingBox(const double* bb1, const double* bb2, int dim, double eps)
{
- auto* bbtemp = new double[2*dim];
+ double* bbtemp = new double[2*dim];
double deltamax=0.0;
for (int i=0; i< dim; i++)
{
- double const delta = bb1[2*i+1]-bb1[2*i];
+ double delta = bb1[2*i+1]-bb1[2*i];
if ( delta > deltamax )
{
deltamax = delta ;
for (int idim=0; idim < dim; idim++)
{
- bool const intersects = (bbtemp[idim*2]<bb2[idim*2+1])
+ bool intersects = (bbtemp[idim*2]<bb2[idim*2+1])
&& (bb2[idim*2]<bbtemp[idim*2+1]) ;
if (!intersects)
{
*/
bool MEDCouplingPointSet::intersectsBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bb1, const double* bb2, int dim, double eps)
{
- auto* bbtemp(new double[2*dim]);
+ double* bbtemp(new double[2*dim]);
double deltamax(0.0);
for (int i=0; i< dim; i++)
{
- double const delta = bb2[2*i+1]-bb2[2*i];
+ double delta = bb2[2*i+1]-bb2[2*i];
if ( delta > deltamax )
{
deltamax = delta ;
bbtemp[i*2+1]=bb2[i*2+1]+deltamax*eps;
}
- bool const intersects(!bb1.isDisjointWith(bbtemp));
+ bool intersects(!bb1.isDisjointWith(bbtemp));
delete [] bbtemp;
return intersects;
}
void MEDCouplingPointSet::rotate3D(const double *center, const double *vect, double angle)
{
double *coords(_coords->getPointer());
- mcIdType const nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
DataArrayDouble::Rotate3DAlg(center,vect,angle,nbNodes,coords,coords);
}
*
* \sa MEDCouplingUMesh::buildPartOfMySelfSlice
*/
-MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& /*beginOut*/, mcIdType& /*endOut*/, mcIdType& /*stepOut*/, DataArrayIdType*& arr) const
+MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const
{
MCAuto<MEDCouplingPointSet> ret(buildPartOfMySelfSlice(beginCellIds,endCellIds,stepCellIds,true));
arr=ret->zipCoordsTraducer();
void MEDCouplingPointSet::rotate2D(const double *center, double angle)
{
double *coords(_coords->getPointer());
- mcIdType const nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
DataArrayDouble::Rotate2DAlg(center,angle,nbNodes,coords,coords);
}
public:
static const int MY_SPACEDIM=3;
static const int MY_MESHDIM=2;
- using MyConnType = mcIdType;
+ typedef mcIdType MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
};
void MEDCouplingPointSet::project2DCellOnXY(const mcIdType *startConn, const mcIdType *endConn, std::vector<double>& res) const
{
const double *coords(_coords->getConstPointer());
- std::size_t const spaceDim(getSpaceDimension());
+ std::size_t spaceDim(getSpaceDimension());
for(const mcIdType *it=startConn;it!=endConn;it++)
res.insert(res.end(),coords+spaceDim*(*it),coords+spaceDim*(*it+1));
if(spaceDim==2)
if(spaceDim==3)
{
std::vector<double> cpy(res);
- mcIdType const nbNodes=ToIdType(std::distance(startConn,endConn));
+ mcIdType nbNodes=ToIdType(std::distance(startConn,endConn));
INTERP_KERNEL::PlanarIntersector<DummyClsMCPS,mcIdType>::Projection(&res[0],&cpy[0],nbNodes,nbNodes,1.e-12,0./*max distance*/,-1./*min dot*/,0.,true);
res.resize(2*nbNodes);
for(mcIdType i=0;i<nbNodes;i++)
*/
bool MEDCouplingPointSet::isButterfly2DCell(const std::vector<double>& res, bool isQuad, double eps)
{
- INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps);
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
- std::size_t const nbOfNodes(res.size()/2);
+ std::size_t nbOfNodes(res.size()/2);
std::vector<INTERP_KERNEL::Node *> nodes(nbOfNodes);
for(std::size_t i=0;i<nbOfNodes;i++)
{
- auto *tmp=new INTERP_KERNEL::Node(res[2*i],res[2*i+1]);
+ INTERP_KERNEL::Node *tmp=new INTERP_KERNEL::Node(res[2*i],res[2*i+1]);
nodes[i]=tmp;
}
- INTERP_KERNEL::QuadraticPolygon *pol=nullptr;
+ INTERP_KERNEL::QuadraticPolygon *pol=0;
if(isQuad)
pol=INTERP_KERNEL::QuadraticPolygon::BuildArcCirclePolygon(nodes);
else
pol=INTERP_KERNEL::QuadraticPolygon::BuildLinearPolygon(nodes);
- bool const ret(pol->isButterflyAbs());
+ bool ret(pol->isButterflyAbs());
delete pol;
return ret;
}
std::vector<mcIdType> c1,c2;
getNodeIdsOfCell(cellId,c1);
other->getNodeIdsOfCell(cellId,c2);
- std::size_t const sz(c1.size());
+ std::size_t sz(c1.size());
if(sz!=c2.size())
return false;
for(std::size_t i=0;i<sz;i++)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute : No coords specified in other !");
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute : No coords specified in this whereas there is any in other !");
- mcIdType const otherNbOfNodes=other.getNumberOfNodes();
+ mcIdType otherNbOfNodes=other.getNumberOfNodes();
MCAuto<DataArrayDouble> newCoords=MergeNodesArray(&other,this);
_coords->incrRef();
MCAuto<DataArrayDouble> oldCoords=_coords;
setCoords(oldCoords);
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute fails : no nodes are mergeable with specified given epsilon !");
}
- mcIdType const maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+otherNbOfNodes);
+ mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+otherNbOfNodes);
const mcIdType *pt=std::find_if(da->getConstPointer()+otherNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind(std::greater<mcIdType>(),std::placeholders::_1,maxId));
if(pt!=da->getConstPointer()+da->getNbOfElems())
{
*/
MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const
{
- DataArrayIdType *cellIdsKept=nullptr;
+ DataArrayIdType *cellIdsKept=0;
fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
- MCAuto<DataArrayIdType> const cellIdsKept2(cellIdsKept);
+ MCAuto<DataArrayIdType> cellIdsKept2(cellIdsKept);
return buildPartOfMySelf(cellIdsKept->begin(),cellIdsKept->end(),true);
}
bool MEDCouplingPointSet::areAllNodesFetched() const
{
checkFullyDefined();
- mcIdType const nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
std::vector<bool> fetchedNodes(nbNodes,false);
computeNodeIdsAlg(fetchedNodes);
return std::find(fetchedNodes.begin(),fetchedNodes.end(),false)==fetchedNodes.end();
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : input is null !");
- const auto *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
+ const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : other is not a PointSet mesh !");
MCAuto<MEDCouplingPointSet> m=dynamic_cast<MEDCouplingPointSet *>(mergeMyselfWith(otherC));
bool areNodesMerged;
mcIdType newNbOfNodes;
- mcIdType const oldNbOfNodes=getNumberOfNodes();
+ mcIdType oldNbOfNodes=getNumberOfNodes();
MCAuto<DataArrayIdType> da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes);
//mergeNodes
if(!areNodesMerged && oldNbOfNodes != 0)
da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes);
//
da=m->zipConnectivityTraducer(cellCompPol);
- mcIdType const nbCells=ToIdType(getNumberOfCells());
+ mcIdType nbCells=ToIdType(getNumberOfCells());
if (nbCells != ToIdType(other->getNumberOfCells()))
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
- mcIdType const dan(da->getNumberOfTuples());
+ mcIdType dan(da->getNumberOfTuples());
if (dan)
{
MCAuto<DataArrayIdType> da1(DataArrayIdType::New()),da2(DataArrayIdType::New());
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
}
MCAuto<DataArrayIdType> cellCor2=da->selectByTupleIdSafeSlice(nbCells,ToIdType(da->getNbOfElems()),1);
- nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?nullptr:nodeCor2.retn();
- cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?nullptr:cellCor2.retn();
+ nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn();
+ cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
/*!
* \ref py_mcumesh_checkDeepEquivalWith "Here is a Python example".
* \endif
*/
-void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double /*prec*/,
+void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
DataArrayIdType *&cellCor) const
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith : input is null !");
- const auto *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
+ const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith : other is not a PointSet mesh !");
if(_coords!=otherC->_coords)
throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : meshes do not share the same coordinates ! Use tryToShareSameCoordinates or call checkDeepEquivalWith !");
MCAuto<MEDCouplingPointSet> m=mergeMyselfWithOnSameCoords(otherC);
MCAuto<DataArrayIdType> da=m->zipConnectivityTraducer(cellCompPol);
- mcIdType const maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells());
+ mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells());
const mcIdType *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind(std::greater<mcIdType>(),std::placeholders::_1,maxId));
if(pt!=da->getConstPointer()+da->getNbOfElems())
{
throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !");
}
MCAuto<DataArrayIdType> cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1);
- cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?nullptr:cellCor2.retn();
+ cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
{
MEDCouplingMesh::checkFastEquivalWith(other,prec);
//other not null checked by the line before
- const auto *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
+ const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkFastEquivalWith : fails because other is not a pointset mesh !");
- mcIdType const nbOfCells=ToIdType(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(nbOfCells<1)
return ;
bool status=true;
*/
DataArrayIdType *MEDCouplingPointSet::getCellIdsLyingOnNodes(const mcIdType *begin, const mcIdType *end, bool fullyIn) const
{
- DataArrayIdType *cellIdsKept=nullptr;
+ DataArrayIdType *cellIdsKept=0;
fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
cellIdsKept->setName(getName());
return cellIdsKept;
#ifndef __PARAMEDMEM_MEDCOUPLINGPOINTSET_HXX__
#define __PARAMEDMEM_MEDCOUPLINGPOINTSET_HXX__
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
#include "MEDCouplingMesh.hxx"
#include "InterpKernelHashMap.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include <cstddef>
-#include <string>
-#include <map>
#include <vector>
namespace INTERP_KERNEL
protected:
MEDCOUPLING_EXPORT MEDCouplingPointSet();
MEDCOUPLING_EXPORT MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy);
- MEDCOUPLING_EXPORT ~MEDCouplingPointSet() override;
+ MEDCOUPLING_EXPORT ~MEDCouplingPointSet();
public:
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const override;
- MEDCOUPLING_EXPORT int getSpaceDimension() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const;
+ MEDCOUPLING_EXPORT int getSpaceDimension() const;
MEDCOUPLING_EXPORT void setCoords(const DataArrayDouble *coords);
MEDCOUPLING_EXPORT const DataArrayDouble *getCoords() const { return _coords; }
MEDCOUPLING_EXPORT DataArrayDouble *getCoords() { return _coords; }
- MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override;
- MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override { return _coords; }
- MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override;
- MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const override;
+ MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
+ MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const { return _coords; }
+ MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override;
+ DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const;
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayIdType *&cellCor) const override;
+ DataArrayIdType *&cellCor) const;
MEDCOUPLING_EXPORT bool areCoordsEqualIfNotWhy(const MEDCouplingPointSet& other, double prec, std::string& reason) const;
MEDCOUPLING_EXPORT bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const;
MEDCOUPLING_EXPORT bool areCoordsEqualWithoutConsideringStr(const MEDCouplingPointSet& other, double prec) const;
MEDCOUPLING_EXPORT virtual DataArrayIdType *mergeNodesCenter(double precision, bool& areNodesMerged, mcIdType& newNbOfNodes);
MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const = 0;
MEDCOUPLING_EXPORT virtual void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const = 0;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const override;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const;
MEDCOUPLING_EXPORT DataArrayIdType *buildPermArrayForMergeNode(double precision, mcIdType limitNodeId, bool& areNodesMerged, mcIdType& newNbOfNodes) const;
MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsNearPoint(const double *pos, double eps) const;
MEDCOUPLING_EXPORT void getNodeIdsNearPoints(const double *pos, mcIdType nbOfPoints, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const;
MEDCOUPLING_EXPORT virtual void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const = 0;
MEDCOUPLING_EXPORT DataArrayIdType *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex,
mcIdType& newNbOfNodes) const;
- MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override;
+ MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const;
MEDCOUPLING_EXPORT void zipCoords();
MEDCOUPLING_EXPORT double getCaracteristicDimension() const;
MEDCOUPLING_EXPORT void recenterForMaxPrecision(double eps);
- MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override;
- MEDCOUPLING_EXPORT void translate(const double *vector) override;
- MEDCOUPLING_EXPORT void scale(const double *point, double factor) override;
+ MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle);
+ MEDCOUPLING_EXPORT void translate(const double *vector);
+ MEDCOUPLING_EXPORT void scale(const double *point, double factor);
MEDCOUPLING_EXPORT void changeSpaceDimension(int newSpaceDim, double dftVal=0.);
MEDCOUPLING_EXPORT void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon);
MEDCOUPLING_EXPORT void duplicateNodesInCoords(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd);
MEDCOUPLING_EXPORT static DataArrayDouble *MergeNodesArray(const std::vector<const MEDCouplingPointSet *>& ms);
MEDCOUPLING_EXPORT static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type);
MEDCOUPLING_EXPORT static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps);
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const override;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const;
MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsLyingOnNodes(const mcIdType *begin, const mcIdType *end, bool fullyIn) const;
MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelf(const mcIdType *start, const mcIdType *end, bool keepCoords=true) const;
MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords=true) const;
MEDCOUPLING_EXPORT virtual bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const = 0;
MEDCOUPLING_EXPORT virtual void invertOrientationOfAllCells() = 0;
MEDCOUPLING_EXPORT virtual void checkFullyDefined() const = 0;
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override;
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
- const std::vector<std::string>& littleStrings) override;
+ const std::vector<std::string>& littleStrings);
MEDCOUPLING_EXPORT virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const = 0;
MEDCOUPLING_EXPORT virtual DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const = 0;
MEDCOUPLING_EXPORT virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) = 0;
public:
MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, mcIdType cellId, double prec) const;
protected:
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT static bool intersectsBoundingBox(const double* bb1, const double* bb2, int dim, double eps);
MEDCOUPLING_EXPORT static bool intersectsBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bb1, const double* bb2, int dim, double eps);
MEDCOUPLING_EXPORT void rotate2D(const double *center, double angle);
#include "InterpKernelException.hxx"
-#include <cstddef>
-#include <set>
-#include <ostream>
-#include <ios>
-#include <map>
#include <sstream>
#include <algorithm>
-#include <string>
-#include <vector>
using namespace MEDCoupling;
-GlobalDict *GlobalDict::UNIQUE_INSTANCE=nullptr;
+GlobalDict *GlobalDict::UNIQUE_INSTANCE=0;
const char *MEDCoupling::MEDCouplingVersionStr()
{
void MEDCoupling::MEDCouplingVersionMajMinRel(int& maj, int& minor, int& releas)
{
- int const ver=MEDCOUPLING_VERSION;
+ int ver=MEDCOUPLING_VERSION;
maj=(ver & 0xFF0000) >> 16;
minor=(ver & 0xFF00) >> 8;
releas=(ver & 0xFF);
bool MEDCoupling::MEDCouplingByteOrder()
{
unsigned int x(1);
- auto *xc(reinterpret_cast<unsigned char *>(&x));
+ unsigned char *xc(reinterpret_cast<unsigned char *>(&x));
return xc[0]==1;
}
ret = it->getHeapMemorySizeWithoutChildren(); sum+=ret;
oss << it->getClassName() << " -> " << ret << std::endl;
s1.insert(it);
- std::vector<const BigMemoryObject *> const v2(it->getDirectChildren());
+ std::vector<const BigMemoryObject *> v2(it->getDirectChildren());
for(auto it2 : v2)
if(s1.find(it2)==s1.end())
s3.push_back(it2);
std::size_t BigMemoryObject::getHeapMemorySize() const
{
- std::size_t const ret(getHeapMemorySizeWithoutChildren());
+ std::size_t ret(getHeapMemorySizeWithoutChildren());
std::vector<const BigMemoryObject *> v(getDirectChildren());
std::set<const BigMemoryObject *> s1,s2(v.begin(),v.end());
return ret+GetHeapMemoryOfSet(s1,s2);
{
ret.insert(ret.end(),s1.begin(),s1.end());
std::vector<const BigMemoryObject *> s3;
- for(auto it0 : s1)
+ for(std::vector<const BigMemoryObject *>::const_iterator it0=s1.begin();it0!=s1.end();it0++)
{
std::vector<const BigMemoryObject *> s2;
- if(it0)
- s2=it0->getDirectChildren();
- for(auto it1 : s2)
+ if(*it0)
+ s2=(*it0)->getDirectChildren();
+ for(std::vector<const BigMemoryObject *>::const_iterator it1=s2.begin();it1!=s2.end();it1++)
{
- if(it1)
- if(std::find(ret.begin(),ret.end(),it1)==ret.end())
- s3.push_back(it1);
+ if(*it1)
+ if(std::find(ret.begin(),ret.end(),*it1)==ret.end())
+ s3.push_back(*it1);
}
}
s1=s3;
{
std::size_t ret(0);
std::set<const BigMemoryObject *> s1,s2;
- for(auto obj : objs)
+ for(std::vector<const BigMemoryObject *>::const_iterator it0=objs.begin();it0!=objs.end();it0++)
{
- if(obj)
- if(s1.find(obj)==s1.end())
+ if(*it0)
+ if(s1.find(*it0)==s1.end())
{
- std::vector<const BigMemoryObject *> vTmp(obj->getDirectChildren());
+ std::vector<const BigMemoryObject *> vTmp((*it0)->getDirectChildren());
s2.insert(vTmp.begin(),vTmp.end());
- ret+=obj->getHeapMemorySizeWithoutChildren();
- s1.insert(obj);
+ ret+=(*it0)->getHeapMemorySizeWithoutChildren();
+ s1.insert(*it0);
}
}
return ret+GetHeapMemoryOfSet(s1,s2);
while(!s2.empty())
{
std::set<const BigMemoryObject *> s3;
- for(auto it : s2)
+ for(std::set<const BigMemoryObject *>::const_iterator it=s2.begin();it!=s2.end();it++)
{
- if(s1.find(it)==s1.end())
+ if(s1.find(*it)==s1.end())
{
- ret+=it->getHeapMemorySizeWithoutChildren();
- s1.insert(it);
- std::vector<const BigMemoryObject *> const v2(it->getDirectChildren());
- for(auto it2 : v2)
- if(s1.find(it2)==s1.end())
- s3.insert(it2);
+ ret+=(*it)->getHeapMemorySizeWithoutChildren();
+ s1.insert(*it);
+ std::vector<const BigMemoryObject *> v2((*it)->getDirectChildren());
+ for(std::vector<const BigMemoryObject *>::const_iterator it2=v2.begin();it2!=v2.end();it2++)
+ if(s1.find(*it2)==s1.end())
+ s3.insert(*it2);
}
}
s2=s3;
std::ostringstream oss2; oss2 << std::fixed << ((double)remain)/1024.;
std::string s(oss2.str());
s=s.substr(1,4);
- std::size_t const pos(s.find_last_not_of('0'));
+ std::size_t pos(s.find_last_not_of('0'));
if(pos==4)
oss << s;
else
std::vector<const BigMemoryObject *> BigMemoryObject::getDirectChildren() const
{
std::vector<const BigMemoryObject *> ret;
- std::vector<const BigMemoryObject *> const retWithNull(getDirectChildrenWithNull());
- for(auto it : retWithNull)
- if(it)
- ret.push_back(it);
+ std::vector<const BigMemoryObject *> retWithNull(getDirectChildrenWithNull());
+ for(std::vector<const BigMemoryObject *>::const_iterator it=retWithNull.begin();it!=retWithNull.end();it++)
+ if(*it)
+ ret.push_back(*it);
return ret;
}
BigMemoryObject::~BigMemoryObject()
-= default;
+{
+}
//=
{
}
-RefCountObjectOnly::RefCountObjectOnly(const RefCountObjectOnly& /*other*/):_cnt(1)
+RefCountObjectOnly::RefCountObjectOnly(const RefCountObjectOnly& other):_cnt(1)
{
}
bool RefCountObjectOnly::decrRef() const
{
- bool const ret=((--_cnt)==0);
+ bool ret=((--_cnt)==0);
if(ret)
delete this;
return ret;
}
RefCountObjectOnly::~RefCountObjectOnly()
-= default;
+{
+}
/*!
* Do nothing here ! It is not a bug ( I hope :) ) because all subclasses that
* copies using operator= should not copy the ref counter of \a other !
*/
-RefCountObjectOnly& RefCountObjectOnly::operator=(const RefCountObjectOnly& /*other*/)
+RefCountObjectOnly& RefCountObjectOnly::operator=(const RefCountObjectOnly& other)
{
return *this;
}
//=
RefCountObject::RefCountObject()
-= default;
+{
+}
RefCountObject::RefCountObject(const RefCountObject& other):RefCountObjectOnly(other)
{
}
RefCountObject::~RefCountObject()
-= default;
+{
+}
//=
bool GlobalDict::hasKey(const std::string& key) const
{
- auto const it(_my_map.find(key));
+ std::map<std::string, std::string>::const_iterator it(_my_map.find(key));
return it!=_my_map.end();
}
std::string GlobalDict::value(const std::string& key) const
{
- auto const it(_my_map.find(key));
+ std::map<std::string, std::string>::const_iterator it(_my_map.find(key));
if(it==_my_map.end())
{
std::ostringstream oss;
std::vector<std::string> GlobalDict::keys() const
{
std::vector<std::string> ret;
- for(const auto & it : _my_map)
- ret.push_back(it.first);
+ for(std::map<std::string, std::string>::const_iterator it=_my_map.begin();it!=_my_map.end();it++)
+ ret.push_back((*it).first);
return ret;
}
void GlobalDict::erase(const std::string& key)
{
- auto const it(_my_map.find(key));
+ std::map<std::string, std::string>::iterator it(_my_map.find(key));
if(it==_my_map.end())
{
std::ostringstream oss;
void GlobalDict::setKeyValue(const std::string& key, const std::string& val)
{
- std::map<std::string, std::string>::const_iterator const it(_my_map.find(key));
+ std::map<std::string, std::string>::const_iterator it(_my_map.find(key));
if(it!=_my_map.end())
{
std::ostringstream oss;
std::string GlobalDict::printSelf() const
{
std::ostringstream oss;
- for(const auto & it : _my_map)
+ for(std::map<std::string, std::string>::const_iterator it=_my_map.begin();it!=_my_map.end();it++)
{
- oss << "(" << it.first << "," << it.second << ")" << std::endl;
+ oss << "(" << (*it).first << "," << (*it).second << ")" << std::endl;
}
return oss.str();
}
protected:
RefCountObject();
RefCountObject(const RefCountObject& other);
- ~RefCountObject() override;
+ virtual ~RefCountObject();
};
class MEDCOUPLING_EXPORT GlobalDict
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingRemapper.hxx"
-#include "Interpolation.txx"
-#include "MCAuto.hxx"
-#include "InterpolationOptions.hxx"
-#include "MCType.hxx"
-#include "Interpolation1D.hxx"
-#include "Interpolation2D.hxx"
-#include "Interpolation3D.hxx"
-#include "Interpolation3D1D.hxx"
-#include "Interpolation1D0D.hxx"
-#include "Interpolation2D1D.hxx"
-#include "Interpolation2D3D.hxx"
-#include "InterpolationCU.hxx"
-#include "InterpolationCC.hxx"
-#include "InterpKernelException.hxx"
-#include "MEDCouplingGaussLocalization.hxx"
-#include "MCIdType.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
#include "MEDCouplingNormalizedUnstructuredMesh.txx"
-#include "MEDCouplingNormalizedCartesianMesh.hxx"
#include "MEDCouplingNormalizedCartesianMesh.txx"
#include "MEDCouplingFieldDiscretizationOnNodesFE.hxx"
-#include "MEDCouplingUMesh.hxx"
+#include "Interpolation1D.txx"
#include "Interpolation2DCurve.hxx"
+#include "Interpolation2D.txx"
#include "Interpolation3D.txx"
#include "Interpolation3DSurf.hxx"
#include "Interpolation2D1D.txx"
#include "Interpolation1D0D.txx"
#include "InterpolationCU.txx"
#include "InterpolationCC.txx"
-#include <string>
-#include <sstream>
-#include <limits>
-#include <cstddef>
-#include "MEDCouplingPointSet.hxx"
-#include <functional>
-#include <iostream>
-#include <numeric>
using namespace MEDCoupling;
-MEDCouplingRemapper::MEDCouplingRemapper():_src_ft(nullptr),_target_ft(nullptr),_interp_matrix_pol(IK_ONLY_PREFERED),_nature_of_deno(NoNature),_time_deno_update(0)
+MEDCouplingRemapper::MEDCouplingRemapper():_src_ft(0),_target_ft(0),_interp_matrix_pol(IK_ONLY_PREFERED),_nature_of_deno(NoNature),_time_deno_update(0)
{
}
int MEDCouplingRemapper::prepareInterpKernelOnly()
{
- int const meshInterpType=((int)_src_ft->getMesh()->getType()*16)+(int)_target_ft->getMesh()->getType();
+ int meshInterpType=((int)_src_ft->getMesh()->getType()*16)+(int)_target_ft->getMesh()->getType();
// *** Remember:
// typedef enum
// {
int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
{
- const auto *src_mesh=static_cast<const MEDCouplingPointSet *>(_src_ft->getMesh());
- const auto *target_mesh=static_cast<const MEDCouplingPointSet *>(_target_ft->getMesh());
+ const MEDCouplingPointSet *src_mesh=static_cast<const MEDCouplingPointSet *>(_src_ft->getMesh());
+ const MEDCouplingPointSet *target_mesh=static_cast<const MEDCouplingPointSet *>(_target_ft->getMesh());
std::string srcMeth,trgMeth;
std::string method(checkAndGiveInterpolationMethodStr(srcMeth,trgMeth));
const int srcMeshDim=src_mesh->getMeshDimension();
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
nbCols=ToIdType(matrixTmp.size());
- INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType const duplicateFaces=interpolation.retrieveDuplicateFaces();
+ INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
if(!duplicateFaces.empty())
{
std::ostringstream oss; oss << "An unexpected situation happened ! For the following 1D Cells are part of edges shared by 2D cells :\n";
MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh);
INTERP_KERNEL::Interpolation2D1D interpolation(*this);
nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
- INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType const duplicateFaces=interpolation.retrieveDuplicateFaces();
+ INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
if(!duplicateFaces.empty())
{
std::ostringstream oss; oss << "An unexpected situation happened ! For the following 1D Cells are part of edges shared by 2D cells :\n";
MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
INTERP_KERNEL::Interpolation2D3D interpolation(*this);
nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
- INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces=interpolation.retrieveDuplicateFaces();
+ INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
if(!duplicateFaces.empty())
{
std::ostringstream oss; oss << "An unexpected situation happened ! For the following 2D Cells are part of edges shared by 3D cells :\n";
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
nbCols=ToIdType(matrixTmp.size());
- INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces=interpolation.retrieveDuplicateFaces();
+ INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
if(!duplicateFaces.empty())
{
std::ostringstream oss; oss << "An unexpected situation happened ! For the following 2D Cells are part of edges shared by 3D cells :\n";
{
std::string srcMeth,trgMeth;
std::string methC=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth);
- const auto *src_mesh=static_cast<const MEDCouplingMappedExtrudedMesh *>(_src_ft->getMesh());
- const auto *target_mesh=static_cast<const MEDCouplingMappedExtrudedMesh *>(_target_ft->getMesh());
+ const MEDCouplingMappedExtrudedMesh *src_mesh=static_cast<const MEDCouplingMappedExtrudedMesh *>(_src_ft->getMesh());
+ const MEDCouplingMappedExtrudedMesh *target_mesh=static_cast<const MEDCouplingMappedExtrudedMesh *>(_target_ft->getMesh());
if(methC!="P0P0")
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyEE : Only P0P0 method implemented for Extruded/Extruded meshes !");
MCAuto<MEDCouplingUMesh> src2D(src_mesh->getMesh2D()->clone(false)); src2D->changeSpaceDimension(2,0.);
int MEDCouplingRemapper::prepareInterpKernelOnlyUC()
{
std::string srcMeth,trgMeth;
- std::string const methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth);
+ std::string methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth);
if(methodCpp!="P0P0")
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC: only P0P0 interpolation supported for the moment !");
if(InterpolationOptions::getIntersectionType()!=INTERP_KERNEL::Triangulation)
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC: only 'Triangulation' intersection type supported!");
- const auto *src_mesh=static_cast<const MEDCouplingUMesh *>(_src_ft->getMesh());
- const auto *target_mesh=static_cast<const MEDCouplingCMesh *>(_target_ft->getMesh());
+ const MEDCouplingUMesh *src_mesh=static_cast<const MEDCouplingUMesh *>(_src_ft->getMesh());
+ const MEDCouplingCMesh *target_mesh=static_cast<const MEDCouplingCMesh *>(_target_ft->getMesh());
const int srcMeshDim=src_mesh->getMeshDimension();
const int srcSpceDim=src_mesh->getSpaceDimension();
const int trgMeshDim=target_mesh->getMeshDimension();
int MEDCouplingRemapper::prepareInterpKernelOnlyCU()
{
std::string srcMeth,trgMeth;
- std::string const methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth);
+ std::string methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth);
if(methodCpp!="P0P0")
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCU : only P0P0 interpolation supported for the moment !");
if(InterpolationOptions::getIntersectionType()!=INTERP_KERNEL::Triangulation)
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCU: only 'Triangulation' intersection type supported!");
- const auto *src_mesh=static_cast<const MEDCouplingCMesh *>(_src_ft->getMesh());
- const auto *target_mesh=static_cast<const MEDCouplingUMesh *>(_target_ft->getMesh());
+ const MEDCouplingCMesh *src_mesh=static_cast<const MEDCouplingCMesh *>(_src_ft->getMesh());
+ const MEDCouplingUMesh *target_mesh=static_cast<const MEDCouplingUMesh *>(_target_ft->getMesh());
const int srcMeshDim=src_mesh->getMeshDimension();
const int trgMeshDim=target_mesh->getMeshDimension();
const int trgSpceDim=target_mesh->getSpaceDimension();
int MEDCouplingRemapper::prepareInterpKernelOnlyCC()
{
std::string srcMeth,trgMeth;
- std::string const methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth);
+ std::string methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth);
if(methodCpp!="P0P0")
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCC : only P0P0 interpolation supported for the moment !");
if(InterpolationOptions::getIntersectionType()!=INTERP_KERNEL::Triangulation)
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCC: only 'Triangulation' intersection type supported!");
- const auto *src_mesh=static_cast<const MEDCouplingCMesh *>(_src_ft->getMesh());
- const auto *target_mesh=static_cast<const MEDCouplingCMesh *>(_target_ft->getMesh());
+ const MEDCouplingCMesh *src_mesh=static_cast<const MEDCouplingCMesh *>(_src_ft->getMesh());
+ const MEDCouplingCMesh *target_mesh=static_cast<const MEDCouplingCMesh *>(_target_ft->getMesh());
const int srcMeshDim=src_mesh->getMeshDimension();
const int trgMeshDim=target_mesh->getMeshDimension();
if(trgMeshDim!=srcMeshDim)
for(const mcIdType *trgId=ids0->begin();trgId!=ids0->end();trgId++)
{
const double *ptTrg=trgLocPtr+trgSpaceDim*(*trgId);
- mcIdType const srcCellId=elts[eltsIndex[*trgId]];
+ mcIdType srcCellId=elts[eltsIndex[*trgId]];
double dist=std::numeric_limits<double>::max();
mcIdType srcEntry=-1;
for(mcIdType srcId=srcOffsetArrPtr[srcCellId];srcId<srcOffsetArrPtr[srcCellId+1];srcId++)
}
if(ids0->getNumberOfTuples()!=trgNbOfGaussPts)
{
- MCAuto<DataArrayIdType> const orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0);
+ MCAuto<DataArrayIdType> orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0);
MCAuto<DataArrayDouble> orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end());
MCAuto<DataArrayIdType> srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg);
const mcIdType *srcIdPerTrgPtr=srcIdPerTrg->begin();
THROW_IK_EXCEPTION("prepareNotInterpKernelOnlyFEFE : only spacedim 3 supported for target !")
if(_src_ft->getMesh()->getSpaceDimension() != 3)
THROW_IK_EXCEPTION("prepareNotInterpKernelOnlyFEFE : only spacedim 3 supported for source !")
- const auto *srcUMesh( dynamic_cast<const MEDCouplingUMesh *>(_src_ft->getMesh()) );
- const auto *trgMesh( dynamic_cast<const MEDCouplingPointSet *>(_target_ft->getMesh()) );
+ const MEDCouplingUMesh *srcUMesh( dynamic_cast<const MEDCouplingUMesh *>(_src_ft->getMesh()) );
+ const MEDCouplingPointSet *trgMesh( dynamic_cast<const MEDCouplingPointSet *>(_target_ft->getMesh()) );
if( !srcUMesh )
THROW_IK_EXCEPTION("prepareNotInterpKernelOnlyFEFE : only 3D UMesh supported as source !");
if( !trgMesh )
void MEDCouplingRemapper::releaseData(bool matrixSuppression)
{
- _src_ft=nullptr;
- _target_ft=nullptr;
+ _src_ft=0;
+ _target_ft=0;
if(matrixSuppression)
{
_matrix.clear();
void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNbOfCompo, bool isDftVal, double dftValue, double *resPointer)
{
int idx=0;
- auto *tmp=new double[inputNbOfCompo];
+ double *tmp=new double[inputNbOfCompo];
for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
{
if((*iter1).empty())
{
std::vector<bool> isReached(_deno_reverse_multiply.size(),false);
mcIdType idx=0;
- auto *tmp=new double[inputNbOfCompo];
+ double *tmp=new double[inputNbOfCompo];
std::fill(resPointer,resPointer+inputNbOfCompo*_deno_reverse_multiply.size(),0.);
for(std::vector<std::map<mcIdType,double> >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++)
{
void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std::vector< std::map<mcIdType,double> >& m1D,
const std::vector< std::map<mcIdType,double> >& m2D,
- const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType /*nbOf1DCellsSrc*/,
+ const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType nbOf1DCellsSrc,
const mcIdType *corrCellIdTrg)
{
mcIdType nbOf2DCellsTrg=ToIdType(m2D.size());
mcIdType nbOf1DCellsTrg=ToIdType(m1D.size());
- mcIdType const nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg;
+ mcIdType nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg;
_matrix.resize(nbOf3DCellsTrg);
mcIdType id2R=0;
for(std::vector< std::map<mcIdType,double> >::const_iterator iter2R=m2D.begin();iter2R!=m2D.end();iter2R++,id2R++)
*/
int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrix(double scaleFactor)
{
- double const maxVal=getMaxValueInCrudeMatrix();
+ double maxVal=getMaxValueInCrudeMatrix();
if(maxVal==0.)
return -1;
return nullifiedTinyCoeffInCrudeMatrixAbs(scaleFactor*maxVal);
#define __PARAMEDMEM_MEDCOUPLINGREMAPPER_HXX__
#include "MEDCoupling.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
#include "MEDCouplingTimeLabel.hxx"
#include "InterpolationOptions.hxx"
+#include "MEDCouplingNatureOfField.hxx"
#include "MCType.hxx"
#include "MCAuto.hxx"
+#include "InterpKernelException.hxx"
#include <map>
-#include <string>
#include <vector>
namespace MEDCoupling
{
public:
MEDCOUPLINGREMAPPER_EXPORT MEDCouplingRemapper();
- MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper() override;
+ MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper();
MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method);
MEDCOUPLINGREMAPPER_EXPORT int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target);
MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector<std::map<mcIdType,double> >& m);
static int CheckInterpolationMethodManageableByNotOnlyInterpKernel(const std::string& method);
//
bool isInterpKernelOnlyOrNotOnly() const;
- void updateTime() const override;
+ void updateTime() const;
void checkPrepare() const;
void synchronizeSizeOfSideMatricesAfterMatrixComputation(mcIdType nbOfColsInMatrix);
std::string checkAndGiveInterpolationMethodStr(std::string& srcMeth, std::string& trgMeth) const;
//
#include "MEDCouplingSkyLineArray.hxx"
-#include "MCType.hxx"
-#include "NormalizedGeometricTypes"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-
-#include <algorithm>
-#include <iterator>
-#include <cstddef>
-#include <ostream>
-#include <limits>
+
#include <sstream>
#include <deque>
#include <set>
-#include <vector>
using namespace MEDCoupling;
}
MEDCouplingSkyLineArray::~MEDCouplingSkyLineArray()
-= default;
+{
+}
MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New()
{
MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector<mcIdType>& index,
const std::vector<mcIdType>& value )
{
- auto * ret = new MEDCouplingSkyLineArray();
+ MEDCouplingSkyLineArray * ret = new MEDCouplingSkyLineArray();
ret->_index->reserve( index.size() );
ret->_index->insertAtTheEnd( index.begin(), index.end() );
ret->_values->reserve( value.size() );
MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( DataArrayIdType* index, DataArrayIdType* value )
{
- auto* ret = new MEDCouplingSkyLineArray();
+ MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray();
ret->set(index, value);
return ret;
}
MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const MEDCouplingSkyLineArray & other )
{
- auto* ret = new MEDCouplingSkyLineArray();
+ MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray();
ret->_super_index = other._super_index;
ret->_index = other._index;
ret->_values = other._values;
{
using namespace std;
- auto* ret = new MEDCouplingSkyLineArray();
+ MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray();
const mcIdType * cP(c->begin()), * cIP(cI->begin());
mcIdType prev = -1;
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: misformatted connectivity (wrong nb of tuples)!");
for (mcIdType i=0; i < cI->getNbOfElems(); i++)
{
- mcIdType const j = cIP[i];
+ mcIdType j = cIP[i];
if (cIP[i] < prev)
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: misformatted connectivity (indices not monotonic ascending)!");
prev = cIP[i];
while (w2 != cP+end)
{
copy(w, w2, work);
- mcIdType const d = ToIdType(distance(w, w2));
+ mcIdType d = ToIdType(distance(w, w2));
cnt += d; work +=d;
idx.push_back(cnt); cnt2++;
w = w2+1; // skip the -1
cI->alloc(_super_index->getNbOfElems(),1); // same number of super packs as number of cells
mcIdType * cIVecP(cI->getPointer());
MCAuto <DataArrayIdType> dsi = _index->deltaShiftIndex();
- mcIdType const sz = dsi->accumulate((std::size_t)0) + ToIdType(dsi->getNbOfElems()); // think about it: one slot for the type, -1 at the end of each face of the cell
+ mcIdType sz = dsi->accumulate((std::size_t)0) + ToIdType(dsi->getNbOfElems()); // think about it: one slot for the type, -1 at the end of each face of the cell
c->alloc(sz, 1);
mcIdType * cVecP(c->getPointer());
for ( mcIdType i=0; i < _super_index->getNbOfElems()-1; i++)
{
cIVecP[i]= cnt;
- mcIdType const endId = siP[i+1];
+ mcIdType endId = siP[i+1];
cVecP[cnt++] = INTERP_KERNEL::NORM_POLYHED;
for (mcIdType j=siP[i]; j < endId; j++)
{
MCAuto<MEDCouplingSkyLineArray> ret(MEDCouplingSkyLineArray::New(indexCpy,valuesCpy));
if(_super_index.isNotNull())
{
- MCAuto<DataArrayIdType> const superIndexCpy(this->_super_index->deepCopy());
+ MCAuto<DataArrayIdType> superIndexCpy(this->_super_index->deepCopy());
ret->_super_index = superIndexCpy;
}
return ret.retn();
void MEDCouplingSkyLineArray::validSuperIndexAndIndex(const std::string& func, mcIdType superIndex, mcIdType index) const
{
validSuperIndex(func, superIndex);
- mcIdType const idx = _super_index->begin()[superIndex] + index;
+ mcIdType idx = _super_index->begin()[superIndex] + index;
if(idx < 0 || idx >= _index->getNbOfElems())
{
std::ostringstream oss;
*/
void MEDCouplingSkyLineArray::thresholdPerPack(mcIdType threshold, MCAuto<MEDCouplingSkyLineArray>& left, MCAuto<MEDCouplingSkyLineArray>& right) const
{
- mcIdType const nbPacks(this->getNumberOf());
+ mcIdType nbPacks(this->getNumberOf());
MCAuto<DataArrayIdType> lCount(DataArrayIdType::New()); lCount->alloc(nbPacks,1); lCount->fillWithZero();
mcIdType *lCountPtr(lCount->getPointerSilent());
const mcIdType *valuesPtr(this->_values->begin()),*indexPtr(this->_index->begin());
indexedPacks->checkAllocated();
if( indexedPacks->getNumberOfComponents() != 1 )
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::groupPacks : number of components must be 1 !");
- std::size_t const nbTuples(indexedPacks->getNumberOfTuples());
+ std::size_t nbTuples(indexedPacks->getNumberOfTuples());
if( nbTuples == 0 )
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::groupPacks : number of tuples must be > 0 !");
const DataArrayIdType *index(this->getIndexArray());
MEDCouplingSkyLineArray *MEDCouplingSkyLineArray::uniqueNotSortedByPack() const
{
- mcIdType const nbPacks(this->getNumberOf());
+ mcIdType nbPacks(this->getNumberOf());
MCAuto<DataArrayIdType> retIndex(DataArrayIdType::New()); retIndex->alloc(nbPacks+1,1);
const mcIdType *valuesPtr(this->_values->begin()),*indexPtr(this->_index->begin());
mcIdType *retIndexPtr(retIndex->getPointer()); *retIndexPtr = 0;
for(mcIdType i = 0 ; i < nbPacks ; ++i, ++retIndexPtr)
{
- std::set<mcIdType> const s(valuesPtr+indexPtr[i],valuesPtr+indexPtr[i+1]);
+ std::set<mcIdType> s(valuesPtr+indexPtr[i],valuesPtr+indexPtr[i+1]);
retIndexPtr[1] = retIndexPtr[0] + ToIdType(s.size());
}
MCAuto<DataArrayIdType> retValues(DataArrayIdType::New()); retValues->alloc(retIndex->back(),1);
mcIdType *retValuesPtr(retValues->getPointer());
for(mcIdType i = 0 ; i < nbPacks ; ++i)
{
- std::set<mcIdType> const s(valuesPtr+indexPtr[i],valuesPtr+indexPtr[i+1]);
+ std::set<mcIdType> s(valuesPtr+indexPtr[i],valuesPtr+indexPtr[i+1]);
retValuesPtr = std::copy(s.begin(),s.end(),retValuesPtr);
}
MCAuto<MEDCouplingSkyLineArray> ret(MEDCouplingSkyLineArray::New(retIndex,retValues));
{
if(sk)
{
- mcIdType const curNbPacks(sk->getNumberOf());
+ mcIdType curNbPacks(sk->getNumberOf());
if(sksEff.empty())
nbOfPacks = curNbPacks;
if(nbOfPacks != curNbPacks)
std::for_each(indicesIn.begin(),indicesIn.end(),[packId,&nbOfAggPacks](const mcIdType *elt) { nbOfAggPacks+=elt[packId+1]-elt[packId]; });
indexPtr[1] = indexPtr[0] + nbOfAggPacks;
}
- mcIdType const nbOfTuplesOut(index->back());
+ mcIdType nbOfTuplesOut(index->back());
MCAuto<DataArrayIdType> values(DataArrayIdType::New()); values->alloc(nbOfTuplesOut,1);
mcIdType *valuesPtr(values->getPointer());
// let's go to populate values array
if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems())
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!");
const mcIdType * iP(_index->begin()), *vP(_values->begin());
- mcIdType const sz = iP[absolutePackId+1]-iP[absolutePackId];
+ mcIdType sz = iP[absolutePackId+1]-iP[absolutePackId];
pack.resize(sz);
std::copy(vP+iP[absolutePackId], vP+iP[absolutePackId+1],pack.begin());
}
checkSuperIndex("findPackIds");
- mcIdType const packSz = ToIdType(std::distance(packBg, packEnd));
+ mcIdType packSz = ToIdType(std::distance(packBg, packEnd));
if (!packSz)
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::findPackIds: void pack!");
out.resize(superPackIndices.size());
mcIdType i = 0;
const mcIdType * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin());
- for(auto it=superPackIndices.begin(); it!=superPackIndices.end(); ++it, i++)
+ for(vector<mcIdType>::const_iterator it=superPackIndices.begin(); it!=superPackIndices.end(); ++it, i++)
{
out[i] = -1;
const mcIdType sPackIdx = *it;
_values->reAlloc(_values->getNbOfElems() - (end-start));
// _index
- mcIdType const nt = _index->getNbOfElems();
+ mcIdType nt = _index->getNbOfElems();
std::copy(iP+siP[superIdx]+idx+1, iP+nt, iP+siP[superIdx]+idx);
_index->reAlloc(nt-1); iP = _index->getPointer(); // better not forget this ...
for(mcIdType ii = siP[superIdx]+idx; ii < nt-1; ii++)
const mcIdType start(iP[idx]), end(iP[idx+1]);
// _values
- mcIdType const initValSz=_values->getNbOfElems();
- mcIdType const deltaSz( start-end ); // should be negative
+ mcIdType initValSz=_values->getNbOfElems();
+ mcIdType deltaSz( start-end ); // should be negative
mcIdType *vP(_values->getPointer());
if (deltaSz < 0)
{
else
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePack");
// _index
- mcIdType const nt=_index->getNbOfElems();
+ mcIdType nt=_index->getNbOfElems();
std::copy(iP+idx+1, iP+nt, iP+idx);
for(mcIdType ii = idx; ii < nt-1; ii++)
iP[ii] += deltaSz;
if (idx->empty())
return;
- for (long const id : *idx)
- validIndex("deleteSimplePacks", id);
+ for (const mcIdType * id = idx->begin(); id != idx->end(); id++)
+ validIndex("deleteSimplePacks", *id);
if (idx->getNbOfElems() != ToIdType( packs.size()))
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePacks: size of list of pack is incorrect");
std::deque< std::set<mcIdType> > valuesByIdx;
mcIdType* vP(_values->getPointer());
mcIdType* iP(_index->getPointer());
- mcIdType const nt = _index->getNbOfElems();
+ mcIdType nt = _index->getNbOfElems();
for (mcIdType ii = 0; ii < nt-1; ii++)
valuesByIdx.push_back(std::set<mcIdType>(vP+iP[ii], vP+iP[ii+1]));
// modify the deque<set<mcIdType>> according to idx and packs
mcIdType ii(0);
- for (long const id : *idx)
+ for (const mcIdType *id = idx->begin(); id != idx->end(); id++)
{
- valuesByIdx[id] = std::set<mcIdType>(packs[ii]->begin(), packs[ii]->end());
+ valuesByIdx[*id] = std::set<mcIdType>(packs[ii]->begin(), packs[ii]->end());
ii++;
}
// copy back the deque<set<mcIdType>> into _index, _values
mcIdType valSz(0);
*iP = 0;
- for (const auto & values : valuesByIdx)
+ for (std::deque< std::set<mcIdType> >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++)
{
- valSz += ToIdType(values.size());
+ valSz += ToIdType((*values).size());
*(++iP) = valSz;
}
_values->reAlloc(valSz);
void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayIdType* idx)
{
- for (long const id : *idx)
- validIndex("deleteSimplePacks", id);
+ for (auto id = idx->begin(); id != idx->end(); id++)
+ validIndex("deleteSimplePacks", *id);
- std::set<mcIdType> const packsToDelete(idx->begin(), idx->end());
+ std::set<mcIdType> packsToDelete(idx->begin(), idx->end());
// _values
mcIdType* iP(_index->getPointer());
- mcIdType const initValSz = _values->getNbOfElems();
+ mcIdType initValSz = _values->getNbOfElems();
mcIdType *vP(_values->getPointer());
mcIdType end_prec(0),start_prec(0);
- for(long const ii : packsToDelete)
+ for(std::set<mcIdType>::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++)
{
- mcIdType const start = iP[ii];
+ mcIdType start = iP[*ii];
if (end_prec != 0)
std::copy(vP+end_prec, vP+start, vP+start_prec);
start_prec += start-end_prec;
- end_prec = iP[ii+1];
+ end_prec = iP[*ii+1];
}
if (end_prec != 0)
std::copy(vP+end_prec, vP+initValSz, vP+start_prec);
_values->reAlloc(initValSz-(end_prec-start_prec));
// _index
- mcIdType const nt = _index->getNbOfElems();
+ mcIdType nt = _index->getNbOfElems();
mcIdType offset = 0;
end_prec = 0;
start_prec = 0;
mcIdType deleted = 0;
- for(long const ii : packsToDelete)
+ for(std::set<mcIdType>::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++)
{
if (end_prec != 0)
{
- std::copy(iP+end_prec, iP+ii, iP+start_prec);
- for (mcIdType i=start_prec; i<ii; i++)
+ std::copy(iP+end_prec, iP+*ii, iP+start_prec);
+ for (mcIdType i=start_prec; i<*ii; i++)
iP[i] -= offset;
}
- offset += iP[ii+1] - iP[ii];
- start_prec = ii-deleted;
- end_prec = ii+1;
+ offset += iP[*ii+1] - iP[*ii];
+ start_prec = *ii-deleted;
+ end_prec = *ii+1;
deleted += 1;
}
if (end_prec != 0)
copy(packBg, packEnd, vP+iP[siP[superIdx+1]]);
// _index
- mcIdType const nt = ToIdType(_index->getNbOfElems());
+ mcIdType nt = ToIdType(_index->getNbOfElems());
_index->reAlloc(nt+1); iP = _index->getPointer();
copy(iP+siP[superIdx+1]+1, iP+nt, iP+siP[superIdx+1]+2);
iP[siP[superIdx+1]+1] = iP[siP[superIdx+1]] + sz;
validIndex("replaceSimplePack", idx);
mcIdType * iP(_index->getPointer());
- mcIdType const newSz = ToIdType(std::distance(packBg, packEnd));
+ mcIdType newSz = ToIdType(std::distance(packBg, packEnd));
const mcIdType start = iP[idx], end = iP[idx+1];
// _values
- mcIdType const initValSz = _values->getNbOfElems();
- mcIdType const deltaSz = newSz-(end-start); // can be negative
+ mcIdType initValSz = _values->getNbOfElems();
+ mcIdType deltaSz = newSz-(end-start); // can be negative
if (deltaSz)
{
if (deltaSz > 0)
validSuperIndexAndIndex("replacePack", superIdx, idx);
mcIdType * siP(_super_index->getPointer()), *iP(_index->getPointer());
- mcIdType const newSz = ToIdType(std::distance(packBg, packEnd));
+ mcIdType newSz = ToIdType(std::distance(packBg, packEnd));
const mcIdType start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1];
// _values
- mcIdType const initValSz = _values->getNbOfElems();
- mcIdType const deltaSz = newSz-(end-start); // can be negative
+ mcIdType initValSz = _values->getNbOfElems();
+ mcIdType deltaSz = newSz-(end-start); // can be negative
if (deltaSz)
{
if (deltaSz > 0)
#pragma once
-#include "MCType.hxx"
-#include "MCIdType.hxx"
#include "MEDCoupling.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
+#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <algorithm>
-#include <string>
-#include <iterator>
#include <vector>
#include <functional>
static std::vector< MCAuto<DataArrayIdType> > RetrieveVecOfSkyLineArrayGen(const std::vector< MCAuto<MEDCouplingSkyLineArray> >& vecSka, std::function<DataArrayIdType *(MEDCouplingSkyLineArray *)> fct)
{
- std::size_t const sz(vecSka.size());
+ std::size_t sz(vecSka.size());
std::vector< MCAuto<DataArrayIdType> > ret(sz);
- auto it(ret.begin());
+ std::vector< MCAuto<DataArrayIdType> >::iterator it(ret.begin());
std::for_each(vecSka.begin(),vecSka.end(),[&it,fct](MCAuto<MEDCouplingSkyLineArray> elt) { *it++ = MCAuto<DataArrayIdType>::TakeRef(fct(elt)); } );
return ret;
}
std::string getClassName() const override { return std::string("MEDCouplingSkyLineArray"); }
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
void set( DataArrayIdType* index, DataArrayIdType* value );
void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value );
private:
MEDCouplingSkyLineArray();
- ~MEDCouplingSkyLineArray() override;
+ ~MEDCouplingSkyLineArray();
void checkSuperIndex(const std::string& func) const;
void validSuperIndex(const std::string& func, mcIdType superIndex) const;
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingStructuredMesh.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
-#include "CellModel.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCoupling1GTUMesh.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingIMesh.hxx"
-#include "NormalizedGeometricTypes"
-
-#include <algorithm>
-#include <cstddef>
-#include <iterator>
-#include <limits>
-#include <functional>
+#include "MEDCouplingIMesh.hxx"//tony to throw when optimization will be performed in AssignPartOfFieldOfDoubleUsing
+
#include <numeric>
-#include <set>
-#include <string>
-#include <sstream>
-#include <vector>
-#include <utility>
using namespace MEDCoupling;
MEDCouplingStructuredMesh::MEDCouplingStructuredMesh()
-= default;
+{
+}
-MEDCouplingStructuredMesh::MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool /*deepCpy*/):MEDCouplingMesh(other)
+MEDCouplingStructuredMesh::MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy):MEDCouplingMesh(other)
{
}
MEDCouplingStructuredMesh::~MEDCouplingStructuredMesh()
-= default;
+{
+}
std::size_t MEDCouplingStructuredMesh::getHeapMemorySizeWithoutChildren() const
{
return MEDCouplingMesh::isEqualIfNotWhy(other,prec,reason);
}
-INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(mcIdType /*cellId*/) const
+INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(mcIdType cellId) const
{
return GetGeoTypeGivenMeshDimension(getMeshDimension());
}
mcIdType MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- mcIdType const ret(getNumberOfCells());
+ mcIdType ret(getNumberOfCells());
if(type==getTypeOfCell(0))
return ret;
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)));
DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const
{
- std::size_t const nbCells=getNumberOfCells();
+ std::size_t nbCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbCells,1);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const
{
- std::size_t const nbCells=getNumberOfCells();
+ std::size_t nbCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbCells,1);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
void MEDCouplingStructuredMesh::getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const
{
- int const meshDim=getMeshDimension();
+ int meshDim=getMeshDimension();
mcIdType tmpCell[3],tmpNode[3];
getSplitCellValues(tmpCell);
getSplitNodeValues(tmpNode);
int spd1(0),pos(0);
for(std::vector<mcIdType>::const_iterator it=nodeStr.begin();it!=nodeStr.end();it++,pos++)
{
- mcIdType const elt(*it);
+ mcIdType elt(*it);
if(elt<=0)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct : At pos #" << pos << " value of node grid structure is " << *it << " ! must be >=1 !";
void MEDCouplingStructuredMesh::getSplitCellValues(mcIdType *res) const
{
- std::vector<mcIdType> const strct(getCellGridStructure());
+ std::vector<mcIdType> strct(getCellGridStructure());
std::vector<mcIdType> ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct));
std::copy(ret.begin(),ret.end(),res);
}
void MEDCouplingStructuredMesh::getSplitNodeValues(mcIdType *res) const
{
- std::vector<mcIdType> const strct(getNodeGridStructure());
+ std::vector<mcIdType> strct(getNodeGridStructure());
std::vector<mcIdType> ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct));
std::copy(ret.begin(),ret.end(),res);
}
*/
mcIdType MEDCouplingStructuredMesh::getNumberOfCellsOfSubLevelMesh() const
{
- std::vector<mcIdType> const cgs(getCellGridStructure());
+ std::vector<mcIdType> cgs(getCellGridStructure());
return GetNumberOfCellsOfSubLevelMesh(cgs,getMeshDimension());
}
*/
DataArrayIdType *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !");
if(code[0]!=ToIdType(getTypeOfCell(0)))
if(code[2]==-1)
{
if(code[1]==nbOfCells)
- return nullptr;
+ return 0;
else
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : mismatch between the number of cells in this (" << nbOfCells << ") and the number of non profile (" << code[1] << ") !";
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile is NULL or not allocated !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile should have exactly one component !");
- mcIdType const nbTuples(profile->getNumberOfTuples());
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbTuples(profile->getNumberOfTuples());
+ mcIdType nbOfCells=getNumberOfCells();
code.resize(3); idsInPflPerType.resize(1);
code[0]=ToIdType(getTypeOfCell(0)); code[1]=nbOfCells;
idsInPflPerType.resize(1);
*/
MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTSubLevelMesh() const
{
- int const meshDim(getMeshDimension());
+ int meshDim(getMeshDimension());
if(meshDim<1 || meshDim>3)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTSubLevelMesh : meshdim must be in [2,3] !");
MCAuto<DataArrayDouble> coords(getCoordinatesAndOwner());
MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const
{
- std::vector<mcIdType> const cgs(getCellGridStructure());
+ std::vector<mcIdType> cgs(getCellGridStructure());
std::vector< std::pair<mcIdType,mcIdType> > cellPartFormat,nodePartFormat;
if(IsPartStructured(start,end,cgs,cellPartFormat))
{
MCAuto<MEDCouplingStructuredMesh> ret(buildStructuredSubPart(cellPartFormat));
nodePartFormat=cellPartFormat;
- for(auto & it : nodePartFormat)
- it.second++;
+ for(std::vector< std::pair<mcIdType,mcIdType> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
+ (*it).second++;
MCAuto<DataArrayIdType> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
MCAuto<DataArrayIdType> tmp2(DataArrayIdType::New()); tmp2->alloc(getNumberOfNodes(),1);
tmp2->fillWithValue(-1);
}
}
-DataArrayIdType *MEDCouplingStructuredMesh::simplexize(int /*policy*/)
+DataArrayIdType *MEDCouplingStructuredMesh::simplexize(int policy)
{
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::simplexize : not available for Cartesian mesh !");
}
throw INTERP_KERNEL::Exception("Expected a MEDCouplingStructuredMesh with meshDim == 2 !");
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME));
MCAuto<DataArrayDouble> array(DataArrayDouble::New());
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
array->alloc(nbOfCells,3);
double *vals(array->getPointer());
for(mcIdType i=0;i<nbOfCells;i++)
void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const
{
- std::vector<mcIdType> const ngs(getNodeGridStructure());
- int const dim(getSpaceDimension());
+ std::vector<mcIdType> ngs(getNodeGridStructure());
+ int dim(getSpaceDimension());
switch(dim)
{
case 1:
void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector<mcIdType>& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx)
{
- mcIdType const nbNodes(ngs[0]);
+ mcIdType nbNodes(ngs[0]);
revNodalIndx->alloc(nbNodes+1,1);
if(nbNodes==0)
{ revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
void MEDCouplingStructuredMesh::GetReverseNodalConnectivity2(const std::vector<mcIdType>& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx)
{
mcIdType nbNodesX(ngs[0]),nbNodesY(ngs[1]);
- mcIdType const nbNodes(nbNodesX*nbNodesY);
+ mcIdType nbNodes(nbNodesX*nbNodesY);
if(nbNodesX==0 || nbNodesY==0)
{ revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
if(nbNodesX==1 || nbNodesY==1)
rni[1]=rni[0]+2; rn[0]=off+nbCellsX-1; rn[1]=off2+nbCellsX-1;
rni++; rn+=2;
}
- mcIdType const off3(nbCellsX*(nbCellsY-1));
+ mcIdType off3(nbCellsX*(nbCellsY-1));
rni[1]=rni[0]+1;
rni++; *rn++=off3;
for(mcIdType i=1;i<nbNodesX-1;i++,rni++,rn+=2)
void MEDCouplingStructuredMesh::GetReverseNodalConnectivity3(const std::vector<mcIdType>& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx)
{
mcIdType nbNodesX(ngs[0]),nbNodesY(ngs[1]),nbNodesZ(ngs[2]);
- mcIdType const nbNodes(nbNodesX*nbNodesY*nbNodesZ);
+ mcIdType nbNodes(nbNodesX*nbNodesY*nbNodesZ);
if(nbNodesX==0 || nbNodesY==0 || nbNodesZ==0)
{ revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
if(nbNodesX==1 || nbNodesY==1 || nbNodesZ==1)
*rni=0;
for(mcIdType k=0;k<nbNodesZ;k++)
{
- bool const factZ(k!=0 && k!=nbNodesZ-1);
+ bool factZ(k!=0 && k!=nbNodesZ-1);
mcIdType offZ0((k-1)*nbCellsX*nbCellsY),offZ1(k*nbCellsX*nbCellsY);
for(mcIdType j=0;j<nbNodesY;j++)
{
- bool const factYZ(factZ && (j!=0 && j!=nbNodesY-1));
+ bool factYZ(factZ && (j!=0 && j!=nbNodesY-1));
mcIdType off00((j-1)*nbCellsX+offZ0),off01(j*nbCellsX+offZ0),off10((j-1)*nbCellsX+offZ1),off11(j*nbCellsX+offZ1);
for(mcIdType i=0;i<nbNodesX;i++,rni++)
{
- mcIdType const fact(factYZ && (i!=0 && i!=nbNodesX-1));
+ mcIdType fact(factYZ && (i!=0 && i!=nbNodesX-1));
if(fact)
{//most of points fall in this part of code
rn[0]=off00+i-1; rn[1]=off00+i; rn[2]=off01+i-1; rn[3]=off01+i;
DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const mcIdType *nodeStBg, const mcIdType *nodeStEnd)
{
mcIdType zippedNodeSt[3];
- mcIdType const dim(ZipNodeStructure(nodeStBg,nodeStEnd,zippedNodeSt));
+ mcIdType dim(ZipNodeStructure(nodeStBg,nodeStEnd,zippedNodeSt));
switch(dim)
{
case 0:
DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(const mcIdType *nodeStBg, const mcIdType *nodeStEnd)
{
- std::size_t const dim(std::distance(nodeStBg,nodeStEnd));
+ std::size_t dim(std::distance(nodeStBg,nodeStEnd));
switch(dim)
{
case 3:
{
if(ghostLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : ghost lev must be >= 0 !");
- std::size_t const dim(st.size());
+ std::size_t dim(st.size());
MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
switch(dim)
{
mcIdType *ptr(ret->getPointer());
for(mcIdType i=0;i<ghostLev;i++,ptr++)
*ptr=i;
- mcIdType const offset(st[0]);
+ mcIdType offset(st[0]);
if(offset<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : element in 1D structure must be >= 0 !");
for(mcIdType i=0;i<ghostLev;i++,ptr++)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : elements in 3D structure must be >= 0 !");
ret->alloc(8*ghostLev,1);
mcIdType *ptr(ret->getPointer());
- mcIdType const zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev));
+ mcIdType zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev));
for(mcIdType i=0;i<ghostLev;i++)
{
*ptr++=i*(2*ghostLev+offsetX+1)+i*zeOffsetZ;
{
mcIdType ret(1);
std::size_t ii(0);
- for(auto it=partCompactFormat.begin();it!=partCompactFormat.end();it++,ii++)
+ for(std::vector< std::pair<mcIdType,mcIdType> >::const_iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,ii++)
{
mcIdType a((*it).first),b((*it).second);
if(a<0 || b<0 || b-a<0)
{
mcIdType ret(1);
bool isFetched(false);
- for(long const i : st)
+ for(std::size_t i=0;i<st.size();i++)
{
- if(i<0)
+ if(st[i]<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure : presence of a negative value in structure !");
- ret*=i;
+ ret*=st[i];
isFetched=true;
}
return isFetched?ret:0;
void MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, int& axisId, mcIdType& sizeOfRange)
{
- mcIdType const dim(ToIdType(partCompactFormat.size()));
+ mcIdType dim(ToIdType(partCompactFormat.size()));
mcIdType ret(-1);
for(int i=0;i<dim;i++)
{
- mcIdType const curDelta(partCompactFormat[i].second-partCompactFormat[i].first);
+ mcIdType curDelta(partCompactFormat[i].second-partCompactFormat[i].first);
if(curDelta<0)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt : at axis #" << i << " the range is invalid (first value < second value) !";
default:
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : only dimension 1, 2 and 3 are supported actually !");
}
- std::vector<mcIdType> const dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat));
+ std::vector<mcIdType> dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat));
mcIdType i(0);
- for(auto it=partCompactFormat.begin();it!=partCompactFormat.end();it++,i++)
+ for(std::vector< std::pair<mcIdType,mcIdType> >::iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,i++)
{
if(st[i]<minPatchLgth)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : the input patch is tinier than the min length constraint !");
*/
std::vector< std::vector<mcIdType> > MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(const std::vector<mcIdType>& st, const std::vector<bool>& crit)
{
- std::size_t const dim(st.size());
+ std::size_t dim(st.size());
std::vector< std::vector<mcIdType> > ret(dim);
switch(dim)
{
case 1:
{
- mcIdType const nx(st[0]);
+ mcIdType nx(st[0]);
ret[0].resize(nx);
std::vector<mcIdType>& retX(ret[0]);
for(mcIdType i=0;i<nx;i++)
mcIdType cnt(0);
for(mcIdType k=0;k<nz;k++)
{
- mcIdType const offz(k*nx*ny+i);
+ mcIdType offz(k*nx*ny+i);
for(mcIdType j=0;j<ny;j++)
if(crit[offz+j*nx])
cnt++;
mcIdType cnt(0),offy(j*nx);
for(mcIdType k=0;k<nz;k++)
{
- mcIdType const offz(k*nx*ny+offy);
+ mcIdType offz(k*nx*ny+offy);
for(mcIdType i=0;i<nx;i++)
if(crit[offz+i])
cnt++;
mcIdType cnt(0),offz(k*nx*ny);
for(mcIdType j=0;j<ny;j++)
{
- mcIdType const offy(offz+j*nx);
+ mcIdType offy(offz+j*nx);
for(mcIdType i=0;i<nx;i++)
if(crit[offy+i])
cnt++;
DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const mcIdType *nodeStBg)
{
- mcIdType const nbOfCells=*nodeStBg-1;
+ mcIdType nbOfCells=*nodeStBg-1;
MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(2*nbOfCells,1);
mcIdType *cp=conn->getPointer();
for(mcIdType j=0;j<n2;j++)
for(mcIdType i=0;i<n1;i++,pos++)
{
- mcIdType const tmp=(n1+1)*(n2+1);
+ mcIdType tmp=(n1+1)*(n2+1);
cp[8*pos+0]=i+1+j*(n1+1)+k*tmp;
cp[8*pos+1]=i+j*(n1+1)+k*tmp;
cp[8*pos+2]=i+(j+1)*(n1+1)+k*tmp;
}
if(ret==0)
{
- std::size_t const sz(st.size());
+ std::size_t sz(st.size());
partCompactFormat.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
}
if(ret==0)
{
- std::size_t const sz(st.size());
+ std::size_t sz(st.size());
partCompactFormat.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
}
if(ret==0)
{
- std::size_t const sz(st.size());
+ std::size_t sz(st.size());
partCompactFormat.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
*/
int MEDCouplingStructuredMesh::ZipNodeStructure(const mcIdType *nodeStBg, const mcIdType *nodeStEnd, mcIdType zipNodeSt[3])
{
- std::size_t const spaceDim(std::distance(nodeStBg,nodeStEnd));
+ std::size_t spaceDim(std::distance(nodeStBg,nodeStEnd));
if(spaceDim>3 || spaceDim<1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ZipNodeStructure : spaceDim must in [1,2,3] !");
zipNodeSt[0]=0; zipNodeSt[1]=0; zipNodeSt[2]=0;
int zippedI(0);
for(std::size_t i=0;i<spaceDim;i++)
{
- mcIdType const elt(nodeStBg[i]);
+ mcIdType elt(nodeStBg[i]);
if(elt<1)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::ZipNodeStructure : the input nodal structure at pos#" << i << "(" << nodeStBg[i] << ") is invalid !";
{
std::vector<mcIdType> ngs(2);
mcIdType n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1;
- mcIdType const off0(nodeStBg[0]);
+ mcIdType off0(nodeStBg[0]);
MCAuto<DataArrayIdType> conn(DataArrayIdType::New());
conn->alloc(2*GetNumberOfCellsOfSubLevelMesh(ngs,2));
mcIdType *cp(conn->getPointer());
{
mcIdType tmp[3]={i,j,k};
mcIdType tmp2[3];
- mcIdType const meshDim(getMeshDimension());
+ mcIdType meshDim(getMeshDimension());
getSplitCellValues(tmp2);
std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies<mcIdType>());
return std::accumulate(tmp,tmp+meshDim,0);
{
mcIdType tmp[3]={i,j,k};
mcIdType tmp2[3];
- mcIdType const spaceDim(getSpaceDimension());
+ mcIdType spaceDim(getSpaceDimension());
getSplitNodeValues(tmp2);
std::transform(tmp,tmp+spaceDim,tmp2,tmp,std::multiplies<mcIdType>());
return std::accumulate(tmp,tmp+spaceDim,0);
std::size_t ii(0);
for(std::vector<mcIdType>::const_iterator it=ngs.begin();it!=ngs.end();it++,ii++)
{
- mcIdType const elt(*it);
+ mcIdType elt(*it);
if(elt<=0)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getNumberOfCells : at pos #" << ii << " the number of nodes in nodeStructure is " << *it << " ! Must be > 0 !";
mcIdType MEDCouplingStructuredMesh::getNumberOfNodes() const
{
- std::vector<mcIdType> const ngs(getNodeGridStructure());
+ std::vector<mcIdType> ngs(getNodeGridStructure());
mcIdType ret(1);
- for(long const ng : ngs)
- ret*=ng;
+ for(std::vector<mcIdType>::const_iterator it=ngs.begin();it!=ngs.end();it++)
+ ret*=*it;
return ret;
}
*/
std::vector<mcIdType> MEDCouplingStructuredMesh::getLocationFromCellId(mcIdType cellId) const
{
- int const meshDim(getMeshDimension());
+ int meshDim(getMeshDimension());
std::vector<mcIdType> ret(meshDim);
std::vector<mcIdType> struc(getCellGridStructure());
- mcIdType const nbCells(std::accumulate(struc.begin(),struc.end(),1,std::multiplies<mcIdType>()));
+ mcIdType nbCells(std::accumulate(struc.begin(),struc.end(),1,std::multiplies<mcIdType>()));
if(cellId<0 || cellId>=nbCells)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getLocationFromCellId : Input cell id (" << cellId << ") is invalid ! Should be in [0," << nbCells << ") !";
*/
std::vector<mcIdType> MEDCouplingStructuredMesh::getLocationFromNodeId(mcIdType nodeId) const
{
- int const spaceDim(getSpaceDimension());
+ int spaceDim(getSpaceDimension());
std::vector<mcIdType> ret(spaceDim);
std::vector<mcIdType> struc(getNodeGridStructure());
- mcIdType const nbNodes(std::accumulate(struc.begin(),struc.end(),1,std::multiplies<mcIdType>()));
+ mcIdType nbNodes(std::accumulate(struc.begin(),struc.end(),1,std::multiplies<mcIdType>()));
if(nodeId<0 || nodeId>=nbNodes)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getLocationFromNodeId : Input node id (" << nodeId << ") is invalid ! Should be in [0," << nbNodes << ") !";
mcIdType work(eltId);
for(int i=meshDim-1;i>=0;i--)
{
- mcIdType const pos=work/split[i];
+ mcIdType pos=work/split[i];
work=work%split[i];
res[i]=pos;
}
std::vector<mcIdType> cgs(getCellGridStructure());
if(cgs.empty())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::computeSquareness : empty mesh !");
- std::size_t const dim(cgs.size());
+ std::size_t dim(cgs.size());
if(dim==1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::computeSquareness : A segment cannot be square !");
if(dim<4)
*/
std::vector<mcIdType> MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::vector<mcIdType>& strct)
{
- std::size_t const spaceDim(strct.size());
+ std::size_t spaceDim(strct.size());
std::vector<mcIdType> res(spaceDim);
for(std::size_t l=0;l<spaceDim;l++)
{
*/
bool MEDCouplingStructuredMesh::IsPartStructured(const mcIdType *startIds, const mcIdType *stopIds, const std::vector<mcIdType>& st, std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat)
{
- int const dim((int)st.size());
+ int dim((int)st.size());
partCompactFormat.resize(dim);
if(dim<1 || dim>3)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::isPartStructured : input structure must be of dimension in [1,2,3] !");
std::vector<mcIdType> tmp2(dim),tmp(dim),tmp3(dim),tmp4(dim); tmp2[0]=1;
for(int i=1;i<dim;i++)
tmp2[i]=tmp2[i-1]*st[i-1];
- std::size_t const sz(std::distance(startIds,stopIds));
+ std::size_t sz(std::distance(startIds,stopIds));
if(sz==0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::IsPartStructured : empty input !");
GetPosFromId(*startIds,dim,&tmp2[0],&tmp[0]);
{
for(mcIdType i=0;i<tmp4[2];i++)
{
- mcIdType const a=tmp2[2]*(partCompactFormat[2].first+i);
+ mcIdType a=tmp2[2]*(partCompactFormat[2].first+i);
for(mcIdType j=0;j<tmp4[1];j++)
{
- mcIdType const b=tmp2[1]*(partCompactFormat[1].first+j);
+ mcIdType b=tmp2[1]*(partCompactFormat[1].first+j);
for(mcIdType k=0;k<tmp4[0];k++,w++)
{
if(partCompactFormat[0].first+k+b+a!=*w)
{
for(mcIdType j=0;j<tmp4[1];j++)
{
- mcIdType const b=tmp2[1]*(partCompactFormat[1].first+j);
+ mcIdType b=tmp2[1]*(partCompactFormat[1].first+j);
for(mcIdType k=0;k<tmp4[0];k++,w++)
{
if(partCompactFormat[0].first+k+b!=*w)
*/
std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(const std::vector<mcIdType>& dims)
{
- std::size_t const sz(dims.size());
+ std::size_t sz(dims.size());
std::vector< std::pair<mcIdType,mcIdType> > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
*/
std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingStructuredMesh::IntersectRanges(const std::vector< std::pair<mcIdType,mcIdType> >& r1, const std::vector< std::pair<mcIdType,mcIdType> >& r2)
{
- std::size_t const sz(r1.size());
+ std::size_t sz(r1.size());
if(sz!=r2.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::IntersectRanges : the two ranges must have the same dimension !");
std::vector< std::pair<mcIdType,mcIdType> > ret(sz);
*/
bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair<mcIdType,mcIdType> >& r1, const std::vector< std::pair<mcIdType,mcIdType> >& r2)
{
- std::size_t const sz(r1.size());
+ std::size_t sz(r1.size());
if(sz!=r2.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::AreRangesIntersect : the two ranges must have the same dimension !");
for(std::size_t i=0;i<sz;i++)
{
for(mcIdType i=0;i<dims[2];i++)
{
- mcIdType const a=(partCompactFormat[2].first+i)*st[0]*st[1];
+ mcIdType a=(partCompactFormat[2].first+i)*st[0]*st[1];
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(partCompactFormat[1].first+j)*st[0];
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++)
vectToSwitchOn[partCompactFormat[0].first+k+b+a]=true;
}
{
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(partCompactFormat[1].first+j)*st[0];
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++)
vectToSwitchOn[partCompactFormat[0].first+k+b]=true;
}
if(ToIdType(fieldOfBool.size())!=DeduceNumberOfGivenStructure(st))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom : invalid size of input field of boolean regarding the structure !");
std::vector<mcIdType> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
- mcIdType const nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims));
+ mcIdType nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims));
fieldOut.resize(nbOfTuplesOfOutField);
mcIdType it(0);
switch(st.size())
{
for(mcIdType i=0;i<dims[2];i++)
{
- mcIdType const a=(partCompactFormat[2].first+i)*st[0]*st[1];
+ mcIdType a=(partCompactFormat[2].first+i)*st[0]*st[1];
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(partCompactFormat[1].first+j)*st[0];
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++)
fieldOut[it++]=fieldOfBool[partCompactFormat[0].first+k+b+a];
}
{
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(partCompactFormat[1].first+j)*st[0];
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++)
fieldOut[it++]=fieldOfBool[partCompactFormat[0].first+k+b];
}
if(fieldOfDbl->getNumberOfTuples()!=DeduceNumberOfGivenStructure(st))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !");
std::vector<mcIdType> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
- mcIdType const nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims));
- std::size_t const nbComp(fieldOfDbl->getNumberOfComponents());
+ mcIdType nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims));
+ std::size_t nbComp(fieldOfDbl->getNumberOfComponents());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp);
ret->copyStringInfoFrom(*fieldOfDbl);
double *ptRet(ret->getPointer());
{
for(mcIdType i=0;i<dims[2];i++)
{
- mcIdType const a=(partCompactFormat[2].first+i)*st[0]*st[1];
+ mcIdType a=(partCompactFormat[2].first+i)*st[0]*st[1];
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(partCompactFormat[1].first+j)*st[0];
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++)
ptRet=std::copy(fieldOfDblPtr+(partCompactFormat[0].first+k+b+a)*nbComp,fieldOfDblPtr+(partCompactFormat[0].first+k+b+a+1)*nbComp,ptRet);
}
{
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(partCompactFormat[1].first+j)*st[0];
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++)
ptRet=std::copy(fieldOfDblPtr+(partCompactFormat[0].first+k+b)*nbComp,fieldOfDblPtr+(partCompactFormat[0].first+k+b+1)*nbComp,ptRet);
}
*/
void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector<mcIdType>& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair<mcIdType,mcIdType> >& partCompactFormat, const DataArrayDouble *other)
{//to be optimized
- std::vector<mcIdType> const facts(st.size(),1);
+ std::vector<mcIdType> facts(st.size(),1);
MEDCouplingIMesh::CondenseFineToCoarse(st,other,partCompactFormat,facts,fieldOfDbl);
}
*/
void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& bigInAbs, const std::vector< std::pair<mcIdType,mcIdType> >& partOfBigInAbs, std::vector< std::pair<mcIdType,mcIdType> >& partOfBigRelativeToBig, bool check)
{
- std::size_t const dim(bigInAbs.size());
+ std::size_t dim(bigInAbs.size());
if(dim!=partOfBigInAbs.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt : The size of parts (dimension) must be the same !");
partOfBigRelativeToBig.resize(dim);
*/
void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& bigInAbs, const std::vector< std::pair<mcIdType,mcIdType> >& partOfBigRelativeToBig, std::vector< std::pair<mcIdType,mcIdType> >& partOfBigInAbs, bool check)
{
- std::size_t const dim(bigInAbs.size());
+ std::size_t dim(bigInAbs.size());
if(dim!=partOfBigRelativeToBig.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt : The size of parts (dimension) must be the same !");
partOfBigInAbs.resize(dim);
*/
std::vector< std::pair<mcIdType,mcIdType> > MEDCouplingStructuredMesh::TranslateCompactFrmt(const std::vector< std::pair<mcIdType,mcIdType> >& part, const std::vector<mcIdType>& translation)
{
- std::size_t const sz(part.size());
+ std::size_t sz(part.size());
if(translation.size()!=sz)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::TranslateCompactFrmt : the sizes are not equal !");
std::vector< std::pair<mcIdType,mcIdType> > ret(sz);
*/
std::vector<mcIdType> MEDCouplingStructuredMesh::FindTranslationFrom(const std::vector< std::pair<mcIdType,mcIdType> >& startingFrom, const std::vector< std::pair<mcIdType,mcIdType> >& goingTo)
{
- std::size_t const sz(startingFrom.size());
+ std::size_t sz(startingFrom.size());
if(goingTo.size()!=sz)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindTranslationFrom : the sizes are not equal !");
std::vector< mcIdType > ret(sz);
{
for(mcIdType i=0;i<dims[2];i++)
{
- mcIdType const a=(partCompactFormat[2].first+i)*st[0]*st[1];
+ mcIdType a=(partCompactFormat[2].first+i)*st[0]*st[1];
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(partCompactFormat[1].first+j)*st[0];
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++,pt++)
*pt=partCompactFormat[0].first+k+b+a;
}
{
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(partCompactFormat[1].first+j)*st[0];
+ mcIdType b=(partCompactFormat[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++,pt++)
*pt=partCompactFormat[0].first+k+b;
}
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : invalid input range 3 !");
dims[i]=part[i].second-part[i].first;
}
- mcIdType const nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st));
- std::size_t const nbCompo(da->getNumberOfComponents());
+ mcIdType nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st));
+ std::size_t nbCompo(da->getNumberOfComponents());
if(da->getNumberOfTuples()!=nbOfTuplesExp)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::MultiplyPartOf : invalid nb of tuples ! Expected " << nbOfTuplesExp << " having " << da->getNumberOfTuples() << " !";
{
for(mcIdType i=0;i<dims[2];i++)
{
- mcIdType const a=(part[2].first+i)*st[0]*st[1];
+ mcIdType a=(part[2].first+i)*st[0]*st[1];
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(part[1].first+j)*st[0];
+ mcIdType b=(part[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++)
{
- mcIdType const offset(part[0].first+k+b+a);
+ mcIdType offset(part[0].first+k+b+a);
std::transform(pt+nbCompo*offset,pt+nbCompo*(offset+1),pt+nbCompo*offset,std::bind(std::multiplies<double>(),std::placeholders::_1,factor));
}
}
{
for(mcIdType j=0;j<dims[1];j++)
{
- mcIdType const b=(part[1].first+j)*st[0];
+ mcIdType b=(part[1].first+j)*st[0];
for(mcIdType k=0;k<dims[0];k++)
{
- mcIdType const offset(part[0].first+k+b);
+ mcIdType offset(part[0].first+k+b);
std::transform(pt+nbCompo*offset,pt+nbCompo*(offset+1),pt+nbCompo*offset,std::bind(std::multiplies<double>(),std::placeholders::_1,factor));
}
}
{
for(mcIdType k=0;k<dims[0];k++)
{
- mcIdType const offset(part[0].first+k);
+ mcIdType offset(part[0].first+k);
std::transform(pt+nbCompo*offset,pt+nbCompo*(offset+1),pt+nbCompo*offset,std::bind(std::multiplies<double>(),std::placeholders::_1,factor));
}
break;
{
if(ghostSize<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : ghost size must be >= 0 !");
- std::size_t const dim(part.size());
+ std::size_t dim(part.size());
if(st.size()!=dim)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : the dimension of input vectors must be the same !");
for(std::size_t i=0;i<dim;i++)
{
if(ghostSize<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt : ghost size must be >= 0 !");
- std::size_t const sz(partBeforeFact.size());
+ std::size_t sz(partBeforeFact.size());
for(std::size_t i=0;i<sz;i++)
{
partBeforeFact[i].first+=ghostSize;
#ifndef __PARAMEDMEM_MEDCOUPLINGSTRUCTUREDMESH_HXX__
#define __PARAMEDMEM_MEDCOUPLINGSTRUCTUREDMESH_HXX__
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
#include "MEDCouplingMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include <set>
-#include <vector>
-#include <cstddef>
-#include <string>
-#include <utility>
namespace MEDCoupling
{
class MEDCouplingStructuredMesh : public MEDCouplingMesh
{
public:
- MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const override;
- MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override;
+ MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
MEDCOUPLING_EXPORT std::vector<mcIdType> getLocationFromCellId(mcIdType cellId) const;
MEDCOUPLING_EXPORT std::vector<mcIdType> getLocationFromNodeId(mcIdType nodeId) const;
MEDCOUPLING_EXPORT static void GetPosFromId(mcIdType eltId, int meshDim, const mcIdType *split, mcIdType *res);
MEDCOUPLING_EXPORT static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension( int meshDim);
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
//tools
- MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const override;
- MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const override;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const;
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTUnstructured() const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const override;
- MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
//some useful methods
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
MEDCOUPLING_EXPORT mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
MEDCOUPLING_EXPORT mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const override;
- MEDCOUPLING_EXPORT int getMeshDimension() const override;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const;
+ MEDCOUPLING_EXPORT int getMeshDimension() const;
MEDCOUPLING_EXPORT mcIdType getNumberOfCellsOfSubLevelMesh() const;
MEDCOUPLING_EXPORT int getSpaceDimensionOnNodeStruct() const;
MEDCOUPLING_EXPORT virtual void getNodeGridStructure(mcIdType *res) const = 0;
protected:
MEDCOUPLING_EXPORT MEDCouplingStructuredMesh();
MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy);
- MEDCOUPLING_EXPORT ~MEDCouplingStructuredMesh() override;
+ MEDCOUPLING_EXPORT ~MEDCouplingStructuredMesh();
};
}
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingTimeDiscretization.txx"
-
#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTimeLabel.hxx"
-#include <cmath>
-#include <cstddef>
+#include <iterator>
#include <algorithm>
#include <functional>
-#include <string>
-#include <sstream>
-#include <vector>
using namespace MEDCoupling;
{
if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
return false;
- if(_array==nullptr && other->_array==nullptr)
+ if(_array==0 && other->_array==0)
return true;
- if(_array==nullptr || other->_array==nullptr)
+ if(_array==0 || other->_array==0)
return false;
if(_array->getNumberOfTuples()!=other->_array->getNumberOfTuples())
return false;
MCAuto<DataArrayDouble> arr;
if(arrSrc)
arr=arrSrc->performCopyOrIncrRef(deepCopy);
- ret->setArray(arr,nullptr);
+ ret->setArray(arr,0);
return ret;
}
bool MEDCouplingTimeDiscretization::isBefore(const MEDCouplingTimeDiscretization *other) const
{
int iteration,order;
- double const time1=getEndTime(iteration,order)-_time_tolerance;
- double const time2=other->getStartTime(iteration,order)+other->getTimeTolerance();
+ double time1=getEndTime(iteration,order)-_time_tolerance;
+ double time2=other->getStartTime(iteration,order)+other->getTimeTolerance();
return time1<=time2;
}
bool MEDCouplingTimeDiscretization::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
{
int iteration,order;
- double const time1=getEndTime(iteration,order)+_time_tolerance;
- double const time2=other->getStartTime(iteration,order)-other->getTimeTolerance();
+ double time1=getEndTime(iteration,order)+_time_tolerance;
+ double time2=other->getStartTime(iteration,order)-other->getTimeTolerance();
return time1<time2;
}
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum()));
ret->setTimeUnit(getTimeUnit());
- ret->setArrays(arrays3,nullptr);
+ ret->setArrays(arrays3,0);
return ret;
}
throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : number of arrays mismatch !");
for(std::size_t i=0;i<arrays1.size();i++)
{
- if(arrays1[i]!=nullptr && arrays2[i]!=nullptr)
+ if(arrays1[i]!=0 && arrays2[i]!=0)
arrays1[i]->setSelectedComponents(arrays2[i],compoIds);
- else if(arrays1[i]!=nullptr || arrays2[i]!=nullptr)
+ else if(arrays1[i]!=0 || arrays2[i]!=0)
throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : some time array in correspondence are not defined symmetrically !");
}
}
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::sortPerTuple(bool asc)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- for(auto & array : arrays)
+ for(std::size_t j=0;j<arrays.size();j++)
{
- if(array)
- array->sortPerTuple(asc);
+ if(arrays[j])
+ arrays[j]->sortPerTuple(asc);
}
}
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(mcIdType nbOfTuple, double value)
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
}
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- for(auto & array : arrays)
+ for(std::size_t j=0;j<arrays.size();j++)
{
- if(array)
- array->applyLin(a,b,compoId);
+ if(arrays[j])
+ arrays[j]->applyLin(a,b,compoId);
}
}
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- for(auto & array : arrays)
+ for(std::size_t j=0;j<arrays.size();j++)
{
- if(array)
- array->applyLin(a,b);
+ if(arrays[j])
+ arrays[j]->applyLin(a,b);
}
}
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const std::string& func)
if(arrays[j])
arrays2[j]=arrays[j]->applyFunc(nbOfComp,func);
else
- arrays2[j]=nullptr;
+ arrays2[j]=0;
}
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::applyFuncCompo(int nbOfComp, const std::string& func)
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::applyFunc(const std::string& func)
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::applyFuncFast32(const std::string& func)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- for(auto & array : arrays)
+ for(std::size_t j=0;j<arrays.size();j++)
{
- if(array)
- array->applyFuncFast32(func);
+ if(arrays[j])
+ arrays[j]->applyFuncFast32(func);
}
}
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- for(auto & array : arrays)
+ for(std::size_t j=0;j<arrays.size();j++)
{
- if(array)
- array->applyFuncFast64(func);
+ if(arrays[j])
+ arrays[j]->applyFuncFast64(func);
}
}
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::fillFromAnalyticCompo(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::fillFromAnalyticNamedCompo(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
- setArrays(arrays3,nullptr);
+ setArrays(arrays3,0);
}
////////////////////////
reason="Time discretization is NULL.";
return false;
}
- const auto *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt32 *>(other));
+ const MEDCouplingTimeDiscretizationInt32 *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt32 *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt32 !");
if(!MEDCouplingTimeDiscretizationTemplate<Int32>::areStrictlyCompatible(other,reason))
{
if(prec!=0)
throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt32::isEqualWithoutConsideringStr : only precision 0 is supported !");
- const auto *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt32 *>(other));
+ const MEDCouplingTimeDiscretizationInt32 *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt32 *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationInt !");
std::string tmp;
reason="Time discretization is NULL.";
return false;
}
- const auto *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt64 *>(other));
+ const MEDCouplingTimeDiscretizationInt64 *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt64 *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt64 !");
if(!MEDCouplingTimeDiscretizationTemplate<Int64>::areStrictlyCompatible(other,reason))
{
if(prec!=0)
throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt64::isEqualWithoutConsideringStr : only precision 0 is supported !");
- const auto *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt64 *>(other));
+ const MEDCouplingTimeDiscretizationInt64 *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt64 *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationInt !");
std::string tmp;
reason="Time discretization is NULL.";
return false;
}
- const auto *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationFloat *>(other));
+ const MEDCouplingTimeDiscretizationFloat *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationFloat *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationFloat !");
if(!MEDCouplingTimeDiscretizationTemplate<float>::areStrictlyCompatible(other,reason))
{
if(prec!=0)
throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationFloat::isEqualWithoutConsideringStr : only precision 0 is supported !");
- const auto *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationFloat *>(other));
+ const MEDCouplingTimeDiscretizationFloat *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationFloat *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationFloat !");
std::string tmp;
////////////////////////
MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel()
-= default;
+{
+}
MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCopy):MEDCouplingTimeDiscretization(other,deepCopy)
{
return stream.str();
}
-void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh * /*mesh*/)
+void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh *mesh)
{
throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::synchronizeTimeWith : impossible to synchronize time with a MEDCouplingMesh because the time discretization is incompatible with it !");
}
{
if(!MEDCouplingTimeDiscretization::areCompatible(other))
return false;
- const auto *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
- return otherC!=nullptr;
+ const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
+ return otherC!=0;
}
bool MEDCouplingNoTimeLabel::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
return false;
- const auto *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
- bool const ret=otherC!=nullptr;
+ const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
+ bool ret=otherC!=0;
if(!ret)
reason.insert(0,"time discretization of this is NO_TIME, other has a different time discretization.");
return ret;
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
return false;
- const auto *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
- return otherC!=nullptr;
+ const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
+ return otherC!=0;
}
bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
return false;
- const auto *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
- return otherC!=nullptr;
+ const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
+ return otherC!=0;
}
bool MEDCouplingNoTimeLabel::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
{
if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
return false;
- const auto *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
- return otherC!=nullptr;
+ const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
+ return otherC!=0;
}
bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const
{
- const auto *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
+ const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
if(!otherC)
{
reason="This has time discretization NO_TIME, other not.";
bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const
{
- const auto *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
+ const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
if(!otherC)
return false;
return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
+ const MEDCouplingNoTimeLabel *otherC(dynamic_cast<const MEDCouplingNoTimeLabel *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::aggregation on mismatched time discretization !");
MCAuto<DataArrayDouble> arr(DataArrayDouble::Aggregate(getArray(),other->getArray()));
- auto *ret(new MEDCouplingNoTimeLabel);
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret(new MEDCouplingNoTimeLabel);
+ ret->setArray(arr,0);
return ret;
}
{
std::vector<const DataArrayDouble *> a(other.size());
int i=0;
- for(auto it=other.begin();it!=other.end();it++,i++)
+ for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
{
- const auto *itC=dynamic_cast<const MEDCouplingNoTimeLabel *>(*it);
+ const MEDCouplingNoTimeLabel *itC=dynamic_cast<const MEDCouplingNoTimeLabel *>(*it);
if(!itC)
throw INTERP_KERNEL::Exception("NoTimeLabel::aggregate on mismatched time discretization !");
a[i]=itC->getArray();
}
MCAuto<DataArrayDouble> arr(DataArrayDouble::Aggregate(a));
- auto *ret(new MEDCouplingNoTimeLabel);
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret(new MEDCouplingNoTimeLabel);
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::meld on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setTimeTolerance(getTimeTolerance());
- ret->setArray(arr,nullptr);
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::dot on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::crossProduct on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::add on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
+ ret->setArray(arr,0);
return ret;
}
void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::addEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::substract on mismatched time discretization !");
if(!getArray())
throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substract : Data Array is NULL !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
+ ret->setArray(arr,0);
return ret;
}
void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::substractEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::multiply on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
+ ret->setArray(arr,0);
return ret;
}
void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::multiplyEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
+ ret->setArray(arr,0);
return ret;
}
void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::divideEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
- auto *ret=new MEDCouplingNoTimeLabel;
- ret->setArray(arr,nullptr);
+ MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
+ ret->setArray(arr,0);
return ret;
}
void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
+ const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::powEqual on mismatched time discretization !");
if(!getArray())
return new MEDCouplingNoTimeLabel(*this,deepCopy);
}
-void MEDCouplingNoTimeLabel::checkTimePresence(double /*time*/) const
+void MEDCouplingNoTimeLabel::checkTimePresence(double time) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-std::vector< const DataArrayDouble *> MEDCouplingNoTimeLabel::getArraysForTime(double /*time*/) const
+std::vector< const DataArrayDouble *> MEDCouplingNoTimeLabel::getArraysForTime(double time) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::getValueForTime(double /*time*/, const std::vector<double>& /*vals*/, double * /*res*/) const
+void MEDCouplingNoTimeLabel::getValueForTime(double time, const std::vector<double>& vals, double *res) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-bool MEDCouplingNoTimeLabel::isBefore(const MEDCouplingTimeDiscretization * /*other*/) const
+bool MEDCouplingNoTimeLabel::isBefore(const MEDCouplingTimeDiscretization *other) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-bool MEDCouplingNoTimeLabel::isStrictlyBefore(const MEDCouplingTimeDiscretization * /*other*/) const
+bool MEDCouplingNoTimeLabel::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-double MEDCouplingNoTimeLabel::getStartTime(int& /*iteration*/, int& /*order*/) const
+double MEDCouplingNoTimeLabel::getStartTime(int& iteration, int& order) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-double MEDCouplingNoTimeLabel::getEndTime(int& /*iteration*/, int& /*order*/) const
+double MEDCouplingNoTimeLabel::getEndTime(int& iteration, int& order) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::setStartIteration(int /*it*/)
+void MEDCouplingNoTimeLabel::setStartIteration(int it)
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::setEndIteration(int /*it*/)
+void MEDCouplingNoTimeLabel::setEndIteration(int it)
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::setStartOrder(int /*order*/)
+void MEDCouplingNoTimeLabel::setStartOrder(int order)
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::setEndOrder(int /*order*/)
+void MEDCouplingNoTimeLabel::setEndOrder(int order)
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::setStartTimeValue(double /*time*/)
+void MEDCouplingNoTimeLabel::setStartTimeValue(double time)
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::setEndTimeValue(double /*time*/)
+void MEDCouplingNoTimeLabel::setEndTimeValue(double time)
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::setStartTime(double /*time*/, int /*iteration*/, int /*order*/)
+void MEDCouplingNoTimeLabel::setStartTime(double time, int iteration, int order)
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::setEndTime(double /*time*/, int /*iteration*/, int /*order*/)
+void MEDCouplingNoTimeLabel::setEndTime(double time, int iteration, int order)
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::getValueOnTime(mcIdType /*eltId*/, double /*time*/, double * /*value*/) const
+void MEDCouplingNoTimeLabel::getValueOnTime(mcIdType eltId, double time, double *value) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingNoTimeLabel::getValueOnDiscTime(mcIdType /*eltId*/, int /*iteration*/, int /*order*/, double * /*value*/) const
+void MEDCouplingNoTimeLabel::getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const
{
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
/*!
* idem finishUnserialization except that it is for multi field fetch
*/
-void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<mcIdType>& /*tinyInfoI*/, const std::vector<double>& tinyInfoD)
+void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD)
{
_time_tolerance=tinyInfoD[0];
}
}
MEDCouplingWithTimeStep::MEDCouplingWithTimeStep()
-= default;
+{
+}
std::string MEDCouplingWithTimeStep::getStringRepr() const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
int it=-1,order=-1;
- double const val=mesh->getTime(it,order);
+ double val=mesh->getTime(it,order);
_tk.setAllInfo(val,it,order);
- std::string const tUnit(mesh->getTimeUnit());
+ std::string tUnit(mesh->getTimeUnit());
setTimeUnit(tUnit);
}
{
if(!MEDCouplingTimeDiscretization::areCompatible(other))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
- return otherC!=nullptr;
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ return otherC!=0;
}
bool MEDCouplingWithTimeStep::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
- bool const ret=otherC!=nullptr;
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ bool ret=otherC!=0;
if(!ret)
reason.insert(0,"time discretization of this is ONE_TIME, other has a different time discretization.");
return ret;
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
- return otherC!=nullptr;
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ return otherC!=0;
}
bool MEDCouplingWithTimeStep::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
- return otherC!=nullptr;
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ return otherC!=0;
}
bool MEDCouplingWithTimeStep::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
{
if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
- return otherC!=nullptr;
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ return otherC!=0;
}
bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
std::ostringstream oss; oss.precision(15);
if(!otherC)
{
bool MEDCouplingWithTimeStep::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
return false;
if(!_tk.isEqual(otherC->_tk,_time_tolerance))
void MEDCouplingWithTimeStep::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other)
{
MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(&other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(&other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::copyTinyAttrFrom : mismatch of time discretization !");
_tk.copyFrom(otherC->_tk);
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::aggregation on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
return ret;
}
{
std::vector<const DataArrayDouble *> a(other.size());
int i=0;
- for(auto it=other.begin();it!=other.end();it++,i++)
+ for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
{
- const auto *itC=dynamic_cast<const MEDCouplingWithTimeStep *>(*it);
+ const MEDCouplingWithTimeStep *itC=dynamic_cast<const MEDCouplingWithTimeStep *>(*it);
if(!itC)
throw INTERP_KERNEL::Exception("WithTimeStep::aggregate on mismatched time discretization !");
a[i]=itC->getArray();
}
MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::meld on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::dot on mismatched time discretization !");
- auto *ret=new MEDCouplingWithTimeStep;
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
MCAuto<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
- ret->setArray(arr,nullptr);
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::crossProduct on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::max on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::min on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::add on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
int tmp1,tmp2;
- double const tmp3=getStartTime(tmp1,tmp2);
+ double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
return ret;
}
void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::addEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::substract on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
int tmp1,tmp2;
- double const tmp3=getStartTime(tmp1,tmp2);
+ double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
return ret;
}
void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::substractEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::multiply on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
int tmp1,tmp2;
- double const tmp3=getStartTime(tmp1,tmp2);
+ double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
return ret;
}
void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::multiplyEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::divide on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
int tmp1,tmp2;
- double const tmp3=getStartTime(tmp1,tmp2);
+ double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
return ret;
}
void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::divideEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::pow on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
- auto *ret=new MEDCouplingWithTimeStep;
- ret->setArray(arr,nullptr);
+ MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
+ ret->setArray(arr,0);
int tmp1,tmp2;
- double const tmp3=getStartTime(tmp1,tmp2);
+ double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
return ret;
}
void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
+ const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::powEqual on mismatched time discretization !");
if(!getArray())
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingWithTimeStep::getValueForTime(double /*time*/, const std::vector<double>& vals, double *res) const
+void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector<double>& vals, double *res) const
{
std::copy(vals.begin(),vals.end(),res);
}
}
MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval()
-= default;
+{
+}
void MEDCouplingConstOnTimeInterval::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other)
{
MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(&other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(&other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::copyTinyAttrFrom : mismatch of time discretization !");
_start.copyFrom(otherC->_start);
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
int it=-1,order=-1;
- double const val=mesh->getTime(it,order);
+ double val=mesh->getTime(it,order);
_start.setAllInfo(val,it,order);
_end.setAllInfo(val,it,order);
- std::string const tUnit(mesh->getTimeUnit());
+ std::string tUnit(mesh->getTimeUnit());
setTimeUnit(tUnit);
}
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingConstOnTimeInterval::getValueForTime(double /*time*/, const std::vector<double>& vals, double *res) const
+void MEDCouplingConstOnTimeInterval::getValueForTime(double time, const std::vector<double>& vals, double *res) const
{
std::copy(vals.begin(),vals.end(),res);
}
{
if(!MEDCouplingTimeDiscretization::areCompatible(other))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
- return otherC!=nullptr;
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ return otherC!=0;
}
bool MEDCouplingConstOnTimeInterval::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
- bool const ret=otherC!=nullptr;
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ bool ret=otherC!=0;
if(!ret)
reason.insert(0,"time discretization of this is CONST_ON_TIME_INTERVAL, other has a different time discretization.");
return ret;
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
return false;
- const auto *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
- return otherC!=nullptr;
+ const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
+ return otherC!=0;
}
bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
return false;
- const auto *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
- return otherC!=nullptr;
+ const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
+ return otherC!=0;
}
bool MEDCouplingConstOnTimeInterval::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
{
if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
return false;
- const auto *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
- return otherC!=nullptr;
+ const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
+ return otherC!=0;
}
bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const
{
- const auto *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
+ const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
std::ostringstream oss; oss.precision(15);
if(!otherC)
{
bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const
{
- const auto *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
+ const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other));
if(!otherC)
return false;
if(!_start.isEqual(otherC->_start,_time_tolerance))
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
-void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(mcIdType eltId, int iteration, int /*order*/, double *value) const
+void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const
{
if(iteration>=_start.getIteration() && iteration<=_end.getIteration())
if(_array)
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregation on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
return ret;
}
{
std::vector<const DataArrayDouble *> a(other.size());
int i=0;
- for(auto it=other.begin();it!=other.end();it++,i++)
+ for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
{
- const auto *itC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(*it);
+ const MEDCouplingConstOnTimeInterval *itC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(*it);
if(!itC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregate on mismatched time discretization !");
a[i]=itC->getArray();
}
MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::meld on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setTimeTolerance(getTimeTolerance());
- ret->setArray(arr,nullptr);
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::dot on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::crossProduct on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::max on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::min on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::add on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
int tmp1,tmp2;
double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::addEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substract on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
int tmp1,tmp2;
double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substractEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("multiply on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
int tmp1,tmp2;
double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::multiplyEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
int tmp1,tmp2;
double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::divideEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
MCAuto<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
- auto *ret=new MEDCouplingConstOnTimeInterval;
- ret->setArray(arr,nullptr);
+ MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
+ ret->setArray(arr,0);
int tmp1,tmp2;
double tmp3=getStartTime(tmp1,tmp2);
ret->setStartTime(tmp3,tmp1,tmp2);
void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
+ const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::powEqual on mismatched time discretization !");
if(!getArray())
if(other._end_array)
_end_array=other._end_array->performCopyOrIncrRef(deepCopy);
else
- _end_array=nullptr;
+ _end_array=0;
}
void MEDCouplingTwoTimeSteps::updateTime() const
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !");
int it=-1,order=-1;
- double const val=mesh->getTime(it,order);
+ double val=mesh->getTime(it,order);
_start.setAllInfo(val,it,order);
_end.setAllInfo(val,it,order);
- std::string const tUnit(mesh->getTimeUnit());
+ std::string tUnit(mesh->getTimeUnit());
setTimeUnit(tUnit);
}
void MEDCouplingTwoTimeSteps::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other)
{
MEDCouplingTimeDiscretization::copyTinyAttrFrom(other);
- const auto *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
+ const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::copyTinyAttrFrom : mismatch of time discretization !");
_start.copyFrom(otherC->_start);
void MEDCouplingTwoTimeSteps::copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other)
{
MEDCouplingTimeDiscretization::copyTinyStringsFrom(other);
- const auto *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
+ const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
if(!otherC)
throw INTERP_KERNEL::Exception("Trying to operate copyTinyStringsFrom on different field type (two times//one time) !");
if(_end_array && otherC->_end_array)
bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const
{
- std::ostringstream const oss;
- const auto *otherC(dynamic_cast<const MEDCouplingTwoTimeSteps *>(other));
+ std::ostringstream oss;
+ const MEDCouplingTwoTimeSteps *otherC(dynamic_cast<const MEDCouplingTwoTimeSteps *>(other));
if(!otherC)
{
reason="This has time discretization LINEAR_TIME, other not.";
bool MEDCouplingTwoTimeSteps::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const
{
- const auto *otherC(dynamic_cast<const MEDCouplingTwoTimeSteps *>(other));
+ const MEDCouplingTwoTimeSteps *otherC(dynamic_cast<const MEDCouplingTwoTimeSteps *>(other));
if(!otherC)
return false;
if(!_start.isEqual(otherC->_start,_time_tolerance))
return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
}
-MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps():_end_array(nullptr)
+MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps():_end_array(0)
{
}
void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
- std::size_t const nbOfCompo=_array->getNumberOfComponents();
+ std::size_t nbOfCompo=_array->getNumberOfComponents();
for(std::size_t i=0;i<nbOfCompo;i++)
tinyInfo.push_back(_array->getInfoOnComponent(i));
for(std::size_t i=0;i<nbOfCompo;i++)
void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
{
arrays.resize(2);
- if(_array!=nullptr)
+ if(_array!=0)
_array->decrRef();
- if(_end_array!=nullptr)
+ if(_end_array!=0)
_end_array->decrRef();
- DataArrayDouble *arr=nullptr;
+ DataArrayDouble *arr=0;
if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
{
arr=DataArrayDouble::New();
}
_array=arr;
arrays[0]=arr;
- arr=nullptr;
+ arr=0;
if(tinyInfoI[6]!=-1 && tinyInfoI[7]!=-1)
{
arr=DataArrayDouble::New();
static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size two !";
if(arrays.size()!=2)
throw INTERP_KERNEL::Exception(MSG);
- if(_array!=nullptr)
+ if(_array!=0)
_array->decrRef();
- if(_end_array!=nullptr)
+ if(_end_array!=0)
_end_array->decrRef();
- _array=nullptr; _end_array=nullptr;
+ _array=0; _end_array=0;
if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
{
if(!arrays[0])
}
MEDCouplingLinearTime::MEDCouplingLinearTime()
-= default;
+{
+}
std::string MEDCouplingLinearTime::getStringRepr() const
{
{
if(!MEDCouplingTimeDiscretization::areCompatible(other))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
- if(otherC==nullptr)
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ if(otherC==0)
return false;
- if(_end_array==nullptr && otherC->_end_array==nullptr)
+ if(_end_array==0 && otherC->_end_array==0)
return true;
- if(_end_array==nullptr || otherC->_end_array==nullptr)
+ if(_end_array==0 || otherC->_end_array==0)
return false;
if(_end_array->getNumberOfComponents()!=otherC->_end_array->getNumberOfComponents())
return false;
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
- bool const ret=otherC!=nullptr;
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ bool ret=otherC!=0;
if(!ret)
reason.insert(0,"time discretization of this is LINEAR_TIME, other has a different time discretization.");
return ret;
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
- return otherC!=nullptr;
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ return otherC!=0;
}
bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const
{
if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
- if(otherC==nullptr)
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ if(otherC==0)
return false;
- if(_end_array==nullptr && otherC->_end_array==nullptr)
+ if(_end_array==0 && otherC->_end_array==0)
return true;
- if(_end_array==nullptr || otherC->_end_array==nullptr)
+ if(_end_array==0 || otherC->_end_array==0)
return false;
- std::size_t const nbC1=_end_array->getNumberOfComponents();
- std::size_t const nbC2=otherC->_end_array->getNumberOfComponents();
+ std::size_t nbC1=_end_array->getNumberOfComponents();
+ std::size_t nbC2=otherC->_end_array->getNumberOfComponents();
if(nbC1!=nbC2 && nbC2!=1)
return false;
return true;
{
if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
return false;
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
- return otherC!=nullptr;
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ return otherC!=0;
}
/*!
*/
void MEDCouplingLinearTime::getValueForTime(double time, const std::vector<double>& vals, double *res) const
{
- double const alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue());
- std::size_t const nbComp=vals.size()/2;
+ double alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue());
+ std::size_t nbComp=vals.size()/2;
std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind(std::multiplies<double>(),std::placeholders::_1,alpha));
std::vector<double> tmp(nbComp);
std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind(std::multiplies<double>(),std::placeholders::_1,1-alpha));
void MEDCouplingLinearTime::getValueOnTime(mcIdType eltId, double time, double *value) const
{
- double const alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue());
+ double alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue());
if(_array)
_array->getTuple(eltId,value);
else
throw INTERP_KERNEL::Exception("No start array existing.");
- std::size_t const nbComp=_array->getNumberOfComponents();
+ std::size_t nbComp=_array->getNumberOfComponents();
std::transform(value,value+nbComp,value,std::bind(std::multiplies<double>(),std::placeholders::_1,alpha));
std::vector<double> tmp(nbComp);
if(_end_array)
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::aggregation on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1=DataArrayDouble::Aggregate(getArray(),other->getArray());
MCAuto<DataArrayDouble> arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray());
- auto *ret=new MEDCouplingLinearTime;
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
std::vector<const DataArrayDouble *> a(other.size());
std::vector<const DataArrayDouble *> b(other.size());
int i=0;
- for(auto it=other.begin();it!=other.end();it++,i++)
+ for(std::vector<const MEDCouplingTimeDiscretization *>::const_iterator it=other.begin();it!=other.end();it++,i++)
{
- const auto *itC=dynamic_cast<const MEDCouplingLinearTime *>(*it);
+ const MEDCouplingLinearTime *itC=dynamic_cast<const MEDCouplingLinearTime *>(*it);
if(!itC)
throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::aggregate on mismatched time discretization !");
a[i]=itC->getArray();
b[i]=itC->getEndArray();
}
MCAuto<DataArrayDouble> arr(DataArrayDouble::Aggregate(a)),arr2(DataArrayDouble::Aggregate(b));
- auto *ret(new MEDCouplingLinearTime);
- ret->setArray(arr,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
+ ret->setArray(arr,0);
+ ret->setEndArray(arr2,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::meld on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1(DataArrayDouble::Meld(getArray(),other->getArray())),arr2(DataArrayDouble::Meld(getEndArray(),other->getEndArray()));
- auto *ret(new MEDCouplingLinearTime);
+ MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
ret->setTimeTolerance(getTimeTolerance());
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::dot on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1(DataArrayDouble::Dot(getArray(),other->getArray())),arr2(DataArrayDouble::Dot(getEndArray(),other->getEndArray()));
- auto *ret(new MEDCouplingLinearTime);
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::crossProduct on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1(DataArrayDouble::CrossProduct(getArray(),other->getArray())),arr2(DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray()));
- auto *ret(new MEDCouplingLinearTime);
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::max on mismatched time discretization !");
- auto *ret=new MEDCouplingLinearTime;
+ MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
MCAuto<DataArrayDouble> arr1(DataArrayDouble::Max(getArray(),other->getArray())),arr2(DataArrayDouble::Max(getEndArray(),other->getEndArray()));
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::min on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1(DataArrayDouble::Min(getArray(),other->getArray())),arr2(DataArrayDouble::Min(getEndArray(),other->getEndArray()));
- auto *ret(new MEDCouplingLinearTime);
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::add on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1(DataArrayDouble::Add(getArray(),other->getArray())),arr2(DataArrayDouble::Add(getEndArray(),other->getEndArray()));
- auto *ret(new MEDCouplingLinearTime);
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret(new MEDCouplingLinearTime);
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::substract on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1=DataArrayDouble::Substract(getArray(),other->getArray());
MCAuto<DataArrayDouble> arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray());
- auto *ret=new MEDCouplingLinearTime;
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::multiply on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1=DataArrayDouble::Multiply(getArray(),other->getArray());
MCAuto<DataArrayDouble> arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray());
- auto *ret=new MEDCouplingLinearTime;
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::divide on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1=DataArrayDouble::Divide(getArray(),other->getArray());
MCAuto<DataArrayDouble> arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray());
- auto *ret=new MEDCouplingLinearTime;
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
if(!getArray())
MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeDiscretization *other) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::pow on mismatched time discretization !");
MCAuto<DataArrayDouble> arr1=DataArrayDouble::Pow(getArray(),other->getArray());
MCAuto<DataArrayDouble> arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray());
- auto *ret=new MEDCouplingLinearTime;
- ret->setArray(arr1,nullptr);
- ret->setEndArray(arr2,nullptr);
+ MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
+ ret->setArray(arr1,0);
+ ret->setEndArray(arr2,0);
return ret;
}
void MEDCouplingLinearTime::powEqual(const MEDCouplingTimeDiscretization *other)
{
- const auto *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
+ const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !");
if(!getArray())
#ifndef __MEDCOUPLINGTIMEDISCRETIZATION_HXX__
#define __MEDCOUPLINGTIMEDISCRETIZATION_HXX__
-#include "MCType.hxx"
#include "MEDCoupling.hxx"
#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingRefCountObject.hxx"
+#include "InterpKernelException.hxx"
#include "MEDCouplingTraits.hxx"
-#include <string>
-#include <cstddef>
#include <vector>
namespace MEDCoupling
void copyTinyAttrFrom(const TimeHolder& other) { _time_unit=other._time_unit; }
protected:
TimeHolder() { }
- TimeHolder(const TimeHolder& other) = default;
- virtual ~TimeHolder() = default;
+ TimeHolder(const TimeHolder& other):_time_unit(other._time_unit) { }
+ virtual ~TimeHolder() { }
private:
std::string _time_unit;
};
class MEDCouplingTimeDiscretizationTemplate : public TimeLabel, public BigMemoryObject, public TimeHolder
{
public:
- MEDCOUPLING_EXPORT void updateTime() const override;
+ MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT virtual void setArray(typename Traits<T>::ArrayType *array, TimeLabel *owner);
MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *getArray() { return _array; }
MEDCOUPLING_EXPORT const typename Traits<T>::ArrayType *getArray() const { return _array; }
MEDCOUPLING_EXPORT virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<T>& other);
MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate<T>& other);
MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT virtual std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
//
MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<T> *other, T prec, std::string& reason) const = 0;
MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<T> *other, T prec) const = 0;
MEDCOUPLING_EXPORT virtual bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<T> *other) const;
MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<T> *other) const;
MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<T> *other) const;
- MEDCOUPLING_EXPORT ~MEDCouplingTimeDiscretizationTemplate() override;
+ MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretizationTemplate();
MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
class MEDCouplingTimeKeeper
{
public:
- MEDCOUPLING_EXPORT MEDCouplingTimeKeeper() = default;
+ MEDCOUPLING_EXPORT MEDCouplingTimeKeeper():_time(0.),_iteration(-1),_order(-1) { }
MEDCOUPLING_EXPORT double getAllInfo(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; }
MEDCOUPLING_EXPORT void setAllInfo(double time, int iteration, int order) { _time=time; _iteration=iteration; _order=order; }
MEDCOUPLING_EXPORT int getIteration() const { return _iteration; }
MEDCOUPLING_EXPORT void copyFrom(const MEDCouplingTimeKeeper& other);
MEDCOUPLING_EXPORT void checkTimePresence(double time, double eps) const;
private:
- double _time{0.};
- int _iteration{-1};
- int _order{-1};
+ double _time;
+ int _iteration;
+ int _order;
};
class MEDCouplingTimeDiscretization : public MEDCouplingTimeDiscretizationTemplate<double>
public:
MEDCOUPLING_EXPORT static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
MEDCOUPLING_EXPORT virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const override;
+ MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const;
+ MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const;
MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCopy) const;
MEDCOUPLING_EXPORT virtual void synchronizeTimeWith(const MEDCouplingMesh *mesh) = 0;
class MEDCouplingTimeDiscretizationSimple : public MEDCouplingTimeDiscretizationTemplate<T>
{
public:
- std::string getStringRepr() const override;
- double getStartTime(int& iteration, int& order) const override { return _tk.getAllInfo(iteration,order); }
- void setStartIteration(int it) override { _tk.setIteration(it); }
- void setStartOrder(int order) override { _tk.setOrder(order); }
- void setStartTimeValue(double time) override { _tk.setTimeValue(time); }
- void setStartTime(double time, int iteration, int order) override { _tk.setAllInfo(time,iteration,order); }
- double getEndTime(int& iteration, int& order) const override;
- void setEndIteration(int it) override;
- void setEndOrder(int order) override;
- void setEndTimeValue(double time) override;
- void setEndTime(double time, int iteration, int order) override;
- TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; }
+ std::string getStringRepr() const;
+ double getStartTime(int& iteration, int& order) const { return _tk.getAllInfo(iteration,order); }
+ void setStartIteration(int it) { _tk.setIteration(it); }
+ void setStartOrder(int order) { _tk.setOrder(order); }
+ void setStartTimeValue(double time) { _tk.setTimeValue(time); }
+ void setStartTime(double time, int iteration, int order) { _tk.setAllInfo(time,iteration,order); }
+ double getEndTime(int& iteration, int& order) const;
+ void setEndIteration(int it);
+ void setEndOrder(int order);
+ void setEndTimeValue(double time);
+ void setEndTime(double time, int iteration, int order);
+ TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
protected:
MEDCouplingTimeDiscretizationSimple(const MEDCouplingTimeDiscretizationSimple<T>& other, bool deepCopy);
MEDCouplingTimeDiscretizationSimple() { }
class MEDCouplingTimeDiscretizationInt32 : public MEDCouplingTimeDiscretizationSimple<Int32>
{
public:
- MEDCouplingTimeDiscretizationInt32() = default;
+ MEDCouplingTimeDiscretizationInt32() { }
std::string getClassName() const override { return std::string("MEDCouplingTimeDiscretizationInt32"); }
MEDCouplingTimeDiscretizationInt32(const MEDCouplingTimeDiscretizationInt32& other, bool deepCopy);
static MEDCouplingTimeDiscretizationInt32 *New(TypeOfTimeDiscretization type);
- MEDCouplingTimeDiscretizationInt32 *performCopyOrIncrRef(bool deepCopy) const override;
- bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<Int32> *other, Int32 prec, std::string& reason) const override;
- bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<Int32> *other, Int32 prec) const override;
+ MEDCouplingTimeDiscretizationInt32 *performCopyOrIncrRef(bool deepCopy) const;
+ bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<Int32> *other, Int32 prec, std::string& reason) const;
+ bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<Int32> *other, Int32 prec) const;
};
class MEDCouplingTimeDiscretizationInt64 : public MEDCouplingTimeDiscretizationSimple<Int64>
{
public:
- MEDCouplingTimeDiscretizationInt64() = default;
+ MEDCouplingTimeDiscretizationInt64() { }
std::string getClassName() const override { return std::string("MEDCouplingTimeDiscretizationInt64"); }
MEDCouplingTimeDiscretizationInt64(const MEDCouplingTimeDiscretizationInt64& other, bool deepCopy);
static MEDCouplingTimeDiscretizationInt64 *New(TypeOfTimeDiscretization type);
- MEDCouplingTimeDiscretizationInt64 *performCopyOrIncrRef(bool deepCopy) const override;
+ MEDCouplingTimeDiscretizationInt64 *performCopyOrIncrRef(bool deepCopy) const;
bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<Int64> *other, Int64 prec, std::string& reason) const override;
bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<Int64> *other, Int64 prec) const override;
};
class MEDCouplingTimeDiscretizationFloat : public MEDCouplingTimeDiscretizationSimple<float>
{
public:
- MEDCouplingTimeDiscretizationFloat() = default;
+ MEDCouplingTimeDiscretizationFloat() { }
std::string getClassName() const override { return std::string("MEDCouplingTimeDiscretizationFloat"); }
MEDCouplingTimeDiscretizationFloat(const MEDCouplingTimeDiscretizationFloat& other, bool deepCopy);
static MEDCouplingTimeDiscretizationFloat *New(TypeOfTimeDiscretization type);
- MEDCouplingTimeDiscretizationFloat *performCopyOrIncrRef(bool deepCopy) const override;
- bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec, std::string& reason) const override;
- bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec) const override;
+ MEDCouplingTimeDiscretizationFloat *performCopyOrIncrRef(bool deepCopy) const;
+ bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec, std::string& reason) const;
+ bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec) const;
private:
static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
};
public:
MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel();
MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCopy);
- MEDCOUPLING_EXPORT std::string getStringRepr() const override;
+ MEDCOUPLING_EXPORT std::string getStringRepr() const;
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingNoTimeLabel"); }
- MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; }
- MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const override;
- MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const override;
- MEDCOUPLING_EXPORT void checkNoTimePresence() const override { }
- MEDCOUPLING_EXPORT void checkTimePresence(double time) const override;
- MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const override;
- MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const override;
- MEDCOUPLING_EXPORT bool isBefore(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const override;
- MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const override;
- MEDCOUPLING_EXPORT void setStartIteration(int it) override;
- MEDCOUPLING_EXPORT void setEndIteration(int it) override;
- MEDCOUPLING_EXPORT void setStartOrder(int order) override;
- MEDCOUPLING_EXPORT void setEndOrder(int order) override;
- MEDCOUPLING_EXPORT void setStartTimeValue(double time) override;
- MEDCOUPLING_EXPORT void setEndTimeValue(double time) override;
- MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) override;
- MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) override;
- MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const override;
- MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const override;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD) override;
+ MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+ MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const;
+ MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const;
+ MEDCOUPLING_EXPORT void checkNoTimePresence() const { }
+ MEDCOUPLING_EXPORT void checkTimePresence(double time) const;
+ MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
+ MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
+ MEDCOUPLING_EXPORT bool isBefore(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const;
+ MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const;
+ MEDCOUPLING_EXPORT void setStartIteration(int it);
+ MEDCOUPLING_EXPORT void setEndIteration(int it);
+ MEDCOUPLING_EXPORT void setStartOrder(int order);
+ MEDCOUPLING_EXPORT void setEndOrder(int order);
+ MEDCOUPLING_EXPORT void setStartTimeValue(double time);
+ MEDCOUPLING_EXPORT void setEndTimeValue(double time);
+ MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order);
+ MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order);
+ MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD);
public:
static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME;
MEDCOUPLING_EXPORT static const char REPR[];
public:
MEDCOUPLING_EXPORT MEDCouplingWithTimeStep();
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingWithTimeLabel"); }
- MEDCOUPLING_EXPORT std::string getStringRepr() const override;
- MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other) override;
- MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; }
- MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const override;
- MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) override;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const override;
- MEDCOUPLING_EXPORT void checkNoTimePresence() const override;
- MEDCOUPLING_EXPORT void checkTimePresence(double time) const override;
- MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) override { _tk.setAllInfo(time,iteration,order); }
- MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) override { _tk.setAllInfo(time,iteration,order); }
- MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const override { return _tk.getAllInfo(iteration,order); }
- MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const override { return _tk.getAllInfo(iteration,order); }
- MEDCOUPLING_EXPORT void setStartIteration(int it) override { _tk.setIteration(it); }
- MEDCOUPLING_EXPORT void setEndIteration(int it) override { _tk.setIteration(it); }
- MEDCOUPLING_EXPORT void setStartOrder(int order) override { _tk.setOrder(order); }
- MEDCOUPLING_EXPORT void setEndOrder(int order) override { _tk.setOrder(order); }
- MEDCOUPLING_EXPORT void setStartTimeValue(double time) override { _tk.setTimeValue(time); }
- MEDCOUPLING_EXPORT void setEndTimeValue(double time) override { _tk.setTimeValue(time); }
- MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const override;
- MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const override;
- MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const override;
- MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const override;
+ MEDCOUPLING_EXPORT std::string getStringRepr() const;
+ MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other);
+ MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+ MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const;
+ MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const;
+ MEDCOUPLING_EXPORT void checkNoTimePresence() const;
+ MEDCOUPLING_EXPORT void checkTimePresence(double time) const;
+ MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _tk.setAllInfo(time,iteration,order); }
+ MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) { _tk.setAllInfo(time,iteration,order); }
+ MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { return _tk.getAllInfo(iteration,order); }
+ MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { return _tk.getAllInfo(iteration,order); }
+ MEDCOUPLING_EXPORT void setStartIteration(int it) { _tk.setIteration(it); }
+ MEDCOUPLING_EXPORT void setEndIteration(int it) { _tk.setIteration(it); }
+ MEDCOUPLING_EXPORT void setStartOrder(int order) { _tk.setOrder(order); }
+ MEDCOUPLING_EXPORT void setEndOrder(int order) { _tk.setOrder(order); }
+ MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _tk.setTimeValue(time); }
+ MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _tk.setTimeValue(time); }
+ MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
+ MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
+ MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const;
public:
static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
MEDCOUPLING_EXPORT static const char REPR[];
public:
MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval();
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingConstOnTimeInterval"); }
- MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other) override;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) override;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const override;
- MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const override;
- MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const override;
- MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const override;
- MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const override;
- MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const override;
- MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; }
- MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh) override;
- MEDCOUPLING_EXPORT std::string getStringRepr() const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) override { _start.setAllInfo(time,iteration,order); }
- MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) override { _end.setAllInfo(time,iteration,order); }
- MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const override { return _start.getAllInfo(iteration,order); }
- MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const override { return _end.getAllInfo(iteration,order); }
- MEDCOUPLING_EXPORT void setStartIteration(int it) override { _start.setIteration(it); }
- MEDCOUPLING_EXPORT void setEndIteration(int it) override { _end.setIteration(it); }
- MEDCOUPLING_EXPORT void setStartOrder(int order) override { _start.setOrder(order); }
- MEDCOUPLING_EXPORT void setEndOrder(int order) override { _end.setOrder(order); }
- MEDCOUPLING_EXPORT void setStartTimeValue(double time) override { _start.setTimeValue(time); }
- MEDCOUPLING_EXPORT void setEndTimeValue(double time) override { _end.setTimeValue(time); }
- MEDCOUPLING_EXPORT void checkNoTimePresence() const override;
- MEDCOUPLING_EXPORT void checkTimePresence(double time) const override;
+ MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other);
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const;
+ MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const;
+ MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
+ MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
+ MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const;
+ MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+ MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh);
+ MEDCOUPLING_EXPORT std::string getStringRepr() const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _start.setAllInfo(time,iteration,order); }
+ MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) { _end.setAllInfo(time,iteration,order); }
+ MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { return _start.getAllInfo(iteration,order); }
+ MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { return _end.getAllInfo(iteration,order); }
+ MEDCOUPLING_EXPORT void setStartIteration(int it) { _start.setIteration(it); }
+ MEDCOUPLING_EXPORT void setEndIteration(int it) { _end.setIteration(it); }
+ MEDCOUPLING_EXPORT void setStartOrder(int order) { _start.setOrder(order); }
+ MEDCOUPLING_EXPORT void setEndOrder(int order) { _end.setOrder(order); }
+ MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _start.setTimeValue(time); }
+ MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _end.setTimeValue(time); }
+ MEDCOUPLING_EXPORT void checkNoTimePresence() const;
+ MEDCOUPLING_EXPORT void checkTimePresence(double time) const;
public:
static const TypeOfTimeDiscretization DISCRETIZATION=CONST_ON_TIME_INTERVAL;
MEDCOUPLING_EXPORT static const char REPR[];
protected:
MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCopy);
MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps();
- MEDCOUPLING_EXPORT ~MEDCouplingTwoTimeSteps() override;
+ MEDCOUPLING_EXPORT ~MEDCouplingTwoTimeSteps();
public:
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingTwoTimeSteps"); }
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh) override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other) override;
- MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other) override;
- MEDCOUPLING_EXPORT const DataArrayDouble *getEndArray() const override;
- MEDCOUPLING_EXPORT DataArrayDouble *getEndArray() override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const override;
- MEDCOUPLING_EXPORT void checkNoTimePresence() const override;
- MEDCOUPLING_EXPORT void checkTimePresence(double time) const override;
- MEDCOUPLING_EXPORT void getArrays(std::vector<DataArrayDouble *>& arrays) const override;
- MEDCOUPLING_EXPORT void setEndArray(DataArrayDouble *array, TimeLabel *owner) override;
- MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) override { _start.setAllInfo(time,iteration,order); }
- MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) override { _end.setAllInfo(time,iteration,order); }
- MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const override { return _start.getAllInfo(iteration,order); }
- MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const override { return _end.getAllInfo(iteration,order); }
- MEDCOUPLING_EXPORT void setStartIteration(int it) override { _start.setIteration(it); }
- MEDCOUPLING_EXPORT void setEndIteration(int it) override { _end.setIteration(it); }
- MEDCOUPLING_EXPORT void setStartOrder(int order) override { _start.setOrder(order); }
- MEDCOUPLING_EXPORT void setEndOrder(int order) override { _end.setOrder(order); }
- MEDCOUPLING_EXPORT void setStartTimeValue(double time) override { _start.setTimeValue(time); }
- MEDCOUPLING_EXPORT void setEndTimeValue(double time) override { _end.setTimeValue(time); }
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, std::vector<DataArrayDouble *>& arrays) override;
- MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays) override;
- MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) override;
- MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD) override;
- MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const override;
- MEDCOUPLING_EXPORT void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) override;
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh);
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other);
+ MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate<double>& other);
+ MEDCOUPLING_EXPORT const DataArrayDouble *getEndArray() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getEndArray();
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkNoTimePresence() const;
+ MEDCOUPLING_EXPORT void checkTimePresence(double time) const;
+ MEDCOUPLING_EXPORT void getArrays(std::vector<DataArrayDouble *>& arrays) const;
+ MEDCOUPLING_EXPORT void setEndArray(DataArrayDouble *array, TimeLabel *owner);
+ MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _start.setAllInfo(time,iteration,order); }
+ MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) { _end.setAllInfo(time,iteration,order); }
+ MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { return _start.getAllInfo(iteration,order); }
+ MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { return _end.getAllInfo(iteration,order); }
+ MEDCOUPLING_EXPORT void setStartIteration(int it) { _start.setIteration(it); }
+ MEDCOUPLING_EXPORT void setEndIteration(int it) { _end.setIteration(it); }
+ MEDCOUPLING_EXPORT void setStartOrder(int order) { _start.setOrder(order); }
+ MEDCOUPLING_EXPORT void setEndOrder(int order) { _end.setOrder(order); }
+ MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _start.setTimeValue(time); }
+ MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _end.setTimeValue(time); }
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
+ MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays);
+ MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD);
+ MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
+ MEDCOUPLING_EXPORT void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner);
protected:
static const char EXCEPTION_MSG[];
protected:
MEDCOUPLING_EXPORT MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCopy);
public:
MEDCOUPLING_EXPORT MEDCouplingLinearTime();
- MEDCOUPLING_EXPORT std::string getStringRepr() const override;
- MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; }
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const override;
- MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const override;
- MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const override;
- MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const override;
- MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other) override;
- MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const override;
- MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other) override;
+ MEDCOUPLING_EXPORT std::string getStringRepr() const;
+ MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const;
+ MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<double> *other, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<double> *other) const;
+ MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
+ MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const;
+ MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other);
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other);
public:
static const TypeOfTimeDiscretization DISCRETIZATION=LINEAR_TIME;
MEDCOUPLING_EXPORT static const char REPR[];
#ifndef __MEDCOUPLINGTIMEDISCRETIZATION_TXX__
#define __MEDCOUPLINGTIMEDISCRETIZATION_TXX__
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
#include "MEDCouplingTimeDiscretization.hxx"
-#include "MEDCouplingTraits.hxx"
-#include "InterpKernelException.hxx"
#include "MEDCouplingMemArray.txx"
-#include <algorithm>
#include <cmath>
-#include <cstddef>
#include <sstream>
-#include <vector>
-#include <string>
namespace MEDCoupling
{
reason=oss.str();
return false;
}
- if(_array==nullptr && other->_array==nullptr)
+ if(_array==0 && other->_array==0)
return true;
- if(_array==nullptr || other->_array==nullptr)
+ if(_array==0 || other->_array==0)
{
reason="Field discretizations differ : Only one timediscretization between the two this and other has a DataArrayDouble for values defined";
return false;
{
if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
return false;
- if(_array==nullptr && other->_array==nullptr)
+ if(_array==0 && other->_array==0)
return true;
- if(_array==nullptr || other->_array==nullptr)
+ if(_array==0 || other->_array==0)
return false;
if(_array->getNumberOfComponents()!=other->_array->getNumberOfComponents())
return false;
{
if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
return false;
- if(_array==nullptr && other->_array==nullptr)
+ if(_array==0 && other->_array==0)
return true;
- if(_array==nullptr || other->_array==nullptr)
+ if(_array==0 || other->_array==0)
return false;
std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
- std::size_t const nbMin(std::min(nbC1,nbC2));
+ std::size_t nbMin(std::min(nbC1,nbC2));
if(nbC1!=nbC2 && nbMin!=1)
return false;
return true;
{
if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
return false;
- if(_array==nullptr && other->_array==nullptr)
+ if(_array==0 && other->_array==0)
return true;
- if(_array==nullptr || other->_array==nullptr)
+ if(_array==0 || other->_array==0)
return false;
std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
if(nbC1!=nbC2 && nbC2!=1)
}
template<class T>
- MEDCouplingTimeDiscretizationTemplate<T>::MEDCouplingTimeDiscretizationTemplate():_time_tolerance(TIME_TOLERANCE_DFT),_array(nullptr)
+ MEDCouplingTimeDiscretizationTemplate<T>::MEDCouplingTimeDiscretizationTemplate():_time_tolerance(TIME_TOLERANCE_DFT),_array(0)
{
}
if(other._array)
_array=other._array->performCopyOrIncrRef(deepCopy);
else
- _array=nullptr;
+ _array=0;
}
template<class T>
}
template<class T>
- void MEDCouplingTimeDiscretizationTemplate<T>::setEndArray(typename Traits<T>::ArrayType * /*array*/, TimeLabel * /*owner*/)
+ void MEDCouplingTimeDiscretizationTemplate<T>::setEndArray(typename Traits<T>::ArrayType *array, TimeLabel *owner)
{
throw INTERP_KERNEL::Exception("setEndArray not available for this type of time discretization !");
}
template<class T>
void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
- std::size_t const nbOfCompo(_array->getNumberOfComponents());
+ std::size_t nbOfCompo(_array->getNumberOfComponents());
for(std::size_t i=0;i<nbOfCompo;i++)
tinyInfo.push_back(_array->getInfoOnComponent(i));
}
void MEDCouplingTimeDiscretizationTemplate<T>::resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI, std::vector<typename Traits<T>::ArrayType *>& arrays)
{
arrays.resize(1);
- if(_array!=nullptr)
+ if(_array!=0)
_array->decrRef();
- typename Traits<T>::ArrayType *arr=nullptr;
+ typename Traits<T>::ArrayType *arr=0;
if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
{
arr=Traits<T>::ArrayType::New();
static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size one !";
if(arrays.size()!=1)
throw INTERP_KERNEL::Exception(MSG);
- if(_array!=nullptr)
+ if(_array!=0)
_array->decrRef();
- _array=nullptr;
+ _array=0;
if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
{
if(!arrays[0])
}
template<class T>
- void MEDCouplingTimeDiscretizationTemplate<T>::finishUnserialization(const std::vector<mcIdType>& /*tinyInfoI*/, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+ void MEDCouplingTimeDiscretizationTemplate<T>::finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
_time_tolerance=tinyInfoD[0];
- std::size_t const nbOfCompo=_array->getNumberOfComponents();
+ std::size_t nbOfCompo=_array->getNumberOfComponents();
for(std::size_t i=0;i<nbOfCompo;i++)
_array->setInfoOnComponent(i,tinyInfoS[i]);
}
}
template<class T>
- double MEDCouplingTimeDiscretizationSimple<T>::getEndTime(int& /*iteration*/, int& /*order*/) const
+ double MEDCouplingTimeDiscretizationSimple<T>::getEndTime(int& iteration, int& order) const
{
throw INTERP_KERNEL::Exception("getEndTime : invalid for this type of time discr !");
}
template<class T>
- void MEDCouplingTimeDiscretizationSimple<T>::setEndIteration(int /*it*/)
+ void MEDCouplingTimeDiscretizationSimple<T>::setEndIteration(int it)
{
throw INTERP_KERNEL::Exception("setEndIteration : invalid for this type of time discr !");
}
template<class T>
- void MEDCouplingTimeDiscretizationSimple<T>::setEndOrder(int /*order*/)
+ void MEDCouplingTimeDiscretizationSimple<T>::setEndOrder(int order)
{
throw INTERP_KERNEL::Exception("setEndOrder : invalid for this type of time discr !");
}
template<class T>
- void MEDCouplingTimeDiscretizationSimple<T>::setEndTimeValue(double /*time*/)
+ void MEDCouplingTimeDiscretizationSimple<T>::setEndTimeValue(double time)
{
throw INTERP_KERNEL::Exception("setEndTimeValue : invalid for this type of time discr !");
}
template<class T>
- void MEDCouplingTimeDiscretizationSimple<T>::setEndTime(double /*time*/, int /*iteration*/, int /*order*/)
+ void MEDCouplingTimeDiscretizationSimple<T>::setEndTime(double time, int iteration, int order)
{
throw INTERP_KERNEL::Exception("setEndTime : invalid for this type of time discr !");
}
#include "InterpKernelException.hxx"
-#include <atomic>
-#include <cstddef>
#include <limits>
using namespace MEDCoupling;
}
TimeLabel::~TimeLabel()
-= default;
+{
+}
-TimeLabel& TimeLabel::operator=(const TimeLabel& /*other*/)
+TimeLabel& TimeLabel::operator=(const TimeLabel& other)
{
_time=GLOBAL_TIME++;
return *this;
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingTraits.hxx"
-#include "MCType.hxx"
using namespace MEDCoupling;
#include "MEDCoupling.hxx"
#include "MCType.hxx"
+#include <vector>
namespace MEDCoupling
{
//
// Author : Anthony Geay (EDF R&D)
-#include "InterpKernelHashMap.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "InterpKernelException.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
+#include "MEDCouplingUMesh.txx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingPointSet.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingMemArray.txx"
#include "MEDCouplingSkyLineArray.hxx"
#include "CellModel.hxx"
-#include "MEDCouplingUMesh.txx"
-#include "NormalizedGeometricTypes"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "VolSurfFormulae.hxx"
-#include "MEDCouplingTraits.hxx"
#include "VolSurfUser.txx"
#include "InterpolationUtils.hxx"
+#include "PointLocatorAlgos.txx"
+#include "BBTree.txx"
#include "BBTreeDst.txx"
-#include "SplitterTetra.txx"
+#include "SplitterTetra.hxx"
+#include "DiameterCalculator.hxx"
#include "DirectedBoundingBox.hxx"
#include "InterpKernelMatrixTools.hxx"
#include "InterpKernelMeshQuality.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelAutoPtr.hxx"
#include "InterpKernelGeo2DNode.hxx"
+#include "InterpKernelGeo2DEdgeLin.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
-#include "MEDCouplingUMesh_internal.hxx"
#include "OrientationInverter.hxx"
-#include "DiameterCalculator.hxx"
+#include "MEDCouplingUMesh_internal.hxx"
-#include <map>
-#include <list>
-#include <memory>
-#include <set>
-#include <cstdlib>
-#include <algorithm>
-#include <functional>
-#include <iterator>
-#include <cmath>
-#include <ostream>
-#include <math.h>
#include <sstream>
+#include <fstream>
#include <numeric>
+#include <memory>
#include <cstring>
#include <limits>
-#include <string>
-#include <utility>
-#include <vector>
+#include <list>
using namespace MEDCoupling;
MEDCouplingUMesh *MEDCouplingUMesh::New(const std::string& meshName, int meshDim)
{
- auto *ret=new MEDCouplingUMesh;
+ MEDCouplingUMesh *ret=new MEDCouplingUMesh;
ret->setName(meshName);
ret->setMeshDimension(meshDim);
return ret;
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::shallowCopyConnectivityFrom : input pointer is null !");
- const auto *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
+ const MEDCouplingUMesh *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::shallowCopyConnectivityFrom : input pointer is not an MEDCouplingUMesh instance !");
- auto *otherC2=const_cast<MEDCouplingUMesh *>(otherC);//sorry :(
+ MEDCouplingUMesh *otherC2=const_cast<MEDCouplingUMesh *>(otherC);//sorry :(
setConnectivity(otherC2->getNodalConnectivity(),otherC2->getNodalConnectivityIndex(),true);
}
std::size_t MEDCouplingUMesh::getHeapMemorySizeWithoutChildren() const
{
- std::size_t const ret(MEDCouplingPointSet::getHeapMemorySizeWithoutChildren());
+ std::size_t ret(MEDCouplingPointSet::getHeapMemorySizeWithoutChildren());
return ret;
}
}
}
-MEDCouplingUMesh::MEDCouplingUMesh():_mesh_dim(-2),_nodal_connec(nullptr),_nodal_connec_index(nullptr)
+MEDCouplingUMesh::MEDCouplingUMesh():_mesh_dim(-2),_nodal_connec(0),_nodal_connec_index(0)
{
}
throw INTERP_KERNEL::Exception("No mesh dimension specified !");
if(_mesh_dim!=-1)
MEDCouplingPointSet::checkConsistencyLight();
- for(auto _type : _types)
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=_types.begin();iter!=_types.end();iter++)
{
- if(ToIdType(INTERP_KERNEL::CellModel::GetCellModel(_type).getDimension())!=_mesh_dim)
+ if(ToIdType(INTERP_KERNEL::CellModel::GetCellModel(*iter).getDimension())!=_mesh_dim)
{
std::ostringstream message;
- message << "Mesh invalid because dimension is " << _mesh_dim << " and there is presence of cell(s) with type " << _type;
+ message << "Mesh invalid because dimension is " << _mesh_dim << " and there is presence of cell(s) with type " << (*iter);
throw INTERP_KERNEL::Exception(message.str().c_str());
}
}
* \throw If number of nodes defining an element does not correspond to the type of element.
* \throw If the nodal connectivity includes an invalid node id.
*/
-void MEDCouplingUMesh::checkConsistency(double /*eps*/) const
+void MEDCouplingUMesh::checkConsistency(double eps) const
{
checkConsistencyLight();
if(_mesh_dim==-1)
return ;
- int const meshDim=getMeshDimension();
- mcIdType const nbOfNodes=getNumberOfNodes();
- mcIdType const nbOfCells=getNumberOfCells();
+ int meshDim=getMeshDimension();
+ mcIdType nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *ptr=_nodal_connec->getConstPointer();
const mcIdType *ptrI=_nodal_connec_index->getConstPointer();
for(mcIdType i=0;i<nbOfCells;i++)
oss << "MEDCouplingUMesh::checkConsistency : cell << #" << i<< " with type Type " << cm.getRepr() << " in 'this' whereas meshdim == " << meshDim << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mcIdType const nbOfNodesInCell=ptrI[i+1]-ptrI[i]-1;
+ mcIdType nbOfNodesInCell=ptrI[i+1]-ptrI[i]-1;
if(!cm.isDynamic())
if(nbOfNodesInCell!=ToIdType(cm.getNumberOfNodes()))
{
}
for(const mcIdType *w=ptr+ptrI[i]+1;w!=ptr+ptrI[i+1];w++)
{
- mcIdType const nodeId=*w;
+ mcIdType nodeId=*w;
if(nodeId>=0)
{
if(nodeId>=nbOfNodes)
const mcIdType *ptr(_nodal_connec->begin()),*ptrI(_nodal_connec_index->begin());
for(auto icell = 0 ; icell < nbOfCells ; ++icell)
{
- std::set<mcIdType> const s(ptr+ptrI[icell]+1,ptr+ptrI[icell+1]);
+ std::set<mcIdType> s(ptr+ptrI[icell]+1,ptr+ptrI[icell+1]);
if(ToIdType(s.size())==ptrI[icell+1]-ptrI[icell]-1)
continue;
std::ostringstream oss; oss << "MEDCouplingUMesh::checkGeomConsistency : for cell #" << icell << " presence of multiple same nodeID !";
void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, const mcIdType *nodalConnOfCell)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
- if(_nodal_connec_index==nullptr)
+ if(_nodal_connec_index==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::insertNextCell : nodal connectivity not set ! invoke allocateCells before calling insertNextCell !");
if(ToIdType(cm.getDimension())==_mesh_dim)
{
oss << " ! Expecting " << cm.getNumberOfNodes() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mcIdType const idx=_nodal_connec_index->back();
- mcIdType const val=idx+size+1;
+ mcIdType idx=_nodal_connec_index->back();
+ mcIdType val=idx+size+1;
_nodal_connec_index->pushBackSilent(val);
_nodal_connec->writeOnPlace(idx,type,nodalConnOfCell,size);
_types.insert(type);
{
std::vector<INTERP_KERNEL::NormalizedCellType> ret;
checkConnectivityFullyDefined();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells==0)
return ret;
if(getNodalConnectivityArrayLen()<1)
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isEqualIfNotWhy : input other pointer is null !");
std::ostringstream oss; oss.precision(15);
- const auto *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
+ const MEDCouplingUMesh *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
if(!otherC)
{
reason="mesh given in input is not castable in MEDCouplingUMesh !";
if(_types!=otherC->_types)
{
oss << "umesh geometric type mismatch :\nThis geometric types are :";
- for(auto _type : _types)
- { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); oss << cm.getRepr() << ", "; }
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=_types.begin();iter!=_types.end();iter++)
+ { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*iter); oss << cm.getRepr() << ", "; }
oss << "\nOther geometric types are :";
- for(auto _type : otherC->_types)
- { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); oss << cm.getRepr() << ", "; }
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=otherC->_types.begin();iter!=otherC->_types.end();iter++)
+ { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*iter); oss << cm.getRepr() << ", "; }
reason=oss.str();
return false;
}
- if(_nodal_connec!=nullptr || otherC->_nodal_connec!=nullptr)
- if(_nodal_connec==nullptr || otherC->_nodal_connec==nullptr)
+ if(_nodal_connec!=0 || otherC->_nodal_connec!=0)
+ if(_nodal_connec==0 || otherC->_nodal_connec==0)
{
reason="Only one UMesh between the two this and other has its nodal connectivity DataArrayInt defined !";
return false;
reason.insert(0,"Nodal connectivity DataArrayInt differ : ");
return false;
}
- if(_nodal_connec_index!=nullptr || otherC->_nodal_connec_index!=nullptr)
- if(_nodal_connec_index==nullptr || otherC->_nodal_connec_index==nullptr)
+ if(_nodal_connec_index!=0 || otherC->_nodal_connec_index!=0)
+ if(_nodal_connec_index==0 || otherC->_nodal_connec_index==0)
{
reason="Only one UMesh between the two this and other has its nodal connectivity index DataArrayInt defined !";
return false;
*/
bool MEDCouplingUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const
{
- const auto *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
+ const MEDCouplingUMesh *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
if(!otherC)
return false;
if(!MEDCouplingPointSet::isEqualWithoutConsideringStr(other,prec))
return false;
if(_types!=otherC->_types)
return false;
- if(_nodal_connec!=nullptr || otherC->_nodal_connec!=nullptr)
- if(_nodal_connec==nullptr || otherC->_nodal_connec==nullptr)
+ if(_nodal_connec!=0 || otherC->_nodal_connec!=0)
+ if(_nodal_connec==0 || otherC->_nodal_connec==0)
return false;
if(_nodal_connec!=otherC->_nodal_connec)
if(!_nodal_connec->isEqualWithoutConsideringStr(*otherC->_nodal_connec))
return false;
- if(_nodal_connec_index!=nullptr || otherC->_nodal_connec_index!=nullptr)
- if(_nodal_connec_index==nullptr || otherC->_nodal_connec_index==nullptr)
+ if(_nodal_connec_index!=0 || otherC->_nodal_connec_index!=0)
+ if(_nodal_connec_index==0 || otherC->_nodal_connec_index==0)
return false;
if(_nodal_connec_index!=otherC->_nodal_connec_index)
if(!_nodal_connec_index->isEqualWithoutConsideringStr(*otherC->_nodal_connec_index))
void MEDCouplingUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
{
MEDCouplingPointSet::checkFastEquivalWith(other,prec);
- const auto *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
+ const MEDCouplingUMesh *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkFastEquivalWith : Two meshes are not not unstructured !");
}
void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const
{
checkFullyDefined();
- mcIdType const nbOfNodes(getNumberOfNodes());
- auto *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType));
+ mcIdType nbOfNodes(getNumberOfNodes());
+ mcIdType *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType));
revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1);
std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
const mcIdType *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
}
}
std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<mcIdType>());
- auto *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType));
+ mcIdType *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType));
revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1);
std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1);
for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
if( targetDeltaLevel == -1 )
{
desc = DataArrayIdType::New(); descIndx = DataArrayIdType::New(); revDesc = DataArrayIdType::New(); revDescIndx = DataArrayIdType::New();
- MCAuto<MEDCouplingUMesh> const ret( this->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx) );
+ MCAuto<MEDCouplingUMesh> ret( this->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx) );
return ret;
}
if( targetDeltaLevel == -2 && this->getMeshDimension() == 3 )
{
desc = DataArrayIdType::New(); descIndx = DataArrayIdType::New(); revDesc = DataArrayIdType::New(); revDescIndx = DataArrayIdType::New();
- MCAuto<MEDCouplingUMesh> const ret( this->explode3DMeshTo1D(desc,descIndx,revDesc,revDescIndx) );
+ MCAuto<MEDCouplingUMesh> ret( this->explode3DMeshTo1D(desc,descIndx,revDesc,revDescIndx) );
return ret;
}
if( targetDeltaLevel == -this->getMeshDimension() )
{
- MCAuto<MEDCouplingUMesh> const ret = MEDCouplingUMesh::Build0DMeshFromCoords( const_cast<DataArrayDouble *>( this->getCoords() ) );
+ MCAuto<MEDCouplingUMesh> ret = MEDCouplingUMesh::Build0DMeshFromCoords( const_cast<DataArrayDouble *>( this->getCoords() ) );
MEDCouplingUMesh::DeleteCellTypeInIndexedArray(getNodalConnectivity(),getNodalConnectivityIndex(),desc,descIndx);
revDesc = DataArrayIdType::New(); revDescIndx = DataArrayIdType::New();
this->getReverseNodalConnectivity(revDesc,revDescIndx);
MCAuto<DataArrayIdType> revDesc=DataArrayIdType::New();
MCAuto<DataArrayIdType> revDescIndx=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- meshDM1=nullptr;
+ meshDM1=0;
ComputeNeighborsOfCellsAdv(desc,descIndx,revDesc,revDescIndx,neighbors,neighborsIndx);
}
nodeNeigh->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh");
nodeNeighI->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh index");
nodeNeighI->checkNbOfTuples(1+getNumberOfNodes(),"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : invalid length");
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
const mcIdType *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()),*ne(nodeNeigh->begin()),*nei(nodeNeighI->begin());
cellNeigh=DataArrayIdType::New(); cellNeigh->alloc(0,1); cellNeighIndex=DataArrayIdType::New(); cellNeighIndex->alloc(1,1); cellNeighIndex->setIJ(0,0,0);
for(mcIdType i=0;i<nbCells;i++)
const mcIdType *revDescPtr=revDesc->begin();
const mcIdType *revDescIPtr=revDescIndx->begin();
//
- mcIdType const nbCells=descIndx->getNumberOfTuples()-1;
+ mcIdType nbCells=descIndx->getNumberOfTuples()-1;
MCAuto<DataArrayIdType> out0=DataArrayIdType::New();
MCAuto<DataArrayIdType> out1=DataArrayIdType::New(); out1->alloc(nbCells+1,1);
mcIdType *out1Ptr=out1->getPointer();
MCAuto<MEDCouplingUMesh> MEDCouplingUMesh::explodeIntoEdges(MCAuto<DataArrayIdType>& desc, MCAuto<DataArrayIdType>& descIndex, MCAuto<DataArrayIdType>& revDesc, MCAuto<DataArrayIdType>& revDescIndx) const
{
checkFullyDefined();
- int const mdim(getMeshDimension());
+ int mdim(getMeshDimension());
desc=DataArrayIdType::New(); descIndex=DataArrayIdType::New(); revDesc=DataArrayIdType::New(); revDescIndx=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> mesh1D;
switch(mdim)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computeNeighborsOfNodes : Mesh dimension supported are [3,2,1] !");
}
}
- desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=nullptr; revDescIndx=nullptr;
+ desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=0; revDescIndx=0;
mesh1D->getReverseNodalConnectivity(desc,descIndx);
MCAuto<DataArrayIdType> ret0(DataArrayIdType::New());
ret0->alloc(desc->getNumberOfTuples(),1);
void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto<DataArrayIdType> &neighbors, MCAuto<DataArrayIdType>& neighborsIdx) const
{
checkFullyDefined();
- mcIdType const nbOfNodes(getNumberOfNodes());
+ mcIdType nbOfNodes(getNumberOfNodes());
const mcIdType *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector< std::set<mcIdType> > st0(nbOfNodes);
for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
const mcIdType *strtNdlConnOfCurCell(conn+connIndex[eltId]+1),*endNdlConnOfCurCell(conn+connIndex[eltId+1]);
std::set<mcIdType> s(strtNdlConnOfCurCell,endNdlConnOfCurCell); s.erase(-1); //for polyhedrons
- for(auto iter2=s.begin();iter2!=s.end();iter2++)
+ for(std::set<mcIdType>::const_iterator iter2=s.begin();iter2!=s.end();iter2++)
st0[*iter2].insert(s.begin(),s.end());
}
neighborsIdx=DataArrayIdType::New(); neighborsIdx->alloc(nbOfNodes+1,1); neighborsIdx->setIJ(0,0,0);
void MEDCouplingUMesh::convertToPolyTypes(const mcIdType *cellIdsToConvertBg, const mcIdType *cellIdsToConvertEnd)
{
checkFullyDefined();
- int const dim=getMeshDimension();
+ int dim=getMeshDimension();
if(dim<2 || dim>3)
throw INTERP_KERNEL::Exception("Invalid mesh dimension : must be 2 or 3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(dim==2)
{
const mcIdType *connIndex=_nodal_connec_index->begin();
for(mcIdType cellId=0;cellId<nbOfCells;cellId++)
{
mcIdType pos(connIndex[cellId]),posP1(connIndex[cellId+1]);
- mcIdType const lgthOld(posP1-pos-1);
+ mcIdType lgthOld(posP1-pos-1);
if(toBeDone[cellId])
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)connOld[pos]);
- unsigned const nbOfFaces(cm.getNumberOfSons2(connOld+pos+1,lgthOld));
- auto *tmp(new mcIdType[nbOfFaces*lgthOld+1]);
+ unsigned nbOfFaces(cm.getNumberOfSons2(connOld+pos+1,lgthOld));
+ mcIdType *tmp(new mcIdType[nbOfFaces*lgthOld+1]);
mcIdType *work=tmp; *work++=INTERP_KERNEL::NORM_POLYHED;
for(unsigned j=0;j<nbOfFaces;j++)
{
INTERP_KERNEL::NormalizedCellType type;
- unsigned const offset=cm.fillSonCellNodalConnectivity2(j,connOld+pos+1,lgthOld,work,type);
+ unsigned offset=cm.fillSonCellNodalConnectivity2(j,connOld+pos+1,lgthOld,work,type);
work+=offset;
*work++=-1;
}
- std::size_t const newLgth(std::distance(tmp,work)-1);//-1 for last -1
+ std::size_t newLgth(std::distance(tmp,work)-1);//-1 for last -1
connNew->pushBackValsSilent(tmp,tmp+newLgth);
connNewI->pushBackSilent(connNewI->back()+ToIdType(newLgth));
delete [] tmp;
*/
void MEDCouplingUMesh::convertAllToPoly()
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<mcIdType> cellIds(nbOfCells);
for(mcIdType i=0;i<nbOfCells;i++)
cellIds[i]=i;
checkFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertExtrudedPolyhedra works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> newCi=DataArrayIdType::New();
newCi->alloc(nbOfCells+1,1);
mcIdType *newci=newCi->getPointer();
newci[0]=0;
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)c[ci[i]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[i]];
if(type==INTERP_KERNEL::NORM_POLYHED)
{
if(std::count(c+ci[i]+1,c+ci[i+1],-1)!=0)
std::ostringstream oss; oss << "MEDCouplingUMesh::convertExtrudedPolyhedra : cell # " << i << " is a polhedron BUT it has NOT exactly 1 face !";
throw INTERP_KERNEL::Exception(oss.str());
}
- std::size_t const n2=std::distance(c+ci[i]+1,c+ci[i+1]);
+ std::size_t n2=std::distance(c+ci[i]+1,c+ci[i+1]);
if(n2%2!=0)
{
std::ostringstream oss; oss << "MEDCouplingUMesh::convertExtrudedPolyhedra : cell # " << i << " is a polhedron with 1 face but there is a mismatch of number of nodes in face should be even !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mcIdType const n1=ToIdType(n2/2);
+ mcIdType n1=ToIdType(n2/2);
newci[i+1]=7*n1+2+newci[i];//6*n1 (nodal length) + n1+2 (number of faces) - 1 (number of '-1' separator is equal to number of faces -1) + 1 (for cell type)
}
else
mcIdType *newc=newC->getPointer();
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)c[ci[i]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[i]];
if(type==INTERP_KERNEL::NORM_POLYHED)
{
- std::size_t const n1=std::distance(c+ci[i]+1,c+ci[i+1])/2;
+ std::size_t n1=std::distance(c+ci[i]+1,c+ci[i+1])/2;
newc=std::copy(c+ci[i],c+ci[i]+n1+1,newc);
*newc++=-1;
for(std::size_t j=0;j<n1;j++)
bool MEDCouplingUMesh::unPolyze()
{
checkFullyDefined();
- int const mdim=getMeshDimension();
+ int mdim=getMeshDimension();
if(mdim<0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::unPolyze works on umeshes with meshdim equals to 0, 1 2 or 3 !");
if(mdim<=1)
return false;
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells<1)
return false;
- mcIdType const initMeshLgth=getNodalConnectivityArrayLen();
+ mcIdType initMeshLgth=getNodalConnectivityArrayLen();
mcIdType *conn=_nodal_connec->getPointer();
mcIdType *index=_nodal_connec_index->getPointer();
mcIdType posOfCurCell=0;
for(mcIdType i=0;i<nbOfCells;i++)
{
lgthOfCurCell=index[i+1]-posOfCurCell;
- auto const type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
INTERP_KERNEL::NormalizedCellType newType=INTERP_KERNEL::NORM_ERROR;
mcIdType newLgth=0;
MCAuto<DataArrayDouble> coords=getCoords()->deepCopy();
coords->recenterForMaxPrecision(eps);
//
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *conn=_nodal_connec->getConstPointer();
const mcIdType *index=_nodal_connec_index->getConstPointer();
MCAuto<DataArrayIdType> connINew=DataArrayIdType::New();
checkFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearizeEdges() : works with meshdim=3 and spaceDim=3!");
- double const seps = sqrt(1-eps);
+ double seps = sqrt(1-eps);
// Computing connectivities and correspondances : elements -> segments -> points
DAI E_Fi(DataArrayIdType::New()), E_F(DataArrayIdType::New()), F_Ei(DataArrayIdType::New()), F_E(DataArrayIdType::New()),
F_Si(DataArrayIdType::New()), F_S(DataArrayIdType::New()), S_Fi(DataArrayIdType::New()), S_F(DataArrayIdType::New()),
std::set<mcIdType> pt_rem;
const mcIdType *m_pi = m_p->getNodalConnectivityIndex()->begin(),
*m_pc = m_p->getNodalConnectivity()->begin();
- auto *coord = (double (*)[3]) getCoords()->begin();
+ double (*coord)[3] = (double (*)[3]) getCoords()->begin();
// Find all points only connected to exaclty 2 segments - they are the candidates for elimination
// Note that in 3D this can only happen for polyhedrons (when this happens at all)
DAI dsi = P_Si->deltaShiftIndex();
for (mcIdType j = 0; j < 2; j++)
for (mcIdType k = 0; k < 2; k++)
{
- mcIdType const off1 = P_Sip[i] + j; // offset to get ID of the j-th seg (around the i-th point) in the point->seg correspondance
- mcIdType const pt_id = P_Sp[off1] + k; // ID of the k-th point of the j-th seg in the point->seg correspondance
- mcIdType const pt_id2 = S_Pp[S_Pip[pt_id]]; // ID of the point in the point mesh
+ mcIdType off1 = P_Sip[i] + j; // offset to get ID of the j-th seg (around the i-th point) in the point->seg correspondance
+ mcIdType pt_id = P_Sp[off1] + k; // ID of the k-th point of the j-th seg in the point->seg correspondance
+ mcIdType pt_id2 = S_Pp[S_Pip[pt_id]]; // ID of the point in the point mesh
p[j][k] = m_pc[m_pi[pt_id2] + 1]; // Absolute ID, as read from the connectvity (+1 to skip type: NORM_POINT1)
// Just for fun, as initially written by Antoine :-)
// p[j][k] = m_pc[m_pi[S_P->getIJ(S_Pi->getIJ(P_S->getIJ(P_Si->getIJ(i, 0) + j, 0), 0) + k, 0)] + 1];
{
checkConnectivityFullyDefined();
const mcIdType *maxEltPt(std::max_element(_nodal_connec->begin(),_nodal_connec->end()));
- mcIdType const maxElt(maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1);
+ mcIdType maxElt(maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1);
std::vector<bool> retS(maxElt,false);
computeNodeIdsAlg(retS);
return DataArrayIdType::BuildListOfSwitchedOn(retS);
struct MEDCouplingAccVisit
{
- MEDCouplingAccVisit() = default;
+ MEDCouplingAccVisit():_new_nb_of_nodes(0) { }
mcIdType operator()(mcIdType val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; }
- mcIdType _new_nb_of_nodes{0};
+ mcIdType _new_nb_of_nodes;
};
/// @endcond
DataArrayIdType *MEDCouplingUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const
{
nbrOfNodesInUse=-1;
- mcIdType const nbOfNodes(getNumberOfNodes());
+ mcIdType nbOfNodes(getNumberOfNodes());
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfNodes,1);
mcIdType *traducer=ret->getPointer();
std::fill(traducer,traducer+nbOfNodes,-1);
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *connIndex=_nodal_connec_index->getConstPointer();
const mcIdType *conn=_nodal_connec->getConstPointer();
for(mcIdType i=0;i<nbOfCells;i++)
DataArrayIdType *MEDCouplingUMesh::computeNbOfNodesPerCell() const
{
checkConnectivityFullyDefined();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
mcIdType *retPtr=ret->getPointer();
DataArrayIdType *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const
{
checkConnectivityFullyDefined();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
mcIdType *retPtr=ret->getPointer();
DataArrayIdType *MEDCouplingUMesh::computeNbOfFacesPerCell() const
{
checkConnectivityFullyDefined();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfCells,1);
mcIdType *retPtr=ret->getPointer();
*/
int MEDCouplingUMesh::AreCellsEqualPolicy1(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2)
{
- mcIdType const sz=connI[cell1+1]-connI[cell1];
+ mcIdType sz=connI[cell1+1]-connI[cell1];
if(sz==connI[cell2+1]-connI[cell2])
{
if(conn[connI[cell1]]==conn[connI[cell2]])
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[cell1]]);
- unsigned const dim=cm.getDimension();
+ unsigned dim=cm.getDimension();
if(dim!=3)
{
if(dim!=1)
{
- mcIdType const sz1=2*(sz-1);
+ mcIdType sz1=2*(sz-1);
INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[sz1];
mcIdType *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(mcIdType *)tmp);
std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],work);
{
if(conn[connI[cell1]]==conn[connI[cell2]])
{
- std::set<mcIdType> const s1(conn+connI[cell1]+1,conn+connI[cell1+1]);
- std::set<mcIdType> const s2(conn+connI[cell2]+1,conn+connI[cell2+1]);
+ std::set<mcIdType> s1(conn+connI[cell1]+1,conn+connI[cell1+1]);
+ std::set<mcIdType> s2(conn+connI[cell2]+1,conn+connI[cell2+1]);
return s1==s2?1:0;
}
}
{
if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2])
{
- std::set<mcIdType> const s1(conn+connI[cell1]+1,conn+connI[cell1+1]);
- std::set<mcIdType> const s2(conn+connI[cell2]+1,conn+connI[cell2+1]);
+ std::set<mcIdType> s1(conn+connI[cell1]+1,conn+connI[cell1+1]);
+ std::set<mcIdType> s2(conn+connI[cell2]+1,conn+connI[cell2+1]);
return s1==s2?1:0;
}
return 0;
*/
int MEDCouplingUMesh::AreCellsEqualPolicy7(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2)
{
- mcIdType const sz=connI[cell1+1]-connI[cell1];
+ mcIdType sz=connI[cell1+1]-connI[cell1];
if(sz==connI[cell2+1]-connI[cell2])
{
if(conn[connI[cell1]]==conn[connI[cell2]])
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[cell1]]);
- unsigned const dim=cm.getDimension();
+ unsigned dim=cm.getDimension();
if(dim!=3)
{
if(dim!=1)
{
- mcIdType const sz1=2*(sz-1);
+ mcIdType sz1=2*(sz-1);
INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[sz1];
mcIdType *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(mcIdType *)tmp);
std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],work);
return 1;
else
{
- std::reverse_iterator<mcIdType *> const it1((mcIdType *)tmp+sz1);
- std::reverse_iterator<mcIdType *> const it2((mcIdType *)tmp);
+ std::reverse_iterator<mcIdType *> it1((mcIdType *)tmp+sz1);
+ std::reverse_iterator<mcIdType *> it2((mcIdType *)tmp);
if(std::search(it1,it2,conn+connI[cell2]+1,conn+connI[cell2+1])!=it2)
return 2;
else
return 1;
if(!cm.isQuadratic())
{
- std::reverse_iterator<const mcIdType *> const it1(conn+connI[cell1+1]);
- std::reverse_iterator<const mcIdType *> const it2(conn+connI[cell1]+1);
+ std::reverse_iterator<const mcIdType *> it1(conn+connI[cell1+1]);
+ std::reverse_iterator<const mcIdType *> it2(conn+connI[cell1]+1);
if(std::equal(it1,it2,conn+connI[cell2]+1))
return 2;
return 0;
DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr)
{
MCAuto<DataArrayIdType> commonCells=DataArrayIdType::New(),commonCellsI=DataArrayIdType::New(); commonCells->alloc(0,1);
- mcIdType const nbOfCells=nodalI->getNumberOfTuples()-1;
+ mcIdType nbOfCells=nodalI->getNumberOfTuples()-1;
commonCellsI->reserve(1); commonCellsI->pushBackSilent(0);
const mcIdType *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer();
const mcIdType *connPtr=nodal->getConstPointer(),*connIPtr=nodalI->getConstPointer();
{
v=v2;
const mcIdType *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i);
- auto const it=std::set_intersection(v.begin(),v.end(),locRevNodal,revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin());
+ std::vector<mcIdType>::iterator it=std::set_intersection(v.begin(),v.end(),locRevNodal,revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin());
v2.resize(std::distance(v2.begin(),it));
}
if(v2.size()>1)
{
if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells))
{
- mcIdType const pos=commonCellsI->back();
+ mcIdType pos=commonCellsI->back();
commonCellsI->pushBackSilent(commonCells->getNumberOfTuples());
for(const mcIdType *it=commonCells->begin()+pos;it!=commonCells->end();it++)
isFetched[*it]=true;
if(*connOfNode>=0)
{
v=v2;
- auto const it=std::set_intersection(v.begin(),v.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin());
+ std::vector<mcIdType>::iterator it=std::set_intersection(v.begin(),v.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin());
v2.resize(std::distance(v2.begin(),it));
}
// v2 contains now candidates. Problem candidates are sorted using id rank.
}
if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells))
{
- mcIdType const newPos(commonCells->getNumberOfTuples());
- mcIdType const pos(commonCellsI->back());
+ mcIdType newPos(commonCells->getNumberOfTuples());
+ mcIdType pos(commonCellsI->back());
std::sort(commonCells->getPointerSilent()+pos,commonCells->getPointerSilent()+newPos);
commonCellsI->pushBackSilent(newPos);
for(const mcIdType *it=commonCells->begin()+pos;it!=commonCells->end();it++)
bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayIdType *& arr) const
{
MCAuto<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
static const int possibleCompType[]={0,1,2};
if(std::find(possibleCompType,possibleCompType+sizeof(possibleCompType)/sizeof(int),compType)==possibleCompType+sizeof(possibleCompType)/sizeof(int))
{
mcIdType newNbOfCells=-1;
MCAuto<DataArrayIdType> o2n = DataArrayIdType::ConvertIndexArrayToO2N(ToIdType(mesh->getNumberOfCells()),commonCells->begin(),commonCellsI->begin(),commonCellsI->end(),newNbOfCells);
MCAuto<DataArrayIdType> p0(o2n->selectByTupleIdSafeSlice(0,nbOfCells,1));
- mcIdType const maxPart(p0->getMaxValueInArray());
- bool const ret(maxPart==newNbOfCells-1);
+ mcIdType maxPart(p0->getMaxValueInArray());
+ bool ret(maxPart==newNbOfCells-1);
MCAuto<DataArrayIdType> p1(p0->invertArrayO2N2N2O(newNbOfCells));
// fill p1 array in case of presence of cells in other not in this
mcIdType *pt(p1->getPointer());
bool MEDCouplingUMesh::areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayIdType *& arr) const
{
MCAuto<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
- DataArrayIdType *commonCells=nullptr,*commonCellsI=nullptr;
- mcIdType const thisNbCells=getNumberOfCells();
+ DataArrayIdType *commonCells=0,*commonCellsI=0;
+ mcIdType thisNbCells=getNumberOfCells();
mesh->findCommonCells(7,thisNbCells,commonCells,commonCellsI);
MCAuto<DataArrayIdType> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
const mcIdType *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer();
- mcIdType const otherNbCells=other->getNumberOfCells();
+ mcIdType otherNbCells=other->getNumberOfCells();
MCAuto<DataArrayIdType> arr2=DataArrayIdType::New();
arr2->alloc(otherNbCells,1);
arr2->fillWithZero();
mcIdType *arr2Ptr=arr2->getPointer();
- mcIdType const nbOfCommon=commonCellsI->getNumberOfTuples()-1;
+ mcIdType nbOfCommon=commonCellsI->getNumberOfTuples()-1;
for(mcIdType i=0;i<nbOfCommon;i++)
{
- mcIdType const start=commonCellsPtr[commonCellsIPtr[i]];
+ mcIdType start=commonCellsPtr[commonCellsIPtr[i]];
if(start<thisNbCells)
{
for(mcIdType j=commonCellsIPtr[i]+1;j!=commonCellsIPtr[i+1];j++)
{
- mcIdType const sig=commonCellsPtr[j]>0?1:-1;
- mcIdType const val=std::abs(commonCellsPtr[j])-1;
+ mcIdType sig=commonCellsPtr[j]>0?1:-1;
+ mcIdType val=std::abs(commonCellsPtr[j])-1;
if(val>=thisNbCells)
arr2Ptr[val-thisNbCells]=sig*(start+1);
}
{
if(!other)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::mergeMyselfWithOnSameCoords : input other is null !");
- const auto *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
+ const MEDCouplingUMesh *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::mergeMyselfWithOnSameCoords : the input other mesh is not of type unstructured !");
std::vector<const MEDCouplingUMesh *> ms(2);
return static_cast<MEDCouplingUMesh *>(MEDCouplingPointSet::buildPartOfMySelfSlice(start,end,step,keepCoords));
else
{
- mcIdType const newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfSlice for -1 dimension mesh ");
+ mcIdType newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfSlice for -1 dimension mesh ");
if(newNbOfCells!=1)
throw INTERP_KERNEL::Exception("-1D mesh has only one cell !");
if(start!=0)
oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mcIdType const nbOfCellsToModify( ToIdType((std::distance(cellIdsBg,cellIdsEnd))));
+ mcIdType nbOfCellsToModify( ToIdType((std::distance(cellIdsBg,cellIdsEnd))));
if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells())
{
std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mcIdType const nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells(getNumberOfCells());
bool easyAssign(true);
const mcIdType *connI(_nodal_connec_index->begin());
const mcIdType *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->begin();
}
else
{
- DataArrayIdType *arrOut=nullptr,*arrIOut=nullptr;
+ DataArrayIdType *arrOut=0,*arrIOut=0;
DataArrayIdType::SetPartOfIndexedArrays(cellIdsBg,cellIdsEnd,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index,
arrOut,arrIOut);
MCAuto<DataArrayIdType> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mcIdType const nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : ");
+ mcIdType nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : ");
if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells())
{
std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
bool easyAssign=true;
const mcIdType *connI=_nodal_connec_index->getConstPointer();
const mcIdType *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer();
}
else
{
- DataArrayIdType *arrOut=nullptr,*arrIOut=nullptr;
+ DataArrayIdType *arrOut=0,*arrIOut=0;
DataArrayIdType::SetPartOfIndexedArraysSlice(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index,
arrOut,arrIOut);
MCAuto<DataArrayIdType> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
MCAuto<DataArrayIdType> desc,descIndx,revDesc,revDescIndx;
desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=DataArrayIdType::New(); revDescIndx=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> subMesh=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- desc=nullptr; descIndx=nullptr; revDesc=nullptr; revDescIndx=nullptr;
+ desc=0; descIndx=0; revDesc=0; revDescIndx=0;
return static_cast<MEDCouplingUMesh*>(subMesh->buildPartOfMySelfNode(begin,end,fullyIn));
}
revDesc->decrRef();
desc->decrRef();
descIndx->decrRef();
- mcIdType const nbOfCells=meshDM1->getNumberOfCells();
+ mcIdType nbOfCells=meshDM1->getNumberOfCells();
const mcIdType *revDescIndxC=revDescIndx->getConstPointer();
std::vector<mcIdType> boundaryCells;
for(mcIdType i=0;i<nbOfCells;i++)
MCAuto<DataArrayIdType> desc(DataArrayIdType::New()), descIndx(DataArrayIdType::New()), revDesc(DataArrayIdType::New()), revDescIndx(DataArrayIdType::New());
//
buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)->decrRef();
- desc=(DataArrayIdType*)nullptr; descIndx=(DataArrayIdType*)nullptr;
+ desc=(DataArrayIdType*)0; descIndx=(DataArrayIdType*)0;
//
MCAuto<DataArrayIdType> tmp=revDescIndx->deltaShiftIndex();
- MCAuto<DataArrayIdType> faceIds=tmp->findIdsEqual(1); tmp=(DataArrayIdType*)nullptr;
+ MCAuto<DataArrayIdType> faceIds=tmp->findIdsEqual(1); tmp=(DataArrayIdType*)0;
const mcIdType *revDescPtr=revDesc->getConstPointer();
const mcIdType *revDescIndxPtr=revDescIndx->getConstPointer();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<bool> ret1(nbOfCells,false);
mcIdType sz=0;
- for(long const pt : *faceIds)
- if(!ret1[revDescPtr[revDescIndxPtr[pt]]])
- { ret1[revDescPtr[revDescIndxPtr[pt]]]=true; sz++; }
+ for(const mcIdType *pt=faceIds->begin();pt!=faceIds->end();pt++)
+ if(!ret1[revDescPtr[revDescIndxPtr[*pt]]])
+ { ret1[revDescPtr[revDescIndxPtr[*pt]]]=true; sz++; }
//
ret2->alloc(sz,1);
mcIdType *ret2Ptr=ret2->getPointer();
MCAuto<DataArrayIdType> descThisPart=DataArrayIdType::New(),descIThisPart=DataArrayIdType::New(),revDescThisPart=DataArrayIdType::New(),revDescIThisPart=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> thisPartConsti=thisPart->buildDescendingConnectivity(descThisPart,descIThisPart,revDescThisPart,revDescIThisPart);
const mcIdType *revDescThisPartPtr=revDescThisPart->getConstPointer(),*revDescIThisPartPtr=revDescIThisPart->getConstPointer();
- DataArrayIdType *idsOtherInConsti=nullptr;
- bool const b=thisPartConsti->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsOtherInConsti);
- MCAuto<DataArrayIdType> const idsOtherInConstiAuto(idsOtherInConsti);
+ DataArrayIdType *idsOtherInConsti=0;
+ bool b=thisPartConsti->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsOtherInConsti);
+ MCAuto<DataArrayIdType> idsOtherInConstiAuto(idsOtherInConsti);
if(!b)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : the given mdim-1 mesh in other is not a constituent of this !");
std::set<mcIdType> s1;
- for(long const idOther : *idsOtherInConsti)
- s1.insert(revDescThisPartPtr+revDescIThisPartPtr[idOther],revDescThisPartPtr+revDescIThisPartPtr[idOther+1]);
+ for(const mcIdType *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++)
+ s1.insert(revDescThisPartPtr+revDescIThisPartPtr[*idOther],revDescThisPartPtr+revDescIThisPartPtr[*idOther+1]);
MCAuto<DataArrayIdType> s1arr_renum1=DataArrayIdType::New(); s1arr_renum1->alloc(s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer());
s1arr_renum1->sort();
cellIdsRk0=s0arr.retn();
MCAuto<DataArrayIdType> revDescIndx=DataArrayIdType::New();
//
MCAuto<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- revDesc=nullptr; desc=nullptr; descIndx=nullptr;
+ revDesc=0; desc=0; descIndx=0;
MCAuto<DataArrayIdType> revDescIndx2=revDescIndx->deltaShiftIndex();
MCAuto<DataArrayIdType> part=revDescIndx2->findIdsEqual(1);
return static_cast<MEDCouplingUMesh *>(meshDM1->buildPartOfMySelf(part->begin(),part->end(),true));
DAInt idsTmp0 = dsi->findIdsNotInRange(-1, 3); // for 2D: if a point is connected to more than 2 segs. For 3D: if a seg is connected to more than two faces.
if(idsTmp0->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group: group is too complex: some points (or edges) have more than two connected segments (or faces)!");
- dt0=nullptr; dit0=nullptr; rdt0=nullptr; rdit0=nullptr; idsTmp0=nullptr;
+ dt0=0; dit0=0; rdt0=0; rdit0=0; idsTmp0=0;
// Get extreme nodes from the group (they won't be duplicated except if they also lie on bound of M0 -- see below),
// ie nodes belonging to the boundary "cells" (might be points) of M1
- DAInt const xtremIdsM2 = dsi->findIdsEqual(1); dsi = nullptr;
+ DAInt xtremIdsM2 = dsi->findIdsEqual(1); dsi = 0;
MCUMesh meshM2Part = static_cast<MEDCouplingUMesh *>(meshM2->buildPartOfMySelf(xtremIdsM2->begin(), xtremIdsM2->end(),true));
DAInt xtrem = meshM2Part->computeFetchedNodeIds();
// Remove from the list points on the boundary of the M0 mesh (those need duplication!).
// Think of a partial (plane) crack in a cube: the points at the tip of the crack and not located inside the volume of the cube are not duplicated
// although they are technically on the skin of the cube.
DAInt fNodes = m0skin->computeFetchedNodeIds();
- DAInt notDup = nullptr;
+ DAInt notDup = 0;
if (getMeshDimension() == 3)
{
DAInt dnu1=DataArrayIdType::New(), dnu2=DataArrayIdType::New(), dnu3=DataArrayIdType::New(), dnu4=DataArrayIdType::New();
MCUMesh m0skinDesc = m0skin->buildDescendingConnectivity(dnu1, dnu2, dnu3, dnu4); // all segments of the skin of the 3D (M0) mesh
- dnu1=nullptr;dnu2=nullptr;dnu3=nullptr;dnu4=nullptr;
- DataArrayIdType * corresp=nullptr;
+ dnu1=0;dnu2=0;dnu3=0;dnu4=0;
+ DataArrayIdType * corresp=0;
meshM2->areCellsIncludedIn(m0skinDesc,2,corresp);
// validIds is the list of segments which are on both the skin of *this*, and in the segments of the M1 group
// In the cube example above, this is a U-shaped polyline.
// algorithm would be duplicating too much ...
// This is a costly algorithm so only go into it if a simple (non sufficient) criteria is met: a node connected to more than 3 segs in meshM2:
dnu1=DataArrayIdType::New(), dnu2=DataArrayIdType::New(), dnu3=DataArrayIdType::New(), rdit0=DataArrayIdType::New();
- MCUMesh const meshM2Desc = meshM2->buildDescendingConnectivity(dnu1, dnu2, dnu3, rdit0); // a mesh made of node cells
- dnu1=nullptr;dnu2=nullptr;dnu3=nullptr;
- dsi = rdit0->deltaShiftIndex(); rdit0=nullptr;
- DAInt singPoints = dsi->findIdsNotInRange(-1,4) ; dsi=nullptr;// points connected to (strictly) more than 3 segments
+ MCUMesh meshM2Desc = meshM2->buildDescendingConnectivity(dnu1, dnu2, dnu3, rdit0); // a mesh made of node cells
+ dnu1=0;dnu2=0;dnu3=0;
+ dsi = rdit0->deltaShiftIndex(); rdit0=0;
+ DAInt singPoints = dsi->findIdsNotInRange(-1,4) ; dsi=0;// points connected to (strictly) more than 3 segments
if (singPoints->getNumberOfTuples())
{
DAInt boundNodes = m1IntersecSkin->computeFetchedNodeIds();
// If a point on this U-shape line is connected to cells which do not share any face with M1, then it
// should not be duplicated
// 1. Extract N D cells touching U-shape line:
- DAInt const cellsAroundBN = getCellIdsLyingOnNodes(boundNodes->begin(), boundNodes->end(), false); // false= take cell in, even if not all nodes are in dupl
+ DAInt cellsAroundBN = getCellIdsLyingOnNodes(boundNodes->begin(), boundNodes->end(), false); // false= take cell in, even if not all nodes are in dupl
MCUMesh mAroundBN = static_cast<MEDCouplingUMesh *>(this->buildPartOfMySelf(cellsAroundBN->begin(), cellsAroundBN->end(), true));
DAInt descBN=DataArrayIdType::New(), descIBN=DataArrayIdType::New(), revDescBN=DataArrayIdType::New(), revDescIBN=DataArrayIdType::New();
MCUMesh mAroundBNDesc = mAroundBN->buildDescendingConnectivity(descBN,descIBN,revDescBN,revDescIBN);
{
if (v >= nCellsDesc) // Keep valid match only
continue;
- mcIdType const idx0 = revDescIBNP[v];
+ mcIdType idx0 = revDescIBNP[v];
// Keep the two cells on either side of the face v of M1:
mcIdType c1=revDescBNP[idx0], c2=revDescBNP[idx0+1];
idsTouch->pushBackSilent(c1); idsTouch->pushBackSilent(c2);
}
// 3. Build complement
- DAInt const idsTouchCompl = idsTouch->buildComplement(nCells);
+ DAInt idsTouchCompl = idsTouch->buildComplement(nCells);
MCUMesh mAroundBNStrict = static_cast<MEDCouplingUMesh *>(mAroundBN->buildPartOfMySelf(idsTouchCompl->begin(), idsTouchCompl->end(), true));
DAInt nod3 = mAroundBNStrict->computeFetchedNodeIds();
DAInt inters = boundNodes->buildIntersection(nod3);
// Compute cell IDs of the mesh with cells that touch the M1 group with a least one node:
DAInt cellsAroundGroupLarge = getCellIdsLyingOnNodes(nodeIdsToDuplicateBg, nodeIdsToDuplicateEnd, false); // false= take cell in, even if not all nodes are in dupl
MCUMesh mAroundGrpLarge=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(cellsAroundGroupLarge->begin(),cellsAroundGroupLarge->end(),true));
- mcIdType const nCellsLarge=cellsAroundGroupLarge->getNumberOfTuples();
+ mcIdType nCellsLarge=cellsAroundGroupLarge->getNumberOfTuples();
DAInt descL=DataArrayIdType::New(),descIL=DataArrayIdType::New(),revDescL=DataArrayIdType::New(),revDescIL=DataArrayIdType::New();
MCUMesh mArGrpLargeDesc=mAroundGrpLarge->buildDescendingConnectivity(descL,descIL,revDescL,revDescIL);
const mcIdType *descILP=descIL->begin(), *descLP=descL->begin();
DataArrayIdType *idsOfM1t;
mArGrpLargeDesc->areCellsIncludedIn(&otherDimM1OnSameCoords,2, idsOfM1t);
DAInt idsOfM1Large(idsOfM1t);
- mcIdType const nL = mArGrpLargeDesc->getNumberOfCells();
+ mcIdType nL = mArGrpLargeDesc->getNumberOfCells();
// Computation of the neighbor information of the mesh WITH the crack (some neighbor links are removed):
// In the neighbor information remove the connection between high dimension cells and its low level constituents which are part
// of the frontier given in parameter (i.e. the cells of low dimension from the group delimiting the crack):
DAInt descLTrunc = descL->deepCopy(), descILTrunc = descIL->deepCopy();
DataArrayIdType::RemoveIdsFromIndexedArrays(idsOfM1Large->begin(), idsOfM1Large->end(),descLTrunc,descILTrunc);
- DataArrayIdType *neight=nullptr, *neighIt=nullptr;
+ DataArrayIdType *neight=0, *neighIt=0;
MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(descLTrunc,descILTrunc,revDescL,revDescIL, neight, neighIt);
DAInt neighL(neight), neighIL(neighIt);
for(const auto& v: *idsOfM1Large)
{
if (v >= nL) continue; // Keep valid match only - see doc of areCellsIncludedIn()
- mcIdType const idx0 = revDescILP[v];
+ mcIdType idx0 = revDescILP[v];
// Retrieve the two cells on either side of the face v of M1:
mcIdType c1=revDescLP[idx0], c2=revDescLP[idx0+1];
std::map<mcIdType, mcIdType> toOther = {{c1, c2}, {c2, c1}};
// If a valid value was found, use it:
mcIdType val = sv.size()==1 ? *sv.begin() : 0;
// Hopefully this does not conflict with an potential value on the other side:
- mcIdType const other = toOther[c];
+ mcIdType other = toOther[c];
if (hitCellsLargeP[other])
{
if(val && hitCellsLargeP[other] != -val)
if (cellsRet1->getNumberOfTuples() + cellsRet2->getNumberOfTuples() != cellsAroundGroupLarge->getNumberOfTuples())
{
- DAInt const nonHitCells = hitCellsLarge->findIdsEqual(0); // variable kept for debug ...
+ DAInt nonHitCells = hitCellsLarge->findIdsEqual(0); // variable kept for debug ...
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellsToRenumber: Some cells not hit - Internal error should not happen");
}
cellsRet1->transformWithIndArr(cellsAroundGroupLarge->begin(),cellsAroundGroupLarge->end());
*/
void MEDCouplingUMesh::duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd)
{
- mcIdType const nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfNodes=getNumberOfNodes();
duplicateNodesInCoords(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd);
duplicateNodesInConn(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd,nbOfNodes);
}
checkConnectivityFullyDefined();
mcIdType *conn(getNodalConnectivity()->getPointer());
const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer());
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
checkConnectivityFullyDefined();
mcIdType *conn=getNodalConnectivity()->getPointer();
const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
checkConnectivityFullyDefined();
mcIdType *conn=getNodalConnectivity()->getPointer();
const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
m[*work]=val;
mcIdType *conn=getNodalConnectivity()->getPointer();
const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
mcIdType& node=conn[iconn];
if(node>=0)//avoid polyhedron separator
{
- auto const it=m.find(node);
+ std::map<mcIdType,mcIdType>::iterator it=m.find(node);
if(it!=m.end())
node=(*it).second;
}
void MEDCouplingUMesh::renumberCells(const mcIdType *old2NewBg, bool check)
{
checkConnectivityFullyDefined();
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
const mcIdType *array=old2NewBg;
if(check)
array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells);
newCI[0]=loc;
for(mcIdType i=0;i<nbCells;i++)
{
- mcIdType const pos=n2oPtr[i];
- mcIdType const nbOfElts=connI[pos+1]-connI[pos];
+ mcIdType pos=n2oPtr[i];
+ mcIdType nbOfElts=connI[pos+1]-connI[pos];
newC=std::copy(conn+connI[pos],conn+connI[pos+1],newC);
loc+=nbOfElts;
newCI[i+1]=loc;
elems->pushBackSilent(0);
return elems.retn();
}
- int const dim=getSpaceDimension();
+ int dim=getSpaceDimension();
INTERP_KERNEL::AutoPtr<double> elem_bb=new double[2*dim];
const mcIdType* conn = getNodalConnectivity()->getConstPointer();
const mcIdType* conn_index= getNodalConnectivityIndex()->getConstPointer();
const double* coords = getCoords()->getConstPointer();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for ( mcIdType ielem=0; ielem<nbOfCells;ielem++ )
{
for (int i=0; i<dim; i++)
for (mcIdType inode=conn_index[ielem]+1; inode<conn_index[ielem+1]; inode++)//+1 due to offset of cell type.
{
- mcIdType const node= conn[inode];
+ mcIdType node= conn[inode];
if(node>=0)//avoid polyhedron separator
{
for (int idim=0; idim<dim; idim++)
elems->pushBackSilent(0);
return elems.retn();
}
- int const dim=getSpaceDimension();
+ int dim=getSpaceDimension();
INTERP_KERNEL::AutoPtr<double> elem_bb=new double[2*dim];
const mcIdType* conn = getNodalConnectivity()->getConstPointer();
const mcIdType* conn_index= getNodalConnectivityIndex()->getConstPointer();
const double* coords = getCoords()->getConstPointer();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for ( mcIdType ielem=0; ielem<nbOfCells;ielem++ )
{
for (int i=0; i<dim; i++)
for (mcIdType inode=conn_index[ielem]+1; inode<conn_index[ielem+1]; inode++)//+1 due to offset of cell type.
{
- mcIdType const node= conn[inode];
+ mcIdType node= conn[inode];
if(node>=0)//avoid polyhedron separator
{
for (int idim=0; idim<dim; idim++)
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(0,1);
checkConnectivityFullyDefined();
- mcIdType const nbCells=getNumberOfCells();
- int const mdim=getMeshDimension();
+ mcIdType nbCells=getNumberOfCells();
+ int mdim=getMeshDimension();
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(mdim!=ToIdType(cm.getDimension()))
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::giveCellsWithType : Mismatch between mesh dimension and dimension of the cell !");
ret << "Unstructured mesh with name : \"" << getName() << "\"\n";
ret << "Description of mesh : \"" << getDescription() << "\"\n";
int tmpp1,tmpp2;
- double const tt=getTime(tmpp1,tmpp2);
+ double tt=getTime(tmpp1,tmpp2);
ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
if(_mesh_dim>=-1)
{ ret << "Mesh dimension : " << _mesh_dim << "\nSpace dimension : "; }
else
{ ret << " Mesh dimension has not been set or is invalid !"; }
- if(_coords!=nullptr)
+ if(_coords!=0)
{
const int spaceDim=getSpaceDimension();
ret << spaceDim << "\nInfo attached on space dimension : ";
else
ret << msg0 << "\n";
ret << "Number of nodes : ";
- if(_coords!=nullptr)
+ if(_coords!=0)
ret << getNumberOfNodes() << "\n";
else
ret << msg0 << "\n";
ret << "Number of cells : ";
- if(_nodal_connec!=nullptr && _nodal_connec_index!=nullptr)
+ if(_nodal_connec!=0 && _nodal_connec_index!=0)
ret << getNumberOfCells() << "\n";
else
ret << "No connectivity specified !" << "\n";
ret << "Cell types present : ";
- for(auto _type : _types)
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=_types.begin();iter!=_types.end();iter++)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*iter);
ret << cm.getRepr() << " ";
}
ret << "\n";
*/
MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(std::size_t spaceDim) const
{
- int const mdim=getMeshDimension();
+ int mdim=getMeshDimension();
if(mdim<0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSetInstanceFromThis : invalid mesh dimension ! Should be >= 0 !");
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),mdim);
* If 'deeCpy' is true all arrays (coordinates and connectivities) are deeply copied.
*/
MEDCouplingUMesh::MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy):MEDCouplingPointSet(other,deepCpy),_mesh_dim(other._mesh_dim),
- _nodal_connec(nullptr),_nodal_connec_index(nullptr),
+ _nodal_connec(0),_nodal_connec_index(0),
_types(other._types)
{
if(other._nodal_connec)
std::copy(conn,conn+getNodalConnectivityArrayLen(),ptA1);
}
else
- a1=nullptr;
+ a1=0;
}
/*!
{
std::string name="MeasureOfMesh_";
name+=getName();
- mcIdType const nbelem=getNumberOfCells();
+ mcIdType nbelem=getNumberOfCells();
MCAuto<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
field->setName(name);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
array->alloc(nbelem,1);
double *area_vol=array->getPointer();
- field->setArray(array) ; array=nullptr;
+ field->setArray(array) ; array=0;
field->setMesh(const_cast<MEDCouplingUMesh *>(this));
field->synchronizeTimeWithMesh();
if(getMeshDimension()!=-1)
{
mcIdType ipt;
INTERP_KERNEL::NormalizedCellType type;
- int const dim_space=getSpaceDimension();
+ int dim_space=getSpaceDimension();
const double *coords=getCoords()->getConstPointer();
const mcIdType *connec=getNodalConnectivity()->getConstPointer();
const mcIdType *connec_index=getNodalConnectivityIndex()->getConstPointer();
{
std::string name="PartMeasureOfMesh_";
name+=getName();
- std::size_t const nbelem=std::distance(begin,end);
+ std::size_t nbelem=std::distance(begin,end);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
array->setName(name);
array->alloc(nbelem,1);
{
mcIdType ipt;
INTERP_KERNEL::NormalizedCellType type;
- int const dim_space=getSpaceDimension();
+ int dim_space=getSpaceDimension();
const double *coords=getCoords()->getConstPointer();
const mcIdType *connec=getNodalConnectivity()->getConstPointer();
const mcIdType *connec_index=getNodalConnectivityIndex()->getConstPointer();
MCAuto<MEDCouplingFieldDouble> tmp=getMeasureField(isAbs);
std::string name="MeasureOnNodeOfMesh_";
name+=getName();
- mcIdType const nbNodes=getNumberOfNodes();
+ mcIdType nbNodes=getNumberOfNodes();
MCAuto<DataArrayDouble> nnpc;
{
MCAuto<DataArrayIdType> tmp2(computeNbOfNodesPerCell());
throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
- mcIdType const nbOfCells=getNumberOfCells();
- int const nbComp=getMeshDimension()+1;
+ mcIdType nbOfCells=getNumberOfCells();
+ int nbComp=getMeshDimension()+1;
array->alloc(nbOfCells,nbComp);
double *vals=array->getPointer();
const mcIdType *connI=_nodal_connec_index->getConstPointer();
const double *locPtr=loc->getConstPointer();
for(mcIdType i=0;i<nbOfCells;i++,vals+=3)
{
- mcIdType const offset=connI[i];
+ mcIdType offset=connI[i];
INTERP_KERNEL::crossprod<3>(locPtr+3*i,coords+3*conn[offset+1],coords+3*conn[offset+2],vals);
- double const n=INTERP_KERNEL::norm<3>(vals);
+ double n=INTERP_KERNEL::norm<3>(vals);
std::transform(vals,vals+3,vals,std::bind(std::multiplies<double>(),std::placeholders::_1,1./n));
}
}
double tmp[2];
for(mcIdType i=0;i<nbOfCells;i++)
{
- mcIdType const offset=connI[i];
+ mcIdType offset=connI[i];
std::transform(coords+2*conn[offset+2],coords+2*conn[offset+2]+2,coords+2*conn[offset+1],tmp,std::minus<double>());
- double const n=INTERP_KERNEL::norm<2>(tmp);
+ double n=INTERP_KERNEL::norm<2>(tmp);
std::transform(tmp,tmp+2,tmp,std::bind(std::multiplies<double>(),std::placeholders::_1,1./n));
*vals++=-tmp[1];
*vals++=tmp[0];
throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
- std::size_t const nbelems=std::distance(begin,end);
- int const nbComp=getMeshDimension()+1;
+ std::size_t nbelems=std::distance(begin,end);
+ int nbComp=getMeshDimension()+1;
array->alloc(nbelems,nbComp);
double *vals=array->getPointer();
const mcIdType *connI=_nodal_connec_index->getConstPointer();
const double *locPtr=loc->getConstPointer();
for(const mcIdType *i=begin;i!=end;i++,vals+=3,locPtr+=3)
{
- mcIdType const offset=connI[*i];
+ mcIdType offset=connI[*i];
INTERP_KERNEL::crossprod<3>(locPtr,coords+3*conn[offset+1],coords+3*conn[offset+2],vals);
- double const n=INTERP_KERNEL::norm<3>(vals);
+ double n=INTERP_KERNEL::norm<3>(vals);
std::transform(vals,vals+3,vals,std::bind(std::multiplies<double>(),std::placeholders::_1,1./n));
}
}
double tmp[2];
for(const mcIdType *i=begin;i!=end;i++)
{
- mcIdType const offset=connI[*i];
+ mcIdType offset=connI[*i];
std::transform(coords+2*conn[offset+2],coords+2*conn[offset+2]+2,coords+2*conn[offset+1],tmp,std::minus<double>());
- double const n=INTERP_KERNEL::norm<2>(tmp);
+ double n=INTERP_KERNEL::norm<2>(tmp);
std::transform(tmp,tmp+2,tmp,std::bind(std::multiplies<double>(),std::placeholders::_1,1./n));
*vals++=-tmp[1];
*vals++=tmp[0];
throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildDirectionVectorField !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
- mcIdType const nbOfCells=getNumberOfCells();
- int const spaceDim=getSpaceDimension();
+ mcIdType nbOfCells=getNumberOfCells();
+ int spaceDim=getSpaceDimension();
array->alloc(nbOfCells,spaceDim);
double *pt=array->getPointer();
const double *coo=getCoords()->getConstPointer();
if(candidates->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane considering bounding boxes !");
std::vector<mcIdType> nodes;
- DataArrayIdType *cellIds1D=nullptr;
+ DataArrayIdType *cellIds1D=0;
MCAuto<MEDCouplingUMesh> subMesh=static_cast<MEDCouplingUMesh*>(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
subMesh->findNodesOnPlane(origin,vec,eps,nodes);
MCAuto<DataArrayIdType> desc1=DataArrayIdType::New(),desc2=DataArrayIdType::New();
MCAuto<DataArrayIdType> revDesc1=DataArrayIdType::New(),revDesc2=DataArrayIdType::New();
MCAuto<DataArrayIdType> revDescIndx1=DataArrayIdType::New(),revDescIndx2=DataArrayIdType::New();
MCAuto<MEDCouplingUMesh> mDesc2=subMesh->buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2);//meshDim==2 spaceDim==3
- revDesc2=nullptr; revDescIndx2=nullptr;
+ revDesc2=0; revDescIndx2=0;
MCAuto<MEDCouplingUMesh> mDesc1=mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3
- revDesc1=nullptr; revDescIndx1=nullptr;
+ revDesc1=0; revDescIndx1=0;
//Marking all 1D cells that contained at least one node located on the plane
//the intersection between those cells and the plane, which consist of the nodes previously tagged, thus don't need to be computed afterwards
//(if said intersection is computed in MEDCouplingUMesh::split3DCurveWithPlane, then we might create additional nodes
//due to accuracy errors when the needed nodes already exist)
mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),false,cellIds1D);
- MCAuto<DataArrayIdType> const cellIds1DTmp(cellIds1D);
+ MCAuto<DataArrayIdType> cellIds1DTmp(cellIds1D);
//
std::vector<mcIdType> cut3DCurve(mDesc1->getNumberOfCells(),-2);
- for(long const it : *cellIds1D)
- cut3DCurve[it]=-1;
+ for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++)
+ cut3DCurve[*it]=-1;
mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve);
std::vector< std::pair<mcIdType,mcIdType> > cut3DSurf(mDesc2->getNumberOfCells());
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->getConstPointer(),mDesc2->getNodalConnectivityIndex()->getConstPointer(),
if(candidates->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : No 3D surf cells in this intercepts the specified plane considering bounding boxes !");
std::vector<mcIdType> nodes;
- DataArrayIdType *cellIds1D(nullptr);
+ DataArrayIdType *cellIds1D(0);
MCAuto<MEDCouplingUMesh> subMesh(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
subMesh->findNodesOnPlane(origin,vec,eps,nodes);
MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc1(subMesh->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));//meshDim==1 spaceDim==3
mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D);
- MCAuto<DataArrayIdType> const cellIds1DTmp(cellIds1D);
+ MCAuto<DataArrayIdType> cellIds1DTmp(cellIds1D);
//
std::vector<mcIdType> cut3DCurve(mDesc1->getNumberOfCells(),-2);
- for(long const it : *cellIds1D)
- cut3DCurve[it]=-1;
+ for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++)
+ cut3DCurve[*it]=-1;
mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve);
- mcIdType const ncellsSub=subMesh->getNumberOfCells();
+ mcIdType ncellsSub=subMesh->getNumberOfCells();
std::vector< std::pair<mcIdType,mcIdType> > cut3DSurf(ncellsSub);
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,subMesh->getNodalConnectivity()->getConstPointer(),subMesh->getNodalConnectivityIndex()->getConstPointer(),
mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(),
}
else
{
- mcIdType const cellId3DSurf=cut3DSurf[i].second;
- mcIdType const offset=nodalI[cellId3DSurf]+1;
- mcIdType const nbOfEdges=nodalI[cellId3DSurf+1]-offset;
+ mcIdType cellId3DSurf=cut3DSurf[i].second;
+ mcIdType offset=nodalI[cellId3DSurf]+1;
+ mcIdType nbOfEdges=nodalI[cellId3DSurf+1]-offset;
for(mcIdType j=0;j<nbOfEdges;j++)
{
conn->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_SEG2)); conn->pushBackSilent(nodal[offset+j]); conn->pushBackSilent(nodal[offset+(j+1)%nbOfEdges]);
findNodesOnPlane(origin,vec,eps,nodes);
MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),desc2(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),descIndx2(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDesc2(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()),revDescIndx2(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc2(buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2));//meshDim==2 spaceDim==3
- revDesc2=nullptr; revDescIndx2=nullptr;
+ revDesc2=0; revDescIndx2=0;
MCAuto<MEDCouplingUMesh> mDesc1(mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));//meshDim==1 spaceDim==3
- revDesc1=nullptr; revDescIndx1=nullptr;
- DataArrayIdType *cellIds1D(nullptr);
+ revDesc1=0; revDescIndx1=0;
+ DataArrayIdType *cellIds1D(0);
mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D);
- MCAuto<DataArrayIdType> const cellIds1DTmp(cellIds1D);
+ MCAuto<DataArrayIdType> cellIds1DTmp(cellIds1D);
std::vector<mcIdType> cut3DCurve(mDesc1->getNumberOfCells(),-2);
- for(long const it : *cellIds1D)
- cut3DCurve[it]=-1;
+ for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++)
+ cut3DCurve[*it]=-1;
bool sameNbNodes;
{
- mcIdType const oldNbNodes(mDesc1->getNumberOfNodes());
+ mcIdType oldNbNodes(mDesc1->getNumberOfNodes());
mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve);
sameNbNodes=(mDesc1->getNumberOfNodes()==oldNbNodes);
}
}
std::vector<std::vector<mcIdType> > res;
buildSubCellsFromCut(cut3DSurf,desc2->begin(),descIndx2->begin(),mDesc1->getCoords()->begin(),eps,res);
- std::size_t const sz(res.size());
+ std::size_t sz(res.size());
if(ToIdType(res.size())==mDesc1->getNumberOfCells() && sameNbNodes)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane : cell is not clipped !");
for(std::size_t i=0;i<sz;i++)
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
ret->setCoords(mDesc1->getCoords());
ret->setConnectivity(conn,connI,true);
- mcIdType const nbCellsRet(ret->getNumberOfCells());
+ mcIdType nbCellsRet(ret->getNumberOfCells());
//
MCAuto<DataArrayDouble> vec2(DataArrayDouble::New()); vec2->alloc(1,3); std::copy(vec,vec+3,vec2->getPointer());
MCAuto<MEDCouplingFieldDouble> ortho(ret->buildOrthogonalField());
checkFullyDefined();
if(getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D works on umeshes with spaceDim equal to 3 !");
- double const normm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]);
+ double normm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]);
if(normm<1e-6)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getCellIdsCrossingPlane : parameter 'vec' should have a norm2 greater than 1e-6 !");
double vec2[3];
vec2[0]=vec[1]; vec2[1]=-vec[0]; vec2[2]=0.;//vec2 is the result of cross product of vec with (0,0,1)
- double const angle=acos(vec[2]/normm);
+ double angle=acos(vec[2]/normm);
MCAuto<DataArrayIdType> cellIds;
double bbox[6];
if(angle>eps)
{
MCAuto<DataArrayDouble> coo=_coords->deepCopy();
- double const normm2(sqrt(vec2[0]*vec2[0]+vec2[1]*vec2[1]+vec2[2]*vec2[2]));
+ double normm2(sqrt(vec2[0]*vec2[0]+vec2[1]*vec2[1]+vec2[2]*vec2[2]));
if(normm2/normm>1e-6)
DataArrayDouble::Rotate3DAlg(origin,vec2,angle,coo->getNumberOfTuples(),coo->getPointer(),coo->getPointer());
MCAuto<MEDCouplingUMesh> mw=clone(false);//false -> shallow copy
{
if(getMeshDimension()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense only for 1D mesh !");
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
if(nbCells<1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense for non empty mesh !");
const mcIdType *connI(_nodal_connec_index->begin()),*conn(_nodal_connec->begin());
checkFullyDefined();
if(ToIdType(std::distance(ptBg,ptEnd))!=spaceDim)
{ std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoint : input point has to have dimension equal to the space dimension of this (" << spaceDim << ") !"; throw INTERP_KERNEL::Exception(oss.str()); }
- DataArrayIdType *ret1=nullptr;
+ DataArrayIdType *ret1=0;
MCAuto<DataArrayDouble> pts=DataArrayDouble::New(); pts->useArray(ptBg,false,DeallocType::C_DEALLOC,1,spaceDim);
MCAuto<DataArrayDouble> ret0=distanceToPoints(pts,ret1);
MCAuto<DataArrayIdType> ret1Safe(ret1);
throw INTERP_KERNEL::Exception(oss.str());
}
checkFullyDefined();
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
if(nbCells==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !");
- mcIdType const nbOfPts=pts->getNumberOfTuples();
+ mcIdType nbOfPts=pts->getNumberOfTuples();
MCAuto<DataArrayDouble> ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1);
MCAuto<DataArrayIdType> ret1=DataArrayIdType::New(); ret1->alloc(nbOfPts,1);
const mcIdType *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin();
{
case 3:
{
- BBTreeDst<3> const myTree(bbox,nullptr,0,nbCells);
+ BBTreeDst<3> myTree(bbox,0,0,nbCells);
for(mcIdType i=0;i<nbOfPts;i++,ret0Ptr++,ret1Ptr++,ptsPtr+=3)
{
double x=std::numeric_limits<double>::max();
}
case 2:
{
- BBTreeDst<2> const myTree(bbox,nullptr,0,nbCells);
+ BBTreeDst<2> myTree(bbox,0,0,nbCells);
for(mcIdType i=0;i<nbOfPts;i++,ret0Ptr++,ret1Ptr++,ptsPtr+=2)
{
double x=std::numeric_limits<double>::max();
const char msg[]="Butterfly detection work only for 2D cells with spaceDim==2 or 3!";
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception(msg);
- int const spaceDim=getSpaceDimension();
+ int spaceDim=getSpaceDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception(msg);
const mcIdType *conn=_nodal_connec->getConstPointer();
const mcIdType *connI=_nodal_connec_index->getConstPointer();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<double> cell2DinS2;
for(mcIdType i=0;i<nbOfCells;i++)
{
- mcIdType const offset=connI[i];
- mcIdType const nbOfNodesForCell=connI[i+1]-offset-1;
+ mcIdType offset=connI[i];
+ mcIdType nbOfNodesForCell=connI[i+1]-offset-1;
if(nbOfNodesForCell<=3)
continue;
- bool const isQuad=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[offset]).isQuadratic();
+ bool isQuad=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[offset]).isQuadratic();
project2DCellOnXY(conn+offset+1,conn+connI[i+1],cell2DinS2);
if(isButterfly2DCell(cell2DinS2,isQuad,eps))
cells.push_back(i);
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convexEnvelop2D works only for meshDim=2 and spaceDim=2 !");
checkFullyDefined();
const double *coords=getCoords()->getConstPointer();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> nodalConnecIndexOut=DataArrayIdType::New();
nodalConnecIndexOut->alloc(nbOfCells+1,1);
MCAuto<DataArrayIdType> nodalConnecOut(DataArrayIdType::New());
isChanged->alloc(0,1);
for(mcIdType i=0;i<nbOfCells;i++,workIndexOut++)
{
- mcIdType const pos=nodalConnecOut->getNumberOfTuples();
+ mcIdType pos=nodalConnecOut->getNumberOfTuples();
if(BuildConvexEnvelopOf2DCellJarvis(coords,nodalConnecIn+nodalConnecIndexIn[i],nodalConnecIn+nodalConnecIndexIn[i+1],nodalConnecOut))
isChanged->pushBackSilent(i);
types.insert((INTERP_KERNEL::NormalizedCellType)nodalConnecOut->getIJ(pos,0));
workIndexOut[1]=nodalConnecOut->getNumberOfTuples();
}
if(isChanged->empty())
- return nullptr;
+ return 0;
setConnectivity(nodalConnecOut,nodalConnecIndexOut,false);
_types=types;
return isChanged.retn();
else
throw INTERP_KERNEL::Exception("Invalid 2D mesh and 1D mesh because 2D mesh has quadratic cells and 1D is not fully quadratic !");
}
- mcIdType const oldNbOfNodes(getNumberOfNodes());
+ mcIdType oldNbOfNodes(getNumberOfNodes());
MCAuto<DataArrayDouble> newCoords;
switch(policy)
{
{
checkFullyDefined();
bool ret=true;
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells && ret;i++)
{
- INTERP_KERNEL::NormalizedCellType const type=getTypeOfCell(i);
+ INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
ret=cm.isQuadratic();
}
{
checkFullyDefined();
bool ret=false;
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells && !ret;i++)
{
- INTERP_KERNEL::NormalizedCellType const type=getTypeOfCell(i);
+ INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
ret=cm.isQuadratic();
}
void MEDCouplingUMesh::convertQuadraticCellsToLinear()
{
checkFullyDefined();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType delta=0;
const mcIdType *iciptr=_nodal_connec_index->begin();
for(mcIdType i=0;i<nbOfCells;i++)
{
- INTERP_KERNEL::NormalizedCellType const type=getTypeOfCell(i);
+ INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(cm.isQuadratic())
{
- INTERP_KERNEL::NormalizedCellType const typel=cm.getLinearType();
+ INTERP_KERNEL::NormalizedCellType typel=cm.getLinearType();
const INTERP_KERNEL::CellModel& cml=INTERP_KERNEL::CellModel::GetCellModel(typel);
if(!cml.isDynamic())
delta+=cm.getNumberOfNodes()-cml.getNumberOfNodes();
_types.clear();
for(mcIdType i=0;i<nbOfCells;i++,ociptr++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)icptr[iciptr[i]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)icptr[iciptr[i]];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(!cm.isQuadratic())
{
}
else
{
- INTERP_KERNEL::NormalizedCellType const typel=cm.getLinearType();
+ INTERP_KERNEL::NormalizedCellType typel=cm.getLinearType();
_types.insert(typel);
const INTERP_KERNEL::CellModel& cml=INTERP_KERNEL::CellModel::GetCellModel(typel);
mcIdType newNbOfNodes=cml.getNumberOfNodes();
*/
DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic(int conversionType)
{
- DataArrayIdType *conn=nullptr,*connI=nullptr;
- DataArrayDouble *coords=nullptr;
+ DataArrayIdType *conn=0,*connI=0;
+ DataArrayDouble *coords=0;
std::set<INTERP_KERNEL::NormalizedCellType> types;
checkFullyDefined();
MCAuto<DataArrayIdType> ret,connSafe,connISafe;
MCAuto<DataArrayDouble> coordsSafe;
- int const meshDim=getMeshDimension();
+ int meshDim=getMeshDimension();
switch(conversionType)
{
case 0:
bool MEDCouplingUMesh::areOnlySimplexCells() const
{
checkFullyDefined();
- int const mdim=getMeshDimension();
+ int mdim=getMeshDimension();
if(mdim<1 || mdim>3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::areOnlySimplexCells : only available with meshes having a meshdim 1, 2 or 3 !");
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
for(mcIdType i=0;i<nbCells;i++)
checkFullyDefined();
if(getMeshDimension()<=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertDegeneratedCells works on umeshes with meshdim equals to 2 or 3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells<1)
return ;
- mcIdType const initMeshLgth=getNodalConnectivityArrayLen();
+ mcIdType initMeshLgth=getNodalConnectivityArrayLen();
mcIdType *conn=_nodal_connec->getPointer();
mcIdType *index=_nodal_connec_index->getPointer();
mcIdType posOfCurCell=0;
for(mcIdType i=0;i<nbOfCells;i++)
{
lgthOfCurCell=index[i+1]-posOfCurCell;
- auto const type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
mcIdType newLgth;
- INTERP_KERNEL::NormalizedCellType const newType=INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,
+ INTERP_KERNEL::NormalizedCellType newType=INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,
conn+newPos+1,newLgth);
conn[newPos]=newType;
newPos+=newLgth+1;
checkFullyDefined();
if(getMeshDimension()<=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertDegeneratedCells works on umeshes with meshdim equals to 2 or 3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(0,1);
if(nbOfCells<1)
return ret.retn();
- mcIdType const initMeshLgth=getNodalConnectivityArrayLen();
+ mcIdType initMeshLgth=getNodalConnectivityArrayLen();
mcIdType *conn=_nodal_connec->getPointer();
mcIdType *index=_nodal_connec_index->getPointer();
mcIdType posOfCurCell=0;
for(mcIdType i=0;i<nbOfCells;i++)
{
lgthOfCurCell=index[i+1]-posOfCurCell;
- auto const type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
mcIdType newLgth;
- INTERP_KERNEL::NormalizedCellType const newType=INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,
+ INTERP_KERNEL::NormalizedCellType newType=INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,
conn+newPos+1,newLgth);
// Shall we delete the cell if it is completely degenerated:
- bool const delCell=INTERP_KERNEL::CellSimplify::isFlatCell(conn, newPos, newLgth, newType);
+ bool delCell=INTERP_KERNEL::CellSimplify::isFlatCell(conn, newPos, newLgth, newType);
if (delCell)
{
nbDelCells++;
{
for(std::size_t i=0;i<nbCells;i++)
{
- auto const ct((INTERP_KERNEL::NormalizedCellType)conn[conni[i]]);
+ INTERP_KERNEL::NormalizedCellType ct((INTERP_KERNEL::NormalizedCellType)conn[conni[i]]);
if(ct==INTERP_KERNEL::NORM_SEG2 || ct==INTERP_KERNEL::NORM_SEG3)
{
if(conn[conni[i]+1]!=conn[conni[i]+2])
{
if(getMeshDimension()!=2 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply are2DCellsNotCorrectlyOriented on it : must be meshDim==2 and spaceDim==3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
if(!polyOnly || (type==INTERP_KERNEL::NORM_POLYGON || type==INTERP_KERNEL::NORM_QPOLYG))
{
- bool const isQuadratic=INTERP_KERNEL::CellModel::GetCellModel(type).isQuadratic();
+ bool isQuadratic=INTERP_KERNEL::CellModel::GetCellModel(type).isQuadratic();
if(!IsPolygonWellOriented(isQuadratic,vec,conn+connI[i]+1,conn+connI[i+1],coordsPtr))
cells.push_back(i);
}
{
if(getMeshDimension()!=2 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply orientCorrectly2DCells on it : must be meshDim==2 and spaceDim==3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType *conn(_nodal_connec->getPointer());
const mcIdType *connI(_nodal_connec_index->begin());
const double *coordsPtr(_coords->begin());
bool isModified(false);
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
+ INTERP_KERNEL::NormalizedCellType type((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
if(!polyOnly || (type==INTERP_KERNEL::NORM_POLYGON || type==INTERP_KERNEL::NORM_QPOLYG))
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
- bool const isQuadratic(cm.isQuadratic());
+ bool isQuadratic(cm.isQuadratic());
if(!IsPolygonWellOriented(isQuadratic,vec,conn+connI[i]+1,conn+connI[i+1],coordsPtr))
{
isModified=true;
*/
void MEDCouplingUMesh::changeOrientationOfCells()
{
- int const mdim(getMeshDimension());
+ int mdim(getMeshDimension());
if(mdim!=2 && mdim!=1)
throw INTERP_KERNEL::Exception("Invalid mesh to apply changeOrientationOfCells on it : must be meshDim==2 or meshDim==1 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType *conn(_nodal_connec->getPointer());
const mcIdType *connI(_nodal_connec_index->begin());
if(mdim==2)
{//2D
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
+ INTERP_KERNEL::NormalizedCellType type((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
cm.changeOrientationOf2D(conn+connI[i]+1,(unsigned int)(connI[i+1]-connI[i]-1));
}
{//1D
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
+ INTERP_KERNEL::NormalizedCellType type((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
cm.changeOrientationOf1D(conn+connI[i]+1,(unsigned int)(connI[i+1]-connI[i]-1));
}
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply arePolyhedronsNotCorrectlyOriented on it : must be meshDim==3 and spaceDim==3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
if(type==INTERP_KERNEL::NORM_POLYHED)
{
if(!IsPolyhedronWellOriented(conn+connI[i]+1,conn+connI[i+1],coordsPtr))
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply orientCorrectlyPolyhedrons on it : must be meshDim==3 and spaceDim==3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType *conn=_nodal_connec->getPointer();
const mcIdType *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
if(type==INTERP_KERNEL::NORM_POLYHED)
{
try
void MEDCouplingUMesh::invertOrientationOfAllCells()
{
checkConnectivityFullyDefined();
- std::set<INTERP_KERNEL::NormalizedCellType> const gts(getAllGeoTypes());
+ std::set<INTERP_KERNEL::NormalizedCellType> gts(getAllGeoTypes());
mcIdType *conn(_nodal_connec->getPointer());
const mcIdType *conni(_nodal_connec_index->begin());
- for(auto gt : gts)
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator gt=gts.begin();gt!=gts.end();gt++)
{
- INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi((INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(gt)));
- MCAuto<DataArrayIdType> cwt(giveCellsWithType(gt));
- for(long const it : *cwt)
- oi->operate(conn+conni[it]+1,conn+conni[it+1]);
+ INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(*gt));
+ MCAuto<DataArrayIdType> cwt(giveCellsWithType(*gt));
+ for(const mcIdType *it=cwt->begin();it!=cwt->end();it++)
+ oi->operate(conn+conni[*it]+1,conn+conni[*it+1]);
}
updateTime();
}
const char msg[]="check3DCellsWellOriented detection works only for 3D cells !";
if(getMeshDimension()!=3)
throw INTERP_KERNEL::Exception(msg);
- int const spaceDim=getSpaceDimension();
+ int spaceDim=getSpaceDimension();
if(spaceDim!=3)
throw INTERP_KERNEL::Exception(msg);
//
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType *conn=_nodal_connec->getPointer();
const mcIdType *connI=_nodal_connec_index->begin();
const double *coo=getCoords()->begin();
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply findAndCorrectBadOriented3DCells on it : must be meshDim==3 and spaceDim==3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType *conn=_nodal_connec->getPointer();
const mcIdType *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
switch(type)
{
case INTERP_KERNEL::NORM_TETRA4:
MEDCouplingFieldDouble *MEDCouplingUMesh::getEdgeRatioField() const
{
checkConsistencyLight();
- int const spaceDim=getSpaceDimension();
- int const meshDim=getMeshDimension();
+ int spaceDim=getSpaceDimension();
+ int meshDim=getMeshDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : SpaceDimension must be equal to 2 or 3 !");
if(meshDim!=2 && meshDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : MeshDimension must be equal to 2 or 3 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
double tmp[12];
for(mcIdType i=0;i<nbOfCells;i++,pt++)
{
- auto const t=(INTERP_KERNEL::NormalizedCellType)*conn;
+ INTERP_KERNEL::NormalizedCellType t=(INTERP_KERNEL::NormalizedCellType)*conn;
switch(t)
{
case INTERP_KERNEL::NORM_TRI3:
MEDCouplingFieldDouble *MEDCouplingUMesh::getAspectRatioField() const
{
checkConsistencyLight();
- int const spaceDim=getSpaceDimension();
- int const meshDim=getMeshDimension();
+ int spaceDim=getSpaceDimension();
+ int meshDim=getMeshDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAspectRatioField : SpaceDimension must be equal to 2 or 3 !");
if(meshDim!=2 && meshDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAspectRatioField : MeshDimension must be equal to 2 or 3 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
double tmp[12];
for(mcIdType i=0;i<nbOfCells;i++,pt++)
{
- auto const t=(INTERP_KERNEL::NormalizedCellType)*conn;
+ INTERP_KERNEL::NormalizedCellType t=(INTERP_KERNEL::NormalizedCellType)*conn;
switch(t)
{
case INTERP_KERNEL::NORM_TRI3:
MEDCouplingFieldDouble *MEDCouplingUMesh::getWarpField() const
{
checkConsistencyLight();
- int const spaceDim=getSpaceDimension();
- int const meshDim=getMeshDimension();
+ int spaceDim=getSpaceDimension();
+ int meshDim=getMeshDimension();
if(spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getWarpField : SpaceDimension must be equal to 3 !");
if(meshDim!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getWarpField : MeshDimension must be equal to 2 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
double tmp[12];
for(mcIdType i=0;i<nbOfCells;i++,pt++)
{
- auto const t=(INTERP_KERNEL::NormalizedCellType)*conn;
+ INTERP_KERNEL::NormalizedCellType t=(INTERP_KERNEL::NormalizedCellType)*conn;
switch(t)
{
case INTERP_KERNEL::NORM_QUAD4:
MEDCouplingFieldDouble *MEDCouplingUMesh::getSkewField() const
{
checkConsistencyLight();
- int const spaceDim=getSpaceDimension();
- int const meshDim=getMeshDimension();
+ int spaceDim=getSpaceDimension();
+ int meshDim=getMeshDimension();
if(spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getSkewField : SpaceDimension must be equal to 3 !");
if(meshDim!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getSkewField : MeshDimension must be equal to 2 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
double tmp[12];
for(mcIdType i=0;i<nbOfCells;i++,pt++)
{
- auto const t=(INTERP_KERNEL::NormalizedCellType)*conn;
+ INTERP_KERNEL::NormalizedCellType t=(INTERP_KERNEL::NormalizedCellType)*conn;
switch(t)
{
case INTERP_KERNEL::NORM_QUAD4:
ret->setMesh(this);
std::set<INTERP_KERNEL::NormalizedCellType> types;
ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index);
- int const spaceDim(getSpaceDimension());
- mcIdType const nbCells(getNumberOfCells());
+ int spaceDim(getSpaceDimension());
+ mcIdType nbCells(getNumberOfCells());
MCAuto<DataArrayDouble> arr(DataArrayDouble::New());
arr->alloc(nbCells,1);
- for(auto type : types)
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
{
- INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::DiameterCalculator> dc(INTERP_KERNEL::CellModel::GetCellModel(type).buildInstanceOfDiameterCalulator(spaceDim));
- MCAuto<DataArrayIdType> cellIds(giveCellsWithType(type));
+ INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::DiameterCalculator> dc(INTERP_KERNEL::CellModel::GetCellModel(*it).buildInstanceOfDiameterCalulator(spaceDim));
+ MCAuto<DataArrayIdType> cellIds(giveCellsWithType(*it));
dc->computeForListOfCellIdsUMeshFrmt(cellIds->begin(),cellIds->end(),_nodal_connec_index->begin(),_nodal_connec->begin(),getCoords()->begin(),arr->getPointer());
}
ret->setArray(arr);
if((mDim==2 && sDim==2) || (mDim==1 && sDim==2))
{
bool presenceOfQuadratic(false);
- for(auto _type : _types)
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=_types.begin();it!=_types.end();it++)
{
- const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_type));
+ const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(*it));
if(cm.isQuadratic())
presenceOfQuadratic=true;
}
DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const
{
checkFullyDefined();
- int const spaceDim(getSpaceDimension());
+ int spaceDim(getSpaceDimension());
mcIdType nbOfCells(getNumberOfCells()), nbOfNodes(getNumberOfNodes());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
for(mcIdType i=0;i<nbOfCells;i++)
{
- mcIdType const offset=connI[i]+1;
+ mcIdType offset=connI[i]+1;
mcIdType nbOfNodesForCell(connI[i+1]-offset),kk(0);
for(mcIdType j=0;j<nbOfNodesForCell;j++)
{
- mcIdType const nodeId=conn[offset+j];
+ mcIdType nodeId=conn[offset+j];
if(nodeId>=0 && nodeId<nbOfNodes)
{
for(int k=0;k<spaceDim;k++)
DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic(double arcDetEps) const
{
checkFullyDefined();
- INTERP_KERNEL::QuadraticPlanarPrecision const arcPrec(arcDetEps);
+ INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(arcDetEps);
int spaceDim(getSpaceDimension()),mDim(getMeshDimension());
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(spaceDim!=2 || mDim!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic : This method should be applied on mesh with mesh dimension equal to 2 and space dimension also equal to 2!");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
for(mcIdType i=0;i<nbOfCells;i++,bbox+=4,connI++)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI]));
- mcIdType const sz(connI[1]-connI[0]-1);
+ mcIdType sz(connI[1]-connI[0]-1);
std::vector<INTERP_KERNEL::Node *> nodes(sz);
- INTERP_KERNEL::QuadraticPolygon *pol(nullptr);
+ INTERP_KERNEL::QuadraticPolygon *pol(0);
for(mcIdType j=0;j<sz;j++)
{
- mcIdType const nodeId(conn[*connI+1+j]);
+ mcIdType nodeId(conn[*connI+1+j]);
nodes[j]=new INTERP_KERNEL::Node(coords[nodeId*2],coords[nodeId*2+1]);
}
if(!cm.isQuadratic())
{
checkFullyDefined();
int spaceDim(getSpaceDimension()),mDim(getMeshDimension());
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(spaceDim!=2 || mDim!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic : This method should be applied on mesh with mesh dimension equal to 1 and space dimension also equal to 2!");
- INTERP_KERNEL::QuadraticPlanarPrecision const arcPrec(arcDetEps);
+ INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(arcDetEps);
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
const double *coords(_coords->begin());
for(mcIdType i=0;i<nbOfCells;i++,bbox+=4,connI++)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI]));
- mcIdType const sz(connI[1]-connI[0]-1);
+ mcIdType sz(connI[1]-connI[0]-1);
std::vector<INTERP_KERNEL::Node *> nodes(sz);
- INTERP_KERNEL::Edge *edge(nullptr);
+ INTERP_KERNEL::Edge *edge(0);
for(mcIdType j=0;j<sz;j++)
{
- mcIdType const nodeId(conn[*connI+1+j]);
+ mcIdType nodeId(conn[*connI+1+j]);
nodes[j]=new INTERP_KERNEL::Node(coords[nodeId*2],coords[nodeId*2+1]);
}
if(!cm.isQuadratic())
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
const mcIdType *work=connI;
- mcIdType const nbOfCells=getNumberOfCells();
- std::size_t const n=getAllGeoTypes().size();
+ mcIdType nbOfCells=getNumberOfCells();
+ std::size_t n=getAllGeoTypes().size();
std::vector<mcIdType> ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here
std::set<INTERP_KERNEL::NormalizedCellType> types;
for(std::size_t i=0;work!=connI+nbOfCells;i++)
{
- auto const typ=(INTERP_KERNEL::NormalizedCellType)conn[*work];
+ INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)conn[*work];
if(types.find(typ)!=types.end())
{
std::ostringstream oss; oss << "MEDCouplingUMesh::getDistributionOfTypes : Type " << INTERP_KERNEL::CellModel::GetCellModel(typ).getRepr();
{
if(code.empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code is empty, should not !");
- std::size_t const sz=code.size();
- std::size_t const n=sz/3;
+ std::size_t sz=code.size();
+ std::size_t n=sz/3;
if(sz%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code size is NOT %3 !");
std::vector<INTERP_KERNEL::NormalizedCellType> types;
if(!checkConsecutiveCellTypesAndOrder(&types[0],&types[0]+types.size()))
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : non contiguous type !");
if(types.size()==_types.size())
- return nullptr;
+ return 0;
}
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nb,1);
mcIdType *retPtr=ret->getPointer();
const mcIdType *connI=_nodal_connec_index->begin();
const mcIdType *conn=_nodal_connec->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *i=connI;
int kk=0;
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++,kk++)
{
i=std::find_if(i,connI+nbOfCells,MEDCouplingImpl::ConnReader2(conn,ToIdType((*it))));
- mcIdType const offset=ToIdType(std::distance(connI,i));
+ mcIdType offset=ToIdType(std::distance(connI,i));
const mcIdType *j=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType((*it))));
- mcIdType const nbOfCellsOfCurType=ToIdType(std::distance(i,j));
+ mcIdType nbOfCellsOfCurType=ToIdType(std::distance(i,j));
if(code[3*kk+2]==-1)
for(mcIdType k=0;k<nbOfCellsOfCurType;k++)
*retPtr++=k+offset;
else
{
- mcIdType const idInIdsPerType=code[3*kk+2];
+ mcIdType idInIdsPerType=code[3*kk+2];
if(idInIdsPerType>=0 && idInIdsPerType<ToIdType(idsPerType.size()))
{
const DataArrayIdType *zePfl=idsPerType[idInIdsPerType];
checkConnectivityFullyDefined();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector<mcIdType> typeRangeVals(1);
for(const mcIdType *i=connI;i!=connI+nbOfCells;)
{
- auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
+ INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
if(std::find(types.begin(),types.end(),curType)!=types.end())
{
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : current mesh is not sorted by type !");
typeRangeVals.push_back(ToIdType(std::distance(connI,i)));
}
//
- DataArrayIdType *castArr=nullptr,*rankInsideCast=nullptr,*castsPresent=nullptr;
+ DataArrayIdType *castArr=0,*rankInsideCast=0,*castsPresent=0;
profile->splitByValueRange(&typeRangeVals[0],&typeRangeVals[0]+typeRangeVals.size(),castArr,rankInsideCast,castsPresent);
- MCAuto<DataArrayIdType> const tmp0=castArr;
- MCAuto<DataArrayIdType> const tmp1=rankInsideCast;
- MCAuto<DataArrayIdType> const tmp2=castsPresent;
+ MCAuto<DataArrayIdType> tmp0=castArr;
+ MCAuto<DataArrayIdType> tmp1=rankInsideCast;
+ MCAuto<DataArrayIdType> tmp2=castsPresent;
//
- mcIdType const nbOfCastsFinal=castsPresent->getNumberOfTuples();
+ mcIdType nbOfCastsFinal=castsPresent->getNumberOfTuples();
code.resize(3*nbOfCastsFinal);
std::vector< MCAuto<DataArrayIdType> > idsInPflPerType2;
std::vector< MCAuto<DataArrayIdType> > idsPerType2;
for(mcIdType i=0;i<nbOfCastsFinal;i++)
{
- mcIdType const castId=castsPresent->getIJ(i,0);
+ mcIdType castId=castsPresent->getIJ(i,0);
MCAuto<DataArrayIdType> tmp3=castArr->findIdsEqual(castId);
idsInPflPerType2.push_back(tmp3);
code[3*i]=ToIdType(types[castId]);
code[3*i+2]=-1;
}
}
- std::size_t const sz2=idsInPflPerType2.size();
+ std::size_t sz2=idsInPflPerType2.size();
idsInPflPerType.resize(sz2);
for(std::size_t i=0;i<sz2;i++)
{
locDa->incrRef();
idsInPflPerType[i]=locDa;
}
- std::size_t const sz=idsPerType2.size();
+ std::size_t sz=idsPerType2.size();
idsPerType.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
tmp->renumberCells(ret0->begin(),false);
revDesc=tmp->getNodalConnectivity();
revDescIndx=tmp->getNodalConnectivityIndex();
- DataArrayIdType *ret=nullptr;
+ DataArrayIdType *ret=0;
if(!ret1->areCellsIncludedIn(nM1LevMesh,2,ret))
{
mcIdType tmp2;
checkFullyDefined();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
std::set<INTERP_KERNEL::NormalizedCellType> types;
for(const mcIdType *i=connI;i!=connI+nbOfCells;)
{
- auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
+ INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
if(types.find(curType)!=types.end())
return false;
types.insert(curType);
checkFullyDefined();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells==0)
return true;
mcIdType lastPos=-1;
std::set<INTERP_KERNEL::NormalizedCellType> sg;
for(const mcIdType *i=connI;i!=connI+nbOfCells;)
{
- auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
+ INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
const INTERP_KERNEL::NormalizedCellType *isTypeExists=std::find(orderBg,orderEnd,curType);
if(isTypeExists!=orderEnd)
{
- mcIdType const pos=ToIdType(std::distance(orderBg,isTypeExists));
+ mcIdType pos=ToIdType(std::distance(orderBg,isTypeExists));
if(pos<=lastPos)
return false;
lastPos=pos;
DataArrayIdType *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayIdType *&nbPerType) const
{
checkConnectivityFullyDefined();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
MCAuto<DataArrayIdType> tmpa=DataArrayIdType::New();
const INTERP_KERNEL::NormalizedCellType *where=std::find(orderBg,orderEnd,(INTERP_KERNEL::NormalizedCellType)conn[*i]);
if(where!=orderEnd)
{
- mcIdType const pos=ToIdType(std::distance(orderBg,where));
+ mcIdType pos=ToIdType(std::distance(orderBg,where));
tmp2[pos]++;
tmp[std::distance(connI,i)]=pos;
}
*/
DataArrayIdType *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const
{
- DataArrayIdType *nbPerType=nullptr;
+ DataArrayIdType *nbPerType=0;
MCAuto<DataArrayIdType> tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType);
nbPerType->decrRef();
return tmpa->buildPermArrPerLevel();
computeTypes();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<INTERP_KERNEL::NormalizedCellType> types;
for(const mcIdType *i=connI;i!=connI+nbOfCells && (types.size()!=_types.size());)
if(std::find(types.begin(),types.end(),(INTERP_KERNEL::NormalizedCellType)conn[*i])==types.end())
{
- auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
+ INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
types.push_back(curType);
for(i++;i!=connI+nbOfCells && (INTERP_KERNEL::NormalizedCellType)conn[*i]==curType;i++);
}
mcIdType *retPtr=ret->getPointer();
std::fill(retPtr,retPtr+nbOfCells,-1);
mcIdType newCellId=0;
- for(auto type : types)
+ for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=types.begin();iter!=types.end();iter++)
{
for(const mcIdType *i=connI;i!=connI+nbOfCells;i++)
- if((INTERP_KERNEL::NormalizedCellType)conn[*i]==type)
+ if((INTERP_KERNEL::NormalizedCellType)conn[*i]==(*iter))
retPtr[std::distance(connI,i)]=newCellId++;
}
renumberCells(retPtr,false);
checkConnectivityFullyDefined();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
std::vector<MEDCouplingUMesh *> ret;
for(const mcIdType *i=connI;i!=connI+nbOfCells;)
{
- auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
- mcIdType const beginCellId=ToIdType(std::distance(connI,i));
+ INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
+ mcIdType beginCellId=ToIdType(std::distance(connI,i));
i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType)));
- mcIdType const endCellId=ToIdType(std::distance(connI,i));
- mcIdType const sz=endCellId-beginCellId;
- auto *cells=new mcIdType[sz];
+ mcIdType endCellId=ToIdType(std::distance(connI,i));
+ mcIdType sz=endCellId-beginCellId;
+ mcIdType *cells=new mcIdType[sz];
for(mcIdType j=0;j<sz;j++)
cells[j]=beginCellId+j;
- auto *m=(MEDCouplingUMesh *)buildPartOfMySelf(cells,cells+sz,true);
+ MEDCouplingUMesh *m=(MEDCouplingUMesh *)buildPartOfMySelf(cells,cells+sz,true);
delete [] cells;
ret.push_back(m);
}
checkConnectivityFullyDefined();
if(_types.size()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : current mesh does not contain exactly one geometric type !");
- INTERP_KERNEL::NormalizedCellType const typ=*_types.begin();
+ INTERP_KERNEL::NormalizedCellType typ=*_types.begin();
MCAuto<MEDCoupling1GTUMesh> ret=MEDCoupling1GTUMesh::New(getName(),typ);
ret->setCoords(getCoords());
- auto *retC=dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh*)ret);
+ MEDCoupling1SGTUMesh *retC=dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh*)ret);
if(retC)
{
MCAuto<DataArrayIdType> c=convertNodalConnectivityToStaticGeoTypeMesh();
}
else
{
- auto *retD=dynamic_cast<MEDCoupling1DGTUMesh *>((MEDCoupling1GTUMesh*)ret);
+ MEDCoupling1DGTUMesh *retD=dynamic_cast<MEDCoupling1DGTUMesh *>((MEDCoupling1GTUMesh*)ret);
if(!retD)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : Internal error !");
- DataArrayIdType *c=nullptr,*ci=nullptr;
+ DataArrayIdType *c=0,*ci=0;
convertNodalConnectivityToDynamicGeoTypeMesh(c,ci);
MCAuto<DataArrayIdType> cs(c),cis(ci);
retD->setNodalConnectivity(cs,cis);
checkConnectivityFullyDefined();
if(_types.size()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh : current mesh does not contain exactly one geometric type !");
- INTERP_KERNEL::NormalizedCellType const typ=*_types.begin();
+ INTERP_KERNEL::NormalizedCellType typ=*_types.begin();
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
if(cm.isDynamic())
{
oss << "this type is dynamic ! Only static geometric type is possible for that type ! call convertNodalConnectivityToDynamicGeoTypeMesh instead !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mcIdType const nbCells=getNumberOfCells();
- mcIdType const typi=ToIdType(typ);
+ mcIdType nbCells=getNumberOfCells();
+ mcIdType typi=ToIdType(typ);
mcIdType nbNodesPerCell=ToIdType(cm.getNumberOfNodes());
MCAuto<DataArrayIdType> connOut=DataArrayIdType::New(); connOut->alloc(nbCells*nbNodesPerCell,1);
mcIdType *outPtr=connOut->getPointer();
for(mcIdType i=0;i<nbCells;i++,cip++,incip++)
{
mcIdType strt(incip[0]+1),stop(incip[1]);//+1 to skip geo type
- mcIdType const delta(stop-strt);
+ mcIdType delta(stop-strt);
if(delta>=1)
{
if((strt>=0 && strt<lgth) && (stop>=0 && stop<=lgth))
DataArrayIdType *&idInMsOfCellGrpOfSameType)
{
std::vector<const MEDCouplingUMesh *> ms2;
- for(auto m : ms)
- if(m)
+ for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++)
+ if(*it)
{
- m->checkConnectivityFullyDefined();
- ms2.push_back(m);
+ (*it)->checkConnectivityFullyDefined();
+ ms2.push_back(*it);
}
if(ms2.empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords : input vector is empty !");
const DataArrayDouble *refCoo=ms2[0]->getCoords();
- int const meshDim=ms2[0]->getMeshDimension();
+ int meshDim=ms2[0]->getMeshDimension();
std::vector<const MEDCouplingUMesh *> m1ssm;
std::vector< MCAuto<MEDCouplingUMesh> > m1ssmAuto;
//
std::vector<MEDCouplingUMesh *> sp=(*it)->splitByType();
std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector<const MEDCouplingUMesh *> >(m1ssm));
std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector<MCAuto<MEDCouplingUMesh> > >(m1ssmAuto));
- for(auto it2 : sp)
+ for(std::vector<MEDCouplingUMesh *>::const_iterator it2=sp.begin();it2!=sp.end();it2++)
{
- auto *singleCell=static_cast<MEDCouplingUMesh *>(it2->buildPartOfMySelf(&fake,&fake+1,true));
+ MEDCouplingUMesh *singleCell=static_cast<MEDCouplingUMesh *>((*it2)->buildPartOfMySelf(&fake,&fake+1,true));
m1ssmSingleAuto.push_back(singleCell);
m1ssmSingle.push_back(singleCell);
- ret1->pushBackSilent(it2->getNumberOfCells()); ret2->pushBackSilent(rk);
+ ret1->pushBackSilent((*it2)->getNumberOfCells()); ret2->pushBackSilent(rk);
}
}
MCAuto<MEDCouplingUMesh> m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle);
checkFullyDefined();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
- mcIdType const nbOfCells=getNumberOfCells();
- std::set<INTERP_KERNEL::NormalizedCellType> const types(getAllGeoTypes());
- auto *tmp=new mcIdType[nbOfCells];
- for(auto type : types)
+ mcIdType nbOfCells=getNumberOfCells();
+ std::set<INTERP_KERNEL::NormalizedCellType> types(getAllGeoTypes());
+ mcIdType *tmp=new mcIdType[nbOfCells];
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=types.begin();iter!=types.end();iter++)
{
mcIdType j=0;
for(const mcIdType *i=connI;i!=connI+nbOfCells;i++)
- if((INTERP_KERNEL::NormalizedCellType)conn[*i]==type)
+ if((INTERP_KERNEL::NormalizedCellType)conn[*i]==(*iter))
tmp[std::distance(connI,i)]=j++;
}
DataArrayIdType *ret=DataArrayIdType::New();
ret->copyStringInfoFrom(*da);
mcIdType *retPtr=ret->getPointer();
const mcIdType *daPtr=da->begin();
- mcIdType const nbOfElems=da->getNbOfElems();
+ mcIdType nbOfElems=da->getNbOfElems();
for(mcIdType k=0;k<nbOfElems;k++)
retPtr[k]=tmp[daPtr[k]];
delete [] tmp;
MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const mcIdType *idsPerGeoTypeBg, const mcIdType *idsPerGeoTypeEnd) const
{
std::vector<mcIdType> code=getDistributionOfTypes();
- std::size_t const nOfTypesInThis=code.size()/3;
+ std::size_t nOfTypesInThis=code.size()/3;
mcIdType sz=0,szOfType=0;
for(std::size_t i=0;i<nOfTypesInThis;i++)
{
*/
std::vector<bool> MEDCouplingUMesh::getQuadraticStatus() const
{
- mcIdType const ncell=getNumberOfCells();
+ mcIdType ncell=getNumberOfCells();
std::vector<bool> ret(ncell);
const mcIdType *cI=getNodalConnectivityIndex()->begin();
const mcIdType *c=getNodalConnectivity()->begin();
for(mcIdType i=0;i<ncell;i++)
{
- auto const typ=(INTERP_KERNEL::NormalizedCellType)c[cI[i]];
+ INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)c[cI[i]];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
ret[i]=cm.isQuadratic();
}
{
if(other->getType()!=UNSTRUCTURED)
throw INTERP_KERNEL::Exception("Merge of umesh only available with umesh each other !");
- const auto *otherC=static_cast<const MEDCouplingUMesh *>(other);
+ const MEDCouplingUMesh *otherC=static_cast<const MEDCouplingUMesh *>(other);
return MergeUMeshes(this,otherC);
}
DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMass() const
{
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int const spaceDim=getSpaceDimension();
- mcIdType const nbOfCells=getNumberOfCells();
+ int spaceDim=getSpaceDimension();
+ mcIdType nbOfCells=getNumberOfCells();
ret->alloc(nbOfCells,spaceDim);
ret->copyStringInfoFrom(*getCoords());
double *ptToFill=ret->getPointer();
const double *coor=_coords->begin();
for(mcIdType i=0;i<nbOfCells;i++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[i]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[i]];
INTERP_KERNEL::computeBarycenter2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(type,nodal+nodalI[i]+1,nodalI[i+1]-nodalI[i]-1,coor,spaceDim,ptToFill);
ptToFill+=spaceDim;
}
*/
DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMassWithPrecision(double eps) const
{
- INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps);
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
MCAuto<DataArrayDouble> ret = computeCellCenterOfMass();
return ret.retn();
}
{
checkFullyDefined();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int const spaceDim=getSpaceDimension();
- mcIdType const nbOfCells=getNumberOfCells();
- mcIdType const nbOfNodes=getNumberOfNodes();
+ int spaceDim=getSpaceDimension();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbOfNodes=getNumberOfNodes();
ret->alloc(nbOfCells,spaceDim);
double *ptToFill=ret->getPointer();
const mcIdType *nodal=_nodal_connec->begin();
const double *coor=_coords->begin();
for(mcIdType i=0;i<nbOfCells;i++,ptToFill+=spaceDim)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[i]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[i]];
std::fill(ptToFill,ptToFill+spaceDim,0.);
if(type!=INTERP_KERNEL::NORM_POLYHED)
{
throw INTERP_KERNEL::Exception(oss.str());
}
}
- mcIdType const nbOfNodesInCell=nodalI[i+1]-nodalI[i]-1;
+ mcIdType nbOfNodesInCell=nodalI[i+1]-nodalI[i]-1;
if(nbOfNodesInCell>0)
std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind(std::multiplies<double>(),std::placeholders::_1,1./(double)nbOfNodesInCell));
else
{
std::set<mcIdType> s(nodal+nodalI[i]+1,nodal+nodalI[i+1]);
s.erase(-1);
- for(long const it : s)
+ for(std::set<mcIdType>::const_iterator it=s.begin();it!=s.end();it++)
{
- if(it>=0 && it<nbOfNodes)
- std::transform(coor+spaceDim*it,coor+spaceDim*(it+1),ptToFill,ptToFill,std::plus<double>());
+ if(*it>=0 && *it<nbOfNodes)
+ std::transform(coor+spaceDim*(*it),coor+spaceDim*((*it)+1),ptToFill,ptToFill,std::plus<double>());
else
{
- std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on cell polyhedron cell #" << i << " presence of nodeId #" << it << " should be in [0," << nbOfNodes << ") !";
+ std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on cell polyhedron cell #" << i << " presence of nodeId #" << *it << " should be in [0," << nbOfNodes << ") !";
throw INTERP_KERNEL::Exception(oss.str());
}
}
DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const mcIdType *begin, const mcIdType *end) const
{
DataArrayDouble *ret=DataArrayDouble::New();
- int const spaceDim=getSpaceDimension();
- std::size_t const nbOfTuple=std::distance(begin,end);
+ int spaceDim=getSpaceDimension();
+ std::size_t nbOfTuple=std::distance(begin,end);
ret->alloc(nbOfTuple,spaceDim);
double *ptToFill=ret->getPointer();
- auto *tmp=new double[spaceDim];
+ double *tmp=new double[spaceDim];
const mcIdType *nodal=_nodal_connec->begin();
const mcIdType *nodalI=_nodal_connec_index->begin();
const double *coor=_coords->begin();
for(const mcIdType *w=begin;w!=end;w++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[*w]];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[*w]];
INTERP_KERNEL::computeBarycenter2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(type,nodal+nodalI[*w]+1,nodalI[*w+1]-nodalI[*w]-1,coor,spaceDim,ptToFill);
ptToFill+=spaceDim;
}
DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- mcIdType const nbOfCells=getNumberOfCells();
- mcIdType const nbOfNodes(getNumberOfNodes());
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbOfNodes(getNumberOfNodes());
if(getSpaceDimension()!=3 || getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computePlaneEquationOf3DFaces : This method must be applied on a mesh having meshDimension equal 2 and a spaceDimension equal to 3 !");
ret->alloc(nbOfCells,4);
,bb[3]={coor[nodal[nodalI[0]+1+2]*3+0]-coor[nodal[nodalI[0]+1+0]*3+0],
coor[nodal[nodalI[0]+1+2]*3+1]-coor[nodal[nodalI[0]+1+0]*3+1],
coor[nodal[nodalI[0]+1+2]*3+2]-coor[nodal[nodalI[0]+1+0]*3+2]};
- double const cc[3]={aa[1]*bb[2]-aa[2]*bb[1],aa[2]*bb[0]-aa[0]*bb[2],aa[0]*bb[1]-aa[1]*bb[0]};
+ double cc[3]={aa[1]*bb[2]-aa[2]*bb[1],aa[2]*bb[0]-aa[0]*bb[2],aa[0]*bb[1]-aa[1]*bb[0]};
double aa_norm(sqrt(aa[0]*aa[0]+aa[1]*aa[1]+aa[2]*aa[2])),bb_norm(sqrt(bb[0]*bb[0]+bb[1]*bb[1]+bb[2]*bb[2]));
for(int j=0;j<3;j++)
{
- mcIdType const nodeId(nodal[nodalI[0]+1+j]);
+ mcIdType nodeId(nodal[nodalI[0]+1+j]);
if(nodeId>=0 && nodeId<nbOfNodes)
std::copy(coor+nodeId*3,coor+(nodeId+1)*3,matrix+4*j);
else
double dd[3]={0.,0.,0.};
for(mcIdType offset=nodalI[0]+1;offset<nodalI[1];offset++)
std::transform(coor+3*nodal[offset],coor+3*(nodal[offset]+1),dd,dd,std::plus<double>());
- mcIdType const nbOfNodesInCell(nodalI[1]-nodalI[0]-1);
+ mcIdType nbOfNodesInCell(nodalI[1]-nodalI[0]-1);
std::transform(dd,dd+3,dd,std::bind(std::multiplies<double>(),std::placeholders::_1,1./(double)nbOfNodesInCell));
std::copy(dd,dd+3,matrix+4*2);
INTERP_KERNEL::inverseMatrix(matrix,4,matrix2);
if(!da)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Build0DMeshFromCoords : instance of DataArrayDouble must be not null !");
da->checkAllocated();
- std::string const name(da->getName());
+ std::string name(da->getName());
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New(name,0));
if(name.empty())
ret->setName("Mesh");
ret->setCoords(da);
- mcIdType const nbOfTuples(da->getNumberOfTuples());
+ mcIdType nbOfTuples(da->getNumberOfTuples());
MCAuto<DataArrayIdType> c(DataArrayIdType::New()),cI(DataArrayIdType::New());
c->alloc(2*nbOfTuples,1);
cI->alloc(nbOfTuples+1,1);
if(!da)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Build01MeshFromCoords : instance of DataArrayDouble must be not null !");
da->checkAllocated();
- std::string const name(da->getName());
+ std::string name(da->getName());
MCAuto<MEDCouplingUMesh> ret;
{
MCAuto<MEDCouplingCMesh> tmp(MEDCouplingCMesh::New());
*/
MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(const std::vector<const MEDCouplingUMesh *>& a)
{
- std::size_t const sz=a.size();
+ std::size_t sz=a.size();
if(sz==0)
return MergeUMeshesLL(a);
for(std::size_t ii=0;ii<sz;ii++)
throw INTERP_KERNEL::Exception(oss.str());
}
const DataArrayDouble *coords=meshes.front()->getCoords();
- int const meshDim=meshes.front()->getMeshDimension();
- auto iter=meshes.begin();
+ int meshDim=meshes.front()->getMeshDimension();
+ std::vector<const MEDCouplingUMesh *>::const_iterator iter=meshes.begin();
mcIdType meshLgth=0;
mcIdType meshIndexLgth=0;
for(;iter!=meshes.end();iter++)
{
const mcIdType *nod=(*iter)->getNodalConnectivity()->begin();
const mcIdType *index=(*iter)->getNodalConnectivityIndex()->begin();
- mcIdType const nbOfCells=(*iter)->getNumberOfCells();
- mcIdType const meshLgth2=(*iter)->getNodalConnectivityArrayLen();
+ mcIdType nbOfCells=(*iter)->getNumberOfCells();
+ mcIdType meshLgth2=(*iter)->getNodalConnectivityArrayLen();
nodalPtr=std::copy(nod,nod+meshLgth2,nodalPtr);
if(iter!=meshes.begin())
nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind(std::plus<mcIdType>(),std::placeholders::_1,offset));
MCAuto<MEDCouplingUMesh> ret=MergeUMeshesOnSameCoords(meshes);
MCAuto<DataArrayIdType> o2n=ret->zipConnectivityTraducer(compType);
corr.resize(meshes.size());
- std::size_t const nbOfMeshes=meshes.size();
+ std::size_t nbOfMeshes=meshes.size();
mcIdType offset=0;
const mcIdType *o2nPtr=o2n->begin();
for(std::size_t i=0;i<nbOfMeshes;i++)
{
DataArrayIdType *tmp=DataArrayIdType::New();
- mcIdType const curNbOfCells=meshes[i]->getNumberOfCells();
+ mcIdType curNbOfCells=meshes[i]->getNumberOfCells();
tmp->alloc(curNbOfCells,1);
std::copy(o2nPtr+offset,o2nPtr+offset+curNbOfCells,tmp->getPointer());
offset+=curNbOfCells;
*/
void MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(const std::vector<MEDCouplingUMesh *>& meshes)
{
- std::size_t const sz=meshes.size();
+ std::size_t sz=meshes.size();
if(sz==0 || sz==1)
return;
std::vector< const DataArrayDouble * > coords(meshes.size());
- auto it2=coords.begin();
- for(auto it=meshes.begin();it!=meshes.end();it++,it2++)
+ std::vector< const DataArrayDouble * >::iterator it2=coords.begin();
+ for(std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();it!=meshes.end();it++,it2++)
{
if((*it))
{
}
}
MCAuto<DataArrayDouble> res=DataArrayDouble::Aggregate(coords);
- auto it=meshes.begin();
+ std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();
mcIdType offset=(*it)->getNumberOfNodes();
(*it++)->setCoords(res);
for(;it!=meshes.end();it++)
{
- mcIdType const oldNumberOfNodes=(*it)->getNumberOfNodes();
+ mcIdType oldNumberOfNodes=(*it)->getNumberOfNodes();
(*it)->setCoords(res);
(*it)->shiftNodeNumbersInConn(offset);
offset+=oldNumberOfNodes;
if(meshes.empty())
return ;
std::set<const DataArrayDouble *> s;
- for(auto it=meshes.begin();it!=meshes.end();it++)
+ for(std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();it!=meshes.end();it++)
{
if(*it)
s.insert((*it)->getCoords());
DataArrayIdType *comm,*commI;
coo->findCommonTuples(eps,-1,comm,commI);
MCAuto<DataArrayIdType> tmp1(comm),tmp2(commI);
- mcIdType const oldNbOfNodes=coo->getNumberOfTuples();
+ mcIdType oldNbOfNodes=coo->getNumberOfTuples();
mcIdType newNbOfNodes;
MCAuto<DataArrayIdType> o2n=DataArrayIdType::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes);
if(oldNbOfNodes==newNbOfNodes)
return ;
- MCAuto<DataArrayDouble> const newCoords=coo->renumberAndReduce(o2n->begin(),newNbOfNodes);
- for(auto meshe : meshes)
+ MCAuto<DataArrayDouble> newCoords=coo->renumberAndReduce(o2n->begin(),newNbOfNodes);
+ for(std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();it!=meshes.end();it++)
{
- meshe->renumberNodesInConn(o2n->begin());
- meshe->setCoords(newCoords);
+ (*it)->renumberNodesInConn(o2n->begin());
+ (*it)->setCoords(newCoords);
}
}
{
std::size_t i, ip1;
double v[3]={0.,0.,0.};
- std::size_t const sz=std::distance(begin,end);
+ std::size_t sz=std::distance(begin,end);
if(!isQuadratic)
for(i=0;i<sz;i++)
{
// Same algorithm as above but also using intermediate quadratic points.
// (taking only linear points might lead to issues if the linearized version of the
// polygon is not convex or self-intersecting ... see testCellOrientation4)
- std::size_t const hsz = sz/2;
+ std::size_t hsz = sz/2;
for(std::size_t j=0;j<sz;j++)
{
if (j%2) // current point i is quadratic, next point i+1 is standard
v[2]+=coords[3*begin[i]]*coords[3*begin[ip1]+1]-coords[3*begin[i]+1]*coords[3*begin[ip1]];
}
}
- double const ret = vec[0]*v[0]+vec[1]*v[1]+vec[2]*v[2];
+ double ret = vec[0]*v[0]+vec[1]*v[1]+vec[2]*v[2];
return (ret>0.);
}
bool MEDCouplingUMesh::IsPolyhedronWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords)
{
std::vector<std::pair<mcIdType,mcIdType> > edges;
- std::size_t const nbOfFaces=std::count(begin,end,-1)+1;
+ std::size_t nbOfFaces=std::count(begin,end,-1)+1;
const mcIdType *bgFace=begin;
for(std::size_t i=0;i<nbOfFaces;i++)
{
const mcIdType *endFace=std::find(bgFace+1,end,-1);
- std::size_t const nbOfEdgesInFace=std::distance(bgFace,endFace);
+ std::size_t nbOfEdgesInFace=std::distance(bgFace,endFace);
for(std::size_t j=0;j<nbOfEdgesInFace;j++)
{
- std::pair<mcIdType,mcIdType> const p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
+ std::pair<mcIdType,mcIdType> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
if(std::find(edges.begin(),edges.end(),p1)!=edges.end())
return false;
edges.push_back(p1);
bool MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords)
{
double vec0[3],vec1[3];
- std::size_t const sz=std::distance(begin,end);
+ std::size_t sz=std::distance(begin,end);
if(sz%2!=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented : the length of nodal connectivity of extruded cell is not even !");
- mcIdType const nbOfNodes=ToIdType(sz/2);
+ mcIdType nbOfNodes=ToIdType(sz/2);
INTERP_KERNEL::areaVectorOfPolygon<mcIdType,INTERP_KERNEL::ALL_C_MODE>(begin,nbOfNodes,coords,vec0);
const double *pt0=coords+3*begin[0];
const double *pt1=coords+3*begin[nbOfNodes];
void MEDCouplingUMesh::CorrectExtrudedStaticCell(mcIdType *begin, mcIdType *end)
{
- std::size_t const sz=std::distance(begin,end);
+ std::size_t sz=std::distance(begin,end);
INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[sz];
- std::size_t const nbOfNodes(sz/2);
+ std::size_t nbOfNodes(sz/2);
std::copy(begin,end,(mcIdType *)tmp);
for(std::size_t j=1;j<nbOfNodes;j++)
{
bool MEDCouplingUMesh::IsTetra4WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords)
{
- std::size_t const sz=std::distance(begin,end);
+ std::size_t sz=std::distance(begin,end);
if(sz!=4)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::IsTetra4WellOriented : Tetra4 cell with not 4 nodes ! Call checkConsistency !");
double vec0[3],vec1[3];
bool MEDCouplingUMesh::IsPyra5WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords)
{
- std::size_t const sz=std::distance(begin,end);
+ std::size_t sz=std::distance(begin,end);
if(sz!=5)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::IsPyra5WellOriented : Pyra5 cell with not 5 nodes ! Call checkConsistency !");
double vec0[3];
void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, mcIdType index, DataArrayIdType *res, MEDCouplingUMesh *faces,
DataArrayIdType *E_Fi, DataArrayIdType *E_F, DataArrayIdType *F_Ei, DataArrayIdType *F_E)
{
- mcIdType const nbFaces = E_Fi->getIJ(index + 1, 0) - E_Fi->getIJ(index, 0);
+ mcIdType nbFaces = E_Fi->getIJ(index + 1, 0) - E_Fi->getIJ(index, 0);
MCAuto<DataArrayDouble> v=DataArrayDouble::New(); v->alloc(nbFaces,3);
double *vPtr=v->getPointer();
MCAuto<DataArrayDouble> p=DataArrayDouble::New(); p->alloc(nbFaces,2);
const mcIdType *f_idx = faces->getNodalConnectivityIndex()->getPointer(), *f_cnn = faces->getNodalConnectivity()->getPointer();
for(mcIdType i=0;i<nbFaces;i++,vPtr+=3,pPtr++)
{
- mcIdType const face = e_f[e_fi[index] + i];
+ mcIdType face = e_f[e_fi[index] + i];
ComputeVecAndPtOfFace(eps, coords->begin(), f_cnn + f_idx[face] + 1, f_cnn + f_idx[face + 1], vPtr, pPtr);
// to differentiate faces going to different cells:
pPtr++, *pPtr = 0;
*pPtr += FromIdType<double>(f_e[j]);
}
pPtr=p->getPointer(); vPtr=v->getPointer();
- DataArrayIdType *comm1=nullptr,*commI1=nullptr;
+ DataArrayIdType *comm1=0,*commI1=0;
v->findCommonTuples(eps,-1,comm1,commI1);
for (mcIdType i = 0; i < nbFaces; i++)
if (comm1->findIdFirstEqual(i) < 0)
MCAuto<DataArrayIdType> comm1Auto(comm1),commI1Auto(commI1);
const mcIdType *comm1Ptr=comm1->begin();
const mcIdType *commI1Ptr=commI1->begin();
- mcIdType const nbOfGrps1=commI1Auto->getNumberOfTuples()-1;
+ mcIdType nbOfGrps1=commI1Auto->getNumberOfTuples()-1;
res->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_POLYHED));
//
for(mcIdType i=0;i<nbOfGrps1;i++)
{
- mcIdType const vecId=comm1Ptr[commI1Ptr[i]];
+ mcIdType vecId=comm1Ptr[commI1Ptr[i]];
MCAuto<DataArrayDouble> tmpgrp2=p->selectByTupleId(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]);
- DataArrayIdType *comm2=nullptr,*commI2=nullptr;
+ DataArrayIdType *comm2=0,*commI2=0;
tmpgrp2->findCommonTuples(eps,-1,comm2,commI2);
for (mcIdType j = 0; j < commI1Ptr[i+1] - commI1Ptr[i]; j++)
if (comm2->findIdFirstEqual(j) < 0)
MCAuto<DataArrayIdType> comm2Auto(comm2),commI2Auto(commI2);
const mcIdType *comm2Ptr=comm2->begin();
const mcIdType *commI2Ptr=commI2->begin();
- mcIdType const nbOfGrps2=commI2Auto->getNumberOfTuples()-1;
+ mcIdType nbOfGrps2=commI2Auto->getNumberOfTuples()-1;
for(mcIdType j=0;j<nbOfGrps2;j++)
{
if(commI2Ptr[j+1] == commI2Ptr[j] + 1)
{
- mcIdType const face = e_f[e_fi[index] + comm1Ptr[commI1Ptr[i] + comm2Ptr[commI2Ptr[j]]]]; //hmmm
+ mcIdType face = e_f[e_fi[index] + comm1Ptr[commI1Ptr[i] + comm2Ptr[commI2Ptr[j]]]]; //hmmm
res->insertAtTheEnd(f_cnn + f_idx[face] + 1, f_cnn + f_idx[face + 1]);
res->pushBackSilent(-1);
}
else
{
- mcIdType const pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]];
+ mcIdType pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]];
MCAuto<DataArrayIdType> ids2=comm2->selectByTupleIdSafeSlice(commI2Ptr[j],commI2Ptr[j+1],1);
ids2->transformWithIndArr(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]);
ids2->transformWithIndArr(e_f + e_fi[index], e_f + e_fi[index + 1]);
const mcIdType *idsNodePtr=idsNode->begin();
double center[3]; center[0]=pPtr[2*pointId]*vPtr[3*vecId]; center[1]=pPtr[2*pointId]*vPtr[3*vecId+1]; center[2]=pPtr[2*pointId]*vPtr[3*vecId+2];
double vec[3]; vec[0]=vPtr[3*vecId+1]; vec[1]=-vPtr[3*vecId]; vec[2]=0.;
- double const norm=vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2];
+ double norm=vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2];
if(std::abs(norm)>eps)
{
- double const angle=INTERP_KERNEL::EdgeArcCircle::SafeAsin(norm);
+ double angle=INTERP_KERNEL::EdgeArcCircle::SafeAsin(norm);
mm3->rotate(center,vec,angle);
}
mm3->changeSpaceDimension(2);
MCAuto<MEDCouplingUMesh> mm4=mm3->buildSpreadZonesWithPoly();
const mcIdType *conn4=mm4->getNodalConnectivity()->begin();
const mcIdType *connI4=mm4->getNodalConnectivityIndex()->begin();
- mcIdType const nbOfCells=mm4->getNumberOfCells();
+ mcIdType nbOfCells=mm4->getNumberOfCells();
for(mcIdType k=0;k<nbOfCells;k++)
{
int l=0;
*/
void MEDCouplingUMesh::ComputeVecAndPtOfFace(double eps, const double *coords, const mcIdType *begin, const mcIdType *end, double *v, double *p)
{
- std::size_t const nbPoints=std::distance(begin,end);
+ std::size_t nbPoints=std::distance(begin,end);
if(nbPoints<3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeVecAndPtOfFace : < of 3 points in face ! not able to find a plane on that face !");
double vec[3]={0.,0.,0.};
vec[0]=coords[3*begin[j+1]]-coords[3*begin[j]];
vec[1]=coords[3*begin[j+1]+1]-coords[3*begin[j]+1];
vec[2]=coords[3*begin[j+1]+2]-coords[3*begin[j]+2];
- double const norm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]);
+ double norm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]);
if(norm>eps)
{
refFound=true;
void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(mcIdType *begin, mcIdType *end, const double *coords)
{
std::list< std::pair<mcIdType,mcIdType> > edgesOK,edgesFinished;
- std::size_t const nbOfFaces=std::count(begin,end,-1)+1;
+ std::size_t nbOfFaces=std::count(begin,end,-1)+1;
std::vector<bool> isPerm(nbOfFaces,false);//field on faces False: I don't know, True : oriented
isPerm[0]=true;
mcIdType *bgFace=begin,*endFace=std::find(begin+1,end,-1);
std::size_t nbOfEdgesInFace=std::distance(bgFace,endFace);
- for(std::size_t l=0;l<nbOfEdgesInFace;l++) { std::pair<mcIdType,mcIdType> const p1(bgFace[l],bgFace[(l+1)%nbOfEdgesInFace]); edgesOK.push_back(p1); }
+ for(std::size_t l=0;l<nbOfEdgesInFace;l++) { std::pair<mcIdType,mcIdType> p1(bgFace[l],bgFace[(l+1)%nbOfEdgesInFace]); edgesOK.push_back(p1); }
//
while(std::find(isPerm.begin(),isPerm.end(),false)!=isPerm.end())
{
bool b=false;
for(std::size_t j=0;j<nbOfEdgesInFace;j++)
{
- std::pair<mcIdType,mcIdType> const p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
- std::pair<mcIdType,mcIdType> const p2(p1.second,p1.first);
- bool const b1=std::find(edgesOK.begin(),edgesOK.end(),p1)!=edgesOK.end();
- bool const b2=std::find(edgesOK.begin(),edgesOK.end(),p2)!=edgesOK.end();
+ std::pair<mcIdType,mcIdType> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
+ std::pair<mcIdType,mcIdType> p2(p1.second,p1.first);
+ bool b1=std::find(edgesOK.begin(),edgesOK.end(),p1)!=edgesOK.end();
+ bool b2=std::find(edgesOK.begin(),edgesOK.end(),p2)!=edgesOK.end();
if(b1 || b2) { b=b2; isPerm[i]=true; smthChanged++; break; }
}
if(isPerm[i])
std::reverse(bgFace+1,endFace);
for(std::size_t j=0;j<nbOfEdgesInFace;j++)
{
- std::pair<mcIdType,mcIdType> const p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
- std::pair<mcIdType,mcIdType> const p2(p1.second,p1.first);
+ std::pair<mcIdType,mcIdType> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
+ std::pair<mcIdType,mcIdType> p2(p1.second,p1.first);
if(std::find(edgesOK.begin(),edgesOK.end(),p1)!=edgesOK.end())
{ std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str()); }
if(std::find(edgesFinished.begin(),edgesFinished.end(),p1)!=edgesFinished.end() || std::find(edgesFinished.begin(),edgesFinished.end(),p2)!=edgesFinished.end())
{ std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str()); }
- auto const it=std::find(edgesOK.begin(),edgesOK.end(),p2);
+ std::list< std::pair<mcIdType,mcIdType> >::iterator it=std::find(edgesOK.begin(),edgesOK.end(),p2);
if(it!=edgesOK.end())
{
edgesOK.erase(it);
if(getMeshDimension()!=2 || getSpaceDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildUnionOf2DMesh : meshdimension, spacedimension must be equal to 2 !");
MCAuto<MEDCouplingUMesh> skin(computeSkin());
- mcIdType const oldNbOfNodes(skin->getNumberOfNodes());
+ mcIdType oldNbOfNodes(skin->getNumberOfNodes());
MCAuto<DataArrayIdType> o2n(skin->zipCoordsTraducer());
- mcIdType const nbOfNodesExpected(skin->getNumberOfNodes());
+ mcIdType nbOfNodesExpected(skin->getNumberOfNodes());
MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes));
- mcIdType const nbCells=skin->getNumberOfCells();
+ mcIdType nbCells=skin->getNumberOfCells();
if(nbCells==nbOfNodesExpected)
return buildUnionOf2DMeshLinear(skin,n2o);
else if(2*nbCells==nbOfNodesExpected)
MCAuto<MEDCouplingUMesh> m=computeSkin();
const mcIdType *conn=m->getNodalConnectivity()->begin();
const mcIdType *connI=m->getNodalConnectivityIndex()->begin();
- mcIdType const nbOfCells=m->getNumberOfCells();
+ mcIdType nbOfCells=m->getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1);
mcIdType *work=ret->getPointer(); *work++=INTERP_KERNEL::NORM_POLYHED;
if(nbOfCells<1)
{
checkConnectivityFullyDefined();
- int const meshDim = this->getMeshDimension();
+ int meshDim = this->getMeshDimension();
MEDCoupling::DataArrayIdType* indexr=MEDCoupling::DataArrayIdType::New();
MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New();
this->getReverseNodalConnectivity(revConn,indexr);
const MEDCoupling::DataArrayIdType* conn;
conn=this->getNodalConnectivity(); // it includes a type as the 1st element!!!
index=this->getNodalConnectivityIndex();
- mcIdType const nbCells=this->getNumberOfCells();
+ mcIdType nbCells=this->getNumberOfCells();
const mcIdType* index_ptr=index->begin();
const mcIdType* conn_ptr=conn->begin();
std::map<mcIdType,mcIdType > counter;
for (mcIdType iconn=index_ptr[icell]+1; iconn<index_ptr[icell+1];iconn++)
{
- mcIdType const inode=conn_ptr[iconn];
+ mcIdType inode=conn_ptr[iconn];
for (mcIdType iconnr=indexr_ptr[inode]; iconnr<indexr_ptr[inode+1];iconnr++)
{
- mcIdType const icell2=revConn_ptr[iconnr];
- auto const iter=counter.find(icell2);
+ mcIdType icell2=revConn_ptr[iconnr];
+ std::map<mcIdType,mcIdType>::iterator iter=counter.find(icell2);
if (iter!=counter.end()) (iter->second)++;
else counter.insert(std::make_pair(icell2,1));
}
void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells<=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::writeVTK : the unstructured mesh has no cells !");
ofs << " <" << getVTKDataSetType() << ">\n";
}
else
{
- mcIdType const deltaFaceOffset=cIPtr[i+1]-cIPtr[i]+1;
+ mcIdType deltaFaceOffset=cIPtr[i+1]-cIPtr[i]+1;
*w1=szFaceOffsets+deltaFaceOffset; szFaceOffsets+=deltaFaceOffset;
std::set<mcIdType> c(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1]); c.erase(-1);
*w3=szConn+ToIdType(c.size()); szConn+=ToIdType(c.size());
w4=std::copy(c.begin(),c.end(),w4);
}
}
- std::unique_ptr<mcIdType[]> const medcoupling2vtkTypeTraducer_mcIdType(new mcIdType[MEDCOUPLING2VTKTYPETRADUCER_LGTH]);
+ std::unique_ptr<mcIdType[]> medcoupling2vtkTypeTraducer_mcIdType(new mcIdType[MEDCOUPLING2VTKTYPETRADUCER_LGTH]);
for(auto ii = 0; ii<MEDCOUPLING2VTKTYPETRADUCER_LGTH ; ++ii)
medcoupling2vtkTypeTraducer_mcIdType[ii] = MEDCOUPLING2VTKTYPETRADUCER[ii]!=MEDCOUPLING2VTKTYPETRADUCER_NONE?MEDCOUPLING2VTKTYPETRADUCER[ii] : -1;
types->transformWithIndArr(medcoupling2vtkTypeTraducer_mcIdType.get(),medcoupling2vtkTypeTraducer_mcIdType.get()+MEDCOUPLING2VTKTYPETRADUCER_LGTH);
types->writeVTK(ofs,8,"UInt8","types",byteData);
- std::string const vtkTypeName = Traits<mcIdType>::VTKReprStr;
+ std::string vtkTypeName = Traits<mcIdType>::VTKReprStr;
offsets->writeVTK(ofs,8,vtkTypeName,"offsets",byteData);
if(szFaceOffsets!=0)
{//presence of Polyhedra
for(mcIdType i=0;i<nbOfCells;i++)
if((INTERP_KERNEL::NormalizedCellType)cPtr[cIPtr[i]]==INTERP_KERNEL::NORM_POLYHED)
{
- mcIdType const nbFaces=ToIdType(std::count(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1],-1))+1;
+ mcIdType nbFaces=ToIdType(std::count(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1],-1))+1;
*w1++=nbFaces;
- const mcIdType *w6=cPtr+cIPtr[i]+1,*w5=nullptr;
+ const mcIdType *w6=cPtr+cIPtr[i]+1,*w5=0;
for(mcIdType j=0;j<nbFaces;j++)
{
w5=std::find(w6,cPtr+cIPtr[i+1],-1);
{ stream << std::endl << "Nodal connectivity NOT set !"; return ; }
if(!_nodal_connec_index->isAllocated())
{ stream << std::endl << "Nodal connectivity set but not allocated !"; return ; }
- mcIdType const lgth=_nodal_connec_index->getNumberOfTuples();
- std::size_t const cpt=_nodal_connec_index->getNumberOfComponents();
+ mcIdType lgth=_nodal_connec_index->getNumberOfTuples();
+ std::size_t cpt=_nodal_connec_index->getNumberOfComponents();
if(cpt!=1 || lgth<1)
return ;
stream << std::endl << "Number of cells : " << lgth-1 << ".";
MCAuto<DataArrayIdType> _dsi(_rDI->deltaShiftIndex());
const mcIdType * dsi(_dsi->begin());
MCAuto<DataArrayIdType> dsii = _dsi->findIdsNotInRange(0,3);
- m_points=nullptr;
+ m_points=0;
if (dsii->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D only work with a mesh being a (piecewise) connected line!");
- mcIdType const nc=getNumberOfCells();
+ mcIdType nc=getNumberOfCells();
MCAuto<DataArrayIdType> result(DataArrayIdType::New());
result->alloc(nc,1);
activeSeg = (seg1 == activeSeg) ? seg2 : seg1;
//for piecewise meshes made up of closed parts
- bool const segmentAlreadyTreated = (std::find(linePiece.begin(), linePiece.end(), activeSeg) != linePiece.end());
+ bool segmentAlreadyTreated = (std::find(linePiece.begin(), linePiece.end(), activeSeg) != linePiece.end());
if(segmentAlreadyTreated)
break;
}
desc->checkAllocated(); descI->checkAllocated(); subNodesInSeg->checkAllocated(); subNodesInSegI->checkAllocated();
if(getSpaceDimension()!=2 || getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split2DCells : This method only works for meshes with spaceDim=2 and meshDim=2 !");
- if(midOpt==nullptr && midOptI==nullptr)
+ if(midOpt==0 && midOptI==0)
{
split2DCellsLinear(desc,descI,subNodesInSeg,subNodesInSegI);
return 0;
}
- else if(midOpt!=nullptr && midOptI!=nullptr)
+ else if(midOpt!=0 && midOptI!=0)
return split2DCellsQuadratic(desc,descI,subNodesInSeg,subNodesInSegI,midOpt,midOptI);
else
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split2DCells : middle parameters must be set to null for all or not null for all.");
*/
bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, DataArrayIdType *nodalConnecOut)
{
- std::size_t const sz=std::distance(nodalConnBg,nodalConnEnd);
+ std::size_t sz=std::distance(nodalConnBg,nodalConnEnd);
if(sz>=4)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)*nodalConnBg);
if(*node!=tmpOut.back() && *node!=prevNode)
{
tmp2[0]=coords[2*(*node)]-coords[2*tmpOut.back()]; tmp2[1]=coords[2*(*node)+1]-coords[2*tmpOut.back()+1];
- double const angleM=INTERP_KERNEL::EdgeArcCircle::GetAbsoluteAngle(tmp2,tmp1);
+ double angleM=INTERP_KERNEL::EdgeArcCircle::GetAbsoluteAngle(tmp2,tmp1);
double res;
if(angleM<=angle0)
res=angle0-angleM;
}
}
std::vector<mcIdType> tmp3(2*(sz-1));
- auto const it=std::copy(nodalConnBg+1,nodalConnEnd,tmp3.begin());
+ std::vector<mcIdType>::iterator it=std::copy(nodalConnBg+1,nodalConnEnd,tmp3.begin());
std::copy(nodalConnBg+1,nodalConnEnd,it);
if(std::search(tmp3.begin(),tmp3.end(),tmpOut.begin(),tmpOut.end())!=tmp3.end())
{
nbOfDepthPeelingPerformed=0;
if(!arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed : arrIndxIn input pointer is NULL !");
- mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
if(nbOfTuples<=0)
{
DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(0,1);
MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const
{
checkFullyDefined();
- int const mdim=getMeshDimension();
- int const spaceDim=getSpaceDimension();
+ int mdim=getMeshDimension();
+ int spaceDim=getSpaceDimension();
if(mdim!=spaceDim)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSpreadZonesWithPoly : meshdimension and spacedimension do not match !");
std::vector<DataArrayIdType *> partition=partitionBySpreadZone();
ret->setCoords(getCoords());
ret->allocateCells(ToIdType(partition.size()));
//
- for(auto it : partition)
+ for(std::vector<DataArrayIdType *>::const_iterator it=partition.begin();it!=partition.end();it++)
{
- MCAuto<MEDCouplingUMesh> tmp=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(it->begin(),it->end(),true));
+ MCAuto<MEDCouplingUMesh> tmp=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf((*it)->begin(),(*it)->end(),true));
MCAuto<DataArrayIdType> cell;
switch(mdim)
{
*/
std::vector<DataArrayIdType *> MEDCouplingUMesh::partitionBySpreadZone() const
{
- DataArrayIdType *neigh=nullptr,*neighI=nullptr;
+ DataArrayIdType *neigh=0,*neighI=0;
computeNeighborsOfCells(neigh,neighI);
MCAuto<DataArrayIdType> neighAuto(neigh),neighIAuto(neighI);
return PartitionBySpreadZone(neighAuto,neighIAuto);
if(!arrIn || !arrIndxIn)
throw INTERP_KERNEL::Exception("PartitionBySpreadZone : null input pointers !");
arrIn->checkAllocated(); arrIndxIn->checkAllocated();
- mcIdType const nbOfTuples(arrIndxIn->getNumberOfTuples());
+ mcIdType nbOfTuples(arrIndxIn->getNumberOfTuples());
if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1 || nbOfTuples<1)
throw INTERP_KERNEL::Exception("PartitionBySpreadZone : invalid arrays in input !");
- mcIdType const nbOfCellsCur(nbOfTuples-1);
+ mcIdType nbOfCellsCur(nbOfTuples-1);
std::vector<DataArrayIdType *> ret;
if(nbOfCellsCur<=0)
return ret;
ret2.push_back(ComputeSpreadZoneGraduallyFromSeedAlg(fetchedCells,&seed,&seed+1,arrIn,arrIndxIn,-1,nbOfPeelPerformed));
seed=ToIdType(std::distance(fetchedCells.begin(),std::find(fetchedCells.begin()+seed,fetchedCells.end(),false)));
}
- for(auto & it : ret2)
- ret.push_back(it.retn());
+ for(std::vector< MCAuto<DataArrayIdType> >::iterator it=ret2.begin();it!=ret2.end();it++)
+ ret.push_back((*it).retn());
return ret;
}
DataArrayIdType *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code)
{
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
- std::size_t const nb=code.size()/3;
+ std::size_t nb=code.size()/3;
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeRangesFromTypeDistribution : invalid input code !");
ret->alloc(nb,2);
*/
MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayIdType *& n2oCells, mcIdType& nbOfAdditionalPoints) const
{
- auto const pol((INTERP_KERNEL::SplittingPolicy)policy);
+ INTERP_KERNEL::SplittingPolicy pol((INTERP_KERNEL::SplittingPolicy)policy);
checkConnectivityFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tetrahedrize : only available for mesh with meshdim == 3 and spacedim == 3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType nbNodes(getNumberOfNodes());
MCAuto<MEDCoupling1SGTUMesh> ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4));
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(nbOfCells,1);
{
std::vector<mcIdType> a; std::vector<double> b;
INTERP_KERNEL::SplitIntoTetras(pol,(INTERP_KERNEL::NormalizedCellType)oldc[oldci[0]],oldc+oldci[0]+1,oldc+oldci[1],coords,a,b);
- std::size_t const nbOfTet(a.size()/4); *retPt=ToIdType(nbOfTet);
+ std::size_t nbOfTet(a.size()/4); *retPt=ToIdType(nbOfTet);
const mcIdType *aa(&a[0]);
if(!b.empty())
{
- for(long & it : a)
- if(it<0)
- it=(-it-1+nbNodes);
+ for(std::vector<mcIdType>::iterator it=a.begin();it!=a.end();it++)
+ if(*it<0)
+ *it=(-(*(it))-1+nbNodes);
addPts->insertAtTheEnd(b.begin(),b.end());
nbNodes+=ToIdType(b.size()/3);
}
return _cell;
}
else
- return nullptr;
+ return 0;
}
MEDCouplingUMeshCellByTypeEntry::MEDCouplingUMeshCellByTypeEntry(MEDCouplingUMesh *mesh):_mesh(mesh)
const mcIdType *ci=_mesh->getNodalConnectivityIndex()->begin();
if(_cell_id<_nb_cell)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)c[ci[_cell_id]];
- mcIdType const nbOfElems=ToIdType(std::distance(ci+_cell_id,std::find_if(ci+_cell_id,ci+_nb_cell,MEDCouplingImpl::ConnReader(c,type))));
- mcIdType const startId=_cell_id;
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[_cell_id]];
+ mcIdType nbOfElems=ToIdType(std::distance(ci+_cell_id,std::find_if(ci+_cell_id,ci+_nb_cell,MEDCouplingImpl::ConnReader(c,type))));
+ mcIdType startId=_cell_id;
_cell_id+=nbOfElems;
return new MEDCouplingUMeshCellEntry(_mesh,type,_cell,startId,_cell_id);
}
else
- return nullptr;
+ return 0;
}
-MEDCouplingUMeshCell::MEDCouplingUMeshCell(MEDCouplingUMesh *mesh):_conn(nullptr),_conn_indx(nullptr),_conn_lgth(NOTICABLE_FIRST_VAL)
+MEDCouplingUMeshCell::MEDCouplingUMeshCell(MEDCouplingUMesh *mesh):_conn(0),_conn_indx(0),_conn_lgth(NOTICABLE_FIRST_VAL)
{
if(mesh)
{
if(_conn_lgth!=NOTICABLE_FIRST_VAL)
return _conn;
else
- return nullptr;
+ return 0;
}
/// @cond INTERNAL
const mcIdType * revInd = revNodalIndx[ iM ]->begin();
const mcIdType * rev = revNodal [ iM ]->begin();
- mcIdType const nbRevFaces0 = revInd[ n0 + 1 ] - revInd[ n0 ];
- mcIdType const nbRevFaces1 = revInd[ n1 + 1 ] - revInd[ n1 ];
+ mcIdType nbRevFaces0 = revInd[ n0 + 1 ] - revInd[ n0 ];
+ mcIdType nbRevFaces1 = revInd[ n1 + 1 ] - revInd[ n1 ];
prevNbF = facesByEdge.size();
facesByEdge.resize( prevNbF + std::max( nbRevFaces0, nbRevFaces1 ));
{
if ( facesByEdge[ i0 ] == theUndefID )
continue;
- mcIdType const objFaceID = MEDCouplingImpl::encodeID( facesByEdge[ i0 ], 0 );
+ mcIdType objFaceID = MEDCouplingImpl::encodeID( facesByEdge[ i0 ], 0 );
bool isInputFace = ( objFaceID == inputFaceID );
for ( size_t i1 = prevNbF; i1 < facesByEdge.size(); ++i1 )
if ( facesByEdge[ i1 ] == theUndefID )
continue;
- mcIdType const f0 = facesByEdge[ i0 ];
- mcIdType const f1 = facesByEdge[ i1 ];
- size_t const nbNodes0 = connI[0][ f0 + 1 ] - connI[0][ f0 ] - 1;
- size_t const nbNodes1 = connI[1][ f1 + 1 ] - connI[1][ f1 ] - 1;
+ mcIdType f0 = facesByEdge[ i0 ];
+ mcIdType f1 = facesByEdge[ i1 ];
+ size_t nbNodes0 = connI[0][ f0 + 1 ] - connI[0][ f0 ] - 1;
+ size_t nbNodes1 = connI[1][ f1 + 1 ] - connI[1][ f1 ] - 1;
if ( nbNodes0 != nbNodes1 )
continue;
if ( std::equal( fConn0, fConn0 + nbNodes0, fConn1 ))
{
// equal faces; remove an object one
- mcIdType const refFaceID = MEDCouplingImpl::encodeID( facesByEdge[ i1 ], 1 );
+ mcIdType refFaceID = MEDCouplingImpl::encodeID( facesByEdge[ i1 ], 1 );
if ( refFaceID == inputFaceID )
isInputFace = true;
MEDCouplingUMesh* mesh[] )
{
int iMesh;
- mcIdType const iF = decodeID( iFEnc, iMesh );
+ mcIdType iF = decodeID( iFEnc, iMesh );
const mcIdType *conn = mesh[ iMesh ]->getNodalConnectivity()->getConstPointer();
const mcIdType *connI = mesh[ iMesh ]->getNodalConnectivityIndex()->getConstPointer();
auto it1 = std::find( conn + connI[ iF ] + 1,
conn + connI[ iF + 1 ],
n1 );
- long const i0 = it0 - conn;
- long const i1 = it1 - conn;
+ long i0 = it0 - conn;
+ long i1 = it1 - conn;
- bool const isRev = ( std::abs( i1 - i0 ) == 1 ) ? i1 < i0 : i0 < i1;
+ bool isRev = ( std::abs( i1 - i0 ) == 1 ) ? i1 < i0 : i0 < i1;
return isRev;
}
void reverseFace( mcIdType iFEnc, MEDCouplingUMesh* mesh[] )
{
int iMesh;
- mcIdType const face = decodeID( iFEnc, iMesh );
+ mcIdType face = decodeID( iFEnc, iMesh );
mcIdType *conn = mesh[ iMesh ]->getNodalConnectivity()->getPointer();
mcIdType *connI = mesh[ iMesh ]->getNodalConnectivityIndex()->getPointer();
break;
}
- mcIdType const fID = faceQueue.back();
+ mcIdType fID = faceQueue.back();
faceQueue.pop_back();
int iMesh, iMesh2;
- mcIdType const refFace = MEDCouplingImpl::decodeID( fID, iMesh );
+ mcIdType refFace = MEDCouplingImpl::decodeID( fID, iMesh );
nbFacesToCheck[iMesh]--;
mcIdType n0 = faceNodes[ nbEdges - 1 ]; // 1st node of edge
for ( int edge = 0; edge < nbEdges; ++edge )
{
- mcIdType const n1 = faceNodes[ edge ]; // 2nd node of edge
+ mcIdType n1 = faceNodes[ edge ]; // 2nd node of edge
// get faces sharing the edge
MEDCouplingImpl::getFacesOfEdge( n0, n1, fID, mesh, revNodal, revNodalIndx,
MEDCouplingImpl::reverseFace( facesByEdge[0], mesh );
}
- mcIdType const face2 = MEDCouplingImpl::decodeID( facesByEdge[0], iMesh2 );
+ mcIdType face2 = MEDCouplingImpl::decodeID( facesByEdge[0], iMesh2 );
if ( !isFaceQueued[iMesh2][face2] )
{
isFaceQueued[iMesh2][face2] = true;
// remove face and equalFaces from revNodal in order not to treat them again
equalFaces.push_back( fID );
- for ( mcIdType const face : equalFaces )
+ for ( mcIdType face : equalFaces )
{
- mcIdType const f = MEDCouplingImpl::decodeID( face, iMesh2 );
+ mcIdType f = MEDCouplingImpl::decodeID( face, iMesh2 );
const mcIdType *conn = mesh[iMesh2]->getNodalConnectivity()->getConstPointer();
const mcIdType *connI = mesh[iMesh2]->getNodalConnectivityIndex()->getConstPointer();
- mcIdType const nbNodes = connI[ f + 1 ] - connI[ f ] - 1;
+ mcIdType nbNodes = connI[ f + 1 ] - connI[ f ] - 1;
for ( const mcIdType* n = conn + connI[ f ] + 1, *nEnd = n + nbNodes; n < nEnd; ++n )
MEDCouplingImpl::removeFromRevNodal( *n, f, // not to treat f again
#pragma once
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "InterpKernelHashMap.hxx"
#include "MEDCoupling.hxx"
-#include "MEDCouplingMesh.hxx"
#include "MEDCouplingPointSet.hxx"
#include "MEDCouplingMemArray.hxx"
#include "CellModel.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <ostream>
-#include <map>
-#include <functional>
-#include <iterator>
#include <set>
-#include <string>
-#include <vector>
-#include <sstream>
-#include <utility>
namespace MEDCoupling
{
MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const std::string& meshName, int meshDim);
MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingUMesh"); }
// Copy methods
- MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopy() const override;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const override;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopyConnectivityOnly() const override;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopy() const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopyConnectivityOnly() const;
- MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) override;
- MEDCOUPLING_EXPORT void updateTime() const override;
- MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return UNSTRUCTURED; }
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override;
- MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const override;
- MEDCOUPLING_EXPORT void checkConsistencyLight() const override;
- MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override;
+ MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
+ MEDCOUPLING_EXPORT void updateTime() const;
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED; }
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
MEDCOUPLING_EXPORT void checkGeomConsistency(double eps=1e-12) const;
MEDCOUPLING_EXPORT void setMeshDimension(int meshDim);
MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0);
MEDCOUPLING_EXPORT void finishInsertingCells();
MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator *cellIterator();
MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeEntry *cellsByType();
- MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const override;
+ MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
MEDCOUPLING_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getAllGeoTypesSorted() const;
MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getTypesOfPart(const mcIdType *begin, const mcIdType *end) const;
MEDCOUPLING_EXPORT void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
MEDCOUPLING_EXPORT const DataArrayIdType *getNodalConnectivityIndex() const { return _nodal_connec_index; }
MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() { return _nodal_connec; }
MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivityIndex() { return _nodal_connec_index; }
- MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override;
- MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const override;
- MEDCOUPLING_EXPORT std::string simpleRepr() const override;
- MEDCOUPLING_EXPORT std::string advancedRepr() const override;
+ MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+ MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
+ MEDCOUPLING_EXPORT std::string simpleRepr() const;
+ MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT std::string cppRepr() const;
MEDCOUPLING_EXPORT std::string reprConnectivityOfThis() const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const;
- MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const override;
- MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override;
- MEDCOUPLING_EXPORT int getMeshDimension() const override;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
+ MEDCOUPLING_EXPORT int getMeshDimension() const;
MEDCOUPLING_EXPORT mcIdType getNodalConnectivityArrayLen() const;
MEDCOUPLING_EXPORT void computeTypes();
//! size of returned tinyInfo must be always the same.
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const override;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const override;
- MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings) override;
- MEDCOUPLING_EXPORT std::string getVTKDataSetType() const override;
- MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override;
- MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override;
- MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override;
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT std::string getVTKDataSetType() const;
+ MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
+ MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
+ MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
//tools
MEDCOUPLING_EXPORT static int AreCellsEqual(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2, int compType);
MEDCOUPLING_EXPORT static int AreCellsEqualPolicy0(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
MEDCOUPLING_EXPORT void colinearizeEdges(double eps);
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
MEDCOUPLING_EXPORT std::vector<DataArrayIdType *> partitionBySpreadZone() const;
- MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const override;
- MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *zipCoordsTraducer() override;
- MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const override;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const;
+ MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *zipCoordsTraducer();
+ MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const;
MEDCOUPLING_EXPORT bool areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayIdType *& arr) const;
MEDCOUPLING_EXPORT bool areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayIdType *& arr) const;
- MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override;
+ MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingUMesh> explodeIntoEdges(MCAuto<DataArrayIdType>& desc, MCAuto<DataArrayIdType>& descIndex, MCAuto<DataArrayIdType>& revDesc, MCAuto<DataArrayIdType>& revDescIndx) const;
MEDCOUPLING_EXPORT MCAuto<MEDCouplingUMesh> explodeMeshTo(int targetDeltaLevel, MCAuto<DataArrayIdType>& desc, MCAuto<DataArrayIdType>& descIndx, MCAuto<DataArrayIdType>& revDesc, MCAuto<DataArrayIdType>& revDescIndx) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx);
MEDCOUPLING_EXPORT void computeNeighborsOfNodes(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx) const;
MEDCOUPLING_EXPORT void computeEnlargedNeighborsOfNodes(MCAuto<DataArrayIdType> &neighbors, MCAuto<DataArrayIdType>& neighborsIdx) const;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const override;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords=true) const override;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords=true) const override;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords=true) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords=true) const;
MEDCOUPLING_EXPORT void setPartOfMySelf(const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
MEDCOUPLING_EXPORT void setPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildFacePartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const override;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const override;
- MEDCOUPLING_EXPORT MEDCouplingUMesh *buildBoundaryMesh(bool keepCoords) const override;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildFacePartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *buildBoundaryMesh(bool keepCoords) const;
MEDCOUPLING_EXPORT DataArrayIdType *findCellIdsOnBoundary() const;
MEDCOUPLING_EXPORT void findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *&cellIdsRk0, DataArrayIdType *&cellIdsRk1) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *computeSkin() const;
MEDCOUPLING_EXPORT void findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnSameCoords, const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd,
DataArrayIdType *& cellIdsNeededToBeRenum, DataArrayIdType *& cellIdsNotModified) const;
MEDCOUPLING_EXPORT void duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd);
- MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset) override;
- MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N) override;
- MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N) override;
+ MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N) override;
MEDCOUPLING_EXPORT void shiftNodeNumbersInConn(mcIdType delta);
MEDCOUPLING_EXPORT void duplicateNodesInConn(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd, mcIdType offset);
- MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override;
- MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const override;
- MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override;
+ MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const;
+ MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
MEDCOUPLING_EXPORT DataArrayDouble *getPartMeasureField(bool isAbs, const mcIdType *begin, const mcIdType *end) const;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildPartOrthogonalField(const mcIdType *begin, const mcIdType *end) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildDirectionVectorField() const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3D(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const;
MEDCOUPLING_EXPORT void project1D(const double *pt, const double *v, double eps, double *res) const;
MEDCOUPLING_EXPORT double distanceToPoint(const double *ptBg, const double *ptEnd, mcIdType& cellId) const;
MEDCOUPLING_EXPORT DataArrayDouble *distanceToPoints(const DataArrayDouble *pts, DataArrayIdType *& cellIds) const;
- MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override;
- MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const override;
+ MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const override;
MEDCOUPLING_EXPORT void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const override;
MEDCOUPLING_EXPORT void checkButterflyCells(std::vector<mcIdType>& cells, double eps=1e-12) const;
MEDCOUPLING_EXPORT DataArrayIdType *convexEnvelop2D();
MEDCOUPLING_EXPORT DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
MEDCOUPLING_EXPORT DataArrayIdType *findAndCorrectBadOriented3DCells();
- MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const override;
+ MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTreeFast() const;
MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
MEDCOUPLING_EXPORT DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
MEDCOUPLING_EXPORT void tessellate2D(double eps);
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *tetrahedrize(int policy, DataArrayIdType *& n2oCells, mcIdType& nbOfAdditionalPoints) const;
- MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override;
+ MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
MEDCOUPLING_EXPORT bool areOnlySimplexCells() const;
MEDCOUPLING_EXPORT void convertDegeneratedCells();
MEDCOUPLING_EXPORT DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
MEDCOUPLING_EXPORT void changeOrientationOfCells();
MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector<mcIdType>& cells) const;
MEDCOUPLING_EXPORT void orientCorrectlyPolyhedrons();
- MEDCOUPLING_EXPORT void invertOrientationOfAllCells() override;
+ MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
MEDCOUPLING_EXPORT void getFastAveragePlaneOfThis(double *vec, double *pos) const;
MEDCOUPLING_EXPORT void attractSeg3MidPtsAroundNodes(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd);
//Mesh quality
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getAspectRatioField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getWarpField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getSkewField() const;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const override;
+ MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const;
//utilities for MED File RW
- MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const override;
- MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const override;
- MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const override;
+ MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *&revDesc, DataArrayIdType *&revDescIndx, DataArrayIdType *& nM1LevMeshIds, DataArrayIdType *&meshnM1Old2New) const;
MEDCOUPLING_EXPORT DataArrayIdType *sortCellsInMEDFileFrmt();
MEDCOUPLING_EXPORT bool checkConsecutiveCellTypes() const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const mcIdType *idsPerGeoTypeBg, const mcIdType *idsPerGeoTypeEnd) const;
MEDCOUPLING_EXPORT std::vector<bool> getQuadraticStatus() const;
//
- MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override;
- MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override;
+ MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps) const;
- MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const mcIdType *begin, const mcIdType *end) const;
MEDCOUPLING_EXPORT DataArrayDouble *computePlaneEquationOf3DFaces() const;
MEDCOUPLING_EXPORT DataArrayIdType *conformize2D(double eps);
MEDCOUPLING_EXPORT DataArrayIdType *colinearize2D(double eps);
MEDCOUPLING_EXPORT DataArrayIdType *colinearizeKeepingConform2D(double eps);
MEDCOUPLING_EXPORT DataArrayIdType *conformize3D(double eps);
- MEDCOUPLING_EXPORT mcIdType split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=nullptr, const DataArrayIdType *midOptI=nullptr);
+ MEDCOUPLING_EXPORT mcIdType split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
MEDCOUPLING_EXPORT static MCAuto<MEDCouplingUMesh> Build1DMeshFromCoords(DataArrayDouble *da);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
MEDCouplingUMesh();
MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy);
- ~MEDCouplingUMesh() override;
- void checkFullyDefined() const override;
+ ~MEDCouplingUMesh();
+ void checkFullyDefined() const;
void checkConnectivityFullyDefined() const;
void reprConnectivityOfThisLL(std::ostringstream& stream) const;
//tools
void tessellate2DInternal(double eps);
void tessellate2DCurveInternal(double eps);
void subDivide2DMesh(const mcIdType *nodeSubdived, const mcIdType *nodeIndxSubdived, const mcIdType *desc, const mcIdType *descIndex);
- void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const override;
+ void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const;
void split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector<mcIdType>& cut3DCurve);
MEDCouplingUMesh *buildExtrudedMeshFromThisLowLev(mcIdType nbOfNodesOf1Lev, bool isQuad) const;
DataArrayDouble *fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation2D(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation3D(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
static bool AreCellsEqualInPool(const std::vector<mcIdType>& candidates, int compType, const mcIdType *conn, const mcIdType *connI, DataArrayIdType *result) ;
- MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const override;
- MEDCouplingUMesh *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const override;
+ MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const;
+ MEDCouplingUMesh *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const;
DataArrayIdType *convertLinearCellsToQuadratic1D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
DataArrayIdType *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayIdType *desc, const DataArrayIdType *descI, DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
DataArrayIdType *convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
/// @cond INTERNAL
static void DeleteCellTypeInIndexedArray(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, MCAuto<DataArrayIdType>& arrOut, MCAuto<DataArrayIdType>& arrIndxOut);
static MEDCouplingUMesh *MergeUMeshesLL(const std::vector<const MEDCouplingUMesh *>& a);
- using DimM1DescNbrer = mcIdType (*)(mcIdType, mcIdType, const INTERP_KERNEL::CellModel &, bool, const mcIdType *, const mcIdType *);
+ typedef mcIdType (*DimM1DescNbrer)(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2);
template<class SonsGenerator>
MEDCouplingUMesh *buildDescendingConnectivityGen(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx, DimM1DescNbrer nbrer) const;
static void DistanceToPoint3DSurfAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId);
// Author : Anthony Geay (EDF R&D)
#pragma once
-#include "MCType.hxx"
-#include "MCIdType.hxx"
#include "MEDCouplingUMesh.hxx"
#include <sstream>
checkConnectivityFullyDefined();
mcIdType *conn(getNodalConnectivity()->getPointer());
const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer());
- mcIdType const nbOfCells=ToIdType(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
for(mcIdType i=0;i<nbOfCells;i++)
for(mcIdType iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
//
// Author : Anthony Geay (CEA/DEN)
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "InterpKernelException.hxx"
-#include "MEDCouplingPointSet.hxx"
#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingCMesh.hxx"
+#include "MEDCoupling1GTUMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingSkyLineArray.hxx"
#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
-#include "VolSurfUser.hxx"
-#include "SplitterTetra.txx"
+#include "VolSurfUser.txx"
+#include "InterpolationUtils.hxx"
+#include "PointLocatorAlgos.txx"
+#include "BBTree.txx"
+#include "BBTreeDst.txx"
+#include "SplitterTetra.hxx"
+#include "DiameterCalculator.hxx"
+#include "DirectedBoundingBox.hxx"
+#include "InterpKernelMatrixTools.hxx"
+#include "InterpKernelMeshQuality.hxx"
+#include "InterpKernelCellSimplify.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelAutoPtr.hxx"
#include "InterpKernelGeo2DNode.hxx"
+#include "InterpKernelGeo2DEdgeLin.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
+#include "InterpKernelGeo2DQuadraticPolygon.hxx"
#include "MEDCouplingUMesh_internal.hxx"
-#include <algorithm>
-#include <iterator>
-#include <cmath>
-#include <map>
-#include <set>
-#include <cstdlib>
-#include <functional>
#include <sstream>
+#include <fstream>
+#include <numeric>
#include <cstring>
#include <limits>
-#include <utility>
-#include <vector>
+#include <list>
using namespace MEDCoupling;
void MEDCouplingUMesh::reprConnectivityOfThisLL(std::ostringstream& stream) const
{
- if(_nodal_connec!=nullptr && _nodal_connec_index!=nullptr)
+ if(_nodal_connec!=0 && _nodal_connec_index!=0)
{
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *c=_nodal_connec->getConstPointer();
const mcIdType *ci=_nodal_connec_index->getConstPointer();
for(mcIdType i=0;i<nbOfCells;i++)
checkConnectivityFullyDefined();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
- mcIdType const nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
+ mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
ret->alloc(nbOfCells+nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
mcIdType *retPt=ret->getPointer();
checkConnectivityFullyDefined();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
- mcIdType const nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
+ mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
ret->alloc(nbOfCells+nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
mcIdType *retPt=ret->getPointer();
checkConnectivityFullyDefined();
if(getMeshDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace5 : this policy is only available for mesh with meshdim == 3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
- mcIdType const nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
+ mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
ret->alloc(nbOfCells+4*nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
mcIdType *retPt=ret->getPointer();
checkConnectivityFullyDefined();
if(getMeshDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace6 : this policy is only available for mesh with meshdim == 3 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
- mcIdType const nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
+ mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
ret->alloc(nbOfCells+5*nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
mcIdType *retPt=ret->getPointer();
checkFullyDefined();
if(getMeshDimension()!=2 || getSpaceDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DInternal works on umeshes with meshdim equal to 2 and spaceDim equal to 2 too!");
- double const epsa=fabs(eps);
+ double epsa=fabs(eps);
if(epsa<std::numeric_limits<double>::min())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !");
MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New());
MCAuto<MEDCouplingUMesh> mDesc(buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1));
- revDesc1=nullptr; revDescIndx1=nullptr;
+ revDesc1=0; revDescIndx1=0;
mDesc->tessellate2D(eps);
subDivide2DMesh(mDesc->_nodal_connec->begin(),mDesc->_nodal_connec_index->begin(),desc1->begin(),descIndx1->begin());
setCoords(mDesc->getCoords());
checkFullyDefined();
if(getMeshDimension()!=1 || getSpaceDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DCurveInternal works on umeshes with meshdim equal to 1 and spaceDim equal to 2 too!");
- double const epsa=fabs(eps);
+ double epsa=fabs(eps);
if(epsa<std::numeric_limits<double>::min())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DCurveInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !");
- INTERP_KERNEL::QuadraticPlanarPrecision const arcPrec(1.e-10); // RAII
- mcIdType const nbCells=getNumberOfCells();
- mcIdType const nbNodes=getNumberOfNodes();
+ INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(1.e-10); // RAII
+ mcIdType nbCells=getNumberOfCells();
+ mcIdType nbNodes=getNumberOfNodes();
const mcIdType *conn=_nodal_connec->begin();
const mcIdType *connI=_nodal_connec_index->begin();
const double *coords=_coords->begin();
checkFullyDefined();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::subDivide2DMesh : works only on umesh with meshdim==2 !");
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
mcIdType *connI=_nodal_connec_index->getPointer();
mcIdType newConnLgth=0;
for(mcIdType i=0;i<nbOfCells;i++,connI++)
{
- mcIdType const offset=descIndex[i];
- mcIdType const nbOfEdges=descIndex[i+1]-offset;
+ mcIdType offset=descIndex[i];
+ mcIdType nbOfEdges=descIndex[i+1]-offset;
//
- bool const ddirect=desc[offset+nbOfEdges-1]>0;
- mcIdType const eedgeId=std::abs(desc[offset+nbOfEdges-1])-1;
+ bool ddirect=desc[offset+nbOfEdges-1]>0;
+ mcIdType eedgeId=std::abs(desc[offset+nbOfEdges-1])-1;
mcIdType ref=ddirect?nodeSubdived[nodeIndxSubdived[eedgeId+1]-1]:nodeSubdived[nodeIndxSubdived[eedgeId]+1];
for(mcIdType j=0;j<nbOfEdges;j++)
{
- bool const direct=desc[offset+j]>0;
- mcIdType const edgeId=std::abs(desc[offset+j])-1;
+ bool direct=desc[offset+j]>0;
+ mcIdType edgeId=std::abs(desc[offset+j])-1;
if(!INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodeSubdived[nodeIndxSubdived[edgeId]]).isQuadratic())
{
- mcIdType const id1=nodeSubdived[nodeIndxSubdived[edgeId]+1];
- mcIdType const id2=nodeSubdived[nodeIndxSubdived[edgeId+1]-1];
- mcIdType const ref2=direct?id1:id2;
+ mcIdType id1=nodeSubdived[nodeIndxSubdived[edgeId]+1];
+ mcIdType id2=nodeSubdived[nodeIndxSubdived[edgeId+1]-1];
+ mcIdType ref2=direct?id1:id2;
if(ref==ref2)
{
- mcIdType const nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1;
+ mcIdType nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1;
newConnLgth+=nbOfSubNodes-1;
ref=direct?id2:id1;
}
for(mcIdType i=0;i<nbOfCells;i++)
{
*work++=INTERP_KERNEL::NORM_POLYGON;
- mcIdType const offset=descIndex[i];
- mcIdType const nbOfEdges=descIndex[i+1]-offset;
+ mcIdType offset=descIndex[i];
+ mcIdType nbOfEdges=descIndex[i+1]-offset;
for(mcIdType j=0;j<nbOfEdges;j++)
{
- bool const direct=desc[offset+j]>0;
- mcIdType const edgeId=std::abs(desc[offset+j])-1;
+ bool direct=desc[offset+j]>0;
+ mcIdType edgeId=std::abs(desc[offset+j])-1;
if(direct)
work=std::copy(nodeSubdived+nodeIndxSubdived[edgeId]+1,nodeSubdived+nodeIndxSubdived[edgeId+1]-1,work);
else
{
- mcIdType const nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1;
- std::reverse_iterator<const mcIdType *> const it(nodeSubdived+nodeIndxSubdived[edgeId+1]);
+ mcIdType nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1;
+ std::reverse_iterator<const mcIdType *> it(nodeSubdived+nodeIndxSubdived[edgeId+1]);
work=std::copy(it,it+nbOfSubNodes-1,work);
}
}
for(const mcIdType *work=begin;work!=end;work++)
if(*work>=0 && *work<sz)
fastFinder[*work]=true;
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *conn=getNodalConnectivity()->getConstPointer();
const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer();
for(mcIdType i=0;i<nbOfCells;i++)
checkFullyDefined();
if(getMeshDimension()!=1 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split3DCurveWithPlane works on umeshes with meshdim equal to 1 and spaceDim equal to 3 !");
- mcIdType const ncells=getNumberOfCells();
- mcIdType const nnodes=getNumberOfNodes();
+ mcIdType ncells=getNumberOfCells();
+ mcIdType nnodes=getNumberOfNodes();
double vec2[3],vec3[3],vec4[3];
- double const normm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]);
+ double normm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]);
if(normm<1e-6)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split3DCurveWithPlane : parameter 'vec' should have a norm2 greater than 1e-6 !");
vec2[0]=vec[0]/normm; vec2[1]=vec[1]/normm; vec2[2]=vec[2]/normm;
{
mcIdType st=conn[connI[i]+1],endd=conn[connI[i]+2];
vec3[0]=coo[3*endd]-coo[3*st]; vec3[1]=coo[3*endd+1]-coo[3*st+1]; vec3[2]=coo[3*endd+2]-coo[3*st+2];
- double const normm2=sqrt(vec3[0]*vec3[0]+vec3[1]*vec3[1]+vec3[2]*vec3[2]);
- double const colin=std::abs((vec3[0]*vec2[0]+vec3[1]*vec2[1]+vec3[2]*vec2[2])/normm2);
+ double normm2=sqrt(vec3[0]*vec3[0]+vec3[1]*vec3[1]+vec3[2]*vec3[2]);
+ double colin=std::abs((vec3[0]*vec2[0]+vec3[1]*vec2[1]+vec3[2]*vec2[2])/normm2);
if(colin>eps)//if colin<=eps -> current SEG2 is colinear to the input plane
{
const double *st2=coo+3*st;
vec4[0]=st2[0]-origin[0]; vec4[1]=st2[1]-origin[1]; vec4[2]=st2[2]-origin[2];
- double const pos=-(vec4[0]*vec2[0]+vec4[1]*vec2[1]+vec4[2]*vec2[2])/((vec3[0]*vec2[0]+vec3[1]*vec2[1]+vec3[2]*vec2[2]));
+ double pos=-(vec4[0]*vec2[0]+vec4[1]*vec2[1]+vec4[2]*vec2[2])/((vec3[0]*vec2[0]+vec3[1]*vec2[1]+vec3[2]*vec2[2]));
if(pos>eps && pos<1-eps)
{
- mcIdType const nNode=ToIdType(addCoo.size())/3;
+ mcIdType nNode=ToIdType(addCoo.size())/3;
vec4[0]=st2[0]+pos*vec3[0]; vec4[1]=st2[1]+pos*vec3[1]; vec4[2]=st2[2]+pos*vec3[2];
addCoo.insert(addCoo.end(),vec4,vec4+3);
cut3DCurve[i]=nnodes+nNode;
}
if(!addCoo.empty())
{
- mcIdType const newNbOfNodes=nnodes+ToIdType(addCoo.size())/3;
+ mcIdType newNbOfNodes=nnodes+ToIdType(addCoo.size())/3;
MCAuto<DataArrayDouble> coo2=DataArrayDouble::New();
coo2->alloc(newNbOfNodes,3);
double *tmp=coo2->getPointer();
*/
DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const
{
- mcIdType const oldNbOfNodes=getNumberOfNodes();
- mcIdType const nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
- std::size_t const spaceDim=getSpaceDimension();
+ mcIdType oldNbOfNodes=getNumberOfNodes();
+ mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
+ std::size_t spaceDim=getSpaceDimension();
DataArrayDouble *ret=DataArrayDouble::New();
- std::vector<bool> const isQuads;
- mcIdType const nbOfLevsInVec=isQuad?2*nbOf1DCells+1:nbOf1DCells+1;
+ std::vector<bool> isQuads;
+ mcIdType nbOfLevsInVec=isQuad?2*nbOf1DCells+1:nbOf1DCells+1;
ret->alloc(oldNbOfNodes*nbOfLevsInVec,spaceDim);
double *retPtr=ret->getPointer();
const double *coords=getCoords()->getConstPointer();
{
if(isQuad)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : not implemented for quadratic cells !");
- mcIdType const oldNbOfNodes=getNumberOfNodes();
- mcIdType const nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
+ mcIdType oldNbOfNodes=getNumberOfNodes();
+ mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
if(nbOf1DCells<2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- mcIdType const nbOfLevsInVec=nbOf1DCells+1;
+ mcIdType nbOfLevsInVec=nbOf1DCells+1;
ret->alloc(oldNbOfNodes*nbOfLevsInVec,2);
double *retPtr=ret->getPointer();
retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr);
const double *p1=i+1<nbOfLevsInVec?end:begin;
const double *p2=i+1<nbOfLevsInVec?third:end;
INTERP_KERNEL::EdgeArcCircle::GetArcOfCirclePassingThru(p0,p1,p2,tmp3,radius,alpha,alpha0);
- double const cosangle=i+1<nbOfLevsInVec?(p0[0]-tmp3[0])*(p1[0]-tmp3[0])+(p0[1]-tmp3[1])*(p1[1]-tmp3[1]):(p2[0]-tmp3[0])*(p1[0]-tmp3[0])+(p2[1]-tmp3[1])*(p1[1]-tmp3[1]);
- double const angle=acos(cosangle/(radius*radius));
- tmp->rotate(end,nullptr,angle);
+ double cosangle=i+1<nbOfLevsInVec?(p0[0]-tmp3[0])*(p1[0]-tmp3[0])+(p0[1]-tmp3[1])*(p1[1]-tmp3[1]):(p2[0]-tmp3[0])*(p1[0]-tmp3[0])+(p2[1]-tmp3[1])*(p1[1]-tmp3[1]);
+ double angle=acos(cosangle/(radius*radius));
+ tmp->rotate(end,0,angle);
retPtr=std::copy(tmp2->getConstPointer(),tmp2->getConstPointer()+tmp2->getNbOfElems(),retPtr);
}
return ret.retn();
{
if(isQuad)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : not implemented for quadratic cells !");
- mcIdType const oldNbOfNodes=getNumberOfNodes();
- mcIdType const nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
+ mcIdType oldNbOfNodes=getNumberOfNodes();
+ mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
if(nbOf1DCells<2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- mcIdType const nbOfLevsInVec=nbOf1DCells+1;
+ mcIdType nbOfLevsInVec=nbOf1DCells+1;
ret->alloc(oldNbOfNodes*nbOfLevsInVec,3);
double *retPtr=ret->getPointer();
retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr);
(p1[2]-p0[2])*(p2[0]-p1[0])-(p1[0]-p0[0])*(p2[2]-p1[2]),
(p1[0]-p0[0])*(p2[1]-p1[1])-(p1[1]-p0[1])*(p2[0]-p1[0]),
};
- double const norm=sqrt(vecPlane[0]*vecPlane[0]+vecPlane[1]*vecPlane[1]+vecPlane[2]*vecPlane[2]);
+ double norm=sqrt(vecPlane[0]*vecPlane[0]+vecPlane[1]*vecPlane[1]+vecPlane[2]*vecPlane[2]);
if(norm>1.e-7)
{
vecPlane[0]/=norm; vecPlane[1]/=norm; vecPlane[2]/=norm;
- double const norm2=sqrt(vecPlane[0]*vecPlane[0]+vecPlane[1]*vecPlane[1]);
- double const vec2[2]={vecPlane[1]/norm2,-vecPlane[0]/norm2};
- double const s2=norm2;
+ double norm2=sqrt(vecPlane[0]*vecPlane[0]+vecPlane[1]*vecPlane[1]);
+ double vec2[2]={vecPlane[1]/norm2,-vecPlane[0]/norm2};
+ double s2=norm2;
double c2=cos(asin(s2));
- double const m[3][3]={
+ double m[3][3]={
{vec2[0]*vec2[0]*(1-c2)+c2, vec2[0]*vec2[1]*(1-c2), vec2[1]*s2},
{vec2[0]*vec2[1]*(1-c2), vec2[1]*vec2[1]*(1-c2)+c2, -vec2[0]*s2},
{-vec2[1]*s2, vec2[0]*s2, c2}
double p1r[3]={m[0][0]*p1[0]+m[0][1]*p1[1]+m[0][2]*p1[2], m[1][0]*p1[0]+m[1][1]*p1[1]+m[1][2]*p1[2], m[2][0]*p1[0]+m[2][1]*p1[1]+m[2][2]*p1[2]};
double p2r[3]={m[0][0]*p2[0]+m[0][1]*p2[1]+m[0][2]*p2[2], m[1][0]*p2[0]+m[1][1]*p2[1]+m[1][2]*p2[2], m[2][0]*p2[0]+m[2][1]*p2[1]+m[2][2]*p2[2]};
INTERP_KERNEL::EdgeArcCircle::GetArcOfCirclePassingThru(p0r,p1r,p2r,tmp3,radius,alpha,alpha0);
- double const cosangle=i+1<nbOfLevsInVec?(p0r[0]-tmp3[0])*(p1r[0]-tmp3[0])+(p0r[1]-tmp3[1])*(p1r[1]-tmp3[1]):(p2r[0]-tmp3[0])*(p1r[0]-tmp3[0])+(p2r[1]-tmp3[1])*(p1r[1]-tmp3[1]);
- double const angle=acos(cosangle/(radius*radius));
+ double cosangle=i+1<nbOfLevsInVec?(p0r[0]-tmp3[0])*(p1r[0]-tmp3[0])+(p0r[1]-tmp3[1])*(p1r[1]-tmp3[1]):(p2r[0]-tmp3[0])*(p1r[0]-tmp3[0])+(p2r[1]-tmp3[1])*(p1r[1]-tmp3[1]);
+ double angle=acos(cosangle/(radius*radius));
tmp->rotate(end,vecPlane,angle);
}
retPtr=std::copy(tmp2->getConstPointer(),tmp2->getConstPointer()+tmp2->getNbOfElems(),retPtr);
*/
MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(mcIdType nbOfNodesOf1Lev, bool isQuad) const
{
- mcIdType const nbOf1DCells(getNumberOfNodes()/nbOfNodesOf1Lev-1);
- mcIdType const nbOf2DCells=getNumberOfCells();
- mcIdType const nbOf3DCells(nbOf2DCells*nbOf1DCells);
+ mcIdType nbOf1DCells(getNumberOfNodes()/nbOfNodesOf1Lev-1);
+ mcIdType nbOf2DCells=getNumberOfCells();
+ mcIdType nbOf3DCells(nbOf2DCells*nbOf1DCells);
MEDCouplingUMesh *ret(MEDCouplingUMesh::New("Extruded",getMeshDimension()+1));
const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
MCAuto<DataArrayIdType> newConn(DataArrayIdType::New()),newConnI(DataArrayIdType::New());
}
newConn->alloc(newc.size()*nbOf1DCells,1);
mcIdType *newConnPtr(newConn->getPointer());
- mcIdType const deltaPerLev(isQuad?2*nbOfNodesOf1Lev:nbOfNodesOf1Lev);
+ mcIdType deltaPerLev(isQuad?2*nbOfNodesOf1Lev:nbOfNodesOf1Lev);
newConnIPtr=newConnI->getPointer();
for(mcIdType iz=0;iz<nbOf1DCells;iz++)
{
const mcIdType *posOfTypeOfCell(newConnIPtr);
for(std::vector<mcIdType>::const_iterator iter=newc.begin();iter!=newc.end();iter++,newConnPtr++)
{
- mcIdType const icell(ToIdType(iter-newc.begin()));//std::distance unfortunately cannot been called here in C++98
+ mcIdType icell(ToIdType(iter-newc.begin()));//std::distance unfortunately cannot been called here in C++98
if(icell!=*posOfTypeOfCell)
{
if(*iter!=-1)
if(candidates.size()<1)
return false;
bool ret=false;
- auto iter=candidates.begin();
- mcIdType const start=(*iter++);
+ std::vector<mcIdType>::const_iterator iter=candidates.begin();
+ mcIdType start=(*iter++);
for(;iter!=candidates.end();iter++)
{
- int const status=AreCellsEqual(conn,connI,start,*iter,compType);
+ int status=AreCellsEqual(conn,connI,start,*iter,compType);
if(status!=0)
{
if(!ret)
MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const
{
checkConnectivityFullyDefined();
- mcIdType const ncell=getNumberOfCells();
+ mcIdType ncell=getNumberOfCells();
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
ret->_mesh_dim=_mesh_dim;
ret->setCoords(_coords);
- std::size_t const nbOfElemsRet=std::distance(begin,end);
- auto *connIndexRet=(mcIdType *)malloc((nbOfElemsRet+1)*sizeof(mcIdType));
+ std::size_t nbOfElemsRet=std::distance(begin,end);
+ mcIdType *connIndexRet=(mcIdType *)malloc((nbOfElemsRet+1)*sizeof(mcIdType));
connIndexRet[0]=0;
const mcIdType *conn=_nodal_connec->getConstPointer();
const mcIdType *connIndex=_nodal_connec_index->getConstPointer();
throw INTERP_KERNEL::Exception(oss.str());
}
}
- auto *connRet=(mcIdType *)malloc(connIndexRet[nbOfElemsRet]*sizeof(mcIdType));
+ mcIdType *connRet=(mcIdType *)malloc(connIndexRet[nbOfElemsRet]*sizeof(mcIdType));
mcIdType *connRetWork=connRet;
std::set<INTERP_KERNEL::NormalizedCellType> types;
for(const mcIdType *work=begin;work!=end;work++)
MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const
{
checkFullyDefined();
- mcIdType const ncell=getNumberOfCells();
+ mcIdType ncell=getNumberOfCells();
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
ret->_mesh_dim=_mesh_dim;
ret->setCoords(_coords);
- mcIdType const newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : ");
+ mcIdType newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : ");
MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New(); newConnI->alloc(newNbOfCells+1,1);
mcIdType *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0;
mcIdType work=start;
}
-mcIdType MEDCouplingFastNbrer(mcIdType id, mcIdType /*nb*/, const INTERP_KERNEL::CellModel& /*cm*/, bool /*compute*/, const mcIdType * /*conn1*/, const mcIdType * /*conn2*/)
+mcIdType MEDCouplingFastNbrer(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2)
{
return id;
}
MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(0,1);
MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
- mcIdType const nbOfCells=getNumberOfCells();
- mcIdType const nbOfNodes=getNumberOfNodes();
+ mcIdType nbOfCells=getNumberOfCells();
+ mcIdType nbOfNodes=getNumberOfNodes();
const mcIdType *cPtr=_nodal_connec->begin();
const mcIdType *icPtr=_nodal_connec_index->begin();
mcIdType lastVal=0,offset=nbOfNodes;
for(mcIdType i=0;i<nbOfCells;i++,icPtr++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
if(type==INTERP_KERNEL::NORM_SEG2)
{
types.insert(INTERP_KERNEL::NORM_SEG3);
MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(0,1);
//
const mcIdType *descPtr(desc->begin()),*descIPtr(descI->begin());
- DataArrayIdType *conn1D=nullptr,*conn1DI=nullptr;
+ DataArrayIdType *conn1D=0,*conn1DI=0;
std::set<INTERP_KERNEL::NormalizedCellType> types1D;
- DataArrayDouble *coordsTmp=nullptr;
- MCAuto<DataArrayIdType> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=nullptr;
+ DataArrayDouble *coordsTmp=0;
+ MCAuto<DataArrayIdType> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
MCAuto<DataArrayDouble> coordsTmpSafe(coordsTmp);
MCAuto<DataArrayIdType> conn1DSafe(conn1D),conn1DISafe(conn1DI);
const mcIdType *c1DPtr=conn1D->begin();
const mcIdType *c1DIPtr=conn1DI->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *cPtr=_nodal_connec->begin();
const mcIdType *icPtr=_nodal_connec_index->begin();
mcIdType lastVal=0;
for(mcIdType i=0;i<nbOfCells;i++,icPtr++,descIPtr++)
{
- auto const typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
+ INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
if(!cm.isQuadratic())
{
- INTERP_KERNEL::NormalizedCellType const typ2=cm.getQuadraticType();
+ INTERP_KERNEL::NormalizedCellType typ2=cm.getQuadraticType();
types.insert(typ2); newConn->pushBackSilent(typ2);
newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]);
for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++)
DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
MCAuto<DataArrayIdType> desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New());
- MCAuto<MEDCouplingUMesh> m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=nullptr; tmp3=nullptr;
+ MCAuto<MEDCouplingUMesh> m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types);
}
DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
MCAuto<DataArrayIdType> desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New());
- MCAuto<MEDCouplingUMesh> m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=nullptr; tmp3=nullptr;
+ MCAuto<MEDCouplingUMesh> m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
//
MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(0,1);
MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
//
MCAuto<DataArrayDouble> bary=computeCellCenterOfMass();
const mcIdType *descPtr(desc->begin()),*descIPtr(descI->begin());
- DataArrayIdType *conn1D=nullptr,*conn1DI=nullptr;
+ DataArrayIdType *conn1D=0,*conn1DI=0;
std::set<INTERP_KERNEL::NormalizedCellType> types1D;
- DataArrayDouble *coordsTmp=nullptr;
- MCAuto<DataArrayIdType> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=nullptr;
+ DataArrayDouble *coordsTmp=0;
+ MCAuto<DataArrayIdType> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
MCAuto<DataArrayDouble> coordsTmpSafe(coordsTmp);
MCAuto<DataArrayIdType> conn1DSafe(conn1D),conn1DISafe(conn1DI);
const mcIdType *c1DPtr=conn1D->begin();
const mcIdType *c1DIPtr=conn1DI->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *cPtr=_nodal_connec->begin();
const mcIdType *icPtr=_nodal_connec_index->begin();
mcIdType lastVal=0;
- mcIdType const offset=coordsTmpSafe->getNumberOfTuples();
+ mcIdType offset=coordsTmpSafe->getNumberOfTuples();
for(mcIdType i=0;i<nbOfCells;i++,icPtr++,descIPtr++)
{
- auto const typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
+ INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
if(!cm.isQuadratic())
{
- INTERP_KERNEL::NormalizedCellType const typ2=cm.getQuadraticType2();
+ INTERP_KERNEL::NormalizedCellType typ2=cm.getQuadraticType2();
types.insert(typ2); newConn->pushBackSilent(typ2);
newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]);
for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++)
DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
MCAuto<DataArrayIdType> desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New());
- MCAuto<MEDCouplingUMesh> m1D=explode3DMeshTo1D(desc,descI,tmp2,tmp3); tmp2=nullptr; tmp3=nullptr;
+ MCAuto<MEDCouplingUMesh> m1D=explode3DMeshTo1D(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types);
}
DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
MCAuto<DataArrayIdType> desc2(DataArrayIdType::New()),desc2I(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New());
- MCAuto<MEDCouplingUMesh> m2D=buildDescendingConnectivityGen<MinusOneSonsGeneratorBiQuadratic>(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=nullptr; tmp3=nullptr;
+ MCAuto<MEDCouplingUMesh> m2D=buildDescendingConnectivityGen<MinusOneSonsGeneratorBiQuadratic>(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=0; tmp3=0;
MCAuto<DataArrayIdType> desc1(DataArrayIdType::New()),desc1I(DataArrayIdType::New()),tmp4(DataArrayIdType::New()),tmp5(DataArrayIdType::New());
- MCAuto<MEDCouplingUMesh> m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=nullptr; tmp5=nullptr;
+ MCAuto<MEDCouplingUMesh> m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=0; tmp5=0;
//
MCAuto<DataArrayIdType> newConn=DataArrayIdType::New(); newConn->alloc(0,1);
MCAuto<DataArrayIdType> newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
//
MCAuto<DataArrayDouble> bary=computeCellCenterOfMass();
const mcIdType *descPtr(desc1->begin()),*descIPtr(desc1I->begin()),*desc2Ptr(desc2->begin()),*desc2IPtr(desc2I->begin());
- DataArrayIdType *conn1D=nullptr,*conn1DI=nullptr,*conn2D=nullptr,*conn2DI=nullptr;
+ DataArrayIdType *conn1D=0,*conn1DI=0,*conn2D=0,*conn2DI=0;
std::set<INTERP_KERNEL::NormalizedCellType> types1D,types2D;
- DataArrayDouble *coordsTmp=nullptr,*coordsTmp2=nullptr;
+ DataArrayDouble *coordsTmp=0,*coordsTmp2=0;
MCAuto<DataArrayIdType> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayIdType::New(); ret1D->alloc(0,1);
MCAuto<DataArrayIdType> conn1DSafe(conn1D),conn1DISafe(conn1DI);
MCAuto<DataArrayDouble> coordsTmpSafe(coordsTmp);
MCAuto<DataArrayDouble> coordsTmp2Safe(coordsTmp2);
MCAuto<DataArrayIdType> conn2DSafe(conn2D),conn2DISafe(conn2DI);
const mcIdType *c1DPtr=conn1D->begin(),*c1DIPtr=conn1DI->begin(),*c2DPtr=conn2D->begin(),*c2DIPtr=conn2DI->begin();
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
const mcIdType *cPtr=_nodal_connec->begin();
const mcIdType *icPtr=_nodal_connec_index->begin();
mcIdType lastVal=0;
mcIdType offset=coordsTmpSafe->getNumberOfTuples();
for(mcIdType i=0;i<nbOfCells;i++,icPtr++,descIPtr++,desc2IPtr++)
{
- auto const typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
+ INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
if(!cm.isQuadratic())
{
- INTERP_KERNEL::NormalizedCellType const typ2=cm.getQuadraticType2();
+ INTERP_KERNEL::NormalizedCellType typ2=cm.getQuadraticType2();
if(typ2==INTERP_KERNEL::NORM_ERROR)
{
std::ostringstream oss; oss << "MEDCouplingUMesh::convertLinearCellsToQuadratic3D1 : On cell #" << i << " the linear cell type does not support advanced quadratization !";
newConn->pushBackSilent(c1DPtr[c1DIPtr[*d]+3]);
for(const mcIdType *d=desc2Ptr+desc2IPtr[0];d!=desc2Ptr+desc2IPtr[1];d++)
{
- mcIdType const nodeId2=c2DPtr[c2DIPtr[(*d)+1]-1];
- mcIdType const tmpPos=newConn->getNumberOfTuples();
+ mcIdType nodeId2=c2DPtr[c2DIPtr[(*d)+1]-1];
+ mcIdType tmpPos=newConn->getNumberOfTuples();
newConn->pushBackSilent(nodeId2);
ret2D->pushBackSilent(nodeId2); ret1D->pushBackSilent(tmpPos);
}
for(const mcIdType *elt=ret1D->begin();elt!=ret1D->end();elt++)
c[*elt]=o2nRet2D->getIJ(c[*elt],0)+offset;
offset=coordsTmp2Safe->getNumberOfTuples();
- for(long const elt : *ret)
- c[cI[elt+1]-1]+=offset;
+ for(const mcIdType *elt=ret->begin();elt!=ret->end();elt++)
+ c[cI[(*elt)+1]-1]+=offset;
coords=DataArrayDouble::Aggregate(v); conn=newConn.retn(); connI=newConnI.retn();
return ret.retn();
}
DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const
{
- mcIdType const nbOfNodesExpected(skin->getNumberOfNodes());
+ mcIdType nbOfNodesExpected(skin->getNumberOfNodes());
const mcIdType *n2oPtr(n2o->begin());
MCAuto<DataArrayIdType> revNodal(DataArrayIdType::New()),revNodalI(DataArrayIdType::New());
skin->getReverseNodalConnectivity(revNodal,revNodalI);
conn.erase(prevNode);
if(conn.size()==1)
{
- mcIdType const curNode(*(conn.begin()));
+ mcIdType curNode(*(conn.begin()));
*work++=n2oPtr[curNode];
std::set<mcIdType> shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]);
shar.erase(prevCell);
DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const
{
- mcIdType const nbOfNodesExpected(skin->getNumberOfNodes());
- mcIdType const nbOfTurn(nbOfNodesExpected/2);
+ mcIdType nbOfNodesExpected(skin->getNumberOfNodes());
+ mcIdType nbOfTurn(nbOfNodesExpected/2);
const mcIdType *n2oPtr(n2o->begin());
MCAuto<DataArrayIdType> revNodal(DataArrayIdType::New()),revNodalI(DataArrayIdType::New());
skin->getReverseNodalConnectivity(revNodal,revNodalI);
conn.erase(prevNode);
if(conn.size()==1)
{
- mcIdType const curNode(*(conn.begin()));
+ mcIdType curNode(*(conn.begin()));
*work=n2oPtr[curNode];
std::set<mcIdType> shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]);
shar.erase(prevCell);
if(shar.size()==1)
{
- mcIdType const curCell(*(shar.begin()));
+ mcIdType curCell(*(shar.begin()));
work[nbOfTurn]=n2oPtr[nodalPtr[nodalIPtr[curCell]+3]];
prevCell=curCell;
prevNode=curNode;
*outArrIndxPtr++ = 0;
for( mcIdType i = 0 ; i < arrIndxNbTuples - 1 ; ++i )
{
- mcIdType const startPos(*inArrIndxPtr++);
- mcIdType const endPos(*inArrIndxPtr);
+ mcIdType startPos(*inArrIndxPtr++);
+ mcIdType endPos(*inArrIndxPtr);
if(inArrPtr[startPos] == INTERP_KERNEL::NORM_POLYHED)
{
presenceOfPolyh = true;
*outArrIndxPtr++ = 0;
for( mcIdType i = 0 ; i < arrIndxNbTuples - 1 ; ++i,++outArrIndxPtr )
{
- mcIdType const startPos(*inArrIndxPtr++);
- mcIdType const endPos(*inArrIndxPtr);
+ mcIdType startPos(*inArrIndxPtr++);
+ mcIdType endPos(*inArrIndxPtr);
if(inArrPtr[startPos] != INTERP_KERNEL::NORM_POLYHED)
{
arrOut->insertAtTheEnd(inArrPtr+startPos+1,inArrPtr+endPos);
{
if(a.empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MergeUMeshes : input array must be NON EMPTY !");
- auto it=a.begin();
- int const meshDim=(*it)->getMeshDimension();
+ std::vector<const MEDCouplingUMesh *>::const_iterator it=a.begin();
+ int meshDim=(*it)->getMeshDimension();
mcIdType nbOfCells=ToIdType((*it)->getNumberOfCells());
mcIdType meshLgth=(*it++)->getNodalConnectivityArrayLen();
for(;it!=a.end();it++)
mcIdType offset2=0;
for(it=a.begin();it!=a.end();it++)
{
- mcIdType const curNbOfCell=ToIdType((*it)->getNumberOfCells());
+ mcIdType curNbOfCell=ToIdType((*it)->getNumberOfCells());
const mcIdType *curCI=(*it)->_nodal_connec_index->begin();
const mcIdType *curC=(*it)->_nodal_connec->begin();
cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind(std::plus<mcIdType>(),std::placeholders::_1,offset));
{
case INTERP_KERNEL::NORM_TRI3:
{
- double const tmp=INTERP_KERNEL::DistanceFromPtToTriInSpaceDim3(pt,coords+3*nc[ncI[*zeCell]+1],coords+3*nc[ncI[*zeCell]+2],coords+3*nc[ncI[*zeCell]+3]);
+ double tmp=INTERP_KERNEL::DistanceFromPtToTriInSpaceDim3(pt,coords+3*nc[ncI[*zeCell]+1],coords+3*nc[ncI[*zeCell]+2],coords+3*nc[ncI[*zeCell]+3]);
if(tmp<ret0)
{ ret0=tmp; cellId=*zeCell; }
break;
case INTERP_KERNEL::NORM_QUAD4:
case INTERP_KERNEL::NORM_POLYGON:
{
- double const tmp=INTERP_KERNEL::DistanceFromPtToPolygonInSpaceDim3(pt,nc+ncI[*zeCell]+1,nc+ncI[*zeCell+1],coords);
+ double tmp=INTERP_KERNEL::DistanceFromPtToPolygonInSpaceDim3(pt,nc+ncI[*zeCell]+1,nc+ncI[*zeCell+1],coords);
if(tmp<ret0)
{ ret0=tmp; cellId=*zeCell; }
break;
nbOfDepthPeelingPerformed=0;
if(!seedBg || !seedEnd || !arrIn || !arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg : some input pointer is NULL !");
- mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
std::vector<bool> fetched2(nbOfTuples,false);
int i=0;
for(const mcIdType *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++)
}
const mcIdType *arrInPtr=arrIn->begin();
const mcIdType *arrIndxPtr=arrIndxIn->begin();
- mcIdType const targetNbOfDepthPeeling=nbOfDepthPeeling!=-1?nbOfDepthPeeling:std::numeric_limits<mcIdType>::max();
+ mcIdType targetNbOfDepthPeeling=nbOfDepthPeeling!=-1?nbOfDepthPeeling:std::numeric_limits<mcIdType>::max();
std::vector<mcIdType> idsToFetch1(seedBg,seedEnd);
std::vector<mcIdType> idsToFetch2;
std::vector<mcIdType> *idsToFetch=&idsToFetch1;
std::vector<mcIdType> *idsToFetchOther=&idsToFetch2;
while(!idsToFetch->empty() && nbOfDepthPeelingPerformed<targetNbOfDepthPeeling)
{
- for(long const it : *idsToFetch)
- for(const mcIdType *it2=arrInPtr+arrIndxPtr[it];it2!=arrInPtr+arrIndxPtr[it+1];it2++)
+ for(std::vector<mcIdType>::const_iterator it=idsToFetch->begin();it!=idsToFetch->end();it++)
+ for(const mcIdType *it2=arrInPtr+arrIndxPtr[*it];it2!=arrInPtr+arrIndxPtr[*it+1];it2++)
if(!fetched[*it2])
{ fetched[*it2]=true; fetched2[*it2]=true; idsToFetchOther->push_back(*it2); }
std::swap(idsToFetch,idsToFetchOther);
idsToFetchOther->clear();
nbOfDepthPeelingPerformed++;
}
- mcIdType const lgth=ToIdType(std::count(fetched2.begin(),fetched2.end(),true));
+ mcIdType lgth=ToIdType(std::count(fetched2.begin(),fetched2.end(),true));
i=0;
MCAuto<DataArrayIdType> ret=DataArrayIdType::New(); ret->alloc(lgth,1);
mcIdType *retPtr=ret->getPointer();
*/
void MEDCouplingUMesh::AppendExtrudedCell(const mcIdType *connBg, const mcIdType *connEnd, mcIdType nbOfNodesPerLev, bool isQuad, std::vector<mcIdType>& ret)
{
- auto const flatType=(INTERP_KERNEL::NormalizedCellType)connBg[0];
+ INTERP_KERNEL::NormalizedCellType flatType=(INTERP_KERNEL::NormalizedCellType)connBg[0];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(flatType);
ret.push_back(cm.getExtrudedType());
- mcIdType const deltaz=isQuad?2*nbOfNodesPerLev:nbOfNodesPerLev;
+ mcIdType deltaz=isQuad?2*nbOfNodesPerLev:nbOfNodesPerLev;
switch(flatType)
{
case INTERP_KERNEL::NORM_POINT1:
std::back_insert_iterator< std::vector<mcIdType> > ii(ret);
std::copy(connBg+1,connEnd,ii);
*ii++=-1;
- std::reverse_iterator<const mcIdType *> const rConnBg(connEnd);
- std::reverse_iterator<const mcIdType *> const rConnEnd(connBg+1);
+ std::reverse_iterator<const mcIdType *> rConnBg(connEnd);
+ std::reverse_iterator<const mcIdType *> rConnEnd(connBg+1);
std::transform(rConnBg,rConnEnd,ii,std::bind(std::plus<mcIdType>(),std::placeholders::_1,deltaz));
- std::size_t const nbOfRadFaces=std::distance(connBg+1,connEnd);
+ std::size_t nbOfRadFaces=std::distance(connBg+1,connEnd);
for(std::size_t i=0;i<nbOfRadFaces;i++)
{
*ii++=-1;
const mcIdType *desc, const mcIdType *descIndx,
std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf)
{
- std::set<mcIdType> const nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end());
- mcIdType const nbOf3DSurfCell=ToIdType(cut3DSurf.size());
+ std::set<mcIdType> nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end());
+ mcIdType nbOf3DSurfCell=ToIdType(cut3DSurf.size());
for(mcIdType i=0;i<nbOf3DSurfCell;i++)
{
std::vector<mcIdType> res;
- mcIdType const offset=descIndx[i];
- mcIdType const nbOfSeg=descIndx[i+1]-offset;
+ mcIdType offset=descIndx[i];
+ mcIdType nbOfSeg=descIndx[i+1]-offset;
for(mcIdType j=0;j<nbOfSeg;j++)
{
- mcIdType const edgeId=desc[offset+j];
- mcIdType const status=cut3DCurve[edgeId];
+ mcIdType edgeId=desc[offset+j];
+ mcIdType status=cut3DCurve[edgeId];
if(status!=-2)
{
if(status>-1)
case 1:
case 0:
{
- std::set<mcIdType> const s1(nodal3DSurf+nodalIndx3DSurf[i]+1,nodal3DSurf+nodalIndx3DSurf[i+1]);
+ std::set<mcIdType> s1(nodal3DSurf+nodalIndx3DSurf[i]+1,nodal3DSurf+nodalIndx3DSurf[i+1]);
std::set_intersection(nodesOnP.begin(),nodesOnP.end(),s1.begin(),s1.end(),std::back_insert_iterator< std::vector<mcIdType> >(res));
if(res.size()==2)
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::assemblyForSplitFrom3DSurf works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
const mcIdType *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin());
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
for(mcIdType i=0;i<nbOfCells;i++)
{
std::map<mcIdType, std::set<mcIdType> > m;
- mcIdType const offset=descIndx[i];
- mcIdType const nbOfFaces=descIndx[i+1]-offset;
+ mcIdType offset=descIndx[i];
+ mcIdType nbOfFaces=descIndx[i+1]-offset;
mcIdType start=-1;
mcIdType end=-1;
for(int j=0;j<nbOfFaces;j++)
else
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodal3D[nodalIndx3D[i]]);
- mcIdType const sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1;
+ mcIdType sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1;
INTERP_KERNEL::AutoPtr<mcIdType> tmp=new mcIdType[sz];
INTERP_KERNEL::NormalizedCellType cmsId;
- unsigned const nbOfNodesSon=cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId);
+ unsigned nbOfNodesSon=cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId);
start=tmp[0]; end=tmp[nbOfNodesSon-1];
for(unsigned k=0;k<nbOfNodesSon;k++)
{
mcIdType prev=end;
while(end!=start)
{
- std::map<mcIdType, std::set<mcIdType> >::const_iterator const it=m.find(start);
+ std::map<mcIdType, std::set<mcIdType> >::const_iterator it=m.find(start);
const std::set<mcIdType>& s=(*it).second;
std::set<mcIdType> s2; s2.insert(prev);
std::set<mcIdType> s3;
std::set_difference(s.begin(),s.end(),s2.begin(),s2.end(),inserter(s3,s3.begin()));
if(s3.size()==1)
{
- mcIdType const val=*s3.begin();
+ mcIdType val=*s3.begin();
conn.push_back(start);
prev=start;
start=val;
{
types.clear();
const mcIdType *conn(nodalConnec->begin()),*connIndex(nodalConnecIndex->begin());
- mcIdType const nbOfElem=ToIdType(nodalConnecIndex->getNbOfElems())-1;
+ mcIdType nbOfElem=ToIdType(nodalConnecIndex->getNbOfElems())-1;
if(nbOfElem>0)
for(const mcIdType *pt=connIndex;pt!=connIndex+nbOfElem;pt++)
types.insert((INTERP_KERNEL::NormalizedCellType)conn[*pt]);
void MEDCouplingUMesh::attractSeg3MidPtsAroundNodes(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd)
{
checkFullyDefined();
- int const mdim(getMeshDimension());
+ int mdim(getMeshDimension());
if(mdim==2 || mdim==3)
{
MCAuto<MEDCouplingUMesh> edges;
*/
void MEDCouplingUMesh::attractSeg3MidPtsAroundNodesUnderground(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd)
{
- int const spaceDim(getSpaceDimension());
+ int spaceDim(getSpaceDimension());
double *coords(getCoords()->getPointer());
auto nbNodes(getNumberOfNodes());
- std::size_t const nbCells(getNumberOfCells());
+ std::size_t nbCells(getNumberOfCells());
std::vector<bool> fastFinder(nbNodes,false);
for(auto work=nodeIdsBg;work!=nodeIdsEnd;work++)
if(*work>=0 && *work<nbNodes)
fastFinder[*work]=true;
- MCAuto<DataArrayIdType> const cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false));
+ MCAuto<DataArrayIdType> cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false));
const mcIdType *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin());
for(std::size_t cellId=0;cellId<nbCells;cellId++,nci++)
{
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// Author : Anthony Geay (EdF)
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "InterpKernelException.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "CellModel.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "BBTree.txx"
-#include "InterpKernelAutoPtr.hxx"
-#include "PointLocatorAlgos.txx"
-
using namespace MEDCoupling;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
// begin
// useless, but for windows compilation ...
- const double* getCoordinatesPtr() const { return nullptr; }
- const MyConnType* getConnectivityPtr() const { return nullptr; }
- const MyConnType* getConnectivityIndexPtr() const { return nullptr; }
+ const double* getCoordinatesPtr() const { return 0; }
+ const MyConnType* getConnectivityPtr() const { return 0; }
+ const MyConnType* getConnectivityIndexPtr() const { return 0; }
INTERP_KERNEL::NormalizedCellType getTypeOfElement(MyConnType) const { return (INTERP_KERNEL::NormalizedCellType)0; }
// end
};
//
// Author : Anthony Geay (CEA/DEN)
-#include "MCIdType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCAuto.hxx"
-#include "InterpKernelGeo2DComposedEdge.hxx"
-#include "InterpKernelGeo2DElementaryEdge.hxx"
-#include "InterpKernelGeo2DEdge.hxx"
-#include "MCType.hxx"
-#include "BBTreePts.txx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "InterpKernelGeo2DPrecision.hxx"
-#include "InterpKernelGeo2DAbstractEdge.hxx"
#include "MEDCouplingUMesh.hxx"
+#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
+#include "VolSurfUser.txx"
+#include "InterpolationUtils.hxx"
+#include "PointLocatorAlgos.txx"
#include "BBTree.txx"
+#include "BBTreeDst.txx"
+#include "DirectedBoundingBox.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelAutoPtr.hxx"
#include "InterpKernelGeo2DNode.hxx"
#include "VectorUtils.hxx"
#include "MEDCouplingSkyLineArray.hxx"
-#include <map>
-#include <algorithm>
-#include <set>
-#include <cstdlib>
-#include <iterator>
-#include <cmath>
-#include <functional>
#include <sstream>
+#include <fstream>
+#include <numeric>
#include <cstring>
#include <limits>
+#include <list>
#include <assert.h>
-#include <vector>
-#include <utility>
using namespace MEDCoupling;
return id;
else
{
- mcIdType const ret(nodesCnter++);
+ mcIdType ret(nodesCnter++);
double newPt[2];
e->getMiddleOfPoints(coo+2*startId,coo+2*endId,newPt);
addCoo.insertAtTheEnd(newPt,newPt+2);
return id;
else
{
- mcIdType const ret(nodesCnter++);
+ mcIdType ret(nodesCnter++);
double newPt[2];
e->getMiddleOfPointsOriented(coo+2*startId,coo+2*endId,newPt);
addCoo.insertAtTheEnd(newPt,newPt+2);
void EnterTheResultOf2DCellFirst(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const mcIdType *connBg, mcIdType offset, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords, std::vector<mcIdType>& middles)
{
mcIdType tmp[3];
- int const trueStart(start>=0?start:nbOfEdges+start);
+ int trueStart(start>=0?start:nbOfEdges+start);
tmp[0]=ToIdType(linOrArc?INTERP_KERNEL::NORM_QPOLYG:INTERP_KERNEL::NORM_POLYGON); tmp[1]=connBg[trueStart]; tmp[2]=connBg[stp];
newConnOfCell->insertAtTheEnd(tmp,tmp+3);
if(linOrArc)
}
}
-void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const mcIdType *connBg, mcIdType offset, DataArrayIdType * /*newConnOfCell*/, DataArrayDouble *appendedCoords, std::vector<mcIdType>& middles)
+void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const mcIdType *connBg, mcIdType offset, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords, std::vector<mcIdType>& middles)
{
// only the quadratic point to deal with:
if(linOrArc)
void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector<mcIdType>& isect)
{
MCAuto<INTERP_KERNEL::Node> nTmp(n); nTmp->incrRef();
- auto const it(m.find(nTmp));
+ std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType>::const_iterator it(m.find(nTmp));
if(it==m.end())
throw INTERP_KERNEL::Exception("Internal error in remapping !");
- mcIdType const v((*it).second);
+ mcIdType v((*it).second);
if(v==forbVal0 || v==forbVal1)
return ;
if(std::find(isect.begin(),isect.end(),v)==isect.end())
bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector<mcIdType>& isect)
{
- int const sz(c.size());
+ int sz(c.size());
if(sz<=1)
return false;
- bool const presenceOfOn(false);
+ bool presenceOfOn(false);
for(int i=0;i<sz;i++)
{
INTERP_KERNEL::ElementaryEdge *e(c[i]);
INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const mcIdType *bg, const double *coords2D, std::map< MCAuto<INTERP_KERNEL::Node>,mcIdType>& m)
{
- INTERP_KERNEL::Edge *ret(nullptr);
+ INTERP_KERNEL::Edge *ret(0);
MCAuto<INTERP_KERNEL::Node> n0(new INTERP_KERNEL::Node(coords2D[2*bg[0]],coords2D[2*bg[0]+1])),n1(new INTERP_KERNEL::Node(coords2D[2*bg[1]],coords2D[2*bg[1]+1]));
m[n0]=bg[0]; m[n1]=bg[1];
switch(typ)
}
case INTERP_KERNEL::NORM_SEG3:
{
- auto *n2(new INTERP_KERNEL::Node(coords2D[2*bg[2]],coords2D[2*bg[2]+1])); m[n2]=bg[2];
- auto *e1(new INTERP_KERNEL::EdgeLin(n0,n2)),*e2(new INTERP_KERNEL::EdgeLin(n2,n1));
- INTERP_KERNEL::SegSegIntersector const inters(*e1,*e2);
+ INTERP_KERNEL::Node *n2(new INTERP_KERNEL::Node(coords2D[2*bg[2]],coords2D[2*bg[2]+1])); m[n2]=bg[2];
+ INTERP_KERNEL::EdgeLin *e1(new INTERP_KERNEL::EdgeLin(n0,n2)),*e2(new INTERP_KERNEL::EdgeLin(n2,n1));
+ INTERP_KERNEL::SegSegIntersector inters(*e1,*e2);
// is the SEG3 degenerated, and thus can be reduced to a SEG2?
- bool const colinearity(inters.areColinears());
+ bool colinearity(inters.areColinears());
delete e1; delete e2;
if(colinearity)
{ ret=new INTERP_KERNEL::EdgeLin(n0,n1); }
INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge(INTERP_KERNEL::NormalizedCellType typ, std::map<mcIdType, INTERP_KERNEL::NodeWithUsage >& mapp2, const mcIdType *bg)
{
- INTERP_KERNEL::Edge *ret=nullptr;
+ INTERP_KERNEL::Edge *ret=0;
mapp2[bg[0]].second = INTERP_KERNEL::USAGE_LINEAR;
mapp2[bg[1]].second = INTERP_KERNEL::USAGE_LINEAR;
}
case INTERP_KERNEL::NORM_SEG3:
{
- auto *e1=new INTERP_KERNEL::EdgeLin(mapp2[bg[0]].first,mapp2[bg[2]].first);
- auto *e2=new INTERP_KERNEL::EdgeLin(mapp2[bg[2]].first,mapp2[bg[1]].first);
- INTERP_KERNEL::SegSegIntersector const inters(*e1,*e2);
+ INTERP_KERNEL::EdgeLin *e1=new INTERP_KERNEL::EdgeLin(mapp2[bg[0]].first,mapp2[bg[2]].first);
+ INTERP_KERNEL::EdgeLin *e2=new INTERP_KERNEL::EdgeLin(mapp2[bg[2]].first,mapp2[bg[1]].first);
+ INTERP_KERNEL::SegSegIntersector inters(*e1,*e2);
// is the SEG3 degenerated, and thus can be reduced to a SEG2?
- bool const colinearity=inters.areColinears();
+ bool colinearity=inters.areColinears();
delete e1; delete e2;
if(colinearity)
ret=new INTERP_KERNEL::EdgeLin(mapp2[bg[0]].first,mapp2[bg[1]].first);
const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer();
const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer();
std::set<mcIdType> s;
- for(long const candidate : candidates)
- s.insert(c+cI[candidate]+1,c+cI[candidate+1]);
- for(long const it2 : s)
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+ s.insert(c+cI[*it]+1,c+cI[(*it)+1]);
+ for(std::set<mcIdType>::const_iterator it2=s.begin();it2!=s.end();it2++)
{
- auto *n=new INTERP_KERNEL::Node(coo[2*it2],coo[2*it2+1]);
- mapp2[it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN);
+ INTERP_KERNEL::Node *n=new INTERP_KERNEL::Node(coo[2*(*it2)],coo[2*(*it2)+1]);
+ mapp2[*it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN);
}
- auto *ret=new INTERP_KERNEL::QuadraticPolygon;
- for(long const candidate : candidates)
+ INTERP_KERNEL::QuadraticPolygon *ret=new INTERP_KERNEL::QuadraticPolygon;
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
{
- auto const typ=(INTERP_KERNEL::NormalizedCellType)c[cI[candidate]];
- ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[candidate]+1));
+ INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)c[cI[*it]];
+ ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[*it]+1));
}
for(std::map<mcIdType, INTERP_KERNEL::NodeWithUsage >::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++)
{
const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer();
const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer();
std::set<mcIdType> s;
- for(long const candidate : candidates)
- s.insert(c+cI[candidate]+1,c+cI[candidate+1]);
- for(long const it2 : s)
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+ s.insert(c+cI[*it]+1,c+cI[(*it)+1]);
+ for(std::set<mcIdType>::const_iterator it2=s.begin();it2!=s.end();it2++)
{
INTERP_KERNEL::Node *n;
// Look for a potential node to merge
std::vector<mcIdType> candNode;
- nodeTree.getElementsAroundPoint(coo+2*it2, candNode);
+ nodeTree.getElementsAroundPoint(coo+2*(*it2), candNode);
if (candNode.size() > 2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MEDCouplingUMeshBuildQPFromMeshWithTree(): some nodes are not properly merged (within eps) in input mesh!");
bool node_created=false;
}
}
if(!node_created)
- n = new INTERP_KERNEL::Node(coo[2*it2],coo[2*it2+1]);
- mapp2[it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN);
+ n = new INTERP_KERNEL::Node(coo[2*(*it2)],coo[2*(*it2)+1]);
+ mapp2[*it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN);
}
- auto *ret=new INTERP_KERNEL::QuadraticPolygon;
- for(long const candidate : candidates)
+ INTERP_KERNEL::QuadraticPolygon *ret=new INTERP_KERNEL::QuadraticPolygon;
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
{
- auto const typ=(INTERP_KERNEL::NormalizedCellType)c[cI[candidate]];
- ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[candidate]+1)); // this call will set quad points to false in the map
+ INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)c[cI[*it]];
+ ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[*it]+1)); // this call will set quad points to false in the map
}
for(std::map<mcIdType, INTERP_KERNEL::NodeWithUsage >::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++)
{
{
if(nodeId>=offset2)
{
- mcIdType const locId=nodeId-offset2;
+ mcIdType locId=nodeId-offset2;
return new INTERP_KERNEL::Node(addCoo[2*locId],addCoo[2*locId+1]);
}
if(nodeId>=offset1)
{
- mcIdType const locId=nodeId-offset1;
+ mcIdType locId=nodeId-offset1;
return new INTERP_KERNEL::Node(coo2[2*locId],coo2[2*locId+1]);
}
return new INTERP_KERNEL::Node(coo1[2*nodeId],coo1[2*nodeId+1]);
{
for(const mcIdType *desc1=desc1Bg;desc1!=desc1End;desc1++)
{
- mcIdType const eltId1=std::abs(*desc1)-1;
- for(long const it1 : intesctEdges1[eltId1])
+ mcIdType eltId1=std::abs(*desc1)-1;
+ for(std::vector<mcIdType>::const_iterator it1=intesctEdges1[eltId1].begin();it1!=intesctEdges1[eltId1].end();it1++)
{
- std::map<mcIdType,INTERP_KERNEL::Node *>::const_iterator const it=mappRev.find(it1);
+ std::map<mcIdType,INTERP_KERNEL::Node *>::const_iterator it=mappRev.find(*it1);
if(it==mappRev.end())
{
- INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(it1,coo1,offset1,coo2,offset2,addCoo);
- mapp[node]=it1;
- mappRev[it1]=node;
+ INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(*it1,coo1,offset1,coo2,offset2,addCoo);
+ mapp[node]=*it1;
+ mappRev[*it1]=node;
}
}
}
INTERP_KERNEL::AutoPtr<mcIdType> tmpConn(new mcIdType[sz]);
INTERP_KERNEL::AutoPtr<mcIdType> tmpConn2(new mcIdType[sz]);
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)connBg[0]));
- unsigned const nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz)));
+ unsigned nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz)));
unsigned nbOfHit(0); // number of fusions operated
int posBaseElt(0),posEndElt(0),nbOfTurn(0);
const std::size_t maxNbOfHit = cm.isQuadratic() ? nbs-2 : nbs-3; // a quad cell is authorized to end up with only two edges, a linear one has to keep 3 at least
{
cm.fillSonCellNodalConnectivity2(nbs-i,connBg+1,ToIdType(sz),tmpConn2,typeOfSon);
// Identify common point:
- mcIdType const commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
+ mcIdType commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
auto itE(forbiddenPoints.end());
if (forbiddenPoints.find(commPoint) != itE) // is the junction point in the list of points we can not remove?
break;
INTERP_KERNEL::Edge *eCand(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn2,coords,m));
INTERP_KERNEL::EdgeIntersector *eint(INTERP_KERNEL::Edge::BuildIntersectorWith(e,eCand));
- bool const isColinear=eint->areColinears();
+ bool isColinear=eint->areColinears();
if(isColinear)
{
nbOfHit++;
{
cm.fillSonCellNodalConnectivity2(j,connBg+1,ToIdType(sz),tmpConn2,typeOfSon); // get edge #j's connectivity
// Identify common point:
- mcIdType const commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
+ mcIdType commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
auto itE(forbiddenPoints.end());
if (forbiddenPoints.find(commPoint) != itE) // is the junction point in the list of points we can not remove?
break;
INTERP_KERNEL::Edge *eCand(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn2,coords,m));
INTERP_KERNEL::EdgeIntersector *eint(INTERP_KERNEL::Edge::BuildIntersectorWith(e,eCand));
- bool const isColinear(eint->areColinears());
+ bool isColinear(eint->areColinears());
if(isColinear)
{
nbOfHit++;
{
if(candidates.empty())
return false;
- for(long const candidate : candidates)
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
{
- const std::vector<mcIdType>& pool(intersectEdge1[candidate]);
+ const std::vector<mcIdType>& pool(intersectEdge1[*it]);
mcIdType tmp[2]; tmp[0]=start; tmp[1]=stop;
if(std::search(pool.begin(),pool.end(),tmp,tmp+2)!=pool.end())
{
- retVal=candidate+1;
+ retVal=*it+1;
return true;
}
tmp[0]=stop; tmp[1]=start;
if(std::search(pool.begin(),pool.end(),tmp,tmp+2)!=pool.end())
{
- retVal=-candidate-1;
+ retVal=-*it-1;
return true;
}
}
const std::vector<double>& addCoo,
const std::vector< std::vector<mcIdType> >& subDiv, std::vector< std::vector<mcIdType> >& intersectEdge)
{
- mcIdType const offset1=m1->getNumberOfNodes();
- mcIdType const ncell2=m2->getNumberOfCells();
+ mcIdType offset1=m1->getNumberOfNodes();
+ mcIdType ncell2=m2->getNumberOfCells();
const mcIdType *c=m2->getNodalConnectivity()->begin();
const mcIdType *cI=m2->getNodalConnectivityIndex()->begin();
const double *coo=m2->getCoords()->begin();
const double *cooBis=m1->getCoords()->begin();
- mcIdType const offset2=offset1+m2->getNumberOfNodes();
+ mcIdType offset2=offset1+m2->getNumberOfNodes();
intersectEdge.resize(ncell2);
for(mcIdType i=0;i<ncell2;i++,cI++)
{
const std::vector<mcIdType>& divs=subDiv[i];
- mcIdType const nnode=cI[1]-cI[0]-1;
+ mcIdType nnode=cI[1]-cI[0]-1;
std::map<mcIdType, INTERP_KERNEL::NodeWithUsage > mapp2;
std::map<INTERP_KERNEL::Node *, mcIdType> mapp22;
for(mcIdType j=0;j<nnode;j++)
{
- auto *nn=new INTERP_KERNEL::Node(coo[2*c[(*cI)+j+1]],coo[2*c[(*cI)+j+1]+1]);
- mcIdType const nnid=c[(*cI)+j+1];
+ INTERP_KERNEL::Node *nn=new INTERP_KERNEL::Node(coo[2*c[(*cI)+j+1]],coo[2*c[(*cI)+j+1]+1]);
+ mcIdType nnid=c[(*cI)+j+1];
mapp2[nnid]=INTERP_KERNEL::NodeWithUsage(nn,INTERP_KERNEL::USAGE_UNKNOWN);
mapp22[nn]=nnid+offset1;
}
std::map<INTERP_KERNEL::Node *,mcIdType> mapp3;
for(std::size_t j=0;j<divs.size();j++)
{
- mcIdType const id=divs[j];
- INTERP_KERNEL::Node *tmp=nullptr;
+ mcIdType id=divs[j];
+ INTERP_KERNEL::Node *tmp=0;
if(id<offset1)
tmp=new INTERP_KERNEL::Node(cooBis[2*id],cooBis[2*id+1]);
else if(id<offset2)
mapp3[tmp]=id;
}
e->sortIdsAbs(addNodes,mapp22,mapp3,intersectEdge[i]);
- for(auto addNode : addNodes)
- addNode->decrRef();
+ for(std::vector<INTERP_KERNEL::Node *>::const_iterator it=addNodes.begin();it!=addNodes.end();it++)
+ (*it)->decrRef();
e->decrRef();
}
}
{
idsInRetColinear=DataArrayIdType::New(); idsInRetColinear->alloc(0,1);
idsInMesh1DForIdsInRetColinear=DataArrayIdType::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1);
- mcIdType const nCells=mesh1D->getNumberOfCells();
+ mcIdType nCells=mesh1D->getNumberOfCells();
if(nCells!=ToIdType(intersectEdge2.size()))
throw INTERP_KERNEL::Exception("BuildMesh1DCutFrom : internal error # 1 !");
const DataArrayDouble *coo2(mesh1D->getCoords());
const mcIdType *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin());
const double *coo2Ptr(coo2->begin());
- mcIdType const offset1(coords1->getNumberOfTuples());
- mcIdType const offset2(offset1+coo2->getNumberOfTuples());
- mcIdType const offset3(offset2+ToIdType(addCoo.size())/2);
+ mcIdType offset1(coords1->getNumberOfTuples());
+ mcIdType offset2(offset1+coo2->getNumberOfTuples());
+ mcIdType offset3(offset2+ToIdType(addCoo.size())/2);
std::vector<double> addCooQuad;
MCAuto<DataArrayIdType> cOut(DataArrayIdType::New()),ciOut(DataArrayIdType::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0);
mcIdType tmp[4],cicnt(0),kk(0);
std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coo2Ptr,m));
const std::vector<mcIdType>& subEdges(intersectEdge2[i]);
- mcIdType const nbSubEdge=ToIdType(subEdges.size()/2);
+ mcIdType nbSubEdge=ToIdType(subEdges.size()/2);
for(mcIdType j=0;j<nbSubEdge;j++,kk++)
{
MCAuto<INTERP_KERNEL::Node> n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),
else
allEdges.insert(allEdges.end(),edge1.rbegin(),edge1.rend());
}
- std::size_t const nb(allEdges.size());
+ std::size_t nb(allEdges.size());
if(nb%2!=0)
throw INTERP_KERNEL::Exception("BuildRefined2DCellLinear : internal error 1 !");
- std::size_t const nbOfEdgesOf2DCellSplit(nb/2);
+ std::size_t nbOfEdgesOf2DCellSplit(nb/2);
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
ret->setCoords(coords);
ret->allocateCells(1);
const mcIdType *c(mesh2D->getNodalConnectivity()->begin()),*ci(mesh2D->getNodalConnectivityIndex()->begin());
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[cellIdInMesh2D]]));
int ii(0);
- unsigned const sz(cm.getNumberOfSons2(c+ci[cellIdInMesh2D]+1,ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]-1));
+ unsigned sz(cm.getNumberOfSons2(c+ci[cellIdInMesh2D]+1,ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]-1));
if(sz!=std::distance(descBg,descEnd))
throw INTERP_KERNEL::Exception("BuildRefined2DCellQuadratic : internal error 1 !");
INTERP_KERNEL::AutoPtr<mcIdType> tmpPtr(new mcIdType[ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]]);
std::vector<mcIdType> allEdges,centers;
const double *coordsPtr(coords->begin());
MCAuto<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
- mcIdType const offset(coords->getNumberOfTuples());
+ mcIdType offset(coords->getNumberOfTuples());
for(const mcIdType *it2(descBg);it2!=descEnd;it2++,ii++)
{
INTERP_KERNEL::NormalizedCellType typeOfSon;
centers.push_back(tmpPtr[2]);//special case where no subsplit of edge -> reuse the original center.
else
{//the current edge has been subsplit -> create corresponding centers.
- mcIdType const nbOfCentersToAppend=ToIdType(edge1.size()/2);
+ mcIdType nbOfCentersToAppend=ToIdType(edge1.size()/2);
std::map< MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
MCAuto<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m));
std::vector<mcIdType>::const_iterator it3(allEdges.end()-edge1.size());
}
}
}
- std::size_t const nb(allEdges.size());
+ std::size_t nb(allEdges.size());
if(nb%2!=0)
throw INTERP_KERNEL::Exception("BuildRefined2DCellQuadratic : internal error 2 !");
- std::size_t const nbOfEdgesOf2DCellSplit(nb/2);
+ std::size_t nbOfEdgesOf2DCellSplit(nb/2);
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
if(addCoo->empty())
ret->setCoords(coords);
void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector<mcIdType>& conn, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edges)
{
bool isQuad(false);
- for(const auto & edge : edges)
+ for(std::vector< MCAuto<INTERP_KERNEL::Edge> >::const_iterator it=edges.begin();it!=edges.end();it++)
{
- const INTERP_KERNEL::Edge *ee(edge);
+ const INTERP_KERNEL::Edge *ee(*it);
if(dynamic_cast<const INTERP_KERNEL::EdgeArcCircle *>(ee))
isQuad=true;
}
else
{
const double *coo(mesh2D->getCoords()->begin());
- std::size_t const sz(conn.size());
+ std::size_t sz(conn.size());
std::vector<double> addCoo;
std::vector<mcIdType> conn2(conn);
- mcIdType const offset(mesh2D->getNumberOfNodes());
+ mcIdType offset(mesh2D->getNumberOfNodes());
for(std::size_t i=0;i<sz;i++)
{
double tmp[2];
void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vector<mcIdType>& edge1Bis, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edge1BisPtr,
std::vector< std::vector<mcIdType> >& out0, std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& out1)
{
- std::size_t const nb(edge1Bis.size()/2);
- std::size_t const nbOfEdgesOf2DCellSplit(nb/2);
- mcIdType const iEnd=splitMesh1D->getNumberOfCells();
+ std::size_t nb(edge1Bis.size()/2);
+ std::size_t nbOfEdgesOf2DCellSplit(nb/2);
+ mcIdType iEnd=splitMesh1D->getNumberOfCells();
if(iEnd==0)
throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal2 : internal error ! input 1D mesh must have at least one cell !");
std::size_t ii,jj;
for(mcIdType ik=0;ik<iEnd;ik++)
{
std::map< MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
- MCAuto<INTERP_KERNEL::Edge> const ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m));
+ MCAuto<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m));
ees[ik]=ee;
}
for(mcIdType ik=iEnd-1;ik>=0;ik--)
struct CellInfo
{
public:
- CellInfo() = default;
+ CellInfo() { }
CellInfo(const std::vector<mcIdType>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr);
public:
std::vector<mcIdType> _edges;
CellInfo::CellInfo(const std::vector<mcIdType>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr)
{
- std::size_t const nbe(edges.size());
+ std::size_t nbe(edges.size());
std::vector<mcIdType> edges2(2*nbe); std::vector< MCAuto<INTERP_KERNEL::Edge> > edgesPtr2(2*nbe);
for(std::size_t i=0;i<nbe;i++)
{
else
{
MCAuto<DataArrayDouble> barys(mesh->computeCellCenterOfMass());
- mcIdType const cellId(mesh2D->getCellContainingPoint(barys->begin(),eps));
+ mcIdType cellId(mesh2D->getCellContainingPoint(barys->begin(),eps));
if(cellId==-1)
throw INTERP_KERNEL::Exception("EdgeInfo::feedEdgeInfoAt : internal error !");
neighbors[0]=offset+cellId; neighbors[1]=offset+cellId;
const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs)
{
get(pos);//to check pos
- bool const isFast(pos==0 && _pool.size()==1);
- std::size_t const sz(edges.size());
+ bool isFast(pos==0 && _pool.size()==1);
+ std::size_t sz(edges.size());
// dealing with edges
if(sz==1)
_edge_info.push_back(EdgeInfo(istart,iend,mesh1DInCase));
std::vector< MCAuto<MEDCouplingUMesh> > ms;
if(pos>0)
{
- MCAuto<MEDCouplingUMesh> const elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(0,pos,true)));
+ MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(0,pos,true)));
ms.push_back(elt);
}
ms.push_back(mesh);
if(pos<_ze_mesh->getNumberOfCells()-1)
{
- MCAuto<MEDCouplingUMesh> const elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true)));
+ MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true)));
ms.push_back(elt);
}
std::vector< const MEDCouplingUMesh *> ms2(ms.size());
if(pos<0)
throw INTERP_KERNEL::Exception("VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId : invalid id ! Must be >=0 !");
mcIdType ret(0);
- for(auto it=_edge_info.begin();it!=_edge_info.end();it++,ret++)
+ for(std::vector<EdgeInfo>::const_iterator it=_edge_info.begin();it!=_edge_info.end();it++,ret++)
{
if((*it).isInMyRange(pos))
return ret;
get(pos);//to perform the sanity check;
if(_edge_info.empty())
return ;
- std::size_t const sz(_edge_info.size()-1);
+ std::size_t sz(_edge_info.size()-1);
for(std::size_t i=0;i<sz;i++)
_edge_info[i].somethingHappendAt(pos,newLeft,newRight);
}
MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh1D, const std::vector<mcIdType>& allEdges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& allEdgesPtr, mcIdType offset,
MCAuto<DataArrayIdType>& idsLeftRight)
{
- mcIdType const nbCellsInSplitMesh1D=splitMesh1D->getNumberOfCells();
+ mcIdType nbCellsInSplitMesh1D=splitMesh1D->getNumberOfCells();
if(nbCellsInSplitMesh1D==0)
throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal : internal error ! input 1D mesh must have at least one cell !");
const mcIdType *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin());
iEnd++;
MCAuto<MEDCouplingUMesh> partOfSplitMesh1D(static_cast<MEDCouplingUMesh *>(splitMesh1D->buildPartOfMySelfSlice(iStart,iEnd,1,true)));
- mcIdType const pos(pool.getPositionOf(eps,partOfSplitMesh1D));
+ mcIdType pos(pool.getPositionOf(eps,partOfSplitMesh1D));
//
MCAuto<MEDCouplingUMesh>retTmp(MEDCouplingUMesh::New("",2));
retTmp->setCoords(splitMesh1D->getCoords());
/*
* splitMesh1D is an input parameter but might have its cells renumbered.
*/
-MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, mcIdType /*cellIdInMesh2D*/, const MEDCouplingUMesh *mesh2DDesc, MEDCouplingUMesh *splitMesh1D,
+MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, mcIdType cellIdInMesh2D, const MEDCouplingUMesh *mesh2DDesc, MEDCouplingUMesh *splitMesh1D,
const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector<mcIdType> >& intersectEdge1, mcIdType offset,
MCAuto<DataArrayIdType>& idsLeftRight)
{
std::vector< MCAuto<INTERP_KERNEL::Edge> > allEdgesPtr; // for each sub edge in splitMesh2D the uncut Edge object of the original mesh2D
for(const mcIdType *it(descBg);it!=descEnd;it++) // for all edges in the descending connectivity of the 2D mesh in relative Fortran mode
{
- mcIdType const edgeId(std::abs(*it)-1);
+ mcIdType edgeId(std::abs(*it)-1);
std::map< MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
- MCAuto<INTERP_KERNEL::Edge> const ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m));
+ MCAuto<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m));
const std::vector<mcIdType>& edge1(intersectEdge1[edgeId]);
if(*it>0)
allEdges.insert(allEdges.end(),edge1.begin(),edge1.end());
else
allEdges.insert(allEdges.end(),edge1.rbegin(),edge1.rend());
- std::size_t const sz(edge1.size());
+ std::size_t sz(edge1.size());
for(std::size_t cnt=0;cnt<sz;cnt++)
allEdgesPtr.push_back(ee);
}
}
else if(typ1.isQuadratic() && typ2.isQuadratic())
{
- bool const status0(conn1[0]==conn2[0] && conn1[1]==conn2[1]);
+ bool status0(conn1[0]==conn2[0] && conn1[1]==conn2[1]);
if(!status0)
return false;
if(conn1[2]==conn2[2])
return true;
const double *a(coo2D+2*conn1[2]),*b(coo2D+2*conn2[2]);
- double const dist(sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])));
+ double dist(sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])));
return dist<eps;
}
else
{//only one is quadratic
- bool const status0(conn1[0]==conn2[0] && conn1[1]==conn2[1]);
+ bool status0(conn1[0]==conn2[0] && conn1[1]==conn2[1]);
if(!status0)
return false;
- const double *a(nullptr),*bb(nullptr),*be(nullptr);
+ const double *a(0),*bb(0),*be(0);
if(typ1.isQuadratic())
{
a=coo2D+2*conn1[2]; bb=coo2D+2*conn2[0]; be=coo2D+2*conn2[1];
a=coo2D+2*conn2[2]; bb=coo2D+2*conn1[0]; be=coo2D+2*conn1[1];
}
double b[2]; b[0]=(be[0]+bb[0])/2.; b[1]=(be[1]+bb[1])/2.;
- double const dist(sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])));
+ double dist(sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])));
return dist<eps;
}
}
MCAuto<MEDCouplingUMesh> cur2D(static_cast<MEDCouplingUMesh *>(mesh2DSplit->buildPartOfMySelf(it,it+1,true)));
const mcIdType *c(cur2D->getNodalConnectivity()->begin()),*ci(cur2D->getNodalConnectivityIndex()->begin());
const INTERP_KERNEL::CellModel &cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[0]]));
- unsigned const sz(cm.getNumberOfSons2(c+ci[0]+1,ci[1]-ci[0]-1));
+ unsigned sz(cm.getNumberOfSons2(c+ci[0]+1,ci[1]-ci[0]-1));
INTERP_KERNEL::AutoPtr<mcIdType> tmpPtr(new mcIdType[ci[1]-ci[0]]);
for(unsigned it2=0;it2<sz;it2++)
{
std::vector< std::vector<mcIdType> >& intersectEdge1, std::vector< std::vector<mcIdType> >& colinear2, std::vector< std::vector<mcIdType> >& subDiv2, std::vector<double>& addCoo, std::map<mcIdType,mcIdType>& mergedNodes)
{
static const int SPACEDIM=2;
- INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps);
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
const mcIdType *c1(m1Desc->getNodalConnectivity()->begin()),*ci1(m1Desc->getNodalConnectivityIndex()->begin());
// Build BB tree of all edges in the tool mesh (second mesh)
MCAuto<DataArrayDouble> bbox1Arr(m1Desc->getBoundingBoxForBBTree(eps)),bbox2Arr(m2Desc->getBoundingBoxForBBTree(eps));
intersectEdge1.resize(nDescCell1);
colinear2.resize(nDescCell2);
subDiv2.resize(nDescCell2);
- BBTree<SPACEDIM,mcIdType> const myTree(bbox2,nullptr,0,m2Desc->getNumberOfCells(),-eps);
- BBTreePts<SPACEDIM,mcIdType> const treeNodes2(m2Desc->getCoords()->begin(),nullptr,0,m2Desc->getCoords()->getNumberOfTuples(),eps);
+ BBTree<SPACEDIM,mcIdType> myTree(bbox2,0,0,m2Desc->getNumberOfCells(),-eps);
+ BBTreePts<SPACEDIM,mcIdType> treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps);
std::vector<mcIdType> candidates1(1);
- mcIdType const offset1(m1Desc->getNumberOfNodes());
- mcIdType const offset2(offset1+m2Desc->getNumberOfNodes());
+ mcIdType offset1(m1Desc->getNumberOfNodes());
+ mcIdType offset2(offset1+m2Desc->getNumberOfNodes());
for(mcIdType i=0;i<nDescCell1;i++) // for all edges in the first mesh
{
std::vector<mcIdType> candidates2; // edges of mesh2 candidate for intersection
// This trick guarantees that Node * are discriminant (i.e. form a unique identifier)
std::set<INTERP_KERNEL::Node *> nodes;
pol1->getAllNodes(nodes); pol2->getAllNodes(nodes);
- std::size_t const szz(nodes.size());
+ std::size_t szz(nodes.size());
std::vector< MCAuto<INTERP_KERNEL::Node> > nodesSafe(szz);
- auto itt(nodes.begin());
+ std::set<INTERP_KERNEL::Node *>::const_iterator itt(nodes.begin());
for(std::size_t iii=0;iii<szz;iii++,itt++)
{ (*itt)->incrRef(); nodesSafe[iii]=*itt; }
// end of protection
static const int SPACEDIM=2;
const double *coo1(m1->getCoords()->begin());
const mcIdType *conn1(m1->getNodalConnectivity()->begin()),*connI1(m1->getNodalConnectivityIndex()->begin());
- mcIdType const offset1(m1->getNumberOfNodes());
+ mcIdType offset1(m1->getNumberOfNodes());
const double *coo2(m2->getCoords()->begin());
const mcIdType *conn2(m2->getNodalConnectivity()->begin()),*connI2(m2->getNodalConnectivityIndex()->begin());
- mcIdType const offset2(offset1+m2->getNumberOfNodes());
- mcIdType const offset3(offset2+ToIdType(addCoords.size())/2);
+ mcIdType offset2(offset1+m2->getNumberOfNodes());
+ mcIdType offset3(offset2+ToIdType(addCoords.size())/2);
MCAuto<DataArrayDouble> bbox1Arr(m1->getBoundingBoxForBBTree(eps)),bbox2Arr(m2->getBoundingBoxForBBTree(eps));
const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
// Here a BBTree on 2D-cells, not on segments:
- BBTree<SPACEDIM,mcIdType> const myTree(bbox2,nullptr,0,m2->getNumberOfCells(),eps);
- mcIdType const ncell1=m1->getNumberOfCells();
+ BBTree<SPACEDIM,mcIdType> myTree(bbox2,0,0,m2->getNumberOfCells(),eps);
+ mcIdType ncell1=m1->getNumberOfCells();
crI.push_back(0);
for(mcIdType i=0;i<ncell1;i++)
{
std::map<INTERP_KERNEL::Node *,mcIdType> mapp;
std::map<mcIdType,INTERP_KERNEL::Node *> mappRev;
INTERP_KERNEL::QuadraticPolygon pol1;
- auto const typ=(INTERP_KERNEL::NormalizedCellType)conn1[connI1[i]];
+ INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)conn1[connI1[i]];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
// Populate mapp and mappRev with nodes from the current cell (i) from mesh1 - this also builds the Node* objects:
MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,/* output */mapp,mappRev);
// Again all the additional intersecting nodes are there.
for(std::vector<mcIdType>::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++)
{
- auto const typ2=(INTERP_KERNEL::NormalizedCellType)conn2[connI2[*it2]];
+ INTERP_KERNEL::NormalizedCellType typ2=(INTERP_KERNEL::NormalizedCellType)conn2[connI2[*it2]];
const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(typ2);
// Complete mapping with elements coming from the current cell it2 in mesh2:
MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,/* output */mapp,mappRev);
void InsertNodeInConnIfNecessary(mcIdType nodeIdToInsert, std::vector<mcIdType>& conn, const double *coords, double eps)
{
- auto const it(std::find(conn.begin(),conn.end(),nodeIdToInsert));
+ std::vector<mcIdType>::iterator it(std::find(conn.begin(),conn.end(),nodeIdToInsert));
if(it!=conn.end())
return ;
- std::size_t const sz(conn.size());
+ std::size_t sz(conn.size());
std::size_t found(std::numeric_limits<std::size_t>::max());
for(std::size_t i=0;i<sz;i++)
{
mcIdType pt0(conn[i]),pt1(conn[(i+1)%sz]);
double v1[3]={coords[3*pt1+0]-coords[3*pt0+0],coords[3*pt1+1]-coords[3*pt0+1],coords[3*pt1+2]-coords[3*pt0+2]},v2[3]={coords[3*nodeIdToInsert+0]-coords[3*pt0+0],coords[3*nodeIdToInsert+1]-coords[3*pt0+1],coords[3*nodeIdToInsert+2]-coords[3*pt0+2]};
- double const normm(sqrt(v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2]));
+ double normm(sqrt(v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2]));
std::transform(v1,v1+3,v1,std::bind(std::multiplies<double>(),std::placeholders::_1,1./normm));
std::transform(v2,v2+3,v2,std::bind(std::multiplies<double>(),std::placeholders::_1,1./normm));
double v3[3];
void SplitIntoToPart(const std::vector<mcIdType>& conn, mcIdType pt0, mcIdType pt1, std::vector<mcIdType>& part0, std::vector<mcIdType>& part1)
{
- std::size_t const sz(conn.size());
+ std::size_t sz(conn.size());
std::vector<mcIdType> *curPart(&part0);
for(std::size_t i=0;i<sz;i++)
{
- mcIdType const nextt(conn[(i+1)%sz]);
+ mcIdType nextt(conn[(i+1)%sz]);
(*curPart).push_back(nextt);
if(nextt==pt0 || nextt==pt1)
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
const mcIdType *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin());
- mcIdType const nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=getNumberOfCells();
if(nbOfCells!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works only with single cell presently !");
for(mcIdType i=0;i<nbOfCells;i++)
{
const std::pair<mcIdType,mcIdType>& p=cut3DSurf[desc[offset+j]];
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodal3D[nodalIndx3D[i]]));
- mcIdType const sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1;
+ mcIdType sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1;
INTERP_KERNEL::AutoPtr<mcIdType> tmp(new mcIdType[sz]);
INTERP_KERNEL::NormalizedCellType cmsId;
- unsigned const nbOfNodesSon(cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId));
+ unsigned nbOfNodesSon(cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId));
std::vector<mcIdType> elt((mcIdType *)tmp,(mcIdType *)tmp+nbOfNodesSon);
if(p.first!=-1 && p.second!=-1)
{
void MEDCouplingUMesh::split2DCellsLinear(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI)
{
checkConnectivityFullyDefined();
- mcIdType const ncells=getNumberOfCells();
- mcIdType const lgthToReach(getNodalConnectivityArrayLen()+subNodesInSeg->getNumberOfTuples());
+ mcIdType ncells=getNumberOfCells();
+ mcIdType lgthToReach(getNodalConnectivityArrayLen()+subNodesInSeg->getNumberOfTuples());
MCAuto<DataArrayIdType> c(DataArrayIdType::New()); c->alloc((std::size_t)lgthToReach);
const mcIdType *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin());
mcIdType *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer());
mcIdType MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *mid, const DataArrayIdType *midI)
{
checkConsistencyLight();
- mcIdType const ncells=getNumberOfCells();
- mcIdType const lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples());
+ mcIdType ncells=getNumberOfCells();
+ mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples());
mcIdType nodesCnt(getNumberOfNodes());
MCAuto<DataArrayIdType> c(DataArrayIdType::New()); c->alloc((std::size_t)lgthToReach);
MCAuto<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
{
mcIdType offset(descIPtr[0]),sz(descIPtr[1]-descIPtr[0]),deltaSz(sz);
for(mcIdType j=0;j<sz;j++)
- { mcIdType const sz2(subIPtr[descPtr[offset+j]+1]-subIPtr[descPtr[offset+j]]); deltaSz+=sz2; }
+ { mcIdType sz2(subIPtr[descPtr[offset+j]+1]-subIPtr[descPtr[offset+j]]); deltaSz+=sz2; }
*cPtr++=ToIdType(INTERP_KERNEL::NORM_QPOLYG); cPtr[0]=oldConn[prevPosOfCi+1];
for(mcIdType j=0;j<sz;j++)//loop over subedges of oldConn
{
cPtr[1]=subPtr[offset2+k];
cPtr[deltaSz]=InternalAddPoint(e,midPtr[offset3+k],oldCoordsPtr,cPtr[0],cPtr[1],*addCoo,nodesCnt); cPtr++;
}
- mcIdType const tmpEnd(oldConn[prevPosOfCi+1+(j+1)%sz]);
+ mcIdType tmpEnd(oldConn[prevPosOfCi+1+(j+1)%sz]);
if(j!=sz-1)
{ cPtr[1]=tmpEnd; }
cPtr[deltaSz]=InternalAddPoint(e,midPtr[offset3+sz2],oldCoordsPtr,cPtr[0],tmpEnd,*addCoo,nodesCnt); cPtr++;
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes : input meshes must be not NULL !");
m1->checkFullyDefined();
m2->checkFullyDefined();
- INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps);
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
if(m1->getMeshDimension()!=2 || m1->getSpaceDimension()!=2 || m2->getMeshDimension()!=2 || m2->getSpaceDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes works on umeshes m1 AND m2 with meshdim equal to 2 and spaceDim equal to 2 too!");
// Step 1: compute all edge intersections (new nodes)
std::vector< std::vector<mcIdType> > intersectEdge1, colinear2, subDiv2;
- MEDCouplingUMesh *m1Desc=nullptr,*m2Desc=nullptr; // descending connec. meshes
- DataArrayIdType *desc1=nullptr,*descIndx1=nullptr,*revDesc1=nullptr,*revDescIndx1=nullptr,*desc2=nullptr,*descIndx2=nullptr,*revDesc2=nullptr,*revDescIndx2=nullptr;
+ MEDCouplingUMesh *m1Desc=0,*m2Desc=0; // descending connec. meshes
+ DataArrayIdType *desc1=0,*descIndx1=0,*revDesc1=0,*revDescIndx1=0,*desc2=0,*descIndx2=0,*revDesc2=0,*revDescIndx2=0;
std::vector<double> addCoo,addCoordsQuadratic; // coordinates of newly created nodes
IntersectDescending2DMeshes(m1,m2,eps,intersectEdge1,colinear2, subDiv2,
m1Desc,desc1,descIndx1,revDesc1,revDescIndx1,
// Step 2: re-order newly created nodes according to the ordering found in m2
std::vector< std::vector<mcIdType> > intersectEdge2;
BuildIntersectEdges(m1Desc,m2Desc,addCoo,subDiv2,intersectEdge2);
- subDiv2.clear(); dd5=nullptr; dd6=nullptr;
+ subDiv2.clear(); dd5=0; dd6=0;
// Step 3:
std::vector<mcIdType> cr,crI; //no DataArrayIdType because interface with Geometric2D
// Step 1: compute all edge intersections (new nodes)
std::vector< std::vector<mcIdType> > intersectEdge1, colinear2, subDiv2;
std::vector<double> addCoo,addCoordsQuadratic; // coordinates of newly created nodes
- INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps);
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
//
// Build desc connectivity
DataArrayIdType *desc1(DataArrayIdType::New()),*descIndx1(DataArrayIdType::New()),*revDesc1(DataArrayIdType::New()),*revDescIndx1(DataArrayIdType::New());
std::map<mcIdType,mcIdType> mergedNodes;
Intersect1DMeshes(m1Desc,mesh1D,eps,intersectEdge1,colinear2,subDiv2,addCoo,mergedNodes);
// use mergeNodes to fix intersectEdge1
- for(auto & it0 : intersectEdge1)
+ for(std::vector< std::vector<mcIdType> >::iterator it0=intersectEdge1.begin();it0!=intersectEdge1.end();it0++)
{
- std::size_t const n(it0.size()/2);
- mcIdType eltStart(it0[0]),eltEnd(it0[2*n-1]);
+ std::size_t n((*it0).size()/2);
+ mcIdType eltStart((*it0)[0]),eltEnd((*it0)[2*n-1]);
std::map<mcIdType,mcIdType>::const_iterator it1;
it1=mergedNodes.find(eltStart);
if(it1!=mergedNodes.end())
- it0[0]=(*it1).second;
+ (*it0)[0]=(*it1).second;
it1=mergedNodes.find(eltEnd);
if(it1!=mergedNodes.end())
- it0[2*n-1]=(*it1).second;
+ (*it0)[2*n-1]=(*it1).second;
}
//
MCAuto<DataArrayDouble> addCooDa(DataArrayDouble::New());
const mcIdType* cellId1 = cells->begin() + cellsIndex->begin()[*it];
const mcIdType* cellId2 = cells->begin() + cellsIndex->begin()[*it]+1;
- std::set<mcIdType> const s1(realIdsInDesc2D->begin()+dd2->begin()[*cellId1], realIdsInDesc2D->begin()+dd2->begin()[*cellId1+1]);
- std::set<mcIdType> const s2(realIdsInDesc2D->begin()+dd2->begin()[*cellId2], realIdsInDesc2D->begin()+dd2->begin()[*cellId2+1]);
+ std::set<mcIdType> s1(realIdsInDesc2D->begin()+dd2->begin()[*cellId1], realIdsInDesc2D->begin()+dd2->begin()[*cellId1+1]);
+ std::set<mcIdType> s2(realIdsInDesc2D->begin()+dd2->begin()[*cellId2], realIdsInDesc2D->begin()+dd2->begin()[*cellId2+1]);
std::vector<mcIdType> commonEdgeId;
std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(), std::back_inserter(commonEdgeId));
MCAuto<DataArrayIdType> out0s;//ids in mesh2D that are impacted by the fact that some edges of \a mesh1D are part of the edges of those cells
if(!idsInDesc2DToBeRefined->empty())
{
- DataArrayIdType *out0(nullptr),*outi0(nullptr);
+ DataArrayIdType *out0(0),*outi0(0);
DataArrayIdType::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0);
- MCAuto<DataArrayIdType> const outi0s(outi0);
+ MCAuto<DataArrayIdType> outi0s(outi0);
out0s=out0;
out0s=out0s->buildUnique();
out0s->sort(true);
}
//
MCAuto<MEDCouplingUMesh> ret1NonCol(static_cast<MEDCouplingUMesh *>(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end())));
- MCAuto<DataArrayDouble> const baryRet1(centerOfMassRet1->selectByTupleId(idsInRet1NotColinear->begin(), idsInRet1NotColinear->end()));
- DataArrayIdType *out(nullptr),*outi(nullptr);
+ MCAuto<DataArrayDouble> baryRet1(centerOfMassRet1->selectByTupleId(idsInRet1NotColinear->begin(), idsInRet1NotColinear->end()));
+ DataArrayIdType *out(0),*outi(0);
DataArrayIdType::ExtractFromIndexedArrays(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end(),cells,cellsIndex,out,outi);
MCAuto<DataArrayIdType> elts(out),eltsIndex(outi);
{// here dealing with cells in out0s but not in cellsToBeModified
MCAuto<DataArrayIdType> fewModifiedCells(out0s->buildSubstraction(cellsToBeModified));
const mcIdType *rdptr(dd3->begin()),*rdiptr(dd4->begin()),*dptr(dd1->begin()),*diptr(dd2->begin());
- for(long const it : *fewModifiedCells)
+ for(const mcIdType *it=fewModifiedCells->begin();it!=fewModifiedCells->end();it++)
{
- outMesh2DSplit.push_back(BuildRefined2DCell(ret1->getCoords(),mesh2D,it,dptr+diptr[it],dptr+diptr[it+1],intersectEdge1));
+ outMesh2DSplit.push_back(BuildRefined2DCell(ret1->getCoords(),mesh2D,*it,dptr+diptr[*it],dptr+diptr[*it+1],intersectEdge1));
ret1->setCoords(outMesh2DSplit.back()->getCoords());
}
- mcIdType const offset(ret2->getNumberOfTuples());
+ mcIdType offset(ret2->getNumberOfTuples());
ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end());
MCAuto<DataArrayIdType> partOfRet3(DataArrayIdType::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1);
partOfRet3->fillWithValue(std::numeric_limits<mcIdType>::max()); partOfRet3->rearrange(2);
mcIdType kk(0),*ret3ptr(partOfRet3->getPointer());
for(const mcIdType *it=idsInDescMesh2DForIdsInRetColinear->begin();it!=idsInDescMesh2DForIdsInRetColinear->end();it++,kk++)
{
- mcIdType const faceId(std::abs(*it)-1);
+ mcIdType faceId(std::abs(*it)-1);
for(const mcIdType *it2=rdptr+rdiptr[faceId];it2!=rdptr+rdiptr[faceId+1];it2++)
{
- mcIdType const tmp(fewModifiedCells->findIdFirstEqual(*it2));
+ mcIdType tmp(fewModifiedCells->findIdFirstEqual(*it2));
if(tmp!=-1)
{
if(std::find(dptr+diptr[*it2],dptr+diptr[*it2+1],-(*it))!=dptr+diptr[*it2+1])
if(!outMesh2DSplit.empty())
{
DataArrayDouble *da(outMesh2DSplit.back()->getCoords());
- for(auto & itt : outMesh2DSplit)
- itt->setCoords(da);
+ for(std::vector< MCAuto<MEDCouplingUMesh> >::iterator itt=outMesh2DSplit.begin();itt!=outMesh2DSplit.end();itt++)
+ (*itt)->setCoords(da);
}
}
cellsToBeModified=cellsToBeModified->buildUniqueNotSorted();
ret2->pushBackSilent(*it);
}
//
- std::size_t const nbOfMeshes(outMesh2DSplit.size());
+ std::size_t nbOfMeshes(outMesh2DSplit.size());
std::vector<const MEDCouplingUMesh *> tmp(nbOfMeshes);
for(std::size_t i=0;i<nbOfMeshes;i++)
tmp[i]=outMesh2DSplit[i];
MCAuto<DataArrayIdType> edgesToDealWith(ret3->findIdsStrictlyNegative());
for(const mcIdType *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++)
{
- mcIdType const old2DCellId(-ret3->getIJ(*it,0)-1);
+ mcIdType old2DCellId(-ret3->getIJ(*it,0)-1);
MCAuto<DataArrayIdType> candidates(ret2->findIdsEqual(old2DCellId));
ret3->setIJ(*it,0,FindRightCandidateAmong(ret2D,candidates->begin(),candidates->end(),ret1,*it%2==0?-((*it)/2+1):(*it)/2+1,eps));// div by 2 because 2 components natively in ret3
}
const double *bbox(bboxArr->begin()),*coords(getCoords()->begin());
mcIdType nCell=getNumberOfCells(),nDescCell=mDesc->getNumberOfCells();
std::vector< std::vector<mcIdType> > intersectEdge(nDescCell),overlapEdge(nDescCell);
- std::vector<double> const addCoo;
- BBTree<SPACEDIM,mcIdType> const myTree(bbox,nullptr,0,nDescCell,-eps);
- INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps);
+ std::vector<double> addCoo;
+ BBTree<SPACEDIM,mcIdType> myTree(bbox,0,0,nDescCell,-eps);
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
for(mcIdType i=0;i<nDescCell;i++)
{
std::vector<mcIdType> candidates;
myTree.getIntersectingElems(bbox+i*2*SPACEDIM,candidates);
- for(long const candidate : candidates)
- if(candidate>i) // we're dealing with pair of edges, no need to treat the same pair twice
+ for(std::vector<mcIdType>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+ if(*it>i) // we're dealing with pair of edges, no need to treat the same pair twice
{
std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
INTERP_KERNEL::Edge *e1(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coords,m)),
- *e2(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[candidate]],c+ci[candidate]+1,coords,m));
+ *e2(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[*it]],c+ci[*it]+1,coords,m));
INTERP_KERNEL::MergePoints merge;
INTERP_KERNEL::QuadraticPolygon c1,c2;
e1->intersectWith(e2,merge,c1,c2);
e1->decrRef(); e2->decrRef();
if(IKGeo2DInternalMapper(c1,m,c[ci[i]+1],c[ci[i]+2],intersectEdge[i]))
- overlapEdge[i].push_back(candidate);
- if(IKGeo2DInternalMapper(c2,m,c[ci[candidate]+1],c[ci[candidate]+2],intersectEdge[candidate]))
- overlapEdge[candidate].push_back(i);
+ overlapEdge[i].push_back(*it);
+ if(IKGeo2DInternalMapper(c2,m,c[ci[*it]+1],c[ci[*it]+2],intersectEdge[*it]))
+ overlapEdge[*it].push_back(i);
}
}
// splitting done. sort intersect point in intersectEdge.
for(mcIdType i=0;i<nDescCell;i++)
{
std::vector<mcIdType>& isect(intersectEdge[i]);
- std::size_t const sz(isect.size());
+ std::size_t sz(isect.size());
if(sz>1)
{
std::map<MCAuto<INTERP_KERNEL::Node>,mcIdType> m;
middleNeedsToBeUsed=true;
const std::vector<mcIdType>& candidates(overlapEdge[i]);
std::vector<mcIdType> trueCandidates;
- for(long const candidate : candidates)
- if((INTERP_KERNEL::NormalizedCellType)c[ci[candidate]]==INTERP_KERNEL::NORM_SEG3)
- trueCandidates.push_back(candidate);
+ for(std::vector<mcIdType>::const_iterator itc=candidates.begin();itc!=candidates.end();itc++)
+ if((INTERP_KERNEL::NormalizedCellType)c[ci[*itc]]==INTERP_KERNEL::NORM_SEG3)
+ trueCandidates.push_back(*itc);
mcIdType stNode(c[ci[i]+1]),endNode(isect[0]);
for(std::size_t j=0;j<sz+1;j++)
{
- for(long const trueCandidate : trueCandidates)
+ for(std::vector<mcIdType>::const_iterator itc=trueCandidates.begin();itc!=trueCandidates.end();itc++)
{
- mcIdType tmpSt(c[ci[trueCandidate]+1]),tmpEnd(c[ci[trueCandidate]+2]);
+ mcIdType tmpSt(c[ci[*itc]+1]),tmpEnd(c[ci[*itc]+2]);
if((tmpSt==stNode && tmpEnd==endNode) || (tmpSt==endNode && tmpEnd==stNode))
- { mid[j]=trueCandidate; break; }
+ { mid[j]=*itc; break; }
}
stNode=endNode;
endNode=j<sz-1?isect[j+1]:c[ci[i]+2];
*retPtr++=i;
//
MCAuto<DataArrayIdType> mSafe,nSafe,oSafe,pSafe,qSafe,rSafe;
- DataArrayIdType *m(nullptr),*n(nullptr),*o(nullptr),*p(nullptr),*q(nullptr),*r(nullptr);
+ DataArrayIdType *m(0),*n(0),*o(0),*p(0),*q(0),*r(0);
DataArrayIdType::ExtractFromIndexedArrays(ret->begin(),ret->end(),desc1,descIndx1,m,n); mSafe=m; nSafe=n;
DataArrayIdType::PutIntoToSkylineFrmt(intersectEdge,o,p); oSafe=o; pSafe=p;
if(middleNeedsToBeUsed)
{ DataArrayIdType::PutIntoToSkylineFrmt(middle,q,r); qSafe=q; rSafe=r; }
MCAuto<MEDCouplingUMesh> modif(static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(ret->begin(),ret->end(),true)));
- mcIdType const nbOfNodesCreated(modif->split2DCells(mSafe,nSafe,oSafe,pSafe,qSafe,rSafe));
+ mcIdType nbOfNodesCreated(modif->split2DCells(mSafe,nSafe,oSafe,pSafe,qSafe,rSafe));
setCoords(modif->getCoords());//if nbOfNodesCreated==0 modif and this have the same coordinates pointer so this line has no effect. But for quadratic cases this line is important.
setPartOfMySelf(ret->begin(),ret->end(),*modif);
{
bool areNodesMerged; mcIdType newNbOfNodes;
if(nbOfNodesCreated!=0)
- MCAuto<DataArrayIdType> const tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes));
+ MCAuto<DataArrayIdType> tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes));
}
return ret.retn();
}
checkConsistencyLight();
if(getSpaceDimension()!=2 || getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !");
- INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps);
+ INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
mcIdType nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
const mcIdType *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin());
MCAuto<DataArrayIdType> newc(DataArrayIdType::New()),newci(DataArrayIdType::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0);
MCAuto<DataArrayIdType> dsi(revDescI2->deltaShiftIndex());
MCAuto<DataArrayIdType> ids(dsi->findIdsGreaterThan(2));
const mcIdType * cPtr(mDesc0D->getNodalConnectivity()->begin());
- for(long const it : *ids)
- forbiddenPoints[cPtr[2*it+1]] = true; // we know that a 0D mesh has a connectivity of the form [NORM_POINT1, i1, NORM_POINT1, i2, ...]
+ for(auto it = ids->begin(); it != ids->end(); it++)
+ forbiddenPoints[cPtr[2*(*it)+1]] = true; // we know that a 0D mesh has a connectivity of the form [NORM_POINT1, i1, NORM_POINT1, i2, ...]
}
MCAuto<DataArrayDouble> appendedCoords(DataArrayDouble::New()); appendedCoords->alloc(0,1);//1 not 2 it is not a bug.
// Keep what is inside [startNode, endNode]:
mcIdType go = 0;
- for (const auto & it : xx)
+ for (vector<PairDI>::const_iterator it=xx.begin(); it != xx.end(); ++it)
{
- const mcIdType idx = it.second;
+ const mcIdType idx = (*it).second;
if (!go)
{
if (idx == startNode) go = 1;
for (const mcIdType * it = idsBg; it != endBg; ++it)
{
mcIdType start = c[cI[*it]+1], end = c[cI[*it]+2];
- vector<mcIdType>::const_iterator const itStart = find(pointIds.begin(), pointIds.end(), start);
+ vector<mcIdType>::const_iterator itStart = find(pointIds.begin(), pointIds.end(), start);
if (itStart == pointIds.end()) continue;
- vector<mcIdType>::const_iterator const itEnd = find(pointIds.begin(), pointIds.end(), end);
+ vector<mcIdType>::const_iterator itEnd = find(pointIds.begin(), pointIds.end(), end);
if (itEnd == pointIds.end()) continue;
if (abs(distance(itEnd, itStart)) != 1) continue;
hitSegs.push_back(*it); // segment is undivided.
const std::vector<mcIdType>& insidePoints, std::vector<mcIdType>& modifiedFace)
{
using namespace std;
- size_t const dst = distance(sIdxConn, sIdxConnE);
+ size_t dst = distance(sIdxConn, sIdxConnE);
modifiedFace.reserve(dst + insidePoints.size()-2);
modifiedFace.resize(dst);
copy(sIdxConn, sIdxConnE, modifiedFace.data());
- auto const shortEnd = modifiedFace.begin()+dst;
- auto startPos = find(modifiedFace.begin(), shortEnd , startNode);
+ vector<mcIdType>::iterator shortEnd = modifiedFace.begin()+dst;
+ vector<mcIdType>::iterator startPos = find(modifiedFace.begin(), shortEnd , startNode);
if (startPos == shortEnd)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ReplaceEdgeInFace: internal error, should never happen!");
- auto endPos = find(modifiedFace.begin(),shortEnd, endNode);
+ vector<mcIdType>::iterator endPos = find(modifiedFace.begin(),shortEnd, endNode);
if (endPos == shortEnd)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ReplaceEdgeInFace: internal error, should never happen!");
- size_t const d = distance(startPos, endPos);
+ size_t d = distance(startPos, endPos);
if (d == 1 || d == (1-dst)) // don't use modulo, for neg numbers, result is implementation defined ...
modifiedFace.insert(++startPos, ++insidePoints.begin(), --insidePoints.end()); // insidePoints also contains start and end node. Those don't need to be inserted.
else
// Build BBTree
MCAuto<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree(eps));
const double *bbox(bboxArr->begin()); getCoords()->begin();
- mcIdType const nDescCell=mDesc->getNumberOfCells();
- BBTree<SPACEDIM,mcIdType> const myTree(bbox,nullptr,0,nDescCell,-eps);
+ mcIdType nDescCell=mDesc->getNumberOfCells();
+ BBTree<SPACEDIM,mcIdType> myTree(bbox,0,0,nDescCell,-eps);
// Surfaces - handle biggest first
MCAuto<MEDCouplingFieldDouble> surfF = mDesc->getMeasureField(true);
DataArrayDouble * surfs = surfF->getArray();
vector< pair<double,mcIdType> > S;
for(mcIdType i=0;i < surfs->getNumberOfTuples();i++)
{
- pair<double,mcIdType> const p = make_pair(surfs->begin()[i], i);
+ pair<double,mcIdType> p = make_pair(surfs->begin()[i], i);
S.push_back(p);
}
sort(S.rbegin(),S.rend()); // reverse sort
vector<bool> hit(nDescCell);
fill(hit.begin(), hit.end(), false);
- vector<mcIdType> const hitPoly; // the final result: which 3D cells have been modified.
+ vector<mcIdType> hitPoly; // the final result: which 3D cells have been modified.
- for(const auto & it : S)
+ for( vector<pair<double,mcIdType> >::const_iterator it = S.begin(); it != S.end(); it++)
{
- mcIdType const faceIdx = it.second;
+ mcIdType faceIdx = (*it).second;
if (hit[faceIdx]) continue;
vector<mcIdType> candidates, cands2;
myTree.getIntersectingElems(bbox+faceIdx*2*SPACEDIM,candidates);
// Keep only candidates whose normal matches the normal of current face
- for(long const candidate : candidates)
+ for(vector<mcIdType>::const_iterator it2=candidates.begin();it2!=candidates.end();it2++)
{
- bool const col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + candidate*SPACEDIM, eps/carMeshSz); // using rough relative epsilon
- if (candidate != faceIdx && col)
- cands2.push_back(candidate);
+ bool col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + *(it2)*SPACEDIM, eps/carMeshSz); // using rough relative epsilon
+ if (*it2 != faceIdx && col)
+ cands2.push_back(*it2);
}
if (!cands2.size())
continue;
double checkSurf=0.0;
const mcIdType * idsGoodPlaneP(idsGoodPlane->begin());
- for (long const ii : *ids)
+ for (const mcIdType * ii = ids->begin(); ii != ids->end(); ii++)
{
- mcIdType const faceIdx2 = cands2[idsGoodPlaneP[ii]];
+ mcIdType faceIdx2 = cands2[idsGoodPlaneP[*ii]];
hit[faceIdx2] = true;
checkSurf += surfs->begin()[faceIdx2];
}
for (const mcIdType * ii = ids->begin(); ii != ids->end(); ii++)
{
// Build pack from the face to insert:
- mcIdType const faceIdx2 = cands2[idsGoodPlane->getIJ(*ii,0)];
+ mcIdType faceIdx2 = cands2[idsGoodPlane->getIJ(*ii,0)];
mcIdType facePack2Sz;
const mcIdType * facePack2 = connSlaDesc->getSimplePackSafePtr(faceIdx2, facePack2Sz); // contains the type!
// Insert it in all hit polyhedrons:
- for (long const polyIndice : polyIndices)
- connSla->pushBackPack(polyIndice, facePack2+1, facePack2+facePack2Sz); // without the type
+ for (vector<mcIdType>::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2)
+ connSla->pushBackPack(*it2, facePack2+1, facePack2+facePack2Sz); // without the type
}
}
} // end step1
const mcIdType *cDesc2(mDesc2->getNodalConnectivity()->begin()),*cIDesc2(mDesc2->getNodalConnectivityIndex()->begin());
MCAuto<DataArrayDouble> bboxArr(mDesc2->getBoundingBoxForBBTree(eps));
const double *bbox2(bboxArr->begin());
- mcIdType const nDesc2Cell=mDesc2->getNumberOfCells();
- BBTree<SPACEDIM,mcIdType> const myTree2(bbox2,nullptr,0,nDesc2Cell,-eps);
+ mcIdType nDesc2Cell=mDesc2->getNumberOfCells();
+ BBTree<SPACEDIM,mcIdType> myTree2(bbox2,0,0,nDesc2Cell,-eps);
// Edges - handle longest first
MCAuto<MEDCouplingFieldDouble> lenF = mDesc2->getMeasureField(true);
vector<pair<double,mcIdType> > S;
for(mcIdType i=0;i < lens->getNumberOfTuples();i++)
{
- pair<double,mcIdType> const p = make_pair(lens->getIJ(i, 0), i);
+ pair<double,mcIdType> p = make_pair(lens->getIJ(i, 0), i);
S.push_back(p);
}
sort(S.rbegin(),S.rend()); // reverse sort
vector<bool> hit(nDesc2Cell);
fill(hit.begin(), hit.end(), false);
- for(const auto & it : S)
+ for( vector<pair<double,mcIdType> >::const_iterator it = S.begin(); it != S.end(); it++)
{
- mcIdType const eIdx = it.second;
+ mcIdType eIdx = (*it).second;
if (hit[eIdx])
continue;
for (mcIdType i3=0; i3 < 3; i3++) // TODO: use fillSonCellNodalConnectivity2 or similar?
vCurr[i3] = coo[start*SPACEDIM+i3] - coo[end*SPACEDIM+i3];
double carSz = INTERP_KERNEL::caracteristicDimVector(vCurr), eps2 = eps*carSz*carSz*carSz;
- for(long const candidate : candidates)
+ for(vector<mcIdType>::const_iterator it2=candidates.begin();it2!=candidates.end();it2++)
{
double vOther[3];
- mcIdType start2 = cDesc2[cIDesc2[candidate]+1], end2 = cDesc2[cIDesc2[candidate]+2];
+ mcIdType start2 = cDesc2[cIDesc2[*it2]+1], end2 = cDesc2[cIDesc2[*it2]+2];
for (mcIdType i3=0; i3 < 3; i3++)
vOther[i3] = coo[start2*SPACEDIM+i3] - coo[end2*SPACEDIM+i3];
// isColinear() expect unit vecotr, and relative (non geometrical) precision.
// relative prec means going from eps -> eps/curSz
// normalizing vCurr and vOther means multiplying by v^4, knowing that inside isColinear3D() the square (^2) of a dot product (^2) is computed
- bool const col = INTERP_KERNEL::isColinear3D(vCurr, vOther, eps2);
+ bool col = INTERP_KERNEL::isColinear3D(vCurr, vOther, eps2);
// Warning: different from faces: we need to keep eIdx in the final list of candidates because we need
// to have its nodes inside the sub mesh mPartCand below (needed in OrderPointsAlongLine())
if (col)
- cands2.push_back(candidate);
+ cands2.push_back(*it2);
}
if (cands2.size() == 1 && cands2[0] == eIdx) // see warning above
continue;
// Now rotate edges to bring them on Ox
- mcIdType const startNode = cDesc2[cIDesc2[eIdx]+1];
- mcIdType const endNode = cDesc2[cIDesc2[eIdx]+2];
+ mcIdType startNode = cDesc2[cIDesc2[eIdx]+1];
+ mcIdType endNode = cDesc2[cIDesc2[eIdx]+2];
INTERP_KERNEL::TranslationRotationMatrix rotation;
INTERP_KERNEL::TranslationRotationMatrix::Rotate3DBipoint(coo+SPACEDIM*startNode, coo+SPACEDIM*endNode, rotation);
MCAuto<MEDCouplingUMesh> mPartRef(mDesc2->buildPartOfMySelfSlice(eIdx, eIdx+1,1,false)); // false=zipCoords is called
// Now the ordering along the Ox axis:
std::vector<mcIdType> insidePoints, hitSegs;
- bool const isSplit = OrderPointsAlongLine(mPartCand->_coords->getConstPointer(), nodeMap->begin()[startNode], nodeMap->begin()[endNode],
+ bool isSplit = OrderPointsAlongLine(mPartCand->_coords->getConstPointer(), nodeMap->begin()[startNode], nodeMap->begin()[endNode],
mPartCand->getNodalConnectivity()->begin(), mPartCand->getNodalConnectivityIndex()->begin(),
idsGoodLine->begin(), idsGoodLine->end(),
/*out*/insidePoints, hitSegs);
// Optim: smaller segments completely included in eIdx and not split won't need any further treatment:
- for (long const hitSeg : hitSegs)
- hit[cands2[hitSeg]] = true;
+ for (vector<mcIdType>::const_iterator its=hitSegs.begin(); its != hitSegs.end(); ++its)
+ hit[cands2[*its]] = true;
if (!isSplit) // current segment remains in one piece
continue;
// Get original node IDs in global coords array
- for (long & insidePoint : insidePoints)
- insidePoint = nodeMapInv->begin()[insidePoint];
+ for (std::vector<mcIdType>::iterator iit = insidePoints.begin(); iit!=insidePoints.end(); ++iit)
+ *iit = nodeMapInv->begin()[*iit];
vector<mcIdType> polyIndices, packsIds, facePack;
// For each face implying this edge
for (mcIdType ii=revDescIP2[eIdx]; ii < revDescIP2[eIdx+1]; ii++)
{
- mcIdType const faceIdx = revDescP2[ii];
+ mcIdType faceIdx = revDescP2[ii];
// each cell where this face is involved connectivity will be modified:
ret->pushBackValsSilent(revDescP + revDescIP[faceIdx], revDescP + revDescIP[faceIdx+1]);
MCAuto<DataArrayIdType> idx(DataArrayIdType::New()); idx->alloc(1); idx->fillWithValue(0);
MCAuto<DataArrayIdType> vals(DataArrayIdType::New()); vals->alloc(0);
newConn->set3(superIdx, idx, vals);
- mcIdType const nbCells=getNumberOfCells();
+ mcIdType nbCells=getNumberOfCells();
for(mcIdType ii = 0; ii < nbCells; ii++)
for (mcIdType jj=descIP[ii]; jj < descIP[ii+1]; jj++)
{
mcIdType sz, faceIdx = abs(descP[jj])-1;
- bool const orient = descP[jj]>0;
+ bool orient = descP[jj]>0;
const mcIdType * p = connSlaDesc->getSimplePackSafePtr(faceIdx, sz);
if (orient)
newConn->pushBackPack(ii, p+1, p+sz); // +1 to skip type
// Author : Anthony Geay (EDF R&D)
#include "MEDCouplingVoronoi.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MCAuto.txx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include <algorithm>
-#include <iterator>
-#include <math.h>
-#include <cmath>
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <vector>
-#include <set>
+#include "MEDCouplingNormalizedUnstructuredMesh.txx"
+#include "Interpolation2D.txx"
+#include "Interpolation3DSurf.hxx"
using namespace MEDCoupling;
Voronizer::~Voronizer()
-= default;
+{
+}
int Voronizer1D::getDimension() const
{
static const double PT[2]={0.,0.};
m->scale(PT,FACT);
MCAuto<MEDCouplingUMesh> mu(m->buildUnstructured());
- double const l(std::max(bbox[1]-bbox[0],bbox[3]-bbox[2]));
+ double l(std::max(bbox[1]-bbox[0],bbox[3]-bbox[2]));
double middle[2]={(pt1[0]+pt2[0])/2.,(pt1[1]+pt2[1])/2.};
double v[2]={pt1[0],pt1[1]};
DataArrayDouble::Rotate2DAlg(middle,M_PI/2,1,v,v);
v[0]=middle[0]-v[0]; v[1]=middle[1]-v[1];
{
- double const nor(sqrt(v[0]*v[0]+v[1]*v[1]));
+ double nor(sqrt(v[0]*v[0]+v[1]*v[1]));
v[0]/=nor; v[1]/=nor;
}
MCAuto<MEDCouplingUMesh> line(MEDCouplingUMesh::New("line",1));
line->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,CONN);
MCAuto<MEDCouplingUMesh> sp2,sp1;
{
- DataArrayIdType *cellNb1(nullptr),*cellNb2(nullptr);
- MEDCouplingUMesh *sp2Pt(nullptr),*sp1Pt(nullptr);
+ DataArrayIdType *cellNb1(0),*cellNb2(0);
+ MEDCouplingUMesh *sp2Pt(0),*sp1Pt(0);
MEDCouplingUMesh::Intersect2DMeshWith1DLine(mu,line,eps,sp2Pt,sp1Pt,cellNb1,cellNb2);
sp1=sp1Pt; sp2=sp2Pt;
MCAuto<DataArrayIdType> cellNb10(cellNb1),cellNb20(cellNb2);
}
-MCAuto<MEDCouplingUMesh> MergeVorCells2D(MEDCouplingUMesh *p, double /*eps*/, bool isZip)
+MCAuto<MEDCouplingUMesh> MergeVorCells2D(MEDCouplingUMesh *p, double eps, bool isZip)
{
MCAuto<DataArrayIdType> edgeToKeep;
MCAuto<MEDCouplingUMesh> p0;
MCAuto<MEDCouplingUMesh> MergeVorCells(const std::vector< MCAuto<MEDCouplingUMesh> >& vcs, double eps)
{
- std::size_t const sz(vcs.size());
+ std::size_t sz(vcs.size());
if(sz<1)
throw INTERP_KERNEL::Exception("MergeVorCells : len of input vec expected to be >= 1 !");
if(sz==1)
p->zipCoords();
{
bool dummy; mcIdType dummy2;
- MCAuto<DataArrayIdType> const dummy3(p->mergeNodes(eps,dummy,dummy2));
+ MCAuto<DataArrayIdType> dummy3(p->mergeNodes(eps,dummy,dummy2));
}
return MergeVorCells2D(p,eps,true);
}
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("SimplifyPolygon : internal error !");
const mcIdType *conn(m->getNodalConnectivity()->begin()),*conni(m->getNodalConnectivityIndex()->begin());
- mcIdType const nbPtsInPolygon(conni[1]-conni[0]-1);
+ mcIdType nbPtsInPolygon(conni[1]-conni[0]-1);
const double *coo(m->getCoords()->begin());
std::vector<mcIdType> resConn;
for(mcIdType i=0;i<nbPtsInPolygon;i++)
coo[3*current+1]-coo[3*zeNext+1],
coo[3*current+2]-coo[3*zeNext+2],
};
- double const c[3]={a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2], a[0]*b[1]-a[1]*b[0]};
+ double c[3]={a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2], a[0]*b[1]-a[1]*b[0]};
if(sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2])>eps)
resConn.push_back(current);
}
MCAuto<MEDCouplingUMesh> MergeVorCells3D(const std::vector< MCAuto<MEDCouplingUMesh> >& vcs, double eps)
{
- std::size_t const sz(vcs.size());
+ std::size_t sz(vcs.size());
if(sz<1)
throw INTERP_KERNEL::Exception("MergeVorCells : len of input vec expected to be >= 1 !");
if(sz==1)
p->zipCoords();
{
bool dummy; mcIdType dummy2;
- MCAuto<DataArrayIdType> const dummy3(p->mergeNodes(eps,dummy,dummy2));
+ MCAuto<DataArrayIdType> dummy3(p->mergeNodes(eps,dummy,dummy2));
}
MCAuto<DataArrayIdType> edgeToKeep;
MCAuto<MEDCouplingUMesh> p0;
MCAuto<DataArrayDouble> eqn(skinOfRes->computePlaneEquationOf3DFaces());
MCAuto<DataArrayIdType> comm,commI;
{
- DataArrayIdType *a(nullptr),*b(nullptr);
+ DataArrayIdType *a(0),*b(0);
eqn->findCommonTuples(eps,0,a,b);
comm=a; commI=b;
//comm=DataArrayIdType::New(); comm->alloc(0,1); commI=DataArrayIdType::New(); commI->alloc(1,1); commI->setIJ(0,0,0);
throw INTERP_KERNEL::Exception("Voronoize1D : spacedim must be equal to 1 and meshdim also equal to 1 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize1D : mesh is expected to have only one cell !");
- mcIdType const nbPts(points->getNumberOfTuples());
+ mcIdType nbPts(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize1D : at least one point expected !");
std::vector<double> bbox(4);
{
bool dummy;
mcIdType newNbNodes;
- MCAuto<DataArrayIdType> const dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
+ MCAuto<DataArrayIdType> dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
}
std::vector<mcIdType> polygsToIterOn;
const double *pt(pts+i);
if(polygsToIterOn.size()>2)
throw INTERP_KERNEL::Exception("Voronoize1D : overlap of points !");
std::vector< MCAuto<MEDCouplingUMesh> > newVorCells;
- for(long const poly : polygsToIterOn)
+ for(std::vector<mcIdType>::const_iterator it=polygsToIterOn.begin();it!=polygsToIterOn.end();it++)
{
+ mcIdType poly(*it);
//
double seed(pts[poly]),zept(*pt);
- double const mid((seed+zept)/2.);
+ double mid((seed+zept)/2.);
//
MCAuto<MEDCouplingUMesh> tile(l0[poly]);
tile->zipCoords();
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::MergeUMeshes(l0Bis));
{
bool dummy; mcIdType dummy2;
- MCAuto<DataArrayIdType> const dummy3(ret->mergeNodes(eps,dummy,dummy2));
+ MCAuto<DataArrayIdType> dummy3(ret->mergeNodes(eps,dummy,dummy2));
}
return ret;
}
throw INTERP_KERNEL::Exception("Voronoize2D : spacedim must be equal to 2 and meshdim also equal to 2 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize2D : mesh is expected to have only one cell !");
- mcIdType const nbPts(points->getNumberOfTuples());
+ mcIdType nbPts(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize2D : at least one point expected !");
std::vector<double> bbox(4);
{
bool dummy;
mcIdType newNbNodes;
- MCAuto<DataArrayIdType> const dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
+ MCAuto<DataArrayIdType> dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
}
std::vector<mcIdType> polygsToIterOn;
const double *pt(pts+i*2);
std::vector< MCAuto<MEDCouplingUMesh> > newVorCells;
while(!elemsToDo.empty())
{
- mcIdType const poly(*elemsToDo.begin()); elemsToDo.erase(elemsToDo.begin()); elemsDone.insert(poly);
+ mcIdType poly(*elemsToDo.begin()); elemsToDo.erase(elemsToDo.begin()); elemsDone.insert(poly);
const double *seed(pts+2*poly);
MCAuto<MEDCouplingUMesh> cell(ComputeBigCellFrom(pt,seed,bbox,eps));
MCAuto<MEDCouplingUMesh> tile(l0[poly]);
MCAuto<MEDCouplingUMesh> a;
MCAuto<DataArrayIdType> b,c;
{
- DataArrayIdType *bPtr(nullptr),*cPtr(nullptr);
+ DataArrayIdType *bPtr(0),*cPtr(0);
a=MEDCouplingUMesh::Intersect2DMeshes(tile,cell,eps,bPtr,cPtr);
b=bPtr; c=cPtr;
}
//
MCAuto<DataArrayIdType> ids;
{
- DataArrayIdType *tmp(nullptr);
- bool const sta(a->getCoords()->areIncludedInMe(cell->getCoords(),eps,tmp));
+ DataArrayIdType *tmp(0);
+ bool sta(a->getCoords()->areIncludedInMe(cell->getCoords(),eps,tmp));
ids=tmp;
if(!sta)
throw INTERP_KERNEL::Exception("Voronoize2D : internal error 2 !");
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::MergeUMeshes(l0Bis));
{
bool dummy; mcIdType dummy2;
- MCAuto<DataArrayIdType> const dummy3(ret->mergeNodes(eps,dummy,dummy2));
+ MCAuto<DataArrayIdType> dummy3(ret->mergeNodes(eps,dummy,dummy2));
}
return ret;
}
-MCAuto<MEDCouplingUMesh> Split3DCellInParts(const MEDCouplingUMesh *m, const double pt[3], const double seed[3], double eps, mcIdType /*tmp*/[2])
+MCAuto<MEDCouplingUMesh> Split3DCellInParts(const MEDCouplingUMesh *m, const double pt[3], const double seed[3], double eps, mcIdType tmp[2])
{
if(m->getMeshDimension()!=3 || m->getSpaceDimension()!=3 || m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Split3DCellInParts : expecting a 3D with exactly one cell !");
- double const middle[3]={(pt[0]+seed[0])/2.,(pt[1]+seed[1])/2.,(pt[2]+seed[2])/2.};
- double const vec[3]={pt[0]-seed[0],pt[1]-seed[1],pt[2]-seed[2]};
- MCAuto<MEDCouplingUMesh> const res(m->clipSingle3DCellByPlane(middle,vec,eps));
+ double middle[3]={(pt[0]+seed[0])/2.,(pt[1]+seed[1])/2.,(pt[2]+seed[2])/2.};
+ double vec[3]={pt[0]-seed[0],pt[1]-seed[1],pt[2]-seed[2]};
+ MCAuto<MEDCouplingUMesh> res(m->clipSingle3DCellByPlane(middle,vec,eps));
return res;
}
throw INTERP_KERNEL::Exception("Voronoize3D : spacedim must be equal to 3 and meshdim also equal to 3 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize3D : mesh is expected to have only one cell !");
- mcIdType const nbPts(points->getNumberOfTuples());
+ mcIdType nbPts(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize3D : at least one point expected !");
std::vector< MCAuto<MEDCouplingUMesh> > l0(1,MCAuto<MEDCouplingUMesh>(m->deepCopy()));
{
bool dummy;
mcIdType newNbNodes;
- MCAuto<DataArrayIdType> const dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
+ MCAuto<DataArrayIdType> dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes));
}
std::vector<mcIdType> polygsToIterOn;
const double *pt(pts+i*3);
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::MergeUMeshes(l0Bis));
{
bool dummy; mcIdType dummy2;
- MCAuto<DataArrayIdType> const dummy3(ret->mergeNodes(eps,dummy,dummy2));
+ MCAuto<DataArrayIdType> dummy3(ret->mergeNodes(eps,dummy,dummy2));
}
return ret;
}
#ifndef __MEDCOUPLINGVORONOI_HXX__
#define __MEDCOUPLINGVORONOI_HXX__
-#include "MCAuto.hxx"
+#include "MEDCoupling.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingUMesh.hxx"
namespace MEDCoupling
class Voronizer1D : public Voronizer
{
public:
- MCAuto<MEDCouplingUMesh> doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const override;
- int getDimension() const override;
+ MCAuto<MEDCouplingUMesh> doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const;
+ int getDimension() const;
};
class Voronizer2D : public Voronizer
{
public:
- MCAuto<MEDCouplingUMesh> doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const override;
- int getDimension() const override;
+ MCAuto<MEDCouplingUMesh> doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const;
+ int getDimension() const;
};
class Voronizer3D : public Voronizer
{
public:
- MCAuto<MEDCouplingUMesh> doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const override;
- int getDimension() const override;
+ MCAuto<MEDCouplingUMesh> doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const;
+ int getDimension() const;
};
}
#ifndef __MEDCOUPLINGBASICSTEST_HXX__
#define __MEDCOUPLINGBASICSTEST_HXX__
-#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
#include "MCType.hxx"
#include <map>
//
// Author : Anthony Geay (CEA/DEN)
-#include "MCType.hxx"
-#include "Interpolation.txx"
-#include "Interpolation2D1D.txx"
-#include "InterpolationOptions.hxx"
-#include "Log.hxx"
-#include "Interpolation2D3D.txx"
#include "MEDCouplingBasicsTest.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingNormalizedUnstructuredMesh.txx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingBasicsTestData1.hxx"
+#include "Interpolation2D.txx"
+#include "Interpolation2D3D.txx"
+#include "Interpolation2D1D.txx"
+#include "MEDCouplingNormalizedUnstructuredMesh.txx"
#include "MEDCouplingNormalizedCartesianMesh.txx"
-#include "NormalizedGeometricTypes"
-#include "VectorUtils.hxx"
-#include <algorithm>
-#include <iostream>
-#include <cppunit/TestAssert.h>
-#include <vector>
-#include <map>
using namespace MEDCoupling;
MEDCouplingUMesh *MEDCouplingBasicsTest::build3DTargetMesh_3()
{
- return nullptr;
+ return 0;
}
MEDCouplingMultiFields *MEDCouplingBasicsTest::buildMultiFields_1()
double MEDCouplingBasicsTest::sumAll(const std::vector< std::map<mcIdType,double> >& matrix)
{
double ret=0.;
- for(const auto & iter : matrix)
- for(auto iter2 : iter)
- ret+=iter2.second;
+ for(std::vector< std::map<mcIdType,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
+ ret+=(*iter2).second;
return ret;
}
int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map<mcIdType,double> >& matrix)
{
int ret=0;
- for(const auto & iter : matrix)
- for(auto iter2 : iter)
- if (!INTERP_KERNEL::epsilonEqual(iter2.second, 0.)) ret +=1;
+ for(std::vector< std::map<mcIdType,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
+ for(std::map<mcIdType,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
+ if (!INTERP_KERNEL::epsilonEqual((*iter2).second, 0.)) ret +=1;
return ret;
}
const int correctDuplicateFacesNbr,
const int correctTotalIntersectFacesNbr)
{
- MEDCouplingNormalizedUnstructuredMesh<2,2> const sourceWrapper(sourceMesh);
- MEDCouplingNormalizedUnstructuredMesh<2,2> const targetWrapper(targetMesh);
+ MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
+ MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D1D myInterpolator;
myInterpolator.setPrecision(1e-12);
const double prec = 1.0e-5;
LOG(1, "length = " << length <<" correctLength = " << correctLength );
CPPUNIT_ASSERT_DOUBLES_EQUAL(correctLength, length, prec * std::max(correctLength, length));
- INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces = myInterpolator.retrieveDuplicateFaces();
- int const duplicateFacesNbr = (int)duplicateFaces.size();
+ INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
+ int duplicateFacesNbr = (int)duplicateFaces.size();
LOG(1, "duplicateFacesNbr = " << duplicateFacesNbr <<" correctDuplicateFacesNbr = " << correctDuplicateFacesNbr);
CPPUNIT_ASSERT_EQUAL(correctDuplicateFacesNbr, duplicateFacesNbr);
const int correctDuplicateFacesNbr,
const int correctTotalIntersectFacesNbr)
{
- MEDCouplingNormalizedUnstructuredMesh<3,3> const sourceWrapper(sourceMesh);
- MEDCouplingNormalizedUnstructuredMesh<3,3> const targetWrapper(targetMesh);
+ MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
+ MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D3D myInterpolator;
myInterpolator.setPrecision(1e-12);
const double prec = 1.0e-5;
IntersectionMatrix matrix;
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( size_t i = 0; i < sizeof(sp)/sizeof(sp[0]); ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
matrix.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0");
LOG(1, "surf = " << surf <<" correctSurf = " << correctSurf );
CPPUNIT_ASSERT_DOUBLES_EQUAL(correctSurf, surf, prec * std::max(correctSurf, surf));
- INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces = myInterpolator.retrieveDuplicateFaces();
- int const duplicateFacesNbr = (int)duplicateFaces.size();
+ INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
+ int duplicateFacesNbr = (int)duplicateFaces.size();
LOG(1, "duplicateFacesNbr = " << duplicateFacesNbr <<" correctDuplicateFacesNbr = " << correctDuplicateFacesNbr);
CPPUNIT_ASSERT_EQUAL(correctDuplicateFacesNbr, duplicateFacesNbr);
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingBasicsTest1.hxx"
-#include "MEDCouplingMemArray.txx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "InterpKernelException.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingPointSet.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingMesh.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include <cppunit/TestAssert.h>
-#include "NormalizedGeometricTypes"
-#include <cstdlib>
-#include <math.h>
-#include <cstddef>
+#include "MEDCouplingMemArray.txx"
+#include <sstream>
#include <cmath>
#include <algorithm>
#include <functional>
-#include <vector>
using namespace MEDCoupling;
mesh->checkConsistencyLight();
//test 1 - no copy ownership C++
myCoords=DataArrayDouble::New();
- auto *tmp=new double[3*nbOfNodes];
+ double *tmp=new double[3*nbOfNodes];
std::copy(coords,coords+3*nbOfNodes,tmp);
myCoords->useArray(tmp,true,DeallocType::CPP_DEALLOC,nbOfNodes,3);
mesh->setCoords(myCoords);
const mcIdType tab2[3]={0,2,3};
//
MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelf(tab1,tab1+2,true);
- auto *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
+ MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(subMesh);
std::string name(subMesh->getName());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
const mcIdType tab1[4]={5,7,8,4};
MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelfNode(tab1,tab1+4,true);
- auto *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
+ MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(subMesh);
CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
//
const mcIdType tab1[2]={0,4};
MEDCouplingPointSet *subMeshPtSet=mesh->buildPartOfMySelf(tab1,tab1+2,true);
- auto *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshPtSet);
+ MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshPtSet);
CPPUNIT_ASSERT(subMesh);
DataArrayIdType *traducer=subMesh->zipCoordsTraducer();
const mcIdType expectedTraducer[9]={0,1,-1,2,3,4,-1,5,6};
MEDCouplingUMesh *m2=build2DTargetMesh_1();
mcIdType cells1[3]={2,3,4};
MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true);
- auto *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
+ MEDCouplingUMesh *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
CPPUNIT_ASSERT(m3);
m2->decrRef();
MEDCouplingUMesh *m4=build2DSourceMesh_1();
CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(mesh2->isEqual(mesh1,1e-12));
double *pt=mesh2->getCoords()->getPointer();
- double const tmp=pt[1];
+ double tmp=pt[1];
pt[1]=5.999;
CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(!mesh2->isEqual(mesh1,1e-12));
CPPUNIT_ASSERT_EQUAL(1,(int)di->getNumberOfComponents());
const mcIdType *toCheck=di->getConstPointer();
CPPUNIT_ASSERT(std::equal(elts,elts+3,toCheck));
- auto *ret1DC=dynamic_cast<MEDCouplingUMesh *>(ret1);
+ MEDCouplingUMesh *ret1DC=dynamic_cast<MEDCouplingUMesh *>(ret1);
CPPUNIT_ASSERT(ret1DC);
ret1->decrRef();
di->decrRef();
MEDCouplingFieldDouble *fieldNodes=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
fieldNodes->setMesh(targetMesh);
MEDCouplingMesh *ret2=fieldNodes->buildSubMeshData(elts,elts+3,di);
- auto *ret2DC=dynamic_cast<MEDCouplingUMesh *>(ret2);
+ MEDCouplingUMesh *ret2DC=dynamic_cast<MEDCouplingUMesh *>(ret2);
CPPUNIT_ASSERT(ret2DC);
CPPUNIT_ASSERT_EQUAL(3,(int)ret2->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(6,(int)ret2->getNumberOfNodes());
void MEDCouplingBasicsTest1::testExtrudedMesh1()
{
- MEDCouplingUMesh *mesh2D=nullptr;
+ MEDCouplingUMesh *mesh2D=0;
MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D);
MEDCouplingMappedExtrudedMesh *ext=MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,1);
CPPUNIT_ASSERT_EQUAL(18,(int)ext->getNumberOfCells());
double v[3]={0.,0.,2.};
mTT->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(43,(int)n.size());
- auto *mTT3dSurf=(MEDCouplingUMesh *)mTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
+ MEDCouplingUMesh *mTT3dSurf=(MEDCouplingUMesh *)mTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
MEDCouplingMappedExtrudedMesh *meTT=MEDCouplingMappedExtrudedMesh::New(mTT,mTT3dSurf,0);
CPPUNIT_ASSERT_EQUAL(200,(int)meTT->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(10,(int)meTT->getMesh2D()->getNumberOfCells());
n.clear();
mN->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(30,(int)n.size());
- auto *mN3dSurf=(MEDCouplingUMesh *)mN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
+ MEDCouplingUMesh *mN3dSurf=(MEDCouplingUMesh *)mN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
MEDCouplingMappedExtrudedMesh *meN=MEDCouplingMappedExtrudedMesh::New(mN,mN3dSurf,0);
CPPUNIT_ASSERT_EQUAL(40,(int)meN->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(20,(int)meN->getMesh2D()->getNumberOfCells());
n.clear();
mTF->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(27,(int)n.size());
- auto *mTF3dSurf=(MEDCouplingUMesh *)mTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
+ MEDCouplingUMesh *mTF3dSurf=(MEDCouplingUMesh *)mTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
MEDCouplingMappedExtrudedMesh *meTF=MEDCouplingMappedExtrudedMesh::New(mTF,mTF3dSurf,0);
CPPUNIT_ASSERT_EQUAL(340,(int)meTF->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(17,(int)meTF->getMesh2D()->getNumberOfCells());
const double vec[2]={1.,0.};
m2->translate(vec);
MEDCouplingMesh *m3=m1->mergeMyselfWith(m2);
- auto *m3C=dynamic_cast<MEDCouplingUMesh *>(m3);
+ MEDCouplingUMesh *m3C=dynamic_cast<MEDCouplingUMesh *>(m3);
CPPUNIT_ASSERT(m3C);
m3->checkConsistencyLight();
MEDCouplingUMesh *m4=build2DTargetMeshMerged_1();
MEDCouplingUMesh *m4=build2DTargetMeshMerged_1();
m4->setName(f1->getMesh()->getName());
CPPUNIT_ASSERT(f3->getMesh()->isEqual(m4,1.e-12));
- std::string const name=f3->getName();
+ std::string name=f3->getName();
CPPUNIT_ASSERT(name=="MeasureOfMesh_");
CPPUNIT_ASSERT(f3->getTypeOfField()==ON_CELLS);
CPPUNIT_ASSERT(f3->getTimeDiscretization()==ONE_TIME);
const double *tmp=f3->getArray()->getConstPointer();
std::transform(tmp,tmp+7,values,values,std::minus<double>());
std::transform(values,values+7,values,[](double c){return fabs(c);});
- double const max=*std::max_element(values,values+7);
+ double max=*std::max_element(values,values+7);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12);
m4->decrRef();
f3->decrRef();
const double *tmp=f1->getArray()->getConstPointer();
std::transform(tmp,tmp+9,values1,values1,std::minus<double>());
std::transform(values1,values1+9,values1,[](double c){return fabs(c);});
- double const max=*std::max_element(values1,values1+9);
+ double max=*std::max_element(values1,values1+9);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12);
f1->decrRef();
m->decrRef();
void MEDCouplingBasicsTest1::testOperationsOnFields4()
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
- std::size_t const nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,CONST_ON_TIME_INTERVAL);
f1->setMesh(m);
DataArrayDouble *array=DataArrayDouble::New();
MEDCouplingUMesh *m1=build3DSurfTargetMesh_1();
std::vector<MEDCouplingUMesh *> v=m1->splitByType();
CPPUNIT_ASSERT_EQUAL(3,(int)v.size());
- std::vector<const MEDCouplingUMesh *> const v2(v.begin(),v.end());
+ std::vector<const MEDCouplingUMesh *> v2(v.begin(),v.end());
MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(v2);
m2->setName(m1->getName().c_str());
CPPUNIT_ASSERT(m1->isEqual(m2,1.e-12));
- for(auto iter : v)
- iter->decrRef();
+ for(std::vector<MEDCouplingUMesh *>::const_iterator iter=v.begin();iter!=v.end();iter++)
+ (*iter)->decrRef();
m2->decrRef();
m1->decrRef();
}
MEDCouplingUMesh *m2=build2DTargetMesh_1();
mcIdType cells1[3]={2,3,4};
MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true);
- auto *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
+ MEDCouplingUMesh *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
CPPUNIT_ASSERT(m3);
meshes.push_back(m3);
mcIdType cells2[3]={1,2,4};
MEDCouplingPointSet *m4_1=m2->buildPartOfMySelf(cells2,cells2+3,true);
- auto *m4=dynamic_cast<MEDCouplingUMesh *>(m4_1);
+ MEDCouplingUMesh *m4=dynamic_cast<MEDCouplingUMesh *>(m4_1);
CPPUNIT_ASSERT(m4);
meshes.push_back(m4);
mcIdType cells3[2]={1,2};
MEDCouplingPointSet *m5_1=m2->buildPartOfMySelf(cells3,cells3+2,true);
- auto *m5=dynamic_cast<MEDCouplingUMesh *>(m5_1);
+ MEDCouplingUMesh *m5=dynamic_cast<MEDCouplingUMesh *>(m5_1);
CPPUNIT_ASSERT(m5);
meshes.push_back(m5);
m2->decrRef();
{
DataArrayIdType *arr=corr[i];
CPPUNIT_ASSERT_EQUAL(1,(int)arr->getNumberOfComponents());
- mcIdType const nbOfVals=expectedVals1[i];
+ mcIdType nbOfVals=expectedVals1[i];
CPPUNIT_ASSERT_EQUAL(nbOfVals,arr->getNumberOfTuples());
const mcIdType *vals=arr->getConstPointer();
for(mcIdType j=0;j<nbOfVals;j++)
CPPUNIT_ASSERT_EQUAL(expectedVals2[i][j],vals[j]);
}
std::vector< std::vector<mcIdType> > fidsOfGroups;
- std::vector<const DataArrayIdType *> const corr2(corr.begin(),corr.end());
+ std::vector<const DataArrayIdType *> corr2(corr.begin(),corr.end());
DataArrayIdType *arr2=DataArrayIdType::MakePartition(corr2,m7->getNumberOfCells(),fidsOfGroups);
const mcIdType fidExp[4]={5,1,3,4};
const mcIdType fidsGrp[3][3]={{1,3,5},{3,4,5},{4,5,23344}};
CPPUNIT_ASSERT(std::equal(fidExp,fidExp+4,arr2->getConstPointer()));
for(int i=0;i<3;i++)
{
- mcIdType const nbOfVals=expectedVals1[i];
+ mcIdType nbOfVals=expectedVals1[i];
CPPUNIT_ASSERT_EQUAL(nbOfVals,ToIdType(fidsOfGroups[i].size()));
CPPUNIT_ASSERT(std::equal(fidsOfGroups[i].begin(),fidsOfGroups[i].end(),fidsGrp[i]));
}
- for(auto & iter : corr)
- iter->decrRef();
+ for(std::vector<DataArrayIdType *>::iterator iter=corr.begin();iter!=corr.end();iter++)
+ (*iter)->decrRef();
arr2->decrRef();
m7->decrRef();
//
MEDCouplingUMesh *m1=build3DExtrudedUMesh_1(m2);
m2->decrRef();
const mcIdType part1[5]={2,3,6,4,10};
- auto *m3=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part1,part1+5,true);
+ MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part1,part1+5,true);
const mcIdType part2[4]={5,6,4,7};
- auto *m4=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part2,part2+4,true);
+ MEDCouplingUMesh *m4=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part2,part2+4,true);
std::vector<const MEDCouplingUMesh *> meshes;
meshes.push_back(m1);
meshes.push_back(m3);
std::vector<DataArrayIdType *> corr;
MEDCouplingUMesh *m5=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
CPPUNIT_ASSERT_EQUAL(18,(int)m5->getNumberOfCells());
- auto it=corr.begin();
+ std::vector<DataArrayIdType *>::iterator it=corr.begin();
const mcIdType exp1[4]={18,5,5,4};
const mcIdType exp2[4][18]={
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17},
int i=0;
for(;it!=corr.end();it++,i++)
{
- mcIdType const sz=(*it)->getNumberOfTuples();
+ mcIdType sz=(*it)->getNumberOfTuples();
CPPUNIT_ASSERT_EQUAL(exp1[i],sz);
CPPUNIT_ASSERT(std::equal(exp2[i],exp2[i]+sz,(*it)->getConstPointer()));
}
{
MEDCouplingUMesh *targetMesh=build3DSurfTargetMesh_1();
MEDCouplingFieldDouble *field=targetMesh->buildOrthogonalField();
- double const expected[3]={0.70710678118654746,0.,-0.70710678118654746};
+ double expected[3]={0.70710678118654746,0.,-0.70710678118654746};
CPPUNIT_ASSERT_EQUAL(5,(int)field->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)field->getNumberOfComponents());
const double *vals=field->getArray()->getConstPointer();
//2D with no help of bounding box.
double center[2]={0.2,0.2};
DataArrayDouble::Rotate2DAlg(center,0.78539816339744830962,6,pos,pos);
- targetMesh->rotate(center,nullptr,0.78539816339744830962);
+ targetMesh->rotate(center,0,0.78539816339744830962);
targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2);
CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(7,(int)t2->getNbOfElems());
{
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
MEDCouplingFieldDouble *fieldOnCells=MEDCouplingFieldDouble::New(ON_CELLS);
- std::size_t const nbOfCells=targetMesh->getNumberOfCells();
+ std::size_t nbOfCells=targetMesh->getNumberOfCells();
fieldOnCells->setMesh(targetMesh);
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(nbOfCells,2);
//
targetMesh=build2DSourceMesh_1();
MEDCouplingFieldDouble *fieldOnNodes=MEDCouplingFieldDouble::New(ON_NODES);
- mcIdType const nbOfNodes=targetMesh->getNumberOfNodes();
+ mcIdType nbOfNodes=targetMesh->getNumberOfNodes();
fieldOnNodes->setMesh(targetMesh);
array=DataArrayDouble::New();
array->alloc(nbOfNodes,2);
MEDCouplingMesh* meshDeepCopy=mesh->deepCopy();
MEDCouplingCMesh* meshClone=mesh->clone(false);
- CPPUNIT_ASSERT_THROW(meshEmpty->copyTinyStringsFrom(nullptr),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(meshEmpty->copyTinyStringsFrom(0),INTERP_KERNEL::Exception);
meshEmpty->copyTinyStringsFrom(mesh);
//no data in meshEmpty, expected false
CPPUNIT_ASSERT(!meshEmpty->isEqual(mesh,1e-12));
ids->decrRef();
check->decrRef();
mcIdType cells1[4]={0,1,25,26};
- auto *partMesh1=
+ MEDCouplingUMesh *partMesh1=
dynamic_cast<MEDCouplingUMesh *>(mesh1->buildPart(cells1,cells1+4));
CPPUNIT_ASSERT(partMesh1);
CPPUNIT_ASSERT_EQUAL(4,(int)partMesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8));
mcIdType cells2[2]={25,26};
DataArrayIdType* arr1;
- auto *partMesh2=
+ MEDCouplingCMesh *partMesh2=
dynamic_cast<MEDCouplingCMesh *>(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1));
CPPUNIT_ASSERT(partMesh2);
CPPUNIT_ASSERT_EQUAL(2,(int)partMesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8));
mcIdType cells3[2]={2,3};
DataArrayIdType* arr2;
- auto *partMesh3=
+ MEDCouplingUMesh *partMesh3=
dynamic_cast<MEDCouplingUMesh *>(partMesh1->buildPartAndReduceNodes(cells3,cells3+2,arr2));
CPPUNIT_ASSERT(partMesh3);
CPPUNIT_ASSERT_EQUAL(2,(int)partMesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8));
double v[3]={0.,0.,2.};
mesh->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(9,(int)n.size());
- auto *m3dSurf=(MEDCouplingUMesh *)mesh->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
+ MEDCouplingUMesh *m3dSurf=(MEDCouplingUMesh *)mesh->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
MEDCouplingMappedExtrudedMesh *me=MEDCouplingMappedExtrudedMesh::New(mesh,m3dSurf,0);
const DataArrayIdType *da=me->getMesh3DIds();
CPPUNIT_ASSERT_EQUAL(8,(int)me->getNumberOfCells());
#include "MEDCouplingBasicsTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
+#include <map>
+#include <vector>
namespace MEDCoupling
{
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingBasicsTest2.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingGaussLocalization.hxx"
-#include "NormalizedGeometricTypes"
#include <cmath>
#include <algorithm>
-#include <cppunit/TestAssert.h>
-#include <cstddef>
#include <functional>
-#include <vector>
-#include <math.h>
-#include <set>
+#include <iterator>
using namespace MEDCoupling;
const double gsCoo1[12]={ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b,
2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 };
const double wg1[6]={ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 };
- std::vector<double> const _refCoo1(refCoo1,refCoo1+6);
+ std::vector<double> _refCoo1(refCoo1,refCoo1+6);
std::vector<double> _gsCoo1(gsCoo1,gsCoo1+12);
std::vector<double> _wg1(wg1,wg1+6);
//
CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo1,_gsCoo1,_wg1),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getNbOfGaussLocalization());
const double refCoo2[8]={ 0.,0., 1.,0., 1.,1., 0.,1. };
- std::vector<double> const _refCoo2(refCoo2,refCoo2+8);
+ std::vector<double> _refCoo2(refCoo2,refCoo2+8);
_gsCoo1.resize(4); _wg1.resize(2);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo2,_gsCoo1,_wg1);
CPPUNIT_ASSERT_EQUAL(ToIdType(2),f->getNbOfGaussLocalization());
MEDCouplingFieldDouble *f2=f->clone(true);
CPPUNIT_ASSERT(f->isEqual(f2,1e-14,1e-14));
MEDCouplingGaussLocalization& gl1=f2->getGaussLocalization(0);
- double const tmp=gl1.getGaussCoord(1,1);
+ double tmp=gl1.getGaussCoord(1,1);
CPPUNIT_ASSERT_DOUBLES_EQUAL(2.07*_b-1,tmp,1e-14);
gl1.setGaussCoord(1,1,0.07);
CPPUNIT_ASSERT(!f->isEqual(f2,1e-14,1e-14));
vec[2]=-1.;
// connectivity inversion
mcIdType *conn=m->getNodalConnectivity()->getPointer();
- mcIdType const tmp=conn[11];
+ mcIdType tmp=conn[11];
conn[11]=conn[12];
conn[12]=tmp;
m->are2DCellsNotCorrectlyOriented(vec,false,res1);
void MEDCouplingBasicsTest2::testCellOrientation2()
{
- MEDCouplingUMesh *m1=nullptr;
+ MEDCouplingUMesh *m1=0;
MEDCouplingUMesh *m2=build3DExtrudedUMesh_1(m1);
m1->decrRef();
std::vector<mcIdType> res1;
DataArrayDouble *f3=m1->computeCellCenterOfMass();
CPPUNIT_ASSERT_EQUAL(4,(int)f3->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)f3->getNumberOfComponents());
- double const expected9[4]={0.75,5.105,0.8,5.155};
+ double expected9[4]={0.75,5.105,0.8,5.155};
ptr=f3->getConstPointer();
for(int i=0;i<4;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected9[i],ptr[i],1e-12);
MEDCouplingFieldDouble *f2=m1->getMeasureField(false);
CPPUNIT_ASSERT_EQUAL(4,(int)f2->getArray()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
- double const expected1[4]={0.5,0.21,-0.6,-0.31};
+ double expected1[4]={0.5,0.21,-0.6,-0.31};
ptr=f2->getArray()->getConstPointer();
for(int i=0;i<4;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],ptr[i],1e-12);
f2->decrRef();
- double const expected2[4]={0.5,0.21,0.6,0.31};
+ double expected2[4]={0.5,0.21,0.6,0.31};
f2=m1->getMeasureField(true);
ptr=f2->getArray()->getConstPointer();
for(int i=0;i<4;i++)
//integral
double res[3];
f1->integral(false,res);
- double const expected3[3]={0.9866,-0.3615,0.4217};
+ double expected3[3]={0.9866,-0.3615,0.4217};
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],res[i],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[0],f1->integral(0,false),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[1],f1->integral(1,false),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[2],f1->integral(2,false),1e-12);
f1->integral(true,res);
- double const expected4[3]={-3.4152,8.7639,-14.6879};
+ double expected4[3]={-3.4152,8.7639,-14.6879};
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected4[i],res[i],1e-12);
//normL1
f1->normL1(res);
- double const expected5[3]={6.979506172839505, 16.89018518518518, 27.02969135802469};
+ double expected5[3]={6.979506172839505, 16.89018518518518, 27.02969135802469};
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[i],res[i],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[0],f1->normL1(0),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[2],f1->normL1(2),1e-12);
//normL2
f1->normL2(res);
- double const expected7[3]={7.090910979452395, 16.9275542960123, 27.053271464160858};
+ double expected7[3]={7.090910979452395, 16.9275542960123, 27.053271464160858};
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected7[i],res[i],1e-9);
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected7[0],f1->normL2(0),1e-9);
f3=m1->computeCellCenterOfMass();
CPPUNIT_ASSERT_EQUAL(4,(int)f3->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)f3->getNumberOfComponents());
- double const expected10[8]={0.75,0.75,5.105,5.105,0.8,0.8,5.155,5.155};
+ double expected10[8]={0.75,0.75,5.105,5.105,0.8,0.8,5.155,5.155};
ptr=f3->getConstPointer();
for(int i=0;i<8;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected10[i],ptr[i],1e-12);
MEDCouplingFieldDouble *f1=m1->getMeasureField(false);
CPPUNIT_ASSERT_EQUAL(10,(int)f1->getArray()->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
- double const expected1[10]={-0.5,-1,-1.5,-0.5,-1, 0.5,1,1.5,0.5,1};
+ double expected1[10]={-0.5,-1,-1.5,-0.5,-1, 0.5,1,1.5,0.5,1};
const double *ptr=f1->getArray()->getConstPointer();
for(int i=0;i<10;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],ptr[i],1e-12);
DataArrayDouble *f2=m1->computeCellCenterOfMass();
CPPUNIT_ASSERT_EQUAL(10,(int)f2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents());
- double const expected2[20]={
+ double expected2[20]={
0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5,
0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5,
};
CPPUNIT_ASSERT_EQUAL(10,(int)f2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(3,(int)f2->getNumberOfComponents());
ptr=f2->getConstPointer();
- double const expected3[30]={
+ double expected3[30]={
0.5,0.3333333333333333,0.,0.5,0.5,0.,0.5,0.77777777777777777,0.,0.5,0.3333333333333333,0.,0.5,0.5,0.,
0.5,0.3333333333333333,0.,0.5,0.5,0.,0.5,0.77777777777777777,0.,0.5,0.3333333333333333,0.,0.5,0.5,0.
};
, 55 , 5 , 12 , 65 , -1 , 66 , 67 , 65 , 55 , 56 , 57 , -1 , 63 , 66 , 57 , 59 , 64 , -1 , 64 , 62 , 58 , 59 , -1
, 60 , 63 , 66 , 67 , 68 , 61 , -1 , 61 , 68 , 20 , 21 , -1 , 67 , 68 , 20 , 12 , 65};
- double const barys[]={ -0.0165220465527 , -0.0190922868195 , 0.158882733414 ,
+ double barys[]={ -0.0165220465527 , -0.0190922868195 , 0.158882733414 ,
0.0287618656076 , 0.135874379934 , -0.14601588119 ,
-0.147128055553 , 0.0465995097041 , -0.049391174453 ,
-0.00142506732317 , -0.0996953090351 , -0.115159183132 };
const double gsCoo1[12]={ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b,
2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 };
const double wg1[6]={ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 };
- std::vector<double> const _refCoo1(refCoo1,refCoo1+6);
+ std::vector<double> _refCoo1(refCoo1,refCoo1+6);
std::vector<double> _gsCoo1(gsCoo1,gsCoo1+12);
std::vector<double> _wg1(wg1,wg1+6);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1);
const double refCoo2[8]={ 0.,0., 1.,0., 1.,1., 0.,1. };
- std::vector<double> const _refCoo2(refCoo2,refCoo2+8);
+ std::vector<double> _refCoo2(refCoo2,refCoo2+8);
_gsCoo1.resize(4); _wg1.resize(2);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo2,_gsCoo1,_wg1);
arr=DataArrayDouble::New();
CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12));
f->renumberCells(renumber1,false);
CPPUNIT_ASSERT(!f->isEqual(fCpy,1e-12,1e-12));
- double const expected2[36]={21.,1021.,22.,1022.,23.,1023.,24.,1024.,25.,1025.,26.,1026., 11.,1011.,12.,1012.,13.,1013.,14.,1014.,15.,1015.,16.,1016., 41.,1041.,42.,1042., 1.,1001.,2.,1002., 31.,1031.,32.,1032.};
+ double expected2[36]={21.,1021.,22.,1022.,23.,1023.,24.,1024.,25.,1025.,26.,1026., 11.,1011.,12.,1012.,13.,1013.,14.,1014.,15.,1015.,16.,1016., 41.,1041.,42.,1042., 1.,1001.,2.,1002., 31.,1031.,32.,1032.};
ptr=f->getArray()->getConstPointer();
for(int i=0;i<36;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],ptr[i],1e-12);
CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12));
f->renumberCells(renumber1,false);
CPPUNIT_ASSERT(!f->isEqual(fCpy,1e-12,1e-12));
- double const expected3[36]={21.,1021.,22.,1022.,23.,1023.,11.,1011.,12.,1012.,13.,1013.,41.,1041.,42.,1042.,43.,1043.,44.,1044.,1.,1001.,2.,1002.,3.,1003.,4.,1004.,31.,1031.,32.,1032.,33.,1033.,34.,1034.};
+ double expected3[36]={21.,1021.,22.,1022.,23.,1023.,11.,1011.,12.,1012.,13.,1013.,41.,1041.,42.,1042.,43.,1043.,44.,1044.,1.,1001.,2.,1002.,3.,1003.,4.,1004.,31.,1031.,32.,1032.,33.,1033.,34.,1034.};
ptr=f->getArray()->getConstPointer();
for(int i=0;i<36;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],ptr[i],1e-12);
f->setMesh(m);
CPPUNIT_ASSERT_EQUAL(ToIdType(9),f->getNumberOfMeshPlacesExpected());
DataArrayDouble *arr=DataArrayDouble::New();
- mcIdType const nbOfNodes=m->getNumberOfNodes();
+ mcIdType nbOfNodes=m->getNumberOfNodes();
arr->alloc(nbOfNodes,3);
f->setArray(arr);
arr->decrRef();
{
MEDCouplingUMesh *mesh=build2DTargetMesh_3();
mesh->checkConsistencyLight();
- std::set<INTERP_KERNEL::NormalizedCellType> const types=mesh->getAllGeoTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
CPPUNIT_ASSERT_EQUAL(5,(int)types.size());
INTERP_KERNEL::NormalizedCellType expected1[5]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_TRI6, INTERP_KERNEL::NORM_QUAD8};
- std::set<INTERP_KERNEL::NormalizedCellType> const expected1Bis(expected1,expected1+5);
+ std::set<INTERP_KERNEL::NormalizedCellType> expected1Bis(expected1,expected1+5);
CPPUNIT_ASSERT(expected1Bis==types);
CPPUNIT_ASSERT(mesh->isPresenceOfQuadratic());
CPPUNIT_ASSERT_EQUAL(ToIdType(62),mesh->getNodalConnectivityArrayLen());
MEDCouplingFieldDouble *f2=mesh->getMeasureField(false);
CPPUNIT_ASSERT(f1->getArray()->isEqual(*f2->getArray(),1e-12));
CPPUNIT_ASSERT_EQUAL(ToIdType(48),mesh->getNodalConnectivityArrayLen());
- std::set<INTERP_KERNEL::NormalizedCellType> const types2=mesh->getAllGeoTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> types2=mesh->getAllGeoTypes();
CPPUNIT_ASSERT_EQUAL(3,(int)types2.size());
INTERP_KERNEL::NormalizedCellType expected2[3]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4};
- std::set<INTERP_KERNEL::NormalizedCellType> const expected2Bis(expected2,expected2+3);
+ std::set<INTERP_KERNEL::NormalizedCellType> expected2Bis(expected2,expected2+3);
CPPUNIT_ASSERT(expected2Bis==types2);
//
f1->decrRef();
DataArrayIdType *cellCor,*nodeCor;
//First test mesh1
mesh1->checkGeoEquivalWith(mesh1,0,1e-12,cellCor,nodeCor);//deepEqual
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh1,1,1e-12,cellCor,nodeCor);//fastEqual
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh1,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
//Second test mesh1 and mesh2 are 2 different meshes instance
mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor);//deepEqual
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
//Third test : cell permutation by keeping the first the middle and the last as it is.
const mcIdType renum[]={0,2,1,3,4,5,6,8,7,9};
mesh2->renumberCells(renum,false);
CPPUNIT_ASSERT_THROW(mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor),INTERP_KERNEL::Exception);//deepEqual fails
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual do not see anything
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations
CPPUNIT_ASSERT(cellCor);
CPPUNIT_ASSERT_EQUAL(10,(int)cellCor->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)cellCor->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(renum,renum+10,cellCor->getConstPointer()));
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(nodeCor==0);
cellCor->decrRef();
- cellCor=nullptr;
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ cellCor=0;
+ CPPUNIT_ASSERT(nodeCor==0);
//4th test : cell and node permutation by keeping the first the middle and the last as it is.
mesh2->decrRef();
mesh2=build2DTargetMesh_3();
mesh2->renumberCells(renum,false);
mesh2->renumberNodes(renum2,11);
CPPUNIT_ASSERT_THROW(mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor),INTERP_KERNEL::Exception);//deepEqual fails
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual do not see anything
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations
CPPUNIT_ASSERT(cellCor);
CPPUNIT_ASSERT_EQUAL(10,(int)cellCor->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)nodeCor->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(renum2,renum2+11,nodeCor->getConstPointer()));
cellCor->decrRef();
- cellCor=nullptr;
+ cellCor=0;
nodeCor->decrRef();
- nodeCor=nullptr;
+ nodeCor=0;
//5th test : modification of the last cell to check fastCheck detection.
mesh2->decrRef();
mesh2=build2DTargetMesh_3();
}
catch(INTERP_KERNEL::Exception&) { isExcep=true; }
CPPUNIT_ASSERT(isExcep); isExcep=false;
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
try { mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual has detected something
}
catch(INTERP_KERNEL::Exception&) { isExcep=true; }
CPPUNIT_ASSERT(isExcep); isExcep=false;
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
mesh2->checkGeoEquivalWith(mesh1,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations
CPPUNIT_ASSERT(cellCor);
CPPUNIT_ASSERT_EQUAL(10,(int)cellCor->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)nodeCor->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(renum2,renum2+11,nodeCor->getConstPointer()));
cellCor->decrRef();
- cellCor=nullptr;
+ cellCor=0;
nodeCor->decrRef();
- nodeCor=nullptr;
+ nodeCor=0;
//
mesh1->decrRef();
mesh2->decrRef();
MEDCouplingUMesh *mesh2=build2DTargetMesh_1();
DataArrayIdType *cellCor,*nodeCor;
mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor!=nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor!=0);
const mcIdType expected1[9]={0, 1, 3, 4, 5, 6, 7, 8, 9};
for(int i=0;i<9;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],nodeCor->getIJ(i,0));
void MEDCouplingBasicsTest2::testCopyTinyStringsFromOnFields()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- std::size_t const nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
f->setMesh(m);
CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected());
void MEDCouplingBasicsTest2::testGetMaxValue1()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- std::size_t const nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
f->setMesh(m);
DataArrayDouble *a1=DataArrayDouble::New();
CPPUNIT_ASSERT_EQUAL(6,(int)f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
- auto *m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
+ MEDCouplingUMesh *m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen());
const double expected2[12]={0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,f2->getIJ(i,0),1e-13);
f2->decrRef();
//
- DataArrayIdType *d2I=nullptr;
+ DataArrayIdType *d2I=0;
DataArrayDouble *d2=array->maxPerTupleWithCompoId(d2I);
CPPUNIT_ASSERT_EQUAL(1,(int)d2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)d2->getNumberOfTuples());
mesh2->getCoords()->setInfoOnComponent(1,"");
CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
- double const tmp=mesh2->getCoords()->getIJ(0,3);
+ double tmp=mesh2->getCoords()->getIJ(0,3);
mesh2->getCoords()->setIJ(0,3,9999.);
CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(!mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
mesh2->getCoords()->setIJ(0,3,tmp);
CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
- mcIdType const tmp2=mesh2->getNodalConnectivity()->getIJ(0,4);
+ mcIdType tmp2=mesh2->getNodalConnectivity()->getIJ(0,4);
mesh2->getNodalConnectivity()->setIJ(0,4,0);
CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(!mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
#include "MEDCouplingBasicsTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
+#include <map>
+#include <vector>
namespace MEDCoupling
{
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingBasicsTest3.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingPointSet.hxx"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
-#include "InterpKernelException.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingMemArray.txx"
#include "MEDCouplingGaussLocalization.hxx"
-#include "NormalizedGeometricTypes"
-#include <algorithm>
#include <cmath>
-#include <cppunit/TestAssert.h>
-#include <cstddef>
-#include <vector>
-#include <sstream>
-#include <math.h>
-#include <set>
+#include <functional>
+#include <iterator>
using namespace MEDCoupling;
MEDCouplingUMesh *m2=build2DTargetMesh_1();
const mcIdType cells1[3]={2,3,4};
MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true);
- auto *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
+ MEDCouplingUMesh *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
CPPUNIT_ASSERT(m3);
m2->decrRef();
MEDCouplingUMesh *m4=build2DSourceMesh_1();
void MEDCouplingBasicsTest3::testFieldDoubleGetMinMaxValues2()
{
- MEDCouplingUMesh *m1=nullptr;
+ MEDCouplingUMesh *m1=0;
MEDCouplingUMesh *m2=build3DExtrudedUMesh_1(m1);
m1->decrRef();
CPPUNIT_ASSERT_EQUAL(18,(int)m2->getNumberOfCells());
a1->setInfoOnComponent(2,"cccc");
a1->setInfoOnComponent(3,"dddd");
const mcIdType arr2[6]={1,2,1,2,0,0};
- std::vector<std::size_t> const arr2V(arr2,arr2+6);
- auto *a2=static_cast<DataArrayDouble *>(a1->keepSelectedComponents(arr2V));
+ std::vector<std::size_t> arr2V(arr2,arr2+6);
+ DataArrayDouble *a2=static_cast<DataArrayDouble *>(a1->keepSelectedComponents(arr2V));
CPPUNIT_ASSERT_EQUAL(6,(int)a2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)a2->getNumberOfTuples());
CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(0))=="bbbb");
for(int i=0;i<30;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a2->getIJ(0,i),1e-14);
MCAuto<DataArrayInt> a3(a1->convertToIntArr());
- auto *a4=static_cast<DataArrayInt *>(a3->keepSelectedComponents(arr2V));
+ DataArrayInt *a4=static_cast<DataArrayInt *>(a3->keepSelectedComponents(arr2V));
CPPUNIT_ASSERT_EQUAL(6,(int)a4->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)a4->getNumberOfTuples());
CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb");
CPPUNIT_ASSERT_EQUAL((int)expected1[i],a4->getIJ(0,i));
// setSelectedComponents
const mcIdType arr3[2]={3,2};
- std::vector<std::size_t> const arr3V(arr3,arr3+2);
- auto *a5=static_cast<DataArrayDouble *>(a1->keepSelectedComponents(arr3V));
+ std::vector<std::size_t> arr3V(arr3,arr3+2);
+ DataArrayDouble *a5=static_cast<DataArrayDouble *>(a1->keepSelectedComponents(arr3V));
a5->setInfoOnComponent(0,"eeee");
a5->setInfoOnComponent(1,"ffff");
const mcIdType arr4[2]={1,2};
- std::vector<std::size_t> const arr4V(arr4,arr4+2);
+ std::vector<std::size_t> arr4V(arr4,arr4+2);
a2->setSelectedComponents(a5,arr4V);
CPPUNIT_ASSERT_EQUAL(6,(int)a2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)a2->getNumberOfTuples());
const mcIdType arr5[3]={2,3,6};
const mcIdType arr6[3]={2,7,5};
const mcIdType arr7[4]={2,1,4,6};
- std::vector<std::size_t> const arr5V(arr5,arr5+3);
- std::vector<std::size_t> const arr6V(arr6,arr6+3);
+ std::vector<std::size_t> arr5V(arr5,arr5+3);
+ std::vector<std::size_t> arr6V(arr6,arr6+3);
std::vector<std::size_t> arr7V(arr7,arr7+4);
CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr5V),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr6V),INTERP_KERNEL::Exception);
f1->checkConsistencyLight();
//
const mcIdType arr2[6]={1,2,1,2,0,0};
- std::vector<std::size_t> const arr2V(arr2,arr2+6);
+ std::vector<std::size_t> arr2V(arr2,arr2+6);
MEDCouplingFieldDouble *f2=f1->keepSelectedComponents(arr2V);
CPPUNIT_ASSERT(f2->getMesh()==f1->getMesh());
CPPUNIT_ASSERT(f2->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f2->getIJ(0,i),1e-14);
//setSelectedComponents
const mcIdType arr3[2]={3,2};
- std::vector<std::size_t> const arr3V(arr3,arr3+2);
+ std::vector<std::size_t> arr3V(arr3,arr3+2);
MEDCouplingFieldDouble *f5=f1->keepSelectedComponents(arr3V);
f5->setTime(6.7,8,9);
f5->getArray()->setInfoOnComponent(0,"eeee");
f5->getArray()->setInfoOnComponent(1,"ffff");
f5->checkConsistencyLight();
const mcIdType arr4[2]={1,2};
- std::vector<std::size_t> const arr4V(arr4,arr4+2);
+ std::vector<std::size_t> arr4V(arr4,arr4+2);
f2->setSelectedComponents(f5,arr4V);
CPPUNIT_ASSERT_EQUAL(6,(int)f2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
CPPUNIT_ASSERT(!((dbl->reprZip().find("Number of components : 1"))==std::string::npos));
std::ostringstream ret;
- dbl->writeVTK(ret,2,"file.tmp",nullptr);
+ dbl->writeVTK(ret,2,"file.tmp",0);
CPPUNIT_ASSERT(!((ret.str().find("<DataArray"))==std::string::npos));
CPPUNIT_ASSERT(!((ret.str().find("Float32"))==std::string::npos));
CPPUNIT_ASSERT(!((ret.str().find("16 15 14 13 12 11 10"))==std::string::npos));
CPPUNIT_ASSERT_EQUAL(ToIdType(9),c->getIJ(1,0));
CPPUNIT_ASSERT_EQUAL(ToIdType(11),c->getIJ(2,0));
c->decrRef();
- DataArrayIdType *cI=nullptr;
+ DataArrayIdType *cI=0;
mesh->getNodeIdsNearPoints(pts,3,1e-7,c,cI);
CPPUNIT_ASSERT_EQUAL(ToIdType(4),cI->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(ToIdType(4),c->getNumberOfTuples());
f->changeSpaceDimension(2);
//
const double center[2]={0.,0.};
- f->rotate(center,nullptr,M_PI/3);
+ f->rotate(center,0,M_PI/3);
MEDCouplingUMesh *g=c->buildExtrudedMesh(f,0);
g->checkConsistencyLight();
const double expected1[]={ 0.4330127018922193, 0.4330127018922193, 0.649519052838329, 1.2990381056766578, 1.299038105676658, 1.948557158514987, 2.1650635094610955, 2.1650635094610964, 3.2475952641916446, 3.031088913245533, 3.0310889132455352, 4.546633369868303 };
for(int i=0;i<15;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f3->getIJ(0,i),1e-12);
int dt,it;
- double const time=f3->getTime(dt,it);
+ double time=f3->getTime(dt,it);
CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,time,1e-14);
CPPUNIT_ASSERT_EQUAL(2,dt);
CPPUNIT_ASSERT_EQUAL(1,it);
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
const mcIdType pt[2]={1,3};
- auto *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(pt,pt+2,true);
+ MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(pt,pt+2,true);
DataArrayIdType *tmp;
CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp));
CPPUNIT_ASSERT_EQUAL(2,(int)tmp->getNumberOfTuples());
{
const char myName[]="Vitoo";
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- auto *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(nullptr,nullptr,true);
+ MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(0,0,true);
CPPUNIT_ASSERT_EQUAL(0,(int)m2->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,m2->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,m2->getMeshDimension());
MEDCouplingUMesh *m3=build3DSurfTargetMesh_1();
//
const mcIdType vec1[3]={0,2,3};
- auto *m2_2=(MEDCouplingUMesh *)m2->buildPartOfMySelf(vec1,vec1+3,false);
+ MEDCouplingUMesh *m2_2=(MEDCouplingUMesh *)m2->buildPartOfMySelf(vec1,vec1+3,false);
const mcIdType vec2[2]={1,1};
- auto *m3_2=(MEDCouplingUMesh *)m3->buildPartOfMySelf(vec2,vec2+2,false);
+ MEDCouplingUMesh *m3_2=(MEDCouplingUMesh *)m3->buildPartOfMySelf(vec2,vec2+2,false);
//
std::vector<const MEDCouplingUMesh *> ms(3);
std::vector<const MEDCouplingMesh *> ms2(3);
m4bis->decrRef();
//
const mcIdType vec3[5]={0,1,2,3,4};
- auto *m4_1=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec3,vec3+5,false);
+ MEDCouplingUMesh *m4_1=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec3,vec3+5,false);
m4_1->setName(m1->getName().c_str());
CPPUNIT_ASSERT(m4_1->isEqual(m1,1e-12));
m4_1->decrRef();
//
const mcIdType vec4[3]={5,6,7};
- auto *m4_2=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec4,vec4+3,false);
- DataArrayIdType *cellCor=nullptr;
- DataArrayIdType *nodeCor=nullptr;
+ MEDCouplingUMesh *m4_2=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec4,vec4+3,false);
+ DataArrayIdType *cellCor=0;
+ DataArrayIdType *nodeCor=0;
m4_2->checkGeoEquivalWith(m2_2,10,1e-12,cellCor,nodeCor);
- CPPUNIT_ASSERT(cellCor==nullptr);
- CPPUNIT_ASSERT(nodeCor==nullptr);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
m4_2->decrRef();
//
const mcIdType vec5[2]={8,9};
- auto *m4_3=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec5,vec5+2,false);
+ MEDCouplingUMesh *m4_3=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec5,vec5+2,false);
CPPUNIT_ASSERT_EQUAL(2,(int)m4_3->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,(int)m4_3->getNumberOfNodes());
m3_2->zipCoords();
CPPUNIT_ASSERT_EQUAL(4,(int)m->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(0,m->getMeshDimension());
- std::set<INTERP_KERNEL::NormalizedCellType> const types=m->getAllGeoTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> types=m->getAllGeoTypes();
CPPUNIT_ASSERT_EQUAL(1,(int)types.size());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POINT1,*types.begin());
for(int i=0;i<4;i++)
#include "MEDCouplingBasicsTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
+#include <map>
+#include <vector>
namespace MEDCoupling
{
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingBasicsTest4.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "InterpKernelException.hxx"
-#include "MEDCouplingDefinitionTime.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingGaussLocalization.hxx"
#include "MEDCouplingMultiFields.hxx"
#include "MEDCouplingFieldOverTime.hxx"
-#include "NormalizedGeometricTypes"
-#include <algorithm>
#include <cmath>
-#include <cppunit/TestAssert.h>
-#include <cstddef>
-#include <vector>
-#include <math.h>
+#include <functional>
+#include <iterator>
using namespace MEDCoupling;
MEDCouplingUMesh *m=build2DTargetMesh_1();
m->setDescription(text1);
CPPUNIT_ASSERT(std::string(m->getDescription())==text1);
- auto *m2=(MEDCouplingUMesh *)m->deepCopy();
+ MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCopy();
CPPUNIT_ASSERT(m->isEqual(m2,1e-12));
CPPUNIT_ASSERT(std::string(m2->getDescription())==text1);
m2->setDescription("ggg");
void MEDCouplingBasicsTest4::testMultiFields1()
{
MEDCouplingMultiFields *mfs=buildMultiFields_1();
- std::vector<MEDCouplingMesh *> const ms=mfs->getMeshes();
+ std::vector<MEDCouplingMesh *> ms=mfs->getMeshes();
std::vector<int> refs;
- std::vector<MEDCouplingMesh *> const dms=mfs->getDifferentMeshes(refs);
- std::vector<DataArrayDouble *> const das=mfs->getArrays();
+ std::vector<MEDCouplingMesh *> dms=mfs->getDifferentMeshes(refs);
+ std::vector<DataArrayDouble *> das=mfs->getArrays();
std::vector< std::vector<int> > refs2;
- std::vector<DataArrayDouble *> const das2=mfs->getDifferentArrays(refs2);
+ std::vector<DataArrayDouble *> das2=mfs->getDifferentArrays(refs2);
//
CPPUNIT_ASSERT_EQUAL(5,(int)ms.size());
CPPUNIT_ASSERT_EQUAL(2,(int)dms.size());
CPPUNIT_ASSERT_THROW(MEDCouplingFieldOverTime::New(fs),INTERP_KERNEL::Exception);
f4bis->setTime(2.7,20,21);
MEDCouplingFieldOverTime *fot=MEDCouplingFieldOverTime::New(fs);
- MEDCouplingDefinitionTime const dt=fot->getDefinitionTimeZone();
+ MEDCouplingDefinitionTime dt=fot->getDefinitionTimeZone();
std::vector<double> hs=dt.getHotSpotsTime();
CPPUNIT_ASSERT_EQUAL(6,(int)hs.size());
const double expected1[]={0.2,0.7,1.2,1.35,1.7,2.7};
dt3.unserialize(tmp1,tmp2);
CPPUNIT_ASSERT(dt2.isEqual(dt3));
//
- for(auto & f : fs)
- f->decrRef();
+ for(std::vector<MEDCouplingFieldDouble *>::iterator it=fs.begin();it!=fs.end();it++)
+ (*it)->decrRef();
fot->decrRef();
}
CPPUNIT_ASSERT(!m1->isEqual(m2,1e-12));
//
m1->setTime(10.34,55,12);
- auto *m3=(MEDCouplingUMesh *)m1->deepCopy();
+ MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->deepCopy();
CPPUNIT_ASSERT(m1->isEqual(m3,1e-12));
tmp3=m3->getTime(tmp1,tmp2);
CPPUNIT_ASSERT_EQUAL(55,tmp1);
CPPUNIT_ASSERT_EQUAL(8,tmp1);
CPPUNIT_ASSERT_EQUAL(100,tmp2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(5.67,tmp3,1e-12);
- auto *c=(MEDCouplingCMesh *)b->deepCopy();
+ MEDCouplingCMesh *c=(MEDCouplingCMesh *)b->deepCopy();
CPPUNIT_ASSERT(c->isEqual(b,1e-12));
tmp3=c->getTime(tmp1,tmp2);
CPPUNIT_ASSERT_EQUAL(8,tmp1);
std::vector<double> gsCoo1(1); gsCoo1[0]=0.2;
std::vector<double> refCoo1(2); refCoo1[0]=-1.0; refCoo1[1]=1.0;
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_SEG2,refCoo1,gsCoo1,wg1);
- std::vector<double> const wg2(wg1);
+ std::vector<double> wg2(wg1);
std::vector<double> gsCoo2(1); gsCoo2[0]=0.2;
std::vector<double> refCoo2(3); refCoo2[0]=-1.0; refCoo2[1]=1.0; refCoo2[2]=0.0;
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_SEG3,refCoo2,gsCoo2,wg2);
f->setMesh(m2);
std::vector<double> wg3(2); wg3[0]=0.3; wg3[1]=0.3;
const double tria3CooGauss[4]={ 0.1, 0.8, 0.2, 0.7 };
- std::vector<double> const gsCoo3(tria3CooGauss,tria3CooGauss+4);
+ std::vector<double> gsCoo3(tria3CooGauss,tria3CooGauss+4);
const double tria3CooRef[6]={ 0.0, 0.0, 1.0 , 0.0, 0.0, 1.0 };
- std::vector<double> const refCoo3(tria3CooRef,tria3CooRef+6);
+ std::vector<double> refCoo3(tria3CooRef,tria3CooRef+6);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,refCoo3,gsCoo3,wg3);
std::vector<double> wg4(3); wg4[0]=0.3; wg4[1]=0.3; wg4[2]=0.3;
const double tria6CooGauss[6]={ 0.3, 0.2, 0.2, 0.1, 0.2, 0.4 };
- std::vector<double> const gsCoo4(tria6CooGauss,tria6CooGauss+6);
+ std::vector<double> gsCoo4(tria6CooGauss,tria6CooGauss+6);
const double tria6CooRef[12]={0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.5, 0.0, 0.5, 0.5, 0.0, 0.5};
- std::vector<double> const refCoo4(tria6CooRef,tria6CooRef+12);
+ std::vector<double> refCoo4(tria6CooRef,tria6CooRef+12);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI6,refCoo4,gsCoo4,wg4);
std::vector<double> wg5(4); wg5[0]=0.3; wg5[1]=0.3; wg5[2]=0.3; wg5[3]=0.3;
const double quad4CooGauss[8]={ 0.3, 0.2, 0.2, 0.1, 0.2, 0.4, 0.15, 0.27 };
- std::vector<double> const gsCoo5(quad4CooGauss,quad4CooGauss+8);
+ std::vector<double> gsCoo5(quad4CooGauss,quad4CooGauss+8);
const double quad4CooRef[8]={-1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0};
- std::vector<double> const refCoo5(quad4CooRef,quad4CooRef+8);
+ std::vector<double> refCoo5(quad4CooRef,quad4CooRef+8);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,refCoo5,gsCoo5,wg5);
std::vector<double> wg6(4); wg6[0]=0.3; wg6[1]=0.3; wg6[2]=0.3; wg6[3]=0.3;
const double quad8CooGauss[8]={ 0.34, 0.16, 0.21, 0.3, 0.23, 0.4, 0.14, 0.37 };
- std::vector<double> const gsCoo6(quad8CooGauss,quad8CooGauss+8);
+ std::vector<double> gsCoo6(quad8CooGauss,quad8CooGauss+8);
const double quad8CooRef[16]={ -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, -1.0, 0.0};
- std::vector<double> const refCoo6(quad8CooRef,quad8CooRef+16);
+ std::vector<double> refCoo6(quad8CooRef,quad8CooRef+16);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD8,refCoo6,gsCoo6,wg6);
//
resToTest=f->getLocalizationOfDiscr();
//
std::vector<double> wg7(1); wg7[0]=0.3;
const double tetra4CooGauss[3]={0.34, 0.16, 0.21};
- std::vector<double> const gsCoo7(tetra4CooGauss,tetra4CooGauss+3);
+ std::vector<double> gsCoo7(tetra4CooGauss,tetra4CooGauss+3);
const double tetra4CooRef[12]={0.0,1.0,0.0, 0.0,0.0,1.0, 0.0,0.0,0.0, 1.0,0.0,0.0};
- std::vector<double> const refCoo7(tetra4CooRef,tetra4CooRef+12);
+ std::vector<double> refCoo7(tetra4CooRef,tetra4CooRef+12);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TETRA4,refCoo7,gsCoo7,wg7);
std::vector<double> wg8(1); wg8[0]=0.3;
const double tetra10CooGauss[3]={0.2, 0.3, 0.1};
- std::vector<double> const gsCoo8(tetra10CooGauss,tetra10CooGauss+3);
+ std::vector<double> gsCoo8(tetra10CooGauss,tetra10CooGauss+3);
const double tetra10CooRef[30]={0.0,1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0, 1.0,0.0,0.0, 0.0,0.5,0.0, 0.0,0.0,0.5, 0.0,0.5,0.5, 0.5,0.5,0.0, 0.5,0.0,0.0, 0.5,0.0,0.5};
- std::vector<double> const refCoo8(tetra10CooRef,tetra10CooRef+30);
+ std::vector<double> refCoo8(tetra10CooRef,tetra10CooRef+30);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TETRA10,refCoo8,gsCoo8,wg8);
std::vector<double> wg9(1); wg9[0]=0.3;
const double pyra5CooGauss[3]={0.2, 0.3, 0.1};
- std::vector<double> const gsCoo9(pyra5CooGauss,pyra5CooGauss+3);
+ std::vector<double> gsCoo9(pyra5CooGauss,pyra5CooGauss+3);
const double pyra5CooRef[15]={1.0,0.0,0.0, 0.0,1.0,0.0, -1.0,0.0,0.0, 0.0,-1.0,0.0, 0.0,0.0,1.0};
- std::vector<double> const refCoo9(pyra5CooRef,pyra5CooRef+15);
+ std::vector<double> refCoo9(pyra5CooRef,pyra5CooRef+15);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PYRA5,refCoo9,gsCoo9,wg9);
std::vector<double> wg10(1); wg10[0]=0.3;
const double pyra13CooGauss[3]={0.1, 0.2, 0.7};
- std::vector<double> const gsCoo10(pyra13CooGauss,pyra13CooGauss+3);
+ std::vector<double> gsCoo10(pyra13CooGauss,pyra13CooGauss+3);
const double pyra13CooRef[39]={1.0,0.0,0.0, 0.0,1.0,0.0,-1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,1.0,0.5,0.5,0.0,-0.5,0.5,0.0,-0.5,-0.5,0.0,0.5,-0.5,0.0,0.5,0.0,0.5,0.0,0.5,0.5,-0.5,0.0,0.5,0.0,-0.5,0.5};
- std::vector<double> const refCoo10(pyra13CooRef,pyra13CooRef+39);
+ std::vector<double> refCoo10(pyra13CooRef,pyra13CooRef+39);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PYRA13,refCoo10,gsCoo10,wg10);
std::vector<double> wg11(1); wg11[0]=0.3;
const double penta6CooGauss[3]={0.2, 0.3, 0.1};
- std::vector<double> const gsCoo11(penta6CooGauss,penta6CooGauss+3);
+ std::vector<double> gsCoo11(penta6CooGauss,penta6CooGauss+3);
const double penta6CooRef[18]={-1.0,1.0,0.0,-1.0,-0.0,1.0,-1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0};
- std::vector<double> const refCoo11(penta6CooRef,penta6CooRef+18);
+ std::vector<double> refCoo11(penta6CooRef,penta6CooRef+18);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PENTA6,refCoo11,gsCoo11,wg11);
std::vector<double> wg12(1); wg12[0]=0.3;
const double penta15CooGauss[3]={0.2, 0.3,0.15};
- std::vector<double> const gsCoo12(penta15CooGauss,penta15CooGauss+3);
+ std::vector<double> gsCoo12(penta15CooGauss,penta15CooGauss+3);
const double penta15CooRef[45]={-1.0,1.0,0.0,-1.0,0.0,1.0,-1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,-1.0,0.5,0.5,-1.0,0.0,0.5,-1.0,0.5,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.5,0.5,1.0,0.0, 0.5,1.0,0.5,0.0};
- std::vector<double> const refCoo12(penta15CooRef,penta15CooRef+45);
+ std::vector<double> refCoo12(penta15CooRef,penta15CooRef+45);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PENTA15,refCoo12,gsCoo12,wg12);
std::vector<double> wg13(1); wg13[0]=0.3;
const double hexa8CooGauss[3]={0.2,0.3,0.15};
- std::vector<double> const gsCoo13(hexa8CooGauss,hexa8CooGauss+3);
+ std::vector<double> gsCoo13(hexa8CooGauss,hexa8CooGauss+3);
const double hexa8CooRef[24]={-1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0};
- std::vector<double> const refCoo13(hexa8CooRef,hexa8CooRef+24);
+ std::vector<double> refCoo13(hexa8CooRef,hexa8CooRef+24);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_HEXA8,refCoo13,gsCoo13,wg13);
std::vector<double> wg14(1); wg14[0]=0.3;
const double hexa20CooGauss[3]={0.11,0.3,0.55};
- std::vector<double> const gsCoo14(hexa20CooGauss,hexa20CooGauss+3);
+ std::vector<double> gsCoo14(hexa20CooGauss,hexa20CooGauss+3);
const double hexa20CooRef[60]={-1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0,0.0,-1.0,-1.0,1.0,0.0,-1.0,0.0,1.0,-1.0,-1.0,0.0,-1.0,-1.0,-1.0,0.0,1.0,-1.0,0.0,1.0,1.0,0.0,-1.0,1.0,0.0,0.0,-1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,-1.0,0.0,1.0};
- std::vector<double> const refCoo14(hexa20CooRef,hexa20CooRef+60);
+ std::vector<double> refCoo14(hexa20CooRef,hexa20CooRef+60);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_HEXA20,refCoo14,gsCoo14,wg14);
//
resToTest=f->getLocalizationOfDiscr();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
f->setMesh(m);
DataArrayDouble *arr=DataArrayDouble::New();
- std::size_t const nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
arr->alloc(nbOfCells,3);
f->setArray(arr);
arr->decrRef();
f=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
f->setMesh(m);
arr=DataArrayDouble::New();
- mcIdType const nbOfNodes=m->getNumberOfNodes();
+ mcIdType nbOfNodes=m->getNumberOfNodes();
arr->alloc(nbOfNodes,3);
f->setArray(arr);
arr->decrRef();
m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn);
m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn);
m->finishInsertingCells();
- std::vector<const MEDCouplingUMesh *> const ms(4,m);
+ std::vector<const MEDCouplingUMesh *> ms(4,m);
MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(ms);
std::vector<mcIdType> temp(1,2);
m2->convertToPolyTypes(&temp[0],&temp[0]+temp.size());
void MEDCouplingBasicsTest4::testEmulateMEDMEMBDC1()
{
- MEDCouplingUMesh *m1=nullptr;
+ MEDCouplingUMesh *m1=0;
MEDCouplingUMesh *m=buildPointe_1(m1);
DataArrayIdType *da1=DataArrayIdType::New();
DataArrayIdType *da2=DataArrayIdType::New();
- DataArrayIdType *da3=nullptr;
- DataArrayIdType *da4=nullptr;
- DataArrayIdType *da5=nullptr;
- DataArrayIdType *da0=nullptr;
+ DataArrayIdType *da3=0;
+ DataArrayIdType *da4=0;
+ DataArrayIdType *da5=0;
+ DataArrayIdType *da0=0;
MEDCouplingUMesh *m2=m->emulateMEDMEMBDC(m1,da1,da2,da3,da4,da5,da0);
const mcIdType expected0[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46};
const mcIdType expected1[6]={1,32,29,23,41,36};
void MEDCouplingBasicsTest4::testGetLevArrPerCellTypes1()
{
- MEDCouplingUMesh *m1=nullptr;
+ MEDCouplingUMesh *m1=0;
MEDCouplingUMesh *m=buildPointe_1(m1);
m1->decrRef();
DataArrayIdType *d0=DataArrayIdType::New();
m1=m->buildDescendingConnectivity(d0,d1,d2,d3);
d0->decrRef(); d1->decrRef(); d2->decrRef(); d3->decrRef();
INTERP_KERNEL::NormalizedCellType order[2]={INTERP_KERNEL::NORM_TRI3,INTERP_KERNEL::NORM_QUAD4};
- DataArrayIdType *da1=nullptr;
+ DataArrayIdType *da1=0;
DataArrayIdType *da0=m1->getLevArrPerCellTypes(order,order+2,da1);
const mcIdType expected0[47]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1};
const mcIdType expected1[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46};
void MEDCouplingBasicsTest4::testSortCellsInMEDFileFrmt1()
{
- MEDCouplingUMesh *m1=nullptr;
+ MEDCouplingUMesh *m1=0;
MEDCouplingUMesh *m=buildPointe_1(m1);
- auto *m2=(MEDCouplingUMesh *)m->deepCopy();
- m->setCoords(nullptr);
+ MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCopy();
+ m->setCoords(0);
const mcIdType vals[16]={0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13};
DataArrayIdType *da=DataArrayIdType::New();
da->alloc(16,1);
DataArrayIdType *d=DataArrayIdType::New();
d->alloc(9,1);
std::copy(val1,val1+9,d->getPointer());
- DataArrayIdType *ee=nullptr,*f=nullptr,*g=nullptr;
+ DataArrayIdType *ee=0,*f=0,*g=0;
d->splitByValueRange(val2,val2+3,ee,f,g);
CPPUNIT_ASSERT_EQUAL(9,(int)ee->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)ee->getNumberOfComponents());
da->alloc(6,1);
const double array1[6]={2.3,1.2,1.3,2.3,2.301,0.8};
std::copy(array1,array1+6,da->getPointer());
- DataArrayIdType *c=nullptr,*cI=nullptr;
+ DataArrayIdType *c=0,*cI=0;
// nbOftuples=1
da->findCommonTuples(1e-2,-1,c,cI);
const mcIdType expected1[3]={0,3,4};
{
MEDCouplingUMesh *m0=build2DTargetMesh_1();
const mcIdType CellIds[2]={1,2};
- auto *m1=static_cast<MEDCouplingUMesh *>(m0->buildPartOfMySelf(CellIds,CellIds+2,true));
+ MEDCouplingUMesh *m1=static_cast<MEDCouplingUMesh *>(m0->buildPartOfMySelf(CellIds,CellIds+2,true));
mcIdType newNbOfNodes=-1;
DataArrayIdType *arr=m1->getNodeIdsInUse(newNbOfNodes);
const mcIdType expected[9]={-1,0,1,-1,2,3,-1,-1,-1};
m1c->setCoordsAt(1,coordY);
MEDCouplingUMesh *m1=m1c->buildUnstructured();
const mcIdType subPart1[3]={3,4,5};
- auto *m1bis=static_cast<MEDCouplingUMesh *>(m1->buildPartOfMySelf(subPart1,subPart1+3,false));
- auto *m2tmp=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
+ MEDCouplingUMesh *m1bis=static_cast<MEDCouplingUMesh *>(m1->buildPartOfMySelf(subPart1,subPart1+3,false));
+ MEDCouplingUMesh *m2tmp=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
const mcIdType subPart2[3]={0,1,2};
- auto *m2=static_cast<MEDCouplingUMesh *>(m2tmp->buildPartOfMySelf(subPart2,subPart2+3,false));
+ MEDCouplingUMesh *m2=static_cast<MEDCouplingUMesh *>(m2tmp->buildPartOfMySelf(subPart2,subPart2+3,false));
const double vec[2]={0.5,0.5};
m2->translate(vec);
// End of construction of input meshes m1bis and m2 -> start of specific part of the test
- DataArrayIdType *d1=nullptr,*d2=nullptr;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1bis,m2,1e-10,d1,d2);
const mcIdType expected1[8]={0,0,1,1,1,2,2,2};
const mcIdType expected2[8]={0,-1,0,1,-1,1,2,-1};
m2c->setCoordsAt(1,coordsY2);
MEDCouplingUMesh *m2=m2c->buildUnstructured();
//
- DataArrayIdType *d1=nullptr,*d2=nullptr;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2);
const mcIdType expected1[9]={0,0,1,1,2,2,3,4,5};
const mcIdType expected2[9]={0,2,1,3,1,3,2,3,3};
m2->setCoords(myCoords2);
myCoords2->decrRef();
//
- DataArrayIdType *d1=nullptr,*d2=nullptr;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2);
m3->unPolyze();
const mcIdType expected1[16]={0,1,1,1,2,3,3,3,4,5,5,5,6,7,7,7};
#include "MEDCouplingBasicsTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
+#include <map>
+#include <vector>
namespace MEDCoupling
{
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingBasicsTest5.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
-#include "InterpKernelException.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingPointSet.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingGaussLocalization.hxx"
#include "MEDCouplingMultiFields.hxx"
-#include "NormalizedGeometricTypes"
+#include "MEDCouplingFieldOverTime.hxx"
-#include <algorithm>
#include <cmath>
-#include <cppunit/TestAssert.h>
-#include <vector>
-#include <string>
-#include <utility>
-#include <math.h>
-#include <set>
+#include <functional>
+#include <iterator>
using namespace MEDCoupling;
m1->setCoords(myCoords1);
myCoords1->decrRef();
//
- auto *m11=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
+ MEDCouplingUMesh *m11=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
m11->tessellate2D(1.);
CPPUNIT_ASSERT(m11->getCoords()->isEqual(*m11->getCoords(),1e-12));
const mcIdType expected1[48]={5,0,3,11,1,5,3,4,12,2,1,11,5,5,15,3,0,5,6,16,4,3,15,5,5,5,0,7,19,5,6,5,19,7,8,20,5,0,1,23,7,5,1,2,24,8,7,23};
CPPUNIT_ASSERT(std::equal(expected2,expected2+9,m11->getNodalConnectivityIndex()->getConstPointer()));
m11->decrRef();
//
- auto *m12=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
+ MEDCouplingUMesh *m12=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
m12->tessellate2D(0.5);
CPPUNIT_ASSERT_EQUAL(ToIdType(41),m12->getNumberOfNodes());
const mcIdType expected3[60]={5,0,3,25,26,1,5,3,4,27,28,2,1,26,25,5,5,29,30,3,0,5,6,31,32,4,3,30,29,5,5,5,0,7,33,34,5,6,5,34,33,7,8,35,36,5,0,1,37,38,7,5,1,2,39,40,8,7,38,37};
m1->setCoords(myCoords);
myCoords->decrRef();
- auto *m2 = static_cast<MEDCouplingUMesh *>(m1->deepCopy());
+ MEDCouplingUMesh *m2 = static_cast<MEDCouplingUMesh *>(m1->deepCopy());
m2->tessellate2D(0.1);
CPPUNIT_ASSERT_NO_THROW(m2->checkConsistency(0.0)); // eps param not used
m1->decrRef();
m2->setCoords(myCoords2);
myCoords2->decrRef();
//
- DataArrayIdType *d1=nullptr,*d2=nullptr;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m2,m1,1e-10,d1,d2);
m3->unPolyze();
const mcIdType expected1[16]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7};
void MEDCouplingBasicsTest5::testGetCellIdsCrossingPlane1()
{
- MEDCouplingUMesh *mesh2D=nullptr;
+ MEDCouplingUMesh *mesh2D=0;
MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D);
const double vec[3]={-0.07,1.,0.07};
const double origin[3]={1.524,1.4552,1.74768};
void MEDCouplingBasicsTest5::testBuildSlice3D1()
{
- MEDCouplingUMesh *mesh2D=nullptr;
+ MEDCouplingUMesh *mesh2D=0;
MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D);
mesh2D->decrRef();
// First slice in the middle of 3D cells
const double vec1[3]={-0.07,1.,0.07};
const double origin1[3]={1.524,1.4552,1.74768};
- DataArrayIdType *ids=nullptr;
+ DataArrayIdType *ids=0;
MEDCouplingUMesh *slice1=mesh3D->buildSlice3D(origin1,vec1,1e-10,ids);
const mcIdType expected1[9]={1,3,4,7,9,10,13,15,16};
const mcIdType expected2[47]={5,42,41,40,43,44,5,42,46,45,41,5,44,43,40,47,48,5,49,42,44,50,5,49,51,46,42,5,50,44,48,52,5,53,49,50,54,5,53,55,51,49,5,54,50,52,56};
void MEDCouplingBasicsTest5::testBuildSlice3DSurf1()
{
- MEDCouplingUMesh *mesh2D=nullptr;
+ MEDCouplingUMesh *mesh2D=0;
MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D);
mesh2D->decrRef();
DataArrayIdType *a=DataArrayIdType::New(),*b=DataArrayIdType::New(),*c=DataArrayIdType::New(),*d=DataArrayIdType::New();
//
const double vec1[3]={-0.07,1.,0.07};
const double origin1[3]={1.524,1.4552,1.74768};
- DataArrayIdType *ids=nullptr;
+ DataArrayIdType *ids=0;
MEDCouplingUMesh *slice1=mesh2D->buildSlice3DSurf(origin1,vec1,1e-10,ids);
const mcIdType expected1[25]={6,8,10,11,13,18,19,21,23,25,26,38,41,43,47,49,52,53,64,67,69,73,75,78,79};
const mcIdType expected2[75]={1,40,41,1,42,41,1,40,43,1,44,43,1,42,44,1,45,41,1,42,46,1,46,45,1,47,40,1,47,48,1,44,48,1,49,42,1,44,50,1,49,50,1,49,51,1,51,46,1,48,52,1,50,52,1,53,49,1,50,54,1,53,54,1,53,55,1,55,51,1,52,56,1,54,56};
const char *comps[2]={"comp1","comp2"};
std::vector<std::string> compsCpp(comps,comps+2);
DataArrayDouble *da=DataArrayDouble::New();
- DataArrayDouble *tmp=nullptr;
+ DataArrayDouble *tmp=0;
da->setInfoAndChangeNbOfCompo(compsCpp);
da->setName("da");
da->alloc(7,2);
const char *comps[2]={"comp1","comp2"};
std::vector<std::string> compsCpp(comps,comps+2);
DataArrayIdType *da=DataArrayIdType::New();
- DataArrayIdType *tmp=nullptr;
+ DataArrayIdType *tmp=0;
da->setInfoAndChangeNbOfCompo(compsCpp);
da->setName("da");
da->alloc(7,2);
myCoords1->decrRef();
//
double vec1[3]={0.,0.,1.};
- auto *vec2=new double[2];
+ double *vec2=new double[2];
for(int i=0;i<18;i++)
{
vec2[0]=3.*cos(M_PI/9.*i);
vec2[1]=3.*sin(M_PI/9.*i);
- auto *m1Cpy=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
+ MEDCouplingUMesh *m1Cpy=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
m1Cpy->translate(vec2);
std::vector<mcIdType> res;
CPPUNIT_ASSERT_THROW(m1Cpy->are2DCellsNotCorrectlyOriented(vec1,false,res),INTERP_KERNEL::Exception);
myCoords3D->decrRef();
mesh3D->checkConsistencyLight();
//
- auto *mesh3D_2=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCopy());
- auto *mesh2D_2=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
- auto *mesh3D_4=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCopy());
- auto *mesh2D_4=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
+ MEDCouplingUMesh *mesh3D_2=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCopy());
+ MEDCouplingUMesh *mesh2D_2=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
+ MEDCouplingUMesh *mesh3D_4=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCopy());
+ MEDCouplingUMesh *mesh2D_4=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
DataArrayIdType *renumNodes=DataArrayIdType::New();
- mcIdType const oldNbOf3DNodes=mesh3D->getNumberOfNodes();
+ mcIdType oldNbOf3DNodes=mesh3D->getNumberOfNodes();
renumNodes->alloc(mesh2D->getNumberOfNodes(),1);
renumNodes->iota(oldNbOf3DNodes);
DataArrayDouble *coo=DataArrayDouble::Aggregate(mesh3D->getCoords(),mesh2D->getCoords());
mesh3D->setCoords(coo);
mesh2D->setCoords(coo);
coo->decrRef();
- auto *mesh2D_3=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
+ MEDCouplingUMesh *mesh2D_3=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
mesh2D_3->shiftNodeNumbersInConn(oldNbOf3DNodes);
mesh2D->renumberNodesInConn(renumNodes->getConstPointer());
renumNodes->decrRef();
//
DataArrayIdType *da1,*da2;
mesh3D->checkGeoEquivalWith(mesh3D_2,10,1e-12,da1,da2);
- CPPUNIT_ASSERT(da1==nullptr);
+ CPPUNIT_ASSERT(da1==0);
CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
const mcIdType expected1[8]={8,11,12,9,4,5,6,7};
da2->decrRef();
//
mesh2D->checkGeoEquivalWith(mesh2D_2,10,1e-12,da1,da2);
- CPPUNIT_ASSERT(da1==nullptr);
+ CPPUNIT_ASSERT(da1==0);
CPPUNIT_ASSERT_EQUAL(9,(int)da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents());
for(mcIdType i=0;i<9;i++)
da2->decrRef();
//
const double vect[3]={1.,0.,0.};
- auto *mesh2D_5=dynamic_cast<MEDCouplingUMesh *>(mesh2D_4->deepCopy());
+ MEDCouplingUMesh *mesh2D_5=dynamic_cast<MEDCouplingUMesh *>(mesh2D_4->deepCopy());
mesh2D_5->translate(vect);
std::vector<MEDCouplingUMesh *> meshes(3);
meshes[0]=mesh3D_4; meshes[1]=mesh2D_4; meshes[2]=mesh2D_5;
void MEDCouplingBasicsTest5::testComputeNeighborsOfCells1()
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
- DataArrayIdType *d1=nullptr,*d2=nullptr;
+ DataArrayIdType *d1=0,*d2=0;
m->computeNeighborsOfCells(d1,d2);
CPPUNIT_ASSERT_EQUAL(6,(int)d2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(10,(int)d1->getNumberOfTuples());
{
const double values1[12]={1.,2.,3.,-0.9,2.1,3.,1.3,1.7,3.,1.,1.8,3.};
DataArrayDouble *d1=DataArrayDouble::New();
- auto *res=new double[2*3];
+ double *res=new double[2*3];
CPPUNIT_ASSERT_THROW(d1->getMinMaxPerComponent(res),INTERP_KERNEL::Exception);
d1->alloc(4,3);
std::copy(values1,values1+12,d1->getPointer());
MEDCouplingUMesh *m1=build2DTargetMesh_1();
const mcIdType cells1[3]={2,3,4};
MEDCouplingPointSet *m2_1=m1->buildPartOfMySelf(cells1,cells1+3,true);
- auto *m2=dynamic_cast<MEDCouplingUMesh *>(m2_1);
- DataArrayIdType *arr=nullptr;
+ MEDCouplingUMesh *m2=dynamic_cast<MEDCouplingUMesh *>(m2_1);
+ DataArrayIdType *arr=0;
CPPUNIT_ASSERT(m2);
// no permutation policy 0
CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,0,arr));
m2_1=m1->buildPartOfMySelf(cells2,cells2+2,true);
m2=dynamic_cast<MEDCouplingUMesh *>(m2_1);
CPPUNIT_ASSERT(m2);
- arr=nullptr;
+ arr=0;
// no permutation policy 0
CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,0,arr));
CPPUNIT_ASSERT_EQUAL(2,(int)arr->getNumberOfTuples());
MEDCouplingUMesh *m=build2DTargetMesh_1();
const mcIdType part0[3]={2,3,4};
const mcIdType part1[2]={0,1};
- auto *m1=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(part0,part0+3));
- auto *m2=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(part1,part1+2));
+ MEDCouplingUMesh *m1=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(part0,part0+3));
+ MEDCouplingUMesh *m2=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(part1,part1+2));
std::vector<const MEDCouplingUMesh *> v(3); v[0]=m; v[1]=m1; v[2]=m2;
MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshes(v);
const mcIdType renum[10]={5,2,9,6,4,7,0,1,3,8};
void MEDCouplingBasicsTest5::testBuildSlice3D2()
{
- MEDCouplingUMesh *mesh2D=nullptr;
+ MEDCouplingUMesh *mesh2D=0;
MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D);
mesh2D->decrRef();
// First slice in the middle of 3D cells
const double vec1[3]={-0.07,1.,0.07};
const double origin1[3]={1.524,1.4552,1.74768};
- DataArrayIdType *ids=nullptr;
+ DataArrayIdType *ids=0;
MEDCouplingUMesh *slice1=mesh3D->buildSlice3D(origin1,vec1,1e-10,ids);
//
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
CPPUNIT_ASSERT(f2->getArray()->isEqual(*arr2,1e-12));
CPPUNIT_ASSERT(slice1->isEqual(f2->getMesh(),1e-12));
int a,b;
- double const c=f2->getTime(a,b);
+ double c=f2->getTime(a,b);
CPPUNIT_ASSERT_EQUAL(6,a);
CPPUNIT_ASSERT_EQUAL(7,b);
CPPUNIT_ASSERT_DOUBLES_EQUAL(4.5,c,1e-12);
const mcIdType expected3[18]={0,1,2,3,4,5,9,10,14,15,19,20,24,25,26,27,28,29};
CPPUNIT_ASSERT_EQUAL(ToIdType(18),ids->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected3,expected3+18,ids->getConstPointer()));
- auto *part=dynamic_cast<MEDCouplingUMesh *>(umesh->buildFacePartOfMySelfNode(ids->begin(),ids->end(),true));
+ MEDCouplingUMesh *part=dynamic_cast<MEDCouplingUMesh *>(umesh->buildFacePartOfMySelfNode(ids->begin(),ids->end(),true));
part->setName(skin->getName().c_str());
CPPUNIT_ASSERT(part->isEqual(skin,1e-12));
- auto *part2=dynamic_cast<MEDCouplingUMesh *>(part->buildPartOfMySelfSlice(1,18,2,true));
+ MEDCouplingUMesh *part2=dynamic_cast<MEDCouplingUMesh *>(part->buildPartOfMySelfSlice(1,18,2,true));
DataArrayIdType *ids2=DataArrayIdType::Range(0,18,2);
part->setPartOfMySelf(ids2->begin(),ids2->end(),*part2);
ids2->decrRef();
std::set<INTERP_KERNEL::NormalizedCellType> s; s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4);
CPPUNIT_ASSERT(s==m->getAllGeoTypes());
const mcIdType ids1[3]={0,3,4};
- auto *part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(ids1,ids1+3,true));
+ MEDCouplingUMesh *part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(ids1,ids1+3,true));
part->simplexize(0)->decrRef();
const mcIdType ids2[3]={1,2,5};
- auto *part2=static_cast<MEDCouplingUMesh *>(part->buildPartOfMySelf(ids2,ids2+3,true));
+ MEDCouplingUMesh *part2=static_cast<MEDCouplingUMesh *>(part->buildPartOfMySelf(ids2,ids2+3,true));
m->setPartOfMySelf(ids1,ids1+3,*part2);
const mcIdType expected1[20]={3,0,4,1,3,1,4,2,3,4,5,2,3,6,7,4,3,7,5,4};
CPPUNIT_ASSERT(std::equal(expected1,expected1+20,m->getNodalConnectivity()->getConstPointer()));
const double targetPointCoordsX[40]={-0.5,-0.45,-0.4,-0.35,-0.3,-0.25,-0.2,-0.15,-0.1,-0.05,-6.93889390391e-17,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.0,1.05,1.1,1.15,1.2,1.25,1.3,1.35,1.4,1.45};
const double targetFieldValsExpected[40]={2.975379475824351, 2.95613491917003, 2.936890362515361, 2.917645805861018, 2.898401249206574, 2.879156692552137, 2.859912135897732, 2.840667579243201, 2.821423022588731, 2.802178465934342, 2.78293390927989, 2.763689352625457, 2.744444795971001, 2.725209522098197, 2.709077577124666, 2.706677252549218, 2.727467797847971, 2.713338094723676, 2.671342424824244, 2.664877370146978, 2.653840141412181, 2.619607861392791, 2.569777214476479, 2.513263929794591, 2.450732752808528, 2.368313560985155, 2.250909795670307, 2.098194272085416, 1.954257891732065, 1.895040660973802, 1.865256788315972, 1.835475248687992, 1.80569370905998, 1.775912169431971, 1.746130629803976, 1.716349090175918, 1.686567550547855, 1.656786010919941, 1.627004471291988, 1.597222931663817};
//
- int const nbOfInputPoints=10;
+ int nbOfInputPoints=10;
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES_KR,ONE_TIME);
DataArrayDouble *srcArrX=DataArrayDouble::New();
srcArrX->alloc(nbOfInputPoints,1);
f->setArray(srcVals);
f->checkConsistencyLight();
//
- auto *res0=new double[1];
+ double *res0=new double[1];
f->getValueOn(targetPointCoordsX,res0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(targetFieldValsExpected[0],res0[0],1e-10);
delete [] res0;
m2->setConnectivity(conn,connI,true);
coords->decrRef(); conn->decrRef(); connI->decrRef();
//
- DataArrayIdType *d1=nullptr,*d2=nullptr;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2);
CPPUNIT_ASSERT_EQUAL(105,(int)m3->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(105,(int)d1->getNumberOfTuples());
m2->setConnectivity(conn,connI,true);
coords->decrRef(); conn->decrRef(); connI->decrRef();
//
- DataArrayIdType *d1=nullptr,*d2=nullptr;
+ DataArrayIdType *d1=0,*d2=0;
MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2);
CPPUNIT_ASSERT_EQUAL(4,(int)m3->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(4,(int)d1->getNumberOfTuples());
void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp7()
{
- double const eps = 1.0e-8;
+ double eps = 1.0e-8;
// coordinates circle - SEE getCircle() on the Python side
DataArrayDouble *coords1=DataArrayDouble::New();
const double coordsData1[16]={0.5328427124746189, -0.08284271247461905, -0.03284271247461901, 0.4828427124746191, -0.03284271247461906, -0.082842712474619, 0.5328427124746191, 0.482842712474619};
m2->setConnectivity(conn2,connI2,true);
coords2->decrRef(); conn2->decrRef(); connI2->decrRef();
- DataArrayIdType * resToM1 = nullptr, * resToM2 = nullptr;
+ DataArrayIdType * resToM1 = 0, * resToM2 = 0;
MEDCouplingUMesh *m_intersec=MEDCouplingUMesh::Intersect2DMeshes(m2, m1, eps, resToM1, resToM2);
m_intersec->zipCoords();
DataArrayIdType *da3=DataArrayIdType::New(); da3->useArray(tab3,false,DeallocType::CPP_DEALLOC,3,1);
DataArrayIdType *da4=DataArrayIdType::New(); da4->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1);
//
- DataArrayIdType *a=nullptr;
+ DataArrayIdType *a=0;
a=da1->buildSubstractionOptimized(da2);
CPPUNIT_ASSERT_EQUAL(4,(int)a->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents());
c->decrRef();
m->checkConsistency();
//
- auto *m1=static_cast<MEDCouplingUMesh *>(m->deepCopy());
+ MEDCouplingUMesh *m1=static_cast<MEDCouplingUMesh *>(m->deepCopy());
DataArrayIdType *d1=m1->simplexize(INTERP_KERNEL::PLANAR_FACE_5);
m1->checkConsistency();
MEDCouplingFieldDouble *f1=m1->getMeasureField(ON_CELLS);
m1->decrRef();
d1->decrRef();
//
- auto *m2=static_cast<MEDCouplingUMesh *>(m->deepCopy());
+ MEDCouplingUMesh *m2=static_cast<MEDCouplingUMesh *>(m->deepCopy());
DataArrayIdType *d2=m2->simplexize(INTERP_KERNEL::PLANAR_FACE_6);
m2->checkConsistency();
MEDCouplingFieldDouble *f2=m2->getMeasureField(ON_CELLS);
#include "MEDCouplingBasicsTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
+#include <map>
+#include <vector>
namespace MEDCoupling
{
//
// Author : Anthony Geay (CEA/DEN)
-#include "MCIdType.hxx"
-
static mcIdType connITT[201]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1029, 1058, 1087, 1116, 1145, 1174, 1203,
1232, 1261, 1290, 1319, 1348, 1377, 1406, 1435, 1464, 1493, 1522, 1551, 1580, 1609, 1638, 1667, 1696, 1725, 1754, 1783, 1812, 1841, 1870, 1899,
1928, 1957, 1986, 2015, 2044, 2073, 2102, 2131, 2160, 2189, 2218, 2247, 2276, 2305, 2334, 2363, 2392, 2421, 2450, 2479, 2508, 2537, 2566, 2595,
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingBasicsTestInterp.hxx"
-#include "MEDCouplingNormalizedUnstructuredMesh.txx"
-#include "Interpolation2D.hxx"
-#include "InterpolationOptions.hxx"
-#include "MCType.hxx"
-#include "Interpolation3D.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingNormalizedCartesianMesh.hxx"
-#include "InterpKernelException.hxx"
-#include "InterpolationCC.hxx"
-#include "InterpolationCU.hxx"
-#include "Interpolation1D.hxx"
-#include "Interpolation2D1D.hxx"
-#include "Interpolation2D3D.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "Interpolation2D.txx"
#include "Interpolation3DSurf.hxx"
#include "Interpolation3D.txx"
#include "Interpolation2D1D.txx"
#include "InterpolationCC.txx"
#include "InterpolationCU.txx"
#include "Interpolation2DCurve.hxx"
+#include "Interpolation1D.txx"
+#include "MEDCouplingNormalizedUnstructuredMesh.txx"
#include "MEDCouplingNormalizedCartesianMesh.txx"
-#include "NormalizedGeometricTypes"
#include <cmath>
-#include <cppunit/TestAssert.h>
-#include <math.h>
-#include <vector>
-#include <map>
+#include <functional>
using namespace MEDCoupling;
-using IntersectionMatrix = int;
+typedef std::vector<std::map<mcIdType,double> > IntersectionMatrix;
void MEDCouplingBasicsTestInterp::test2DInterpP0P0_1()
{
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
std::vector<std::map<mcIdType,double> > res;
- INTERP_KERNEL::IntersectionType const types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Convex, INTERP_KERNEL::Geometric2D};
- for(auto & type : types)
+ INTERP_KERNEL::IntersectionType types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Convex, INTERP_KERNEL::Geometric2D};
+ for(int i=0;i<3;i++)
{
myInterpolator.setPrecision(1e-12);
- myInterpolator.setIntersectionType(type);
+ myInterpolator.setIntersectionType(types[i]);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[0][0],1e-12);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
std::vector<std::map<mcIdType,double> > res;
- INTERP_KERNEL::IntersectionType const types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
- for(auto & type : types)
+ INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
+ for(int i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
- myInterpolator.setIntersectionType(type);
+ myInterpolator.setIntersectionType(types[i]);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[0][0],1e-12);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
std::vector<std::map<mcIdType,double> > res;
- INTERP_KERNEL::IntersectionType const types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
- for(auto & type : types)
+ INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
+ for(mcIdType i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
- myInterpolator.setIntersectionType(type);
+ myInterpolator.setIntersectionType(types[i]);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
std::vector<std::map<mcIdType,double> > res;
- INTERP_KERNEL::IntersectionType const types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
- for(auto & type : types)
+ INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
+ for(int i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
- myInterpolator.setIntersectionType(type);
+ myInterpolator.setIntersectionType(types[i]);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1");
CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.08333333333333334,res[0][0],1.e-12);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
std::vector<std::map<mcIdType,double> > res;
- INTERP_KERNEL::IntersectionType const types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
+ INTERP_KERNEL::IntersectionType types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
for(int i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
- for(auto & type : types)
+ for(int i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
- myInterpolator.setIntersectionType(type);
+ myInterpolator.setIntersectionType(types[i]);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[0][0],1e-12);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
- for(auto & type : types)
+ for(int i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
- myInterpolator.setIntersectionType(type);
+ myInterpolator.setIntersectionType(types[i]);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25*sqrt(2.),res[0][0],1e-12);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
- for(auto & type : types)
+ for(int i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
- myInterpolator.setIntersectionType(type);
+ myInterpolator.setIntersectionType(types[i]);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1");
CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.08333333333333334*sqrt(2.),res[0][0],1.e-12);
{
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
std::vector<std::map<mcIdType,double> > res;
- double const vecTrans[3]={0.,0.,1.e-10};
- double const vec[3]={0.,-1.,0.};
- double const pt[3]={-0.3,-0.3,5.e-11};
+ double vecTrans[3]={0.,0.,1.e-10};
+ double vec[3]={0.,-1.,0.};
+ double pt[3]={-0.3,-0.3,5.e-11};
const int N=32;
const double deltaA=M_PI/N;
myInterpolator.setPrecision(1e-12);
std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( int i = 0; i < 4; ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
res.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( int i = 0; i < 4; ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
res.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( int i = 0; i < 4; ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
res.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( int i = 0; i < 4; ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
res.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( int i = 0; i < 4; ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
res.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( int i = 0; i < 4; ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
res.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( int i = 0; i < 4; ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
res.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
std::vector<std::map<mcIdType,double> > res;
myInterpolator.setPrecision(1e-12);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24};
- for (auto & i : sp)
+ for ( int i = 0; i < 3; ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
res.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( int i = 0; i < 4; ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
res.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
myInterpolator.setPrecision(1e-12);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1");
CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
- double const res3D[8][28]= {{124999.999883775978, 245370.370390364464, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 203703.703634892299, 187500.000094145857, 0.0, 0.0, 4629.6296266718, 0.0, 215277.777751402784, 209722.222322299582, 0.0, 0.0, 0.0, 0.0, 104166.666590829205, 121296.296368812196, 0.0, 250000.000003472145},
+ double res3D[8][28]= {{124999.999883775978, 245370.370390364464, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 203703.703634892299, 187500.000094145857, 0.0, 0.0, 4629.6296266718, 0.0, 215277.777751402784, 209722.222322299582, 0.0, 0.0, 0.0, 0.0, 104166.666590829205, 121296.296368812196, 0.0, 250000.000003472145},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 120370.370368827047, 0.0, 0.0, 38888.888897777797, 0.0, 0.0, 45370.3703701697596, 0.0, 0.0, 45370.3703701697596, 83333.3333263888926, 0.0},
{0.0, 0.0, 0.0, 97222.2222222221753, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 97222.2222222221608, 0.0, 97222.2222222222044, 41666.6666666666642, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 277777.777787084982, 199074.074074073927, 0.0, 0.0, 0.0, 4629.62962962962774, 0.0, 321759.259254934732, 83333.3333333333139, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4629.62962667180363, 0.0, 0.0, 251388.88888319055, 194444.444454861077, 0.0, 79629.6296194135939, 250000.000003472145, 0.0, 0.0, 0.0, 0.0},
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
std::vector<std::map<mcIdType,double> > res;
- INTERP_KERNEL::IntersectionType const types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D};
- for(auto & type : types)
+ INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D};
+ for(int i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
- myInterpolator.setIntersectionType(type);
+ myInterpolator.setIntersectionType(types[i]);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666669,res[0][0],1e-12);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
std::vector<std::map<mcIdType,double> > res;
INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D};
- for(auto & type : types)
+ for(int i=0;i<2;i++)
{
myInterpolator.setPrecision(1e-12);
- myInterpolator.setIntersectionType(type);
+ myInterpolator.setIntersectionType(types[i]);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666669*sqrt(2.),res[0][0],1e-12);
targetMesh->decrRef();
}
+#include <iomanip>
void MEDCouplingBasicsTestInterp::test3DInterpP1P0Bary_1()
{
MEDCouplingUMesh *sourceMesh=build3DSourceMesh_2();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
- double const res3D[5][28]={{104166.66658918398, 885416.666685817763, 135416.666666666541, 36458.3333333335031, 31249.9999999999018, 145833.333333333256, 41666.6666666667516, 124999.999999999971, 177083.333326388849, 0.0, 31249.9999999999636, 0.0, 41666.666620792399, 159722.22229009436, 0.0, 0.0, 41666.6666631944681, 125000, 43499.2283723790752, 164351.851924000395, 36458.3333372396883, 0.0, 0.0, 125000.000001736029, 34722.2221800900952, 13599.5370788455439, 0.0, 167438.27159690368},
+ double res3D[5][28]={{104166.66658918398, 885416.666685817763, 135416.666666666541, 36458.3333333335031, 31249.9999999999018, 145833.333333333256, 41666.6666666667516, 124999.999999999971, 177083.333326388849, 0.0, 31249.9999999999636, 0.0, 41666.666620792399, 159722.22229009436, 0.0, 0.0, 41666.6666631944681, 125000, 43499.2283723790752, 164351.851924000395, 36458.3333372396883, 0.0, 0.0, 125000.000001736029, 34722.2221800900952, 13599.5370788455439, 0.0, 167438.27159690368},
{0.0, 41666.6664479170649, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 125000.000161457952, 0.0, 0.0, 0.0, 0.0, 111111.11112005508, 0.0, 0.0, 291666.666656249959, 41666.6666666666933, 6944.4444415638809, 270833.333520485845, 0.0, 0.0, 124999.999989583303, 41666.6665798612958, 20833.3333186342825, 145833.333354303701, 83333.3333263888198, 27777.7777501651799},
{0.0, 93750.0000000000728, 125000.000000000058, 0.0, 0.0, 72916.666666666526, 291666.666666666628, 41666.6666666667152, 197916.66666666657, 166666.666666666802, 218750.000000000116, 41666.6666666665697, 0.0, 0.0, 0.0, 0.0, 0.0, 41666.6666666666861, 0.0, 0.0, 0.0, 0.0, 0.0, 41666.6666666666642, 0.0, 0.0, 0.0, 0.0},
{72916.6666484848247, 82465.2777799315081, 0.0, 0.0, 217447.916666666686, 197916.666666666802, 0.0, 41666.6666666666715, 0.0, 0.0, 0.0, 0.0, 290364.583310396119, 125000.000018181803, 41666.6666666666351, 166666.666666666599, 0.0, 41666.6666666665551, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 27777.7777734705051, 0.0, 0.0, 27777.7778028684952},
CPPUNIT_ASSERT_DOUBLES_EQUAL(6., matrix[1][6],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(3., matrix[1][7],1e-12);
- INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces = myInterpolator.retrieveDuplicateFaces();
+ INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
CPPUNIT_ASSERT_EQUAL(1,(int)duplicateFaces.size());
INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces;
myInterpolator.setPrecision(1e-12);
std::vector<std::map<int,double> > matrix;
INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
- for (auto & i : sp)
+ for ( size_t i = 0; i < sizeof(sp)/sizeof(sp[0]); ++i )
{
- myInterpolator.setSplittingPolicy( i );
+ myInterpolator.setSplittingPolicy( sp[i] );
matrix.clear();
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0");
CPPUNIT_ASSERT_DOUBLES_EQUAL(80. ,matrix[2][5],1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(112. ,matrix[2][6],1e-12);
- INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces = myInterpolator.retrieveDuplicateFaces();
+ INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
CPPUNIT_ASSERT_EQUAL(3,(int)duplicateFaces.size());
INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces;
#include "MEDCouplingBasicsTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
+#include <map>
+#include <vector>
namespace MEDCoupling
{
//
// Author : Anthony Geay (EDF R&D)
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "InterpKernelException.hxx"
#include "MEDCouplingBasicsTest.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingPointSet.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingMemArray.txx"
#include "MEDCouplingMultiFields.hxx"
-#include <vector>
-#include <stdio.h>
-#include <cppunit/TestAssert.h>
-#include <algorithm>
-#include <cmath>
-#include "NormalizedGeometricTypes"
-#include <math.h>
-#include <cstdlib>
void CppExample_MEDCouplingFieldDouble_WriteVTK()
field2->applyFunc("x + 5"); // "translate" field2
// concatenate field1 and field2
- MCAuto<MEDCouplingFieldDouble> const field3 =
+ MCAuto<MEDCouplingFieldDouble> field3 =
MEDCouplingFieldDouble::MergeFields( field1, field2 );
std::vector<const MEDCouplingFieldDouble *> fields( 2 );
fields[0] = field1;
fields[1] = field2;
- MCAuto<MEDCouplingFieldDouble> const field4 =
+ MCAuto<MEDCouplingFieldDouble> field4 =
MEDCouplingFieldDouble::MergeFields( fields );
//! [CppSnippet_MEDCouplingFieldDouble_MergeFields_1]
}
// transform the field to a 3D vector field
const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10";
const char* varNames[2] = { "a", "b" }; // names used to refer to X and Y components
- std::vector<std::string> const varNamesVec( varNames, varNames+2 );
+ std::vector<std::string> varNamesVec( varNames, varNames+2 );
field->applyFuncNamedCompo( 3, varNamesVec, func ); // require 3 components
CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components as required
//! [CppSnippet_MEDCouplingFieldDouble_applyFunc3_1]
field->setMesh( mesh );
const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10";
const char* varNames[2] = { "a", "b" }; // names used to refer to X and Y coord components
- std::vector<std::string> const varNamesVec( varNames, varNames+2 );
+ std::vector<std::string> varNamesVec( varNames, varNames+2 );
field->fillFromAnalyticNamedCompo( 3, varNamesVec, func );
//! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_2]
//! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_3]
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
- double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
+ double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )"
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
- double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
+ double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )"
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
- double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
+ double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )"
//! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_2]
const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10";
const char* varNames[2] = { "a", "b" }; // names used to refer to X and Y coord components
- std::vector<std::string> const varNamesVec( varNames, varNames+2 );
+ std::vector<std::string> varNamesVec( varNames, varNames+2 );
MCAuto<MEDCouplingFieldDouble> field =
mesh->fillFromAnalyticNamedCompo( MEDCoupling::ON_CELLS, 3, varNamesVec, func );
//! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_2]
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
- double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
+ double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )"
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
- double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
+ double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )"
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
- double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
+ double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a"
CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )"
(MEDCouplingUMesh*) mesh1->buildPartOfMySelf( cells2, cells2+3, true );
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2]
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_3]
- int const compType = 0; // the strongest policy
+ int compType = 0; // the strongest policy
DataArrayIdType *corr2to1, *corr1to2;
// a larger mesh1 includes a smaller mesh2
CPPUNIT_ASSERT( mesh1->areCellsIncludedIn( mesh2, compType, corr2to1 ));
//! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_1]
//! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_2]
const mcIdType cellIds[2]={1,2};
- auto* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true);
- auto* mesh3=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,false);
+ MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true);
+ MEDCouplingUMesh* mesh3=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,false);
CPPUNIT_ASSERT( coordsArr->isEqual( *mesh2->getCoords(), 1e-13 )); // same nodes
CPPUNIT_ASSERT( !coordsArr->isEqual( *mesh3->getCoords(), 1e-13 )); // different nodes
for ( mcIdType i = 0; i < 2; ++i )
//! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_1]
//! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_2]
const mcIdType cellIds[2]={1,2};
- auto* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true);
+ MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true);
DataArrayIdType *arr=mesh2->zipCoordsTraducer();
CPPUNIT_ASSERT_EQUAL( ToIdType(4), mesh2->getNumberOfNodes() ); // nb of nodes decreased
CPPUNIT_ASSERT_EQUAL( mesh->getNumberOfNodes(), arr->getNumberOfTuples() );
//! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_1]
//! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_2]
const mcIdType cellIds[2]={1,2};
- auto* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true);
+ MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true);
mcIdType newNbOfNodes = 0;
DataArrayIdType *arr=mesh2->getNodeIdsInUse( newNbOfNodes );
const mcIdType idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1};
std::copy(array2,array2+12,da->getPointer());
//! [CppSnippet_DataArrayDouble_findCommonTuples1]
//! [CppSnippet_DataArrayDouble_findCommonTuples2]
- DataArrayIdType *c=nullptr,*cI=nullptr;
+ DataArrayIdType *c=0,*cI=0;
da->findCommonTuples(1.01e-1,-1,c,cI);
const mcIdType expected3[5]={0,3,4,1,2};
CPPUNIT_ASSERT_EQUAL(ToIdType(6),f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
- auto *m2C=dynamic_cast<MEDCoupling::MEDCouplingUMesh *>(const_cast<MEDCoupling::MEDCouplingMesh *>(f2->getMesh()));
+ MEDCoupling::MEDCouplingUMesh *m2C=dynamic_cast<MEDCoupling::MEDCouplingUMesh *>(const_cast<MEDCoupling::MEDCouplingMesh *>(f2->getMesh()));
CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen());
const double expected2[12]={0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7};
for(mcIdType i=0;i<12;i++)
const mcIdType nbOfNodes=12;
double coords[3*nbOfNodes]={2.,3.,4.,3.,4.,5.,4.,5.,6.,5.,6.,7.,6.,7.,8.,7.,8.,9.,8.,9.,10.,9.,10.,11.,10.,11.,12.,11.,12.,13.,12.,13.,14.,13.,14.,15.};
//
- MEDCoupling::DataArrayDouble *coordsArr=nullptr;
- double *tmp=nullptr;
+ MEDCoupling::DataArrayDouble *coordsArr=0;
+ double *tmp=0;
//! [CppSnippetDataArrayBuild1_0]
//
//! [CppSnippetDataArrayBuild1_1]
coordsArr->alloc(nbOfNodes,3);
tmp=coordsArr->getPointer();
std::copy(coords,coords+3*nbOfNodes,tmp);
- MEDCoupling::DataArrayDouble *coordsArrCpy=nullptr;
+ MEDCoupling::DataArrayDouble *coordsArrCpy=0;
//! [CppSnippetDataArrayBuild1_5]
coordsArrCpy=coordsArr->deepCopy();
//! [CppSnippetDataArrayBuild1_5]
//! [CppSnippetFieldDoubleBuild4_1]
}
-int main(int /*argc*/, char * /*argv*/[])
+int main(int argc, char *argv[])
{
CppExample_MEDCouplingFieldDouble_WriteVTK();
CppExample_MEDCouplingFieldDouble_MaxFields();
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingRemapperTest.hxx"
-#include "InterpolationOptions.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MCType.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingRemapper.hxx"
#include "MEDCouplingBasicsTest.hxx"
-#include "NormalizedGeometricTypes"
-#include <algorithm>
#include <cmath>
-#include <cppunit/TestAssert.h>
-#include <map>
#include <numeric>
-#include <vector>
using namespace MEDCoupling;
void MEDCouplingRemapperTest::testExtruded()
{
- MEDCouplingUMesh *mesh2DS=nullptr;
+ MEDCouplingUMesh *mesh2DS=0;
MEDCouplingUMesh *mesh3DS=build3DExtrudedUMesh_1(mesh2DS);
MEDCouplingMappedExtrudedMesh *extS=MEDCouplingMappedExtrudedMesh::New(mesh3DS,mesh2DS,1);
mesh3DS->decrRef();
mesh2DS->decrRef();
- MEDCouplingUMesh *mesh2DT=nullptr;
+ MEDCouplingUMesh *mesh2DT=0;
MEDCouplingUMesh *mesh3DT=build3DExtrudedUMesh_1(mesh2DT);
MEDCouplingMappedExtrudedMesh *extT=MEDCouplingMappedExtrudedMesh::New(mesh3DT,mesh2DT,1);
//
MEDCouplingUMesh *meshN,*meshTT,*meshTF;
MEDCouplingBasicsTest::build3DExtrudedUMesh_2(meshN,meshTT,meshTF);
std::vector<mcIdType> n;
- double const pt[3]={300.,300.,0.};
- double const v[3]={0.,0.,2.};
+ double pt[3]={300.,300.,0.};
+ double v[3]={0.,0.,2.};
meshN->findNodesOnPlane(pt,v,1e-12,n);
- auto *meshN2D=(MEDCouplingUMesh *)meshN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
+ MEDCouplingUMesh *meshN2D=(MEDCouplingUMesh *)meshN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
n.clear();
bool b=false;
mcIdType newNbOfNodes;
CPPUNIT_ASSERT(b);
da->decrRef();
meshTT->findNodesOnPlane(pt,v,1e-12,n);
- auto *meshTT2D=(MEDCouplingUMesh *)meshTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
+ MEDCouplingUMesh *meshTT2D=(MEDCouplingUMesh *)meshTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
n.clear();
meshTF->findNodesOnPlane(pt,v,1e-12,n);
- auto *meshTF2D=(MEDCouplingUMesh *)meshTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
+ MEDCouplingUMesh *meshTF2D=(MEDCouplingUMesh *)meshTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
n.clear();
//
MEDCouplingMappedExtrudedMesh *meshNE=MEDCouplingMappedExtrudedMesh::New(meshN,meshN2D,0);
std::copy(vals2,vals2+meshTTE->getNumberOfCells(),array->getPointer());
array->decrRef();
srcField=remapper.reverseTransferField(trgField,4.220173);
- double const expected3[40]={
+ double expected3[40]={
550.,550.,551.,552.,553.,550.,550.,554.,555.,556.,550.,550.,554.,555.,556.,550.,550.,557.,558.,559.,
1550.,1550.,1551.,1552.,1553.,1550.,1550.,1554.,1555.,1556.,1550.,1550.,1554.,1555.,1556.,1550.,1550.,1557.,1558.,1559.
};
std::copy(vals3,vals3+meshTFE->getNumberOfCells(),array->getPointer());
array->decrRef();
srcField=remapper.reverseTransferField(trgField,4.220173);
- double const expected4[40]={
+ double expected4[40]={
566.,566.,552.5,553.5,554.5,566.,566.,554.5,555.5,556.5,566.,566.,558.5,559.5,560.5,566.,566.,560.5,561.5,562.5,
1566.,1566.,1552.5,1553.5,1554.5,1566.,1566.,1554.5,1555.5,1556.5,1566.,1566.,1558.5,1559.5,1560.5,1566.,1566.,1560.5,1561.5,1562.5
};
#ifndef __MEDCOUPLINGREMAPPERTEST_HXX__
#define __MEDCOUPLINGREMAPPERTEST_HXX__
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
+#include <map>
+#include <vector>
namespace MEDCoupling
{
#include "MEDCouplingBasicsTest4.hxx"
#include "MEDCouplingBasicsTest5.hxx"
#include "MEDCouplingBasicsTestInterp.hxx"
-#include <cppunit/extensions/HelperMacros.h>
CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::MEDCouplingBasicsTest1 );
CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::MEDCouplingBasicsTest2 );
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingRemapperTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::MEDCouplingRemapperTest );
#include "InterpKernelAutoPtr.hxx"
#include "BoxSplittingOptions.hxx"
-#include "MEDCouplingNatureOfField.hxx"
using namespace MEDCoupling;
using namespace INTERP_KERNEL;
#ifndef __MEDCOUPLINGDATAARRAYTRAITS_HXX__
#define __MEDCOUPLINGDATAARRAYTRAITS_HXX__
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.txx"
+#include "MEDCouplingMemArray.hxx"
#include <Python.h>
MCData *_pt_mc;
};
-using PyCallBackDataArrayChar = struct PyCallBackDataArraySt<MEDCoupling::DataArrayByte>;
-using PyCallBackDataArrayInt32 = struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt32>;
-using PyCallBackDataArrayInt64 = struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt64>;
-using PyCallBackDataArrayFloat = struct PyCallBackDataArraySt<MEDCoupling::DataArrayFloat>;
-using PyCallBackDataArrayDouble = struct PyCallBackDataArraySt<MEDCoupling::DataArrayDouble>;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayByte> PyCallBackDataArrayChar;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt32> PyCallBackDataArrayInt32;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt64> PyCallBackDataArrayInt64;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayFloat> PyCallBackDataArrayFloat;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayDouble> PyCallBackDataArrayDouble;
extern "C"
{
static PyObject *callbackmcdataarraychar___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- auto *self = (PyCallBackDataArrayChar *) ( type->tp_alloc(type, 0) );
+ PyCallBackDataArrayChar *self = (PyCallBackDataArrayChar *) ( type->tp_alloc(type, 0) );
return (PyObject *)self;
}
static PyObject *callbackmcdataarrayint32___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- auto *self = (PyCallBackDataArrayInt32 *) ( type->tp_alloc(type, 0) );
+ PyCallBackDataArrayInt32 *self = (PyCallBackDataArrayInt32 *) ( type->tp_alloc(type, 0) );
return (PyObject *)self;
}
static PyObject *callbackmcdataarrayint64___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- auto *self = (PyCallBackDataArrayInt64 *) ( type->tp_alloc(type, 0) );
+ PyCallBackDataArrayInt64 *self = (PyCallBackDataArrayInt64 *) ( type->tp_alloc(type, 0) );
return (PyObject *)self;
}
static PyObject *callbackmcdataarrayfloat___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- auto *self = (PyCallBackDataArrayFloat *) ( type->tp_alloc(type, 0) );
+ PyCallBackDataArrayFloat *self = (PyCallBackDataArrayFloat *) ( type->tp_alloc(type, 0) );
return (PyObject *)self;
}
static PyObject *callbackmcdataarraydouble___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- auto *self = (PyCallBackDataArrayDouble *) ( type->tp_alloc(type, 0) );
+ PyCallBackDataArrayDouble *self = (PyCallBackDataArrayDouble *) ( type->tp_alloc(type, 0) );
return (PyObject *)self;
}
#include "MEDFileBasis.hxx"
-#include <algorithm>
#include <cstring>
-#include <string>
using namespace MEDCoupling;
#ifndef __MEDFILEBASIS_HXX__
#define __MEDFILEBASIS_HXX__
-#include "MCAuto.hxx"
+#include "InterpKernelException.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingTraits.hxx"
-#include "MEDCouplingRefCountObject.hxx"
+#include "MEDCouplingMemArray.txx"
#include <string>
#include <vector>
// Author : Anthony Geay (EDF R&D)
#include "MEDFileBlowStrEltUp.hxx"
-#include "MCAuto.hxx"
-#include "MCAuto.txx"
-#include "MCType.hxx"
-#include "MEDCoupling1GTUMesh.hxx"
-#include "MCIdType.hxx"
-#include "InterpKernelAutoPtr.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDFileField.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "MEDFileFieldMultiTS.hxx"
-#include "MEDFileField1TS.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDFileFieldGlobs.hxx"
-#include "MEDFileFieldInternal.hxx"
#include "MEDFileFieldVisitor.hxx"
#include "MEDCouplingPartDefinition.hxx"
-#include "MEDFileMesh.hxx"
-#include "MEDFileStructureElement.hxx"
-#include <algorithm>
-#include <cstddef>
-#include "MEDFileMeshLL.hxx"
-#include "MEDFileMeshElt.hxx"
-#include "NormalizedGeometricTypes"
-#include <cmath>
-#include <iterator>
-#include <math.h>
+#include "MCAuto.txx"
#include <numeric>
-#include <utility>
-#include <string>
-#include <sstream>
-#include <vector>
using namespace MEDCoupling;
_ms.takeRef(ms); _ses.takeRef(ses);
std::vector< std::pair<std::string,std::string> > ps;
fsOnlyOnSE->getMeshSENames(ps);
- std::size_t const sz(ps.size());
+ std::size_t sz(ps.size());
_elts.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
const std::pair<std::string,std::string>& p(ps[i]);
- MCAuto<MEDFileFields> const f(fsOnlyOnSE->partOfThisLyingOnSpecifiedMeshSEName(p.first,p.second));
+ MCAuto<MEDFileFields> f(fsOnlyOnSE->partOfThisLyingOnSpecifiedMeshSEName(p.first,p.second));
_elts[i]=f;
}
for(std::size_t i=0;i<sz;i++)
MEDFileMesh *mesh(_ms->getMeshWithName(p.first));
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp : NULL mesh !");
- auto *umesh(dynamic_cast<MEDFileUMesh *>(mesh));
+ MEDFileUMesh *umesh(dynamic_cast<MEDFileUMesh *>(mesh));
if(!umesh)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp : Blow up of Stru Elt not managed yet for unstructured meshes !");
}
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithSEInMesh : null pointer !");
if(seName==MED_BALL_STR)
{
- MCAuto<MEDFileEltStruct4Mesh> const ret(dealWithMEDBALLInMesh(mesh,mOut,fsOut));
+ MCAuto<MEDFileEltStruct4Mesh> ret(dealWithMEDBALLInMesh(mesh,mOut,fsOut));
mesh->killStructureElements();
return ret;
}
mOut=MEDFileUMesh::New(); fsOut=MEDFileFields::New();
const std::vector< MCAuto<MEDFileEltStruct4Mesh> >& strs(mesh->getAccessOfUndergroundEltStrs());
MCAuto<MEDFileEltStruct4Mesh> zeStr;
- for(const auto & str : strs)
+ for(std::vector< MCAuto<MEDFileEltStruct4Mesh> >::const_iterator it=strs.begin();it!=strs.end();it++)
{
- if(str->getGeoTypeName()==MED_BALL_STR)
+ if((*it)->getGeoTypeName()==MED_BALL_STR)
{
- zeStr=str;
+ zeStr=*it;
break;
}
}
mOut->setRenumFieldArr(0,const_cast<DataArrayIdType *>(nf0));
mOut->copyFamGrpMapsFrom(*mesh);
const std::vector< MCAuto<DataArray> >& vars(zeStr->getVars());
- for(const auto & var : vars)
+ for(std::vector< MCAuto<DataArray> >::const_iterator it=vars.begin();it!=vars.end();it++)
{
- const DataArray *elt(var);
+ const DataArray *elt(*it);
if(!elt)
continue;
{
- const auto *eltC(dynamic_cast<const DataArrayDouble *>(elt));
+ const DataArrayDouble *eltC(dynamic_cast<const DataArrayDouble *>(elt));
if(eltC)
{
MCAuto<MEDFileFieldMultiTS> fmts(MEDFileFieldMultiTS::New());
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithSEInFields : only MED_BALL is managed for the moment, but if you are interested please send spec to anthony.geay@edf.fr !");
}
-void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, const MEDFileEltStruct4Mesh * /*zeStr*/, const MEDFileFields *varAtt, MEDFileFields *zeOutputs) const
+void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, const MEDFileEltStruct4Mesh *zeStr, const MEDFileFields *varAtt, MEDFileFields *zeOutputs) const
{
- int const nbf(fs->getNumberOfFields());
+ int nbf(fs->getNumberOfFields());
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTS> > elts0;
std::vector< MEDFileAnyTypeFieldMultiTS * > elts1;
std::string zeMeshName;
{
MCAuto<MEDFileAnyTypeFieldMultiTS> elt(fs->getFieldAtPos(i));
MCAuto<MEDFileAnyTypeFieldMultiTS> eltOut(elt->buildNewEmpty());
- int const nbTS(elt->getNumberOfTS());
+ int nbTS(elt->getNumberOfTS());
for(int j=0;j<nbTS;j++)
{
MCAuto<MEDFileAnyTypeField1TS> eltt(elt->getTimeStepAtPos(j));
MCAuto<MEDFileAnyTypeField1TS> elttOut(eltt->deepCopy());
- std::string const meshName(eltt->getMeshName());
+ std::string meshName(eltt->getMeshName());
zeMeshName=BuildNewMeshName(meshName,MED_BALL_STR);
elttOut->setMeshName(zeMeshName);
elttOut->convertMedBallIntoClassic();
std::size_t jj(0);
for(std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> >::const_iterator it1=sp2.begin();it1!=sp2.end();it1++,jj++)
{
- for(auto it2 : *it1)
- zeOutputs->pushField(it2);
+ for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
+ zeOutputs->pushField(*it2);
// The most exciting part. Users that put profiles on struct elements part of fields. Reduce var att.
if((*it1).size()<1)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : take a deep breath !");
{
if(!(*it1)[0])
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : take a deep breath 2 !");
- int const pdm((*it1)[0]->getNumberOfTS());
+ int pdm((*it1)[0]->getNumberOfTS());
if(pdm<1)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : take a deep breath 3 !");
zeGuideForPfl=(*it1)[0]->getTimeStepAtPos(0);
// Yeah we have pfls
std::vector<double> t2s;
std::vector< std::pair<int,int> > t1s((*it1)[0]->getTimeSteps(t2s));
- std::size_t const nbTS3(t2s.size());
- int const nbf2(varAtt->getNumberOfFields());
+ std::size_t nbTS3(t2s.size());
+ int nbf2(varAtt->getNumberOfFields());
for(int i=0;i<nbf2;i++)
{
MCAuto<MEDFileAnyTypeFieldMultiTS> elt(varAtt->getFieldAtPos(i));
- int const nbTS2(elt->getNumberOfTS());
+ int nbTS2(elt->getNumberOfTS());
if(nbTS2!=1)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : internal error ! The dealWithMEDBALLInMesh is expected to return a single TS !");
MCAuto<MEDFileAnyTypeField1TS> elt2(elt->getTimeStepAtPos(0));
void MEDFileBlowStrEltUp::generate(MEDFileMeshes *msOut, MEDFileFields *allZeOutFields)
{
- for(auto & _elt : _elts)
+ for(std::vector< MCAuto<MEDFileFields> >::iterator elt=_elts.begin();elt!=_elts.end();elt++)
{
std::vector< std::pair<std::string,std::string> > ps;
- _elt->getMeshSENames(ps);
+ (*elt)->getMeshSENames(ps);
if(ps.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::generateMeshes : internal error !");
MEDFileMesh *mesh(_ms->getMeshWithName(ps[0].first));
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::generateMeshes : NULL mesh !");
- auto *umesh(dynamic_cast<MEDFileUMesh *>(mesh));
+ MEDFileUMesh *umesh(dynamic_cast<MEDFileUMesh *>(mesh));
if(!umesh)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::generateMeshes : Blow up of Stru Elt not managed yet for unstructured meshes !");
//
- MCAuto<MEDFileFields> classicalSEFields(splitFieldsPerLoc(_elt,umesh,msOut,allZeOutFields));
+ MCAuto<MEDFileFields> classicalSEFields(splitFieldsPerLoc(*elt,umesh,msOut,allZeOutFields));
if(classicalSEFields.isNotNull())
{
MCAuto<MEDFileUMesh> mOut;
class LocInfo
{
public:
- LocInfo() = default;
+ LocInfo() { }
LocInfo(const std::vector<FieldWalker2>& fw);
bool operator==(const LocInfo& other) const { return _locs==other._locs && _pfl==other._pfl; }
void push(const std::string& loc, const std::string& pfl) { checkUniqueLoc(loc); _locs.push_back(loc); _pfl.push_back(pfl); }
LocInfo::LocInfo(const std::vector<FieldWalker2>& fw)
{
- std::size_t const sz(fw.size());
+ std::size_t sz(fw.size());
_locs.resize(sz); _pfl.resize(sz); _cts.resize(sz);
if(sz>0)
_pd=fw[0].getPartDef()->deepCopy();
}
}
-MCAuto<MEDCouplingUMesh> LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh * /*section*/, const MEDFileFieldGlobsReal *globs, MCAuto<DataArrayDouble>& ptsForLoc)
+MCAuto<MEDCouplingUMesh> LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs, MCAuto<DataArrayDouble>& ptsForLoc)
{
MCAuto<DataArrayIdType> conn(zeStr->getConn());
conn=conn->deepCopy(); conn->rearrange(1);
//
MCAuto<MEDCouplingFieldDouble> dir(geoMesh->buildDirectionVectorField());
MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
- std::size_t const nbCompo(ptsForLoc->getNumberOfComponents());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
mcIdType nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
{
const int TAB[3]={2,0,1};
- std::vector<std::size_t> const v(TAB,TAB+3);
+ std::vector<std::size_t> v(TAB,TAB+3);
secPts=secPts->keepSelectedComponents(v);
}
const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
for(int j=0;j<nbCells;j++)
{
MCAuto<DataArrayDouble> p(secPts->deepCopy());
- double const ang0(rot->getIJ(j,2));
+ double ang0(rot->getIJ(j,2));
DataArrayDouble::Rotate3DAlg(CENTER,AX0,ang0,nbSecPts,p->begin(),p->getPointer());
AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ
- double const ang1(M_PI/2.-rot->getIJ(j,1));
+ double ang1(M_PI/2.-rot->getIJ(j,1));
DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer());
DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,angleVrille->getIJ(j,0),nbSecPts,p->begin(),p->getPointer());
for(int l=0;l<nbg;l++)
}
}
std::vector<const DataArrayDouble *> arrs2(VecAutoToVecOfCstPt(arrs));
- MCAuto<DataArrayDouble> const resu(DataArrayDouble::Aggregate(arrs2));
+ MCAuto<DataArrayDouble> resu(DataArrayDouble::Aggregate(arrs2));
return resu;
}
MCAuto<MEDCouplingFieldDouble> ortho(geoMesh->buildOrthogonalField());
orthoArr.takeRef(ortho->getArray());
}
- mcIdType const nbCompo(ToIdType(orthoArr->getNumberOfComponents()));
+ mcIdType nbCompo(ToIdType(orthoArr->getNumberOfComponents()));
MCAuto<DataArrayDouble> secPts(section->getCoords()->duplicateEachTupleNTimes(nbCompo));
secPts->rearrange(nbCompo);
std::vector< MCAuto<DataArrayDouble> > arrs(nbCells*nbg);
}
}
std::vector<const DataArrayDouble *> arrs2(VecAutoToVecOfCstPt(arrs));
- MCAuto<DataArrayDouble> const resu(DataArrayDouble::Aggregate(arrs2));
+ MCAuto<DataArrayDouble> resu(DataArrayDouble::Aggregate(arrs2));
return resu;
}
dir=geoMesh2->buildDirectionVectorField();
}
MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
- std::size_t const nbCompo(ptsForLoc->getNumberOfComponents());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
{
const int TAB[3]={2,0,1};
- std::vector<std::size_t> const v(TAB,TAB+3);
+ std::vector<std::size_t> v(TAB,TAB+3);
secPts=secPts->keepSelectedComponents(v);
}
const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
{
constexpr int DIM=3;
MCAuto<DataArrayDouble> p(secPts->deepCopy());
- double const ang0(rot->getIJ(j,2));
+ double ang0(rot->getIJ(j,2));
double rmin(zeScale->getIJ(j,0)),rmax(zeScale->getIJ(j,1));
{
auto pt(p->rwBegin());
}
DataArrayDouble::Rotate3DAlg(CENTER,AX0,ang0,nbSecPts,p->begin(),p->getPointer());
AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ
- double const ang1(M_PI/2.-rot->getIJ(j,1));
+ double ang1(M_PI/2.-rot->getIJ(j,1));
DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer());
for(int l=0;l<3;l++)
{
}
}
std::vector<const DataArrayDouble *> arrs2(VecAutoToVecOfCstPt(arrs));
- MCAuto<DataArrayDouble> const resu(DataArrayDouble::Aggregate(arrs2));
+ MCAuto<DataArrayDouble> resu(DataArrayDouble::Aggregate(arrs2));
return resu;
}
dir=geoMesh2->buildDirectionVectorField();
}
MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
- std::size_t const nbCompo(ptsForLoc->getNumberOfComponents());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
{
const int TAB[3]={2,0,1};
- std::vector<std::size_t> const v(TAB,TAB+3);
+ std::vector<std::size_t> v(TAB,TAB+3);
secPts=secPts->keepSelectedComponents(v);
}
const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
{
constexpr int DIM=3;
MCAuto<DataArrayDouble> p(secPts->deepCopy());
- double const ang0(rot->getIJ(j,2));
+ double ang0(rot->getIJ(j,2));
double rmin(zeScale->getIJ(j,0)),rmax(zeScale->getIJ(j,1));
{
auto pt(p->rwBegin());
}
DataArrayDouble::Rotate3DAlg(CENTER,AX0,ang0,nbSecPts,p->begin(),p->getPointer());
AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ
- double const ang1(M_PI/2.-rot->getIJ(j,1));
+ double ang1(M_PI/2.-rot->getIJ(j,1));
DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer());
for(int l=0;l<3;l++)
{
}
}
std::vector<const DataArrayDouble *> arrs2(VecAutoToVecOfCstPt(arrs));
- MCAuto<DataArrayDouble> const resu(DataArrayDouble::Aggregate(arrs2));
+ MCAuto<DataArrayDouble> resu(DataArrayDouble::Aggregate(arrs2));
return resu;
}
{
const MEDFileFieldLoc& loc(globs->getLocalization(_locs[i]));
const MEDFileGTKeeper *gtk(loc.getUndergroundGTKeeper());
- const auto *gtk2(dynamic_cast<const MEDFileGTKeeperDyn *>(gtk));
+ const MEDFileGTKeeperDyn *gtk2(dynamic_cast<const MEDFileGTKeeperDyn *>(gtk));
if(!gtk2)
throw INTERP_KERNEL::Exception("LocInfo::generateNonClassicalData : internal error !");
const MEDFileUMesh *meshLoc(gtk2->getMesh()),*section(gtk2->getSection());
const MEDFileStructureElement *se(gtk2->getSE());
MCAuto<MEDCouplingUMesh> um(meshLoc->getMeshAtLevel(0));
- INTERP_KERNEL::NormalizedCellType const gt(_cts[i]);
+ INTERP_KERNEL::NormalizedCellType gt(_cts[i]);
{
std::vector<int> nel(meshLoc->getNonEmptyLevels());
if(nel.size()!=1)
throw INTERP_KERNEL::Exception(MSG1);
std::vector<mcIdType> v;
um->getNodeIdsOfCell(zePos,v);
- std::size_t const sz2(v.size());
+ std::size_t sz2(v.size());
for(std::size_t j=0;j<sz2;j++)
if(v[j]!=ToIdType(j))
throw INTERP_KERNEL::Exception(MSG1);
}
const std::vector< MCAuto<MEDFileEltStruct4Mesh> >& strs(mesh->getAccessOfUndergroundEltStrs());
MCAuto<MEDFileEltStruct4Mesh> zeStr;
- for(const auto & str : strs)
+ for(std::vector< MCAuto<MEDFileEltStruct4Mesh> >::const_iterator it=strs.begin();it!=strs.end();it++)
{
- if(str->getGeoTypeName()==se->getName())
+ if((*it)->getGeoTypeName()==se->getName())
{
- zeStr=str;
+ zeStr=*it;
break;
}
}
std::string tmp;
ret2=_pd->isEqual(other._pd,tmp);
}
- bool const ret(_loc==other._loc && _pfl==other._pfl && _is_classic==other._is_classic && ret2);
+ bool ret(_loc==other._loc && _pfl==other._pfl && _is_classic==other._is_classic && ret2);
return ret;
}
class FieldWalker1
{
public:
- FieldWalker1(const MEDFileAnyTypeField1TSWithoutSDA *ts):_ts(ts) { }
+ FieldWalker1(const MEDFileAnyTypeField1TSWithoutSDA *ts):_ts(ts),_pm_pt(0),_nb_mesh(0) { }
void newMeshEntry(const MEDFileFieldPerMesh *fpm);
void endMeshEntry(const MEDFileFieldPerMesh *fpm) { }
void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt);
std::vector<FieldWalker2> getNonClassicalData() const { return _fw; }
private:
const MEDFileAnyTypeField1TSWithoutSDA *_ts;
- const MEDFileFieldPerMeshPerTypeDyn *_pm_pt{nullptr};
+ const MEDFileFieldPerMeshPerTypeDyn *_pm_pt;
std::vector<FieldWalker2> _fw;
- int _nb_mesh{0};
+ int _nb_mesh;
};
-void FieldWalker1::newMeshEntry(const MEDFileFieldPerMesh * /*fpm*/)
+void FieldWalker1::newMeshEntry(const MEDFileFieldPerMesh *fpm)
{
if(_nb_mesh++==1)
throw INTERP_KERNEL::Exception("FieldWalker1::newMeshEntry : multi mesh not supported !");
{
if(_pm_pt)
throw INTERP_KERNEL::Exception("FieldWalker1::newPerMeshPerTypeEntry : multi SE loc not managed yet !");
- const auto *pmpt2(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>(pmpt));
+ const MEDFileFieldPerMeshPerTypeDyn *pmpt2(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>(pmpt));
if(!pmpt2)
throw INTERP_KERNEL::Exception("newPerMeshPerTypeEntry : internal error !");
_pm_pt=pmpt2;
void FieldWalker1::checkOK(const FieldWalker1& other) const
{
- std::size_t const sz(_fw.size());
+ std::size_t sz(_fw.size());
if(other._fw.size()!=sz)
throw INTERP_KERNEL::Exception("checkOK : not OK because size are not the same !");
for(std::size_t i=0;i<sz;i++)
if(_fw.empty())
throw INTERP_KERNEL::Exception("FieldWalker1::endPerMeshPerTypeEntry : internal error !");
std::size_t ic(0),inc(0);
- for(const auto & it : _fw)
+ for(std::vector<FieldWalker2>::const_iterator it=_fw.begin();it!=_fw.end();it++)
{
- if(it.isClassic())
+ if((*it).isClassic())
ic++;
else
inc++;
_fw=new FieldWalker1(ts);
}
-void FieldWalker::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA * /*ts*/)
+void FieldWalker::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts)
{
if(_fw_prev.isNull())
_fw_prev=new FieldWalker1(*_fw);
else
_fw_prev->checkOK(*_fw);
- _fw=nullptr;
+ _fw=0;
}
void FieldWalker::newMeshEntry(const MEDFileFieldPerMesh *fpm)
class LocSpliter : public MEDFileFieldVisitor
{
public:
- LocSpliter(const MEDFileFieldGlobsReal *globs):_globs(globs),_fw(nullptr) { }
+ LocSpliter(const MEDFileFieldGlobsReal *globs):_globs(globs),_fw(0) { }
MCAuto<MEDFileFields> getClassical() const { return _classical; }
void generateNonClassicalData(const MEDFileUMesh *mesh, std::vector< MCAuto<MEDFileFields> >& outFields, std::vector< MCAuto<MEDFileUMesh> >& outMeshes) const;
private:
- void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) override;
- void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) override;
+ void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field);
+ void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field);
//
- void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) override;
- void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) override;
+ void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts);
+ void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts);
//
- void newMeshEntry(const MEDFileFieldPerMesh *fpm) override;
- void endMeshEntry(const MEDFileFieldPerMesh *fpm) override;
+ void newMeshEntry(const MEDFileFieldPerMesh *fpm);
+ void endMeshEntry(const MEDFileFieldPerMesh *fpm);
//
- void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) override;
- void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) override;
+ void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt);
+ void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt);
//
- void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) override;
+ void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd);
private:
const MEDFileFieldGlobsReal *_globs;
std::vector< LocInfo > _locs;
}
else
{
- std::vector<FieldWalker2> const fw2(_fw->getNonClassicalData());
- LocInfo const elt(fw2);
- auto const it(std::find(_locs.begin(),_locs.end(),elt));
+ std::vector<FieldWalker2> fw2(_fw->getNonClassicalData());
+ LocInfo elt(fw2);
+ std::vector< LocInfo >::iterator it(std::find(_locs.begin(),_locs.end(),elt));
if(it==_locs.end())
{
_locs.push_back(elt);
void LocSpliter::generateNonClassicalData(const MEDFileUMesh *mesh, std::vector< MCAuto<MEDFileFields> >& outFields, std::vector< MCAuto<MEDFileUMesh> >& outMeshes) const
{
int i(0);
- for(auto it=_locs.begin();it!=_locs.end();it++,i++)
+ for(std::vector<LocInfo>::const_iterator it=_locs.begin();it!=_locs.end();it++,i++)
{
MCAuto<MEDFileUMesh> m((*it).generateNonClassicalData(i,mesh,_globs));
outMeshes.push_back(m);
MCAuto<MEDFileField1TS> outF1t(MEDFileField1TS::New());
MCAuto<MEDFileField1TS> f1ts(fmts->getTimeStepAtPos(k));
int t2,t3;
- double const t1(f1ts->getTime(t2,t3));
+ double t1(f1ts->getTime(t2,t3));
MCAuto<MEDCouplingFieldDouble> mcf(MEDCouplingFieldDouble::New(ON_NODES));
MCAuto<DataArrayDouble> arr,arr2;
arr.takeRef(f1ts->getUndergroundDataArray());
std::vector< MCAuto<MEDFileFields> > outFields;
std::vector< MCAuto<MEDFileUMesh> > outMeshes;
ls.generateNonClassicalData(mesh,outFields,outMeshes);
- for(auto & outField : outFields)
+ for(std::vector< MCAuto<MEDFileFields> >::iterator it=outFields.begin();it!=outFields.end();it++)
{
- for(int j=0;j<outField->getNumberOfFields();j++)
+ for(int j=0;j<(*it)->getNumberOfFields();j++)
{
- MCAuto<MEDFileAnyTypeFieldMultiTS> fmts(outField->getFieldAtPos(j));
+ MCAuto<MEDFileAnyTypeFieldMultiTS> fmts((*it)->getFieldAtPos(j));
//DealWithConflictNames(fmts,allZeOutFields);// uncomment to have a writable data structure
allZeOutFields->pushField(fmts);
}
}
- for(auto & outMeshe : outMeshes)
- msOut->pushMesh(outMeshe);
+ for(std::vector< MCAuto<MEDFileUMesh> >::iterator it=outMeshes.begin();it!=outMeshes.end();it++)
+ msOut->pushMesh(*it);
return ls.getClassical();
}
#ifndef __MEDFILEBLOWSTRELTUP_HXX__
#define __MEDFILEBLOWSTRELTUP_HXX__
-#include "MCAuto.hxx"
-#include "MEDFileMeshLL.hxx"
-#include "MEDFileFieldMultiTS.hxx"
+#include "MEDLoaderDefines.hxx"
+#include "MEDFileUtilities.txx"
#include "MEDFileMesh.hxx"
#include "MEDFileField.hxx"
#include "MEDFileStructureElement.hxx"
-#include <string>
-#include <cstddef>
-#include <vector>
+#include "MEDCouplingRefCountObject.hxx"
namespace MEDCoupling
{
// Author : Anthony Geay (CEA/DEN)
#include "MEDFileData.hxx"
-#include "MEDFileUtilities.hxx"
-#include "MCAuto.hxx"
-#include "MEDFileField.hxx"
-#include "MEDFileMesh.hxx"
-#include "MEDFileParameter.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDFileMeshSupport.hxx"
-#include "MEDFileStructureElement.hxx"
-#include "MCType.hxx"
-#include "MEDFileFieldMultiTS.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDFileBlowStrEltUp.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include <string>
-#include "med.h"
-#include <cstddef>
-#include <vector>
-#include <sstream>
-#include <ostream>
-#include <utility>
-#include <set>
-#include "medfile.h"
using namespace MEDCoupling;
MEDFileData *MEDFileData::New(const std::string& fileName)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid);
}
bool MEDFileData::changeMeshName(const std::string& oldMeshName, const std::string& newMeshName)
{
- std::string const oldName(oldMeshName);
+ std::string oldName(oldMeshName);
std::vector< std::pair<std::string,std::string> > v(1);
v[0].first=oldName; v[0].second=newMeshName;
return changeMeshNames(v);
if(m)
{
std::vector<mcIdType> oldCode,newCode;
- DataArrayIdType *o2nRenumCell=nullptr;
- bool const modif=m->unPolyze(oldCode,newCode,o2nRenumCell);
+ DataArrayIdType *o2nRenumCell=0;
+ bool modif=m->unPolyze(oldCode,newCode,o2nRenumCell);
if(!modif)
continue;
renumParamsOfMeshImpacted.push_back(o2nRenumCell); memSaverIfThrow.push_back(o2nRenumCell);
MCAuto<MEDFileData> ret(MEDFileData::New());
std::vector<const MEDFileUMesh *> ms(sz);
std::vector< std::vector< std::pair<int,mcIdType> > > dts(sz);
- for(auto it=mfds.begin();it!=mfds.end();it++,i++)
+ for(std::vector<const MEDFileData *>::const_iterator it=mfds.begin();it!=mfds.end();it++,i++)
{
const MEDFileData *elt(*it);
if(!elt)
const MEDFileMesh *mesh(meshes->getMeshAtPos(0));
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : presence of null mesh in a MEDFileData instance among input vector !");
- const auto *umesh(dynamic_cast<const MEDFileUMesh *>(mesh));
+ const MEDFileUMesh *umesh(dynamic_cast<const MEDFileUMesh *>(mesh));
if(!umesh)
throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : works only for unstructured meshes !");
ms[i]=umesh;
ret->setMeshes(mss);
// fields
std::vector<std::string> fieldNames(mfds[0]->getFields()->getFieldsNames());
- std::set<std::string> const fieldNamess(fieldNames.begin(),fieldNames.end());
+ std::set<std::string> fieldNamess(fieldNames.begin(),fieldNames.end());
if(fieldNames.size()!=fieldNamess.size())
throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : field names must be different each other !");
std::vector< std::vector<const MEDFileAnyTypeFieldMultiTS *> > vectOfFields(fieldNames.size());
std::vector< std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > > vectOfFields2(fieldNames.size());
MCAuto<MEDFileFields> fss(MEDFileFields::New());
- for(auto mfd : mfds)
+ for(std::vector<const MEDFileData *>::const_iterator it=mfds.begin();it!=mfds.end();it++)
{
- std::vector<std::string> fieldNames0(mfd->getFields()->getFieldsNames());
- std::set<std::string> const fieldNamess0(fieldNames0.begin(),fieldNames0.end());
+ std::vector<std::string> fieldNames0((*it)->getFields()->getFieldsNames());
+ std::set<std::string> fieldNamess0(fieldNames0.begin(),fieldNames0.end());
if(fieldNamess!=fieldNamess0)
throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : field names must be the same for all input instances !");
i=0;
for(std::vector<std::string>::const_iterator it1=fieldNames.begin();it1!=fieldNames.end();it1++,i++)
{
- MCAuto<MEDFileAnyTypeFieldMultiTS> fmts(mfd->getFields()->getFieldWithName(*it1));
+ MCAuto<MEDFileAnyTypeFieldMultiTS> fmts((*it)->getFields()->getFieldWithName(*it1));
if(fmts.isNull())
throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : internal error 1 !");
vectOfFields2[i].push_back(fmts); vectOfFields[i].push_back(fmts);
}
MEDFileData::MEDFileData()
-= default;
+{
+}
MEDFileData::MEDFileData(med_idt fid)
try
void MEDFileData::readHeader(med_idt fid)
{
INTERP_KERNEL::AutoPtr<char> header(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
- int const ret(MEDfileCommentRd(fid,header));
+ int ret(MEDfileCommentRd(fid,header));
if(ret==0)
_header=MEDLoaderBase::buildStringFromFortran(header,MED_COMMENT_SIZE);
}
#define __MEDFILEDATA_HXX__
#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "MEDFileParameter.hxx"
#include "MEDFileField.hxx"
#include "MEDFileMesh.hxx"
#include "MEDFileMeshSupport.hxx"
#include "MEDFileStructureElement.hxx"
-#include "MEDFileUtilities.txx"
-#include "MEDLoaderDefines.hxx"
-#include <string>
-#include "med.h"
-#include <cstddef>
-#include <vector>
-#include <utility>
namespace MEDCoupling
{
MEDLOADER_EXPORT static MEDFileData *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileData>(db); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileData"); }
MEDLOADER_EXPORT MEDFileData *deepCopy() const;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT MEDFileFields *getFields() const;
MEDLOADER_EXPORT MEDFileMeshes *getMeshes() const;
MEDLOADER_EXPORT MEDFileParameters *getParams() const;
MEDLOADER_EXPORT void dealWithStructureElements();
MEDLOADER_EXPORT static MCAuto<MEDFileData> Aggregate(const std::vector<const MEDFileData *>& mfds);
//
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
private:
MEDFileData();
MEDFileData(med_idt fid);
// Author : Anthony Geay (EDF R&D)
#include "MEDFileEntities.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDFileStructureElement.hxx"
-#include "MEDFileMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include <string>
-#include <vector>
-#include <utility>
using namespace MEDCoupling;
}
MEDFileEntities::~MEDFileEntities()
-= default;
+{
+}
//////////////
#ifndef __MEDFILEENTITIES_HXX__
#define __MEDFILEENTITIES_HXX__
-#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDLoaderDefines.hxx"
#include "MEDFileStructureElement.hxx"
-#include "NormalizedGeometricTypes"
-#include <string>
-#include <vector>
-#include <utility>
+#include "MEDCouplingRefCountObject.hxx"
+#include "NormalizedGeometricTypes"
namespace MEDCoupling
{
public:
MEDFileStaticEntities(const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities):_entities(entities) { }
const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& getEntries() const { return _entities; }
- std::vector<int> getDynGTAvail() const override;
- bool areAllStaticTypesPresent() const override;
+ std::vector<int> getDynGTAvail() const;
+ bool areAllStaticTypesPresent() const;
bool areAllStaticPresentAndNoDyn() const override;
private:
std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > _entities;
class MEDLOADER_EXPORT MEDFileAllStaticEntites : public MEDFileEntities
{
public:
- MEDFileAllStaticEntites() = default;
- std::vector<int> getDynGTAvail() const override;
- bool areAllStaticTypesPresent() const override;
+ MEDFileAllStaticEntites() { }
+ std::vector<int> getDynGTAvail() const;
+ bool areAllStaticTypesPresent() const;
bool areAllStaticPresentAndNoDyn() const override;
};
{
public:
MEDFileAllStaticEntitiesPlusDyn(const MEDFileStructureElements *se);
- std::vector<int> getDynGTAvail() const override;
- bool areAllStaticTypesPresent() const override;
+ std::vector<int> getDynGTAvail() const;
+ bool areAllStaticTypesPresent() const;
bool areAllStaticPresentAndNoDyn() const override;
const MEDFileStructureElement *getWithGT(int idGT) const;
const MEDFileUMesh *getSupMeshWithName(const std::string& name) const;
// Author : Anthony Geay (EDF R&D)
#include "MEDFileEquivalence.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDFileBasis.hxx"
-#include "CellModel.hxx"
-#include "MCType.hxx"
#include "MEDFileSafeCaller.txx"
+#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDLoaderBase.hxx"
#include "MEDFileMesh.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "med.h"
-#include "NormalizedGeometricTypes"
-#include <string>
-#include "medequivalence.h"
-#include <sstream>
-#include <ostream>
-#include <vector>
-#include <cstddef>
-#include <algorithm>
-#include <iterator>
// From MEDLOader.cxx TU
extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO];
void MEDFileEquivalencePair::writeLL(med_idt fid) const
{
- std::string const meshName(getFather()->getMeshName());
+ std::string meshName(getFather()->getMeshName());
INTERP_KERNEL::AutoPtr<char> meshName2(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> desc(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
MEDFileEquivalenceNode *node(_node);
if(!node)
{
- _node=new MEDFileEquivalenceNode(this,nullptr);
+ _node=new MEDFileEquivalenceNode(this,0);
node=_node;
}
node->setArray(da);
*/
MEDFileEquivalenceNode *MEDFileEquivalencePair::initNode()
{
- _node=new MEDFileEquivalenceNode(this,nullptr);
+ _node=new MEDFileEquivalenceNode(this,0);
return _node;
}
void MEDFileEquivalencePair::load(med_idt fid)
{
- std::string const meshName(_father->getMeshName());
+ std::string meshName(_father->getMeshName());
int dt,it;
_father->getDtIt(dt,it);
med_int ncor;
MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,da->getPointer()));
da->applyLin(1,-1);
da->rearrange(2);
- MCAuto<MEDFileEquivalenceNode> const node(new MEDFileEquivalenceNode(this,FromMedIntArray<int>(da)));
+ MCAuto<MEDFileEquivalenceNode> node(new MEDFileEquivalenceNode(this,FromMedIntArray<int>(da)));
_node=node;
}
_cell=MEDFileEquivalenceCell::Load(fid,this);
std::vector<const BigMemoryObject *> MEDFileEquivalences::getDirectChildrenWithNull() const
{
- std::size_t const sz(_equ.size());
+ std::size_t sz(_equ.size());
std::vector<const BigMemoryObject *> ret(sz);
for(std::size_t i=0;i<sz;i++)
ret[i]=_equ[i];
void MEDFileEquivalences::pushEquivalence(MEDFileEquivalencePair *elt)
{
- MCAuto<MEDFileEquivalencePair> const elta(elt);
+ MCAuto<MEDFileEquivalencePair> elta(elt);
if(elt)
elt->incrRef();
_equ.push_back(elta);
MEDFileEquivalencePair *MEDFileEquivalences::getEquivalence(int i)
{
- int const sz(size());
+ int sz(size());
if(i<0 || i>=sz)
{
std::ostringstream oss; oss << "MEDFileEquivalences::getEquivalence : invalid id ! Must be in [0," << sz << ") !";
MEDFileEquivalencePair *MEDFileEquivalences::getEquivalenceWithName(const std::string& name)
{
- for(auto & it : _equ)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it=_equ.begin();it!=_equ.end();it++)
{
- MEDFileEquivalencePair *elt(it);
+ MEDFileEquivalencePair *elt(*it);
if(elt)
{
if(elt->getName()==name)
std::vector<std::string> MEDFileEquivalences::getEquivalenceNames() const
{
std::vector<std::string> ret;
- for(const auto & it : _equ)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
{
- const MEDFileEquivalencePair *elt(it);
+ const MEDFileEquivalencePair *elt(*it);
if(elt)
{
ret.push_back(elt->getName());
bool MEDFileEquivalences::isEqual(const MEDFileEquivalences *other, std::string& what) const
{
- std::size_t const sz(_equ.size());
+ std::size_t sz(_equ.size());
if(sz!=other->_equ.size())
{
what="Equivalences differs : not same number !";
void MEDFileEquivalences::getRepr(std::ostream& oss) const
{
std::size_t ii(0);
- for(auto it=_equ.begin();it!=_equ.end();it++,ii++)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++,ii++)
{
const MEDFileEquivalencePair *elt(*it);
oss << "Equivalence #" << ii << " : " ;
void MEDFileEquivalences::killEquivalenceWithName(const std::string& name)
{
- auto it(_equ.begin());
+ std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it(_equ.begin());
for(;it!=_equ.end();it++)
{
const MEDFileEquivalencePair *elt(*it);
void MEDFileEquivalences::killEquivalenceAt(int i)
{
- int const sz(size());
+ int sz(size());
if(i<0 || i>=sz)
{
std::ostringstream oss; oss << "MEDFileEquivalences::killEquivalenceAt : Id must be in [0," << sz << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- auto it(_equ.begin());
+ std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it(_equ.begin());
for(int j=0;j<i;it++,j++);
_equ.erase(it);
}
void MEDFileEquivalences::writeLL(med_idt fid) const
{
- for(const auto & it : _equ)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
{
- const MEDFileEquivalencePair *elt(it);
+ const MEDFileEquivalencePair *elt(*it);
if(elt)
elt->writeLL(fid);
}
int MEDFileEquivalences::PresenceOfEquivalences(med_idt fid, const std::string& meshName)
{
- med_int const nequ(MEDnEquivalence(fid,meshName.c_str()));
+ med_int nequ(MEDnEquivalence(fid,meshName.c_str()));
return FromMedInt<int>(nequ);
}
MCAuto<MEDFileEquivalences> ret(new MEDFileEquivalences(owner));
if(!owner)
throw INTERP_KERNEL::Exception("MEDFileEquivalences::Load : owner is NULL !");
- std::string const meshName(owner->getName());
+ std::string meshName(owner->getName());
for(int i=0;i<nbOfEq;i++)
{
INTERP_KERNEL::AutoPtr<char> equ(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
void MEDFileEquivalences::deepCpyFrom(const MEDFileEquivalences& other)
{
- for(const auto & it : other._equ)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=other._equ.begin();it!=other._equ.end();it++)
{
- const MEDFileEquivalencePair *elt(it);
+ const MEDFileEquivalencePair *elt(*it);
MCAuto<MEDFileEquivalencePair> eltCpy;
if(elt)
{
const MEDFileMesh *mesh(getFather()->getMesh());
int dt,it;
mesh->getTime(dt,it);
- std::string const meshName(mesh->getName());
- std::string const equName(getFather()->getName());
+ std::string meshName(mesh->getName());
+ std::string equName(getFather()->getName());
INTERP_KERNEL::AutoPtr<char> meshName2(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy());
std::vector<const BigMemoryObject *> MEDFileEquivalenceCell::getDirectChildrenWithNull() const
{
- std::size_t const sz(_types.size());
+ std::size_t sz(_types.size());
std::vector<const BigMemoryObject *> ret(sz);
for(std::size_t i=0;i<sz;i++)
ret[i]=_types[i];
if(ret->size()>0)
return ret.retn();
else
- return nullptr;
+ return 0;
}
void MEDFileEquivalenceCell::writeLL(med_idt fid) const
{
- for(const auto & _type : _types)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
{
- const MEDFileEquivalenceCellType *ct(_type);
+ const MEDFileEquivalenceCellType *ct(*it);
if(ct)
ct->writeLL(fid);
}
MEDFileEquivalenceCell *MEDFileEquivalenceCell::deepCopy(MEDFileEquivalencePair *owner) const
{
MCAuto<MEDFileEquivalenceCell> ret(new MEDFileEquivalenceCell(owner));
- for(const auto & _type : _types)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
{
- const MEDFileEquivalenceCellType *elt(_type);
+ const MEDFileEquivalenceCellType *elt(*it);
MCAuto<MEDFileEquivalenceCellType> eltCpy;
if(elt)
eltCpy=elt->deepCopy(owner);
bool MEDFileEquivalenceCell::isEqual(const MEDFileEquivalenceCell *other, std::string& what) const
{
- std::size_t const sz(_types.size());
+ std::size_t sz(_types.size());
if(sz!=other->_types.size())
{
std::ostringstream oss; oss << "Nb of geo types differs : " << sz << " != " << other->_types.size();
void MEDFileEquivalenceCell::getRepr(std::ostream& oss) const
{
- for(const auto & _type : _types)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
{
- const MEDFileEquivalenceCellType *elt(_type);
+ const MEDFileEquivalenceCellType *elt(*it);
if(elt)
elt->getRepr(oss);
}
DataArrayInt *MEDFileEquivalenceCell::getArray(INTERP_KERNEL::NormalizedCellType type)
{
- for(auto & _type : _types)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
{
- MEDFileEquivalenceCellType *elt(_type);
+ MEDFileEquivalenceCellType *elt(*it);
if(elt && elt->getType()==type)
return elt->getArray();
}
return ;
MEDFileEquivalences::CheckDataArray(da);
MEDFileMesh *mm(getMesh());
- mcIdType const totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax));
+ mcIdType totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax));
//
MCAuto<DataArrayInt> tmp(da->deepCopy()); tmp->rearrange(1);
int maxv,minv;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
//
- std::vector<INTERP_KERNEL::NormalizedCellType> const gts(mm->getGeoTypesAtLevel(meshDimRelToMax));
+ std::vector<INTERP_KERNEL::NormalizedCellType> gts(mm->getGeoTypesAtLevel(meshDimRelToMax));
int startId(0),endId;
- std::vector<std::size_t> const compS(1,0);
- for(auto gt : gts)
+ std::vector<std::size_t> compS(1,0);
+ for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=gts.begin();it!=gts.end();it++)
{
- endId=startId+(int)mm->getNumberOfCellsWithType(gt);
+ endId=startId+(int)mm->getNumberOfCellsWithType(*it);
MCAuto<DataArrayInt> da0(da->keepSelectedComponents(compS));
MCAuto<DataArrayIdType> ids(da0->findIdsInRange(startId,endId));
MCAuto<DataArrayInt> da1(da->selectByTupleIdSafe(ids->begin(),ids->end()));
da1->applyLin(1,-startId);
- setArrayForType(gt,da1);
+ setArrayForType(*it,da1);
startId=endId;
}
}
void MEDFileEquivalenceCell::setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da)
{
- for(auto & _type : _types)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
{
- MEDFileEquivalenceCellType *elt(_type);
+ MEDFileEquivalenceCellType *elt(*it);
if(elt && elt->getType()==type)
{
elt->setArray(da);
return ;
}
}
- MCAuto<MEDFileEquivalenceCellType> const newElt(new MEDFileEquivalenceCellType(getFather(),type,da));
+ MCAuto<MEDFileEquivalenceCellType> newElt(new MEDFileEquivalenceCellType(getFather(),type,da));
_types.push_back(newElt);
}
std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileEquivalenceCell::getTypes() const
{
std::vector<INTERP_KERNEL::NormalizedCellType> ret;
- for(const auto & _type : _types)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
{
- const MEDFileEquivalenceCellType *elt(_type);
+ const MEDFileEquivalenceCellType *elt(*it);
if(elt)
ret.push_back(elt->getType());
}
MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],da->getPointer()));
da->applyLin(1,-1);
da->rearrange(2);
- MCAuto<MEDFileEquivalenceCellType> const ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],FromMedIntArray<int>(da)));
+ MCAuto<MEDFileEquivalenceCellType> ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],FromMedIntArray<int>(da)));
_types.push_back(ct);
}
}
#ifndef __MEDFILEEQUIVALENCE_HXX__
#define __MEDFILEEQUIVALENCE_HXX__
-#include "MEDFileUtilities.hxx"
-#include "MCType.hxx"
#include "MEDLoaderDefines.hxx"
#include "MEDCouplingRefCountObject.hxx"
+#include "MEDCouplingMemArray.hxx"
+#include "MEDFileUtilities.txx"
#include "MCAuto.hxx"
#include "NormalizedGeometricTypes"
-#include "med.h"
-#include <string>
-#include <ostream>
-#include <cstddef>
#include <vector>
namespace MEDCoupling
public:
static MEDFileEquivalencePair *Load(MEDFileEquivalences *father, med_idt fid, const std::string& name, const std::string &desc);
std::string getClassName() const override { return std::string("MEDFileEquivalencePair"); }
- void writeLL(med_idt fid) const override;
+ void writeLL(med_idt fid) const;
const MEDFileEquivalences *getFather() const { return _father; }
MEDFileEquivalences *getFather() { return _father; }
const MEDFileMesh *getMesh() const;
bool isEqual(const MEDFileEquivalencePair *other, std::string& what) const;
void getRepr(std::ostream& oss) const;
static MEDFileEquivalencePair *New(MEDFileEquivalences *father, const std::string& name);
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
public:
MEDLOADER_EXPORT std::string getName() const { return _name; }
MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; }
class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone
{
public:
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT const MEDFileMesh *getMesh() const { return _owner; }
MEDLOADER_EXPORT MEDFileMesh *getMesh() { return _owner; }
void getDtIt(int &dt, int &it) const;
MEDLOADER_EXPORT void killEquivalenceAt(int i);
MEDLOADER_EXPORT void clear();
public:
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
static int PresenceOfEquivalences(med_idt fid, const std::string& meshName);
static MEDFileEquivalences *Load(med_idt fid, int nbOfEq, MEDFileMesh *owner);
static void CheckDataArray(const DataArrayInt *data);
const MEDFileMesh *getMesh() const { return getFather()->getMesh(); }
MEDFileMesh *getMesh() { return getFather()->getMesh(); }
protected:
- ~MEDFileEquivalenceBase() override = default;
+ ~MEDFileEquivalenceBase() { }
private:
MEDFileEquivalencePair *_father;
};
MEDLOADER_EXPORT void setArray(DataArrayInt *data);
MEDLOADER_EXPORT const DataArrayInt *getArray() const { return _data; }
MEDLOADER_EXPORT DataArrayInt *getArray() { return _data; }
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
bool isEqual(const MEDFileEquivalenceData *other, std::string& what) const;
protected:
void writeAdvanced(med_idt fid, med_entity_type medtype, med_geometry_type medgt) const;
protected:
- ~MEDFileEquivalenceData() override = default;
+ ~MEDFileEquivalenceData() { }
protected:
MCAuto<DataArrayInt> _data;
};
public:
MEDFileEquivalenceCellType(MEDFileEquivalencePair *owner, INTERP_KERNEL::NormalizedCellType type, DataArrayInt *data):MEDFileEquivalenceData(owner,data),_type(type) { }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileEquivalenceCellType"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
INTERP_KERNEL::NormalizedCellType getType() const { return _type; }
MEDFileEquivalenceCellType *deepCopy(MEDFileEquivalencePair *owner) const;
bool isEqual(const MEDFileEquivalenceCellType *other, std::string& what) const;
void getRepr(std::ostream& oss) const;
public:
- void writeLL(med_idt fid) const override;
+ void writeLL(med_idt fid) const;
protected:
- ~MEDFileEquivalenceCellType() override = default;
+ ~MEDFileEquivalenceCellType() { }
private:
INTERP_KERNEL::NormalizedCellType _type;
};
class MEDFileEquivalenceCell : public MEDFileEquivalenceBase
{
public:
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileEquivalenceCell"); }
static MEDFileEquivalenceCell *Load(med_idt fid, MEDFileEquivalencePair *owner);
- void writeLL(med_idt fid) const override;
+ void writeLL(med_idt fid) const;
MEDFileEquivalenceCell *deepCopy(MEDFileEquivalencePair *owner) const;
bool isEqual(const MEDFileEquivalenceCell *other, std::string& what) const;
void getRepr(std::ostream& oss) const;
public:
MEDFileEquivalenceCell(MEDFileEquivalencePair *owner):MEDFileEquivalenceBase(owner) { }
private:
- ~MEDFileEquivalenceCell() override = default;
+ ~MEDFileEquivalenceCell() { }
private:
void load(med_idt fid);
std::string getName() const { return getFather()->getName(); }
public:
MEDFileEquivalenceNode(MEDFileEquivalencePair *owner, DataArrayInt *data):MEDFileEquivalenceData(owner,data) { }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileEquivalenceNode"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ void writeLL(med_idt fid) const;
MEDFileEquivalenceNode *deepCopy(MEDFileEquivalencePair *owner) const;
bool isEqual(const MEDFileEquivalenceNode *other, std::string& what) const;
void getRepr(std::ostream& oss) const;
protected:
- ~MEDFileEquivalenceNode() override = default;
+ ~MEDFileEquivalenceNode() { }
};
}
// Author : Anthony Geay (EDF R&D)
#include "MEDFileField.hxx"
-#include "MEDFileEntities.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "MEDCoupling1GTUMesh.hxx"
-#include "MEDFileFieldInternal.hxx"
-#include "InterpKernelException.hxx"
#include "MEDFileMesh.hxx"
-#include "MEDFileUtilities.hxx"
+#include "MEDLoaderBase.hxx"
#include "MEDLoaderTraits.hxx"
+#include "MEDFileSafeCaller.txx"
#include "MEDFileFieldOverView.hxx"
#include "MEDFileBlowStrEltUp.hxx"
#include "MEDFileFieldVisitor.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "NormalizedGeometricTypes"
-#include "med.h"
-#include "medfield.h"
+#include "CellModel.hxx"
#include <algorithm>
-#include <cstddef>
#include <iterator>
-#include <string>
-#include <vector>
-#include <utility>
-#include <set>
-#include <sstream>
-#include <ostream>
-#include <map>
// From MEDLoader.cxx TU:
extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO];
MEDFileFields *MEDFileFields::New(const std::string& fileName, bool loadAll)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,loadAll);
}
MEDFileFields *MEDFileFields::NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return NewAdv(fid,loadAll,entities);
}
MEDFileFields *MEDFileFields::NewAdv(med_idt fid, bool loadAll, const MEDFileEntities *entities)
{
- return new MEDFileFields(fid,loadAll,nullptr,entities);
+ return new MEDFileFields(fid,loadAll,0,entities);
}
MEDFileFields *MEDFileFields::NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return NewWithDynGT(fid,se,loadAll);
}
if(!se)
throw INTERP_KERNEL::Exception("MEDFileFields::NewWithDynGT : null struct element pointer !");
INTERP_KERNEL::AutoCppPtr<MEDFileEntities> entities(MEDFileEntities::BuildFrom(*se));
- return new MEDFileFields(fid,loadAll,nullptr,entities);
+ return new MEDFileFields(fid,loadAll,0,entities);
}
MEDFileFields *MEDFileFields::New(med_idt fid, bool loadAll)
{
- return new MEDFileFields(fid,loadAll,nullptr,nullptr);
+ return new MEDFileFields(fid,loadAll,0,0);
}
MEDFileFields *MEDFileFields::LoadPartOf(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
- return new MEDFileFields(fid,loadAll,ms,nullptr);
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+ return new MEDFileFields(fid,loadAll,ms,0);
}
MEDFileFields *MEDFileFields::LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll)
{
MEDFileUtilities::CheckFileForRead(fileName);
INTERP_KERNEL::AutoCppPtr<MEDFileEntities> ent(new MEDFileStaticEntities(entities));
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
- return new MEDFileFields(fid,loadAll,nullptr,ent);
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+ return new MEDFileFields(fid,loadAll,0,ent);
}
std::size_t MEDFileFields::getHeapMemorySizeWithoutChildren() const
std::vector<const BigMemoryObject *> MEDFileFields::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _field : _fields)
- ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_field);
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)*it);
return ret;
}
{
MCAuto<MEDFileFields> ret(shallowCpy());
std::size_t i(0);
- for(auto it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
{
if((const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it)
ret->_fields[i]=(*it)->deepCopy();
std::set< std::pair<int,int> > s;
bool firstShot=true;
areThereSomeForgottenTS=false;
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- if(!(const MEDFileAnyTypeFieldMultiTSWithoutSDA*)_field)
+ if(!(const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it)
continue;
- std::vector< std::pair<int,int> > v=_field->getIterations();
+ std::vector< std::pair<int,int> > v=(*it)->getIterations();
std::set< std::pair<int,int> > s1; std::copy(v.begin(),v.end(),std::inserter(s1,s1.end()));
if(firstShot)
{ s=s1; firstShot=false; }
{
std::vector<std::string> ret(_fields.size());
int i(0);
- for(auto it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *f=(*it);
if(f)
std::vector<std::string> MEDFileFields::getMeshesNames() const
{
std::vector<std::string> ret;
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field);
+ const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
if(cur)
ret.push_back(cur->getMeshName());
}
void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const
{
- int const nbOfFields(getNumberOfFields());
- std::string const startLine(bkOffset,' ');
+ int nbOfFields(getNumberOfFields());
+ std::string startLine(bkOffset,' ');
oss << startLine << "There are " << nbOfFields << " fields in this :" << std::endl;
int i=0;
- for(auto it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
if(cur)
}
}
i=0;
- for(auto it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
- std::string const chapter(17,(char)('0'+i));
+ std::string chapter(17,(char)('0'+i));
oss << startLine << chapter << std::endl;
if(cur)
{
}
MEDFileFields::MEDFileFields()
-= default;
+{
+}
MEDFileFields::MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
try:MEDFileFieldGlobsReal(fid)
{
int i=0;
writeGlobals(fid,*this);
- for(auto it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt=*it;
if(!elt)
{
if(getFileName().empty())
throw INTERP_KERNEL::Exception("MEDFileFields::loadArrays : the structure does not come from a file !");
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName()));
- for(auto & _field : _fields)
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
{
- MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(_field);
+ MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
if(elt)
elt->loadBigArraysRecursively(fid,*elt);
}
{
if(!getFileName().empty())
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName()));
- for(auto & _field : _fields)
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
{
- MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(_field);
+ MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
if(elt)
elt->loadBigArraysRecursivelyIfNecessary(fid,*elt);
}
*/
void MEDFileFields::unloadArrays()
{
- for(auto & _field : _fields)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
{
- MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(_field);
+ MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
if(elt)
elt->unloadArrays();
}
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- std::vector<std::string> const tmp=_field->getPflsReallyUsed2();
- for(const auto & it2 : tmp)
- if(ret2.find(it2)==ret2.end())
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
{
- ret.push_back(it2);
- ret2.insert(it2);
+ ret.push_back(*it2);
+ ret2.insert(*it2);
}
}
return ret;
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- std::vector<std::string> const tmp(_field->getLocsReallyUsed2());
- for(const auto & it2 : tmp)
- if(ret2.find(it2)==ret2.end())
+ std::vector<std::string> tmp((*it)->getLocsReallyUsed2());
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
{
- ret.push_back(it2);
- ret2.insert(it2);
+ ret.push_back(*it2);
+ ret2.insert(*it2);
}
}
return ret;
std::vector<std::string> MEDFileFields::getPflsReallyUsedMulti() const
{
std::vector<std::string> ret;
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- std::vector<std::string> tmp(_field->getPflsReallyUsedMulti2());
+ std::vector<std::string> tmp((*it)->getPflsReallyUsedMulti2());
ret.insert(ret.end(),tmp.begin(),tmp.end());
}
return ret;
std::vector<std::string> MEDFileFields::getLocsReallyUsedMulti() const
{
std::vector<std::string> ret;
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- std::vector<std::string> tmp(_field->getLocsReallyUsed2());
+ std::vector<std::string> tmp((*it)->getLocsReallyUsed2());
ret.insert(ret.end(),tmp.begin(),tmp.end());
}
return ret;
void MEDFileFields::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & _field : _fields)
- _field->changePflsRefsNamesGen2(mapOfModif);
+ for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++)
+ (*it)->changePflsRefsNamesGen2(mapOfModif);
}
void MEDFileFields::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & _field : _fields)
- _field->changeLocsRefsNamesGen2(mapOfModif);
+ for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++)
+ (*it)->changeLocsRefsNamesGen2(mapOfModif);
}
void MEDFileFields::resize(int newSize)
void MEDFileFields::pushFields(const std::vector<MEDFileAnyTypeFieldMultiTS *>& fields)
{
- for(auto field : fields)
- pushField(field);
+ for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it=fields.begin();it!=fields.end();it++)
+ pushField(*it);
}
void MEDFileFields::pushField(MEDFileAnyTypeFieldMultiTS *field)
void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step)
{
static const char msg[]="MEDFileFields::destroyFieldsAtPos2";
- mcIdType const nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg));
+ mcIdType nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg));
std::vector<bool> b(_fields.size(),true);
int k=bg;
for(int i=0;i<nbOfEntriesToKill;i++,k+=step)
bool MEDFileFields::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
bool ret(false);
- for(auto & _field : _fields)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
{
- MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field);
+ MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
if(cur)
ret=cur->changeMeshNames(modifTab) || ret;
}
bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N)
{
bool ret(false);
- for(auto & _field : _fields)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
{
- MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts(_field);
+ MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts(*it);
if(fmts)
{
ret=fmts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,*this) || ret;
if(!mm)
throw INTERP_KERNEL::Exception("MEDFileFields::extractPart : input mesh is NULL !");
MCAuto<MEDFileFields> fsOut(MEDFileFields::New());
- int const nbFields(getNumberOfFields());
+ int nbFields(getNumberOfFields());
for(int i=0;i<nbFields;i++)
{
MCAuto<MEDFileAnyTypeFieldMultiTS> fmts(getFieldAtPos(i));
void MEDFileFields::accept(MEDFileFieldVisitor& visitor) const
{
- for(const auto & _field : _fields)
- if(_field.isNotNull())
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ if((*it).isNotNull())
{
- visitor.newFieldEntry(_field);
- _field->accept(visitor);
- visitor.endFieldEntry(_field);
+ visitor.newFieldEntry(*it);
+ (*it)->accept(visitor);
+ visitor.endFieldEntry(*it);
}
}
class MEDFileFieldLin2QuadVisitor : public MEDFileFieldVisitor
{
public:
- MEDFileFieldLin2QuadVisitor(const MEDFileUMesh *lin, const MEDFileUMesh *quad, const MEDFileFieldGlobsReal *linGlobs, MEDFileFields* outFs):_lin(lin),_quad(quad),_lin_globs(linGlobs),_out_fs(outFs) { }
- void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) override { if(field->getMeshName()!=_lin->getName()) return; _cur_fmts=MEDFileFieldMultiTS::New(); }
- void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA * /*field*/) override { if(_cur_fmts.isNotNull()) { if(_cur_fmts->getNumberOfTS()>0) _out_fs->pushField(_cur_fmts); } }
+ MEDFileFieldLin2QuadVisitor(const MEDFileUMesh *lin, const MEDFileUMesh *quad, const MEDFileFieldGlobsReal *linGlobs, MEDFileFields* outFs):_lin(lin),_quad(quad),_lin_globs(linGlobs),_out_fs(outFs),_gt(INTERP_KERNEL::NORM_ERROR),_1ts_update_requested(false) { }
+ void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) { if(field->getMeshName()!=_lin->getName()) return; _cur_fmts=MEDFileFieldMultiTS::New(); }
+ void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) { if(_cur_fmts.isNotNull()) { if(_cur_fmts->getNumberOfTS()>0) _out_fs->pushField(_cur_fmts); } }
//
- void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) override;
- void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) override;
+ void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts);
+ void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts);
//
- void newMeshEntry(const MEDFileFieldPerMesh *fpm) override;
- void endMeshEntry(const MEDFileFieldPerMesh *fpm) override { }
+ void newMeshEntry(const MEDFileFieldPerMesh *fpm);
+ void endMeshEntry(const MEDFileFieldPerMesh *fpm) { }
//
- void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) override;
- void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) override { }
+ void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt);
+ void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) { }
//
- void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) override;
+ void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd);
private:
void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes);
private:
MEDFileFields *_out_fs;
MCAuto<MEDFileFieldMultiTS> _cur_fmts;
MCAuto<MEDFileField1TS> _cur_f1ts;
- INTERP_KERNEL::NormalizedCellType _gt{INTERP_KERNEL::NORM_ERROR};
+ INTERP_KERNEL::NormalizedCellType _gt;
// Info on 1TS modification
- bool _1ts_update_requested{false};
+ bool _1ts_update_requested;
// Cache of matrix to compute faster the values on newly created points
std::map< std::string, PFLData > _cache;
std::vector<std::string> _pfls_to_be_updated;
throw INTERP_KERNEL::Exception("Not managed yet for ON_CELLS ON_GAUSS_NE and ON_GAUSS_PT");
_1ts_update_requested=true;
MEDFileAnyTypeField1TSWithoutSDA *ct(_cur_f1ts->contentNotNullBase());
- int const locId(pmptpd->getFather()->locIdOfLeaf(pmptpd));
+ int locId(pmptpd->getFather()->locIdOfLeaf(pmptpd));
MEDFileFieldPerMeshPerTypePerDisc *pmtdToModify(ct->getLeafGivenMeshAndTypeAndLocId(_lin->getName(),_gt,locId));
- std::string const pflName(pmptpd->getProfile());
+ std::string pflName(pmptpd->getProfile());
_pfls_to_be_updated.push_back(pflName);
- auto const itCache(_cache.find(pflName));
+ std::map< std::string, PFLData >::iterator itCache(_cache.find(pflName));
if(itCache!=_cache.end())
{
updateData(pmtdToModify,(*itCache).second.getNbOfAddPtsInPfl());
DataArrayIdType *nodeConn(allSeg3->getNodalConnectivity());
nodeConn->rearrange(3);
{
- std::vector<std::size_t> const v(1,2);
+ std::vector<std::size_t> v(1,2);
midPts=nodeConn->keepSelectedComponents(v);
}
cellSeg3Ids=DataArrayIdType::FindPermutationFromFirstToSecond(midPts,newPtsIds);
pflq=DataArrayIdType::Aggregate(vs);
pflq->setName(pflName);
}
- PFLData const pdata(matrix,pflq,newPtsIds->getNumberOfTuples());
+ PFLData pdata(matrix,pflq,newPtsIds->getNumberOfTuples());
_cache[pflName]=pdata;
updateData(pmtdToModify,pdata.getNbOfAddPtsInPfl());
}
void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt)
{
- const auto *pmpt2(dynamic_cast<const MEDFileFieldPerMeshPerType *>(pmpt));
+ const MEDFileFieldPerMeshPerType *pmpt2(dynamic_cast<const MEDFileFieldPerMeshPerType *>(pmpt));
if(!pmpt2)
throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newPerMeshPerTypeEntry : not managed for structure elements !");
if(pmpt2->getNumberOfLoc()!=1)
_1ts_update_requested=false; _pfls_to_be_updated.clear();
if(!ts)
return ;
- const auto *tsd(dynamic_cast<const MEDFileField1TSWithoutSDA *>(ts));
+ const MEDFileField1TSWithoutSDA *tsd(dynamic_cast<const MEDFileField1TSWithoutSDA *>(ts));
if(!tsd)
return ;
MCAuto<MEDFileAnyTypeField1TSWithoutSDA> contentCpy(ts->deepCopy());
_cur_f1ts->deepCpyGlobs(*_lin_globs);
}
-void MEDFileFieldLin2QuadVisitor::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA * /*ts*/)
+void MEDFileFieldLin2QuadVisitor::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts)
{
if(_cur_f1ts.isNull())
return ;
if(_1ts_update_requested)
{
MCAuto<DataArrayIdType> matrix,oldPfl;
- for(const auto & it : _pfls_to_be_updated)
+ for(std::vector<std::string>::const_iterator it=_pfls_to_be_updated.begin();it!=_pfls_to_be_updated.end();it++)
{
- std::map< std::string, PFLData >::const_iterator const it2(_cache.find(it));
+ std::map< std::string, PFLData >::const_iterator it2(_cache.find(*it));
if(it2==_cache.end())
throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::endTimeStepEntry : invalid situation !");
matrix=(*it2).second.getMatrix();
- if(it.empty())
+ if((*it).empty())
continue;
- int const locId(_cur_f1ts->getProfileId(it));
- oldPfl.takeRef(_cur_f1ts->getProfile(it));
+ int locId(_cur_f1ts->getProfileId(*it));
+ oldPfl.takeRef(_cur_f1ts->getProfile(*it));
{
- std::vector<int> const locToKill(1,locId);
+ std::vector<int> locToKill(1,locId);
_cur_f1ts->killProfileIds(locToKill);
}
_cur_f1ts->appendProfile((*it2).second.getProfile());
MEDFileMesh *mm(oldLin->getMeshAtPos(i));
if(!mm)
continue;
- auto *mmu(dynamic_cast<MEDFileUMesh *>(mm));
+ MEDFileUMesh *mmu(dynamic_cast<MEDFileUMesh *>(mm));
if(!mmu)
continue;
MEDFileMesh *mmq(newQuad->getMeshWithName(mmu->getName()));
- auto *mmqu(dynamic_cast<MEDFileUMesh *>(mmq));
+ MEDFileUMesh *mmqu(dynamic_cast<MEDFileUMesh *>(mmq));
if(!mmqu)
{
std::ostringstream oss; oss << "MEDFileFields::linearToQuadratic : mismatch of name between input meshes for name \"" << mmu->getName() << "\"";
}
const MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts=_fields[i];
if(!fmts)
- return nullptr;
+ return 0;
MCAuto<MEDFileAnyTypeFieldMultiTS> ret;
- const auto *fmtsC(dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(fmts));
- const auto *fmtsC2(dynamic_cast<const MEDFileInt32FieldMultiTSWithoutSDA *>(fmts));
- const auto *fmtsC4(dynamic_cast<const MEDFileInt64FieldMultiTSWithoutSDA *>(fmts));
- const auto *fmtsC3(dynamic_cast<const MEDFileFloatFieldMultiTSWithoutSDA *>(fmts));
+ const MEDFileFieldMultiTSWithoutSDA *fmtsC(dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(fmts));
+ const MEDFileInt32FieldMultiTSWithoutSDA *fmtsC2(dynamic_cast<const MEDFileInt32FieldMultiTSWithoutSDA *>(fmts));
+ const MEDFileInt64FieldMultiTSWithoutSDA *fmtsC4(dynamic_cast<const MEDFileInt64FieldMultiTSWithoutSDA *>(fmts));
+ const MEDFileFloatFieldMultiTSWithoutSDA *fmtsC3(dynamic_cast<const MEDFileFloatFieldMultiTSWithoutSDA *>(fmts));
if(fmtsC)
ret=MEDFileFieldMultiTS::New(*fmtsC,false);
else if(fmtsC2)
MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endIds) const
{
MCAuto<MEDFileFields> ret=shallowCpy();
- std::size_t const sz=std::distance(startIds,endIds);
+ std::size_t sz=std::distance(startIds,endIds);
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(sz);
int j=0;
for(const int *i=startIds;i!=endIds;i++,j++)
bool MEDFileFields::removeFieldsWithoutAnyTimeStep()
{
std::vector<MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > newFields;
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(_field);
+ const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
if(elt)
{
if(elt->getNumberOfTS()>0)
- newFields.push_back(_field);
+ newFields.push_back(*it);
}
}
if(_fields.size()==newFields.size())
MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const
{
MCAuto<MEDFileFields> ret(MEDFileFields::New());
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field);
+ const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
if(!cur)
continue;
if(cur->getMeshName()==meshName)
{
cur->incrRef();
- MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> const cur2(const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(cur));
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> cur2(const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(cur));
ret->_fields.push_back(cur2);
}
}
MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
MCAuto<MEDFileFields> ret(MEDFileFields::New());
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field);
+ const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
if(!cur)
continue;
- MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> const elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps);
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps);
ret->_fields.push_back(elt);
}
ret->shallowCpyOnlyUsedGlobs(*this);
MEDFileFields *MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
MCAuto<MEDFileFields> ret=MEDFileFields::New();
- for(const auto & _field : _fields)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
- const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field);
+ const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
if(!cur)
continue;
MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps);
bool MEDFileFields::presenceOfStructureElements() const
{
- for(const auto & _field : _fields)
- if(_field.isNotNull())
- if(_field->presenceOfStructureElements())
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ if((*it).isNotNull())
+ if((*it)->presenceOfStructureElements())
return true;
return false;
}
void MEDFileFields::killStructureElements()
{
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
- for(auto & _field : _fields)
- if(_field.isNotNull())
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+ if((*it).isNotNull())
{
- if(_field->presenceOfStructureElements())
+ if((*it)->presenceOfStructureElements())
{
- if(!_field->onlyStructureElements())
+ if(!(*it)->onlyStructureElements())
{
- _field->killStructureElements();
- ret.push_back(_field);
+ (*it)->killStructureElements();
+ ret.push_back(*it);
}
}
else
{
- ret.push_back(_field);
+ ret.push_back(*it);
}
}
_fields=ret;
void MEDFileFields::keepOnlyStructureElements()
{
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
- for(auto & _field : _fields)
- if(_field.isNotNull())
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+ if((*it).isNotNull())
{
- if(_field->presenceOfStructureElements())
+ if((*it)->presenceOfStructureElements())
{
- if(!_field->onlyStructureElements())
- _field->keepOnlyStructureElements();
- ret.push_back(_field);
+ if(!(*it)->onlyStructureElements())
+ (*it)->keepOnlyStructureElements();
+ ret.push_back(*it);
}
}
_fields=ret;
void MEDFileFields::keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName)
{
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
- for(auto & _field : _fields)
- if(_field.isNotNull())
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+ if((*it).isNotNull())
{
- if(_field->getMeshName()!=meshName)
+ if((*it)->getMeshName()!=meshName)
continue;
std::vector< std::pair<std::string,std::string> > ps;
- _field->getMeshSENames(ps);
- std::pair<std::string,std::string> const p(meshName,seName);
+ (*it)->getMeshSENames(ps);
+ std::pair<std::string,std::string> p(meshName,seName);
if(std::find(ps.begin(),ps.end(),p)!=ps.end())
- _field->keepOnlyOnSE(seName);
- ret.push_back(_field);
+ (*it)->keepOnlyOnSE(seName);
+ ret.push_back(*it);
}
_fields=ret;
}
void MEDFileFields::getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const
{
- for(const auto & _field : _fields)
- if(_field.isNotNull())
- _field->getMeshSENames(ps);
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ if((*it).isNotNull())
+ (*it)->getMeshSENames(ps);
}
void MEDFileFields::blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses)
THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : ms is nullptr !");
//
std::vector<std::string> msNames(ms->getMeshesNames());
- std::set<std::string> const msNamesSet(msNames.begin(),msNames.end());
+ std::set<std::string> msNamesSet(msNames.begin(),msNames.end());
if(msNames.size() == msNamesSet.size())
return ;
//
zeMeshNames.insert(fmtsWithSameName->getMeshName());
if(zeMeshNames.size()!=1)
THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : Presence of multiple MultiTS instances with same name but lying on same meshName. Looks bad !");
- std::string const meshNameToMerge = *zeMeshNames.begin();
+ std::string meshNameToMerge = *zeMeshNames.begin();
if(expectedMeshNamesToMerge.find(meshNameToMerge) != expectedMeshNamesToMerge.end())
THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : unexpected situation ! Error in implementation !");
expectedMeshNamesToMerge.insert(*zeMeshNames.begin());
for(auto entry : entries)
dtsToPush.push_back({entry.first.first,entry.second.second-entry.second.first});
dtsToAggregate.push_back(dtsToPush);
- MCAuto<MEDFileAnyTypeFieldMultiTS> const eltToAggregate = MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(fieldToBeAggregated);
+ MCAuto<MEDFileAnyTypeFieldMultiTS> eltToAggregate = MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(fieldToBeAggregated);
eltsToAggregate.push_back(eltToAggregate);
}
MCAuto<MEDFileAnyTypeFieldMultiTS> gg = MEDFileAnyTypeFieldMultiTS::Aggregate(FromVecAutoToVecOfConst(eltsToAggregate),dtsToAggregate);
{
if(!curMesh->getNonEmptyLevels().empty())
THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : only meshes without cells supported.");
- auto *curMeshU(dynamic_cast<MEDFileUMesh *>(curMesh));
+ MEDFileUMesh *curMeshU(dynamic_cast<MEDFileUMesh *>(curMesh));
if(!curMeshU)
THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : only unstructured mesh supported.");
coos.push_back(curMeshU->getCoords());
void MEDFileFields::aggregate(const MEDFileFields& other)
{
- int const nbFieldsToAdd(other.getNumberOfFields());
+ int nbFieldsToAdd(other.getNumberOfFields());
std::vector<std::string> fsn(getFieldsNames());
for(int i=0;i<nbFieldsToAdd;i++)
{
MCAuto<MEDFileAnyTypeFieldMultiTS> elt(other.getFieldAtPos(i));
- std::string const name(elt->getName());
+ std::string name(elt->getName());
if(std::find(fsn.begin(),fsn.end(),name)!=fsn.end())
{
std::ostringstream oss; oss << "MEDFileFields::aggregate : name \"" << name << "\" already appears !";
int MEDFileFields::getPosFromFieldName(const std::string& fieldName) const
{
- std::string const tmp(fieldName);
+ std::string tmp(fieldName);
std::vector<std::string> poss;
for(unsigned int i=0;i<_fields.size();i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *f(_fields[i]);
if(f)
{
- std::string const fname(f->getName());
+ std::string fname(f->getName());
if(tmp==fname)
return i;
else
}
MEDFileFieldsIterator::~MEDFileFieldsIterator()
-= default;
+{
+}
MEDFileAnyTypeFieldMultiTS *MEDFileFieldsIterator::nextt()
{
if(fs)
return fs->getFieldAtPos(_iter_id++);
else
- return nullptr;
+ return 0;
}
else
- return nullptr;
+ return 0;
}
#pragma once
-#include "MEDFileUtilities.hxx"
-#include "MCType.hxx"
#include "MEDLoaderDefines.hxx"
#include "MEDFileFieldInternal.hxx"
#include "MEDFileFieldMultiTS.hxx"
#include "MEDFileFieldOverView.hxx"
+#include "MEDFileUtilities.txx"
#include "MEDFileEntities.hxx"
#include "MCAuto.hxx"
+#include "MEDLoaderTraits.hxx"
#include "MEDCouplingTraits.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingPartDefinition.hxx"
-#include "NormalizedGeometricTypes"
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelException.hxx"
-#include <utility>
-#include <cstddef>
-#include <ostream>
-#include <map>
#include <vector>
#include <string>
+#include <list>
+#include <set>
#include "med.h"
MEDLOADER_EXPORT static MEDFileFields *NewWithDynGT(med_idt fid, const MEDFileStructureElements *se, bool loadAll=true);
MEDLOADER_EXPORT static MEDFileFields *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileFields>(db); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFields"); }
- MEDLOADER_EXPORT static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=nullptr);
+ MEDLOADER_EXPORT static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
MEDLOADER_EXPORT static MEDFileFields *LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT MEDFileFields *deepCopy() const;
MEDLOADER_EXPORT MEDFileFields *shallowCpy() const;
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT void loadArrays();
MEDLOADER_EXPORT void loadArraysIfNecessary();
MEDLOADER_EXPORT void unloadArrays();
public:
MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const;
public:
- MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const override;
- MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const override;
- MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti() const override;
- MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti() const override;
- MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) override;
- MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) override;
+ MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
+ MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
+ MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti() const;
+ MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti() const;
+ MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
+ MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
private:
- ~MEDFileFields() override = default;
+ ~MEDFileFields() { }
MEDFileFields();
MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
private:
#pragma once
-#include "MEDCouplingMemArray.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDFileEntities.hxx"
-#include "InterpKernelAutoPtr.hxx"
#include "MEDFileField.hxx"
#include "MEDCouplingTraits.hxx"
#include "MEDCouplingFieldInt32.hxx"
#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
-#include "MEDFileField1TS.hxx"
-#include <vector>
-#include <utility>
-#include "NormalizedGeometricTypes"
-#include "MEDLoaderTraits.hxx"
-#include <cstddef>
-#include "MEDFileFieldInternal.hxx"
-#include <string>
-#include "MEDFileUtilities.hxx"
-#include "med.h"
-#include <sstream>
-#include <map>
-#include "MEDFileFieldMultiTS.hxx"
namespace MEDCoupling
{
_arr=0;
return ;
}
- auto *arrC=dynamic_cast<typename Traits<T>::ArrayType *>(arr);
+ typename Traits<T>::ArrayType *arrC=dynamic_cast<typename Traits<T>::ArrayType *>(arr);
if(!arrC)
throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::setArray : the input not null array is not of type DataArrayDouble !");
else
_arr=Traits<T>::ArrayType::New();
_arr->alloc(start,nbCompo); _arr->copyStringInfoFrom(*arr);
start=0;
- for(const auto & it : extractInfo)
+ for(std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >::const_iterator it=extractInfo.begin();it!=extractInfo.end();it++)
{
- const DataArray *zeArr(das[it.first]);
- _arr->setContigPartOfSelectedValuesSlice(start,zeArr,it.second.first,it.second.second,1);
- start+=it.second.second-it.second.first;
+ const DataArray *zeArr(das[(*it).first]);
+ _arr->setContigPartOfSelectedValuesSlice(start,zeArr,(*it).second.first,(*it).second.second,1);
+ start+=(*it).second.second-(*it).second.first;
}
// see definition of _nb_of_tuples_to_be_allocated. array is built from scratch and allocated.
_nb_of_tuples_to_be_allocated=-3;
const MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
if(!pt)
throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::contentNotNull : the content pointer is null !");
- const auto *ret(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(pt));
+ const typename MLFieldTraits<T>::F1TSWSDAType *ret(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(pt));
if(!ret)
{
std::ostringstream oss; oss << "MEDFileTemplateField1TS<T>::contentNotNull : the content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR;
MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
if(!pt)
throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::contentNotNull : the non const content pointer is null !");
- auto *ret(dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType *>(pt));
+ typename MLFieldTraits<T>::F1TSWSDAType *ret(dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType *>(pt));
if(!ret)
{
std::ostringstream oss; oss << "MEDFileTemplateField1TS<T>::contentNotNull : the non const content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR;
if(arr.isNull())
throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::SetDataArrayInField : no array !");
int t1,t2;
- double const t0(f->getTime(t1,t2));
- std::string const tu(f->getTimeUnit());
+ double t0(f->getTime(t1,t2));
+ std::string tu(f->getTimeUnit());
MCAuto<typename Traits<T>::ArrayType> arr2(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(arr));
MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*f));
MCAuto<typename Traits<T>::FieldType> ret(Traits<T>::FieldType::New(*ft));
if(!mm)
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !");
MCAuto<typename MLFieldTraits<T>::F1TSType> ret(MLFieldTraits<T>::F1TSType::New());
- std::vector<TypeOfField> const tof(getTypesOfFieldAvailable());
- for(auto it0 : tof)
+ std::vector<TypeOfField> tof(getTypesOfFieldAvailable());
+ for(std::vector<TypeOfField>::const_iterator it0=tof.begin();it0!=tof.end();it0++)
{
- if(it0!=ON_NODES)
+ if((*it0)!=ON_NODES)
{
std::vector<int> levs;
getNonEmptyLevels(mm->getName(),levs);
- for(int const lev : levs)
+ for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
- auto const it2(extractDef.find(lev));
+ std::map<int, MCAuto<DataArrayIdType> >::const_iterator it2(extractDef.find(*lev));
if(it2!=extractDef.end())
{
MCAuto<DataArrayIdType> t((*it2).second);
if(t.isNull())
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !");
- MCAuto<typename Traits<T>::FieldType> f(getFieldOnMeshAtLevel(ON_CELLS,lev,mm));
+ MCAuto<typename Traits<T>::FieldType> f(getFieldOnMeshAtLevel(ON_CELLS,(*lev),mm));
MCAuto<typename Traits<T>::FieldType> fOut(f->buildSubPart(t));
ret->setFieldNoProfileSBT(fOut);
}
}
else
{
- auto const it2(extractDef.find(1));
+ std::map<int, MCAuto<DataArrayIdType> >::const_iterator it2(extractDef.find(1));
if(it2==extractDef.end())
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a NODE field and no extract array available for NODE !");
MCAuto<DataArrayIdType> t((*it2).second);
{
if(!f1ts)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
- const auto *f1tsC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(f1ts));
+ const typename MLFieldTraits<T>::F1TSWSDAType *f1tsC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(f1ts));
if(!f1tsC)
{
std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : the input field1TS is not a " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR << " type !";
MCAuto<MEDFileFieldMultiTSWithoutSDA> ret(new MEDFileFieldMultiTSWithoutSDA);
ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
int i=0;
- for(auto it=this->_time_steps.begin();it!=this->_time_steps.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=this->_time_steps.begin();it!=this->_time_steps.end();it++,i++)
{
const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it);
if(eltToConv)
if(!mm)
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::extractPart : mesh is null !");
MCAuto<typename MLFieldTraits<T>::FMTSType> fmtsOut(MLFieldTraits<T>::FMTSType::New());
- int const nbTS(getNumberOfTS());
+ int nbTS(getNumberOfTS());
for(int i=0;i<nbTS;i++)
{
MCAuto<MEDFileAnyTypeField1TS> f1ts(getTimeStepAtPos(i));
const MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
if(!pt)
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::contentNotNull : the content pointer is null !");
- const auto *ret=dynamic_cast<const typename MLFieldTraits<T>::FMTSWSDAType *>(pt);
+ const typename MLFieldTraits<T>::FMTSWSDAType *ret=dynamic_cast<const typename MLFieldTraits<T>::FMTSWSDAType *>(pt);
if(!ret)
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::contentNotNull : the content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !");
return ret;
std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !";
throw INTERP_KERNEL::Exception(oss.str());
}
- const auto *itemC=dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(item);
+ const typename MLFieldTraits<T>::F1TSWSDAType *itemC=dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(item);
if(itemC)
{
MCAuto<typename MLFieldTraits<T>::F1TSType> ret(MLFieldTraits<T>::F1TSType::New(*itemC,false));
{
if(!f1ts)
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
- const auto *f1tsC=dynamic_cast<const typename MLFieldTraits<T>::F1TSType *>(f1ts);
+ const typename MLFieldTraits<T>::F1TSType *f1tsC=dynamic_cast<const typename MLFieldTraits<T>::F1TSType *>(f1ts);
if(!f1tsC)
{
std::ostringstream oss; oss << "MEDFileTemplateFieldMultiTS<T>::checkCoherencyOfType : the input field1TS is not a " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR << " type !";
const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(this->_content);
if(content)
{
- const auto *contc=dynamic_cast<const typename MLFieldTraits<T>::FMTSWSDAType *>(content);
+ const typename MLFieldTraits<T>::FMTSWSDAType *contc=dynamic_cast<const typename MLFieldTraits<T>::FMTSWSDAType *>(content);
if(!contc)
throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::convertToInt : the content inside this is not INT32 ! This is incoherent !");
MCAuto<MEDFileFieldMultiTSWithoutSDA> newc(contc->convertToDouble());
// Author : Anthony Geay (EDF R&D)
#include "MEDFileField1TS.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDFileFieldGlobs.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCIdType.hxx"
-#include "CellModel.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDFileEntities.hxx"
-#include "InterpKernelAutoPtr.hxx"
-#include "MEDFileBasis.hxx"
-#include "MEDCouplingPartDefinition.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDFileFieldInternal.hxx"
#include "MEDFileFieldVisitor.hxx"
-#include "MEDFileMesh.hxx"
#include "MEDFileSafeCaller.txx"
-#include "MEDFileUtilities.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileField.txx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingFieldInt32.hxx"
-#include "MEDCouplingFieldInt64.hxx"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <vector>
-#include <ostream>
-#include <string>
-#include <utility>
-#include <set>
-#include <iterator>
-#include <algorithm>
-#include <functional>
-#include <sstream>
-#include "med.h"
-#include "medfield.h"
-#include <limits>
using namespace MEDCoupling;
{
_field_per_mesh.resize(other._field_per_mesh.size());
std::size_t i=0;
- for(auto it=other._field_per_mesh.begin();it!=other._field_per_mesh.end();it++,i++)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=other._field_per_mesh.begin();it!=other._field_per_mesh.end();it++,i++)
{
if((const MEDFileFieldPerMesh *)*it)
_field_per_mesh[i]=(*it)->deepCopy(this);
void MEDFileAnyTypeField1TSWithoutSDA::accept(MEDFileFieldVisitor& visitor) const
{
- for(const auto & it : _field_per_mesh)
- if(it.isNotNull())
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
{
- visitor.newMeshEntry(it);
- it->accept(visitor);
- visitor.endMeshEntry(it);
+ visitor.newMeshEntry(*it);
+ (*it)->accept(visitor);
+ visitor.endMeshEntry(*it);
}
}
*/
void MEDFileAnyTypeField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const
{
- std::string const startOfLine(bkOffset,' ');
+ std::string startOfLine(bkOffset,' ');
oss << startOfLine << "Field ";
if(bkOffset==0)
oss << "[Type=" << getTypeStr() << "] with name \"" << getName() << "\" ";
if(f1tsId<0)
{
oss << startOfLine << "Field has " << comps.size() << " components with the following infos :" << std::endl;
- for(const auto & comp : comps)
- oss << startOfLine << " - \"" << comp << "\"" << std::endl;
+ for(std::vector<std::string>::const_iterator it=comps.begin();it!=comps.end();it++)
+ oss << startOfLine << " - \"" << (*it) << "\"" << std::endl;
}
if(arr->isAllocated())
{
if(!_field_per_mesh.empty())
{
int i=0;
- for(auto it2=_field_per_mesh.begin();it2!=_field_per_mesh.end();it2++,i++)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it2=_field_per_mesh.begin();it2!=_field_per_mesh.end();it2++,i++)
{
const MEDFileFieldPerMesh *cur=(*it2);
if(cur)
const DataArray *arr(getUndergroundDataArray());
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitComponents : no array defined !");
- std::size_t const nbOfCompo=arr->getNumberOfComponents();
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfCompo);
for(std::size_t i=0;i<nbOfCompo;i++)
{
ret[i]=deepCopy();
- std::vector<std::size_t> const v(1,i);
+ std::vector<std::size_t> v(1,i);
MCAuto<DataArray> arr2=arr->keepSelectedComponents(v);
ret[i]->setArray(arr2);
}
int MEDFileAnyTypeField1TSWithoutSDA::getDimension() const
{
int ret=-2;
- for(const auto & it : _field_per_mesh)
- it->getDimension(ret);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->getDimension(ret);
return ret;
}
bool MEDFileAnyTypeField1TSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
bool ret=false;
- for(auto & it : _field_per_mesh)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
{
- MEDFileFieldPerMesh *cur(it);
+ MEDFileFieldPerMesh *cur(*it);
if(cur)
ret=cur->changeMeshNames(modifTab) || ret;
}
void MEDFileAnyTypeField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const
{
std::set<TypeOfField> types2;
- for(const auto & it : _field_per_mesh)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
{
- it->fillTypesOfFieldAvailable(types2);
+ (*it)->fillTypesOfFieldAvailable(types2);
}
- std::back_insert_iterator< std::vector<TypeOfField> > const bi(types);
+ std::back_insert_iterator< std::vector<TypeOfField> > bi(types);
std::copy(types2.begin(),types2.end(),bi);
}
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & it : _field_per_mesh)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
{
- std::vector<std::string> const tmp=it->getPflsReallyUsed();
- for(const auto & it2 : tmp)
- if(ret2.find(it2)==ret2.end())
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsed();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
{
- ret.push_back(it2);
- ret2.insert(it2);
+ ret.push_back(*it2);
+ ret2.insert(*it2);
}
}
return ret;
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & it : _field_per_mesh)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
{
- std::vector<std::string> const tmp=it->getLocsReallyUsed();
- for(const auto & it2 : tmp)
- if(ret2.find(it2)==ret2.end())
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsed();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
{
- ret.push_back(it2);
- ret2.insert(it2);
+ ret.push_back(*it2);
+ ret2.insert(*it2);
}
}
return ret;
std::vector<std::string> MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsedMulti2() const
{
std::vector<std::string> ret;
- for(const auto & it : _field_per_mesh)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
{
- std::vector<std::string> tmp=it->getPflsReallyUsedMulti();
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti();
ret.insert(ret.end(),tmp.begin(),tmp.end());
}
return ret;
std::vector<std::string> MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsedMulti2() const
{
std::vector<std::string> ret;
- std::set<std::string> const ret2;
- for(const auto & it : _field_per_mesh)
+ std::set<std::string> ret2;
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
{
- std::vector<std::string> tmp=it->getLocsReallyUsedMulti();
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti();
ret.insert(ret.end(),tmp.begin(),tmp.end());
}
return ret;
void MEDFileAnyTypeField1TSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & it : _field_per_mesh)
- it->changePflsRefsNamesGen(mapOfModif);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->changePflsRefsNamesGen(mapOfModif);
}
void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & it : _field_per_mesh)
- it->changeLocsRefsNamesGen(mapOfModif);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->changeLocsRefsNamesGen(mapOfModif);
}
/*!
* Length of this and of nested sequences is the same as that of \a typesF.
* \throw If no field is lying on \a mname.
*/
-std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& /*mname*/, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
* \return int - the maximal absolute dimension of elements \a this fields lies on.
* \throw If no field is lying on \a mname.
*/
-int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& /*mname*/, std::vector<int>& levs) const
+int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const
{
levs.clear();
std::vector<INTERP_KERNEL::NormalizedCellType> types;
return -1;
st.erase(INTERP_KERNEL::NORM_ERROR);
std::set<int> ret1;
- for(auto it : st)
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=st.begin();it!=st.end();it++)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(it);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*it);
ret1.insert((int)cm.getDimension());
}
- int const ret=*std::max_element(ret1.begin(),ret1.end());
+ int ret=*std::max_element(ret1.begin(),ret1.end());
std::copy(ret1.rbegin(),ret1.rend(),std::back_insert_iterator<std::vector<int> >(levs));
std::transform(levs.begin(),levs.end(),levs.begin(),std::bind(std::plus<int>(),std::placeholders::_1,-ret));
return ret;
void MEDFileAnyTypeField1TSWithoutSDA::convertMedBallIntoClassic()
{
- for(auto it=_field_per_mesh.begin();it<_field_per_mesh.end();it++)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it<_field_per_mesh.end();it++)
if((*it).isNotNull())
(*it)->convertMedBallIntoClassic();
}
{
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : null pfl !");
- std::string const name(pfl->getName());
+ std::string name(pfl->getName());
pfl->checkAllocated();
if(pfl->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : non mono compo array !");
* \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
* \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
*/
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& /*mName*/, INTERP_KERNEL::NormalizedCellType typ, int locId)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId)
{
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId : This is empty !");
* \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
* \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
*/
-const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& /*mName*/, INTERP_KERNEL::NormalizedCellType typ, int locId) const
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const
{
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId : This is empty !");
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No field set !");
if(mName.empty())
return 0;
- std::string const mName2(mName);
+ std::string mName2(mName);
int ret=0;
std::vector<std::string> msg;
- for(auto it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++)
if(mName2==(*it)->getMeshName())
return ret;
else
msg.push_back((*it)->getMeshName());
std::ostringstream oss; oss << "MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No such mesh \"" << mName2 << "\" as underlying mesh of field \"" << getName() << "\" !\n";
oss << "Possible meshes are : ";
- for(const auto & it2 : msg)
- oss << "\"" << it2 << "\" ";
+ for(std::vector<std::string>::const_iterator it2=msg.begin();it2!=msg.end();it2++)
+ oss << "\"" << (*it2) << "\" ";
throw INTERP_KERNEL::Exception(oss.str());
}
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary : input mesh is NULL !");
- std::string const tmp(mesh->getName());
+ std::string tmp(mesh->getName());
if(tmp.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::addNewEntryIfNecessary : empty mesh name ! unsupported by MED file !");
setMeshName(tmp);
if((*it)->getMeshName()==tmp)
return i;
}
- std::size_t const sz=_field_per_mesh.size();
+ std::size_t sz=_field_per_mesh.size();
_field_per_mesh.resize(sz+1);
_field_per_mesh[sz]=MEDFileFieldPerMesh::New(this,mesh);
return (int)sz;
MEDFileFieldGlobsReal& glob)
{
bool ret=false;
- for(auto & it : _field_per_mesh)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
{
- MEDFileFieldPerMesh *fpm(it);
+ MEDFileFieldPerMesh *fpm(*it);
if(fpm)
ret=fpm->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret;
}
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls,locs;
- std::vector< std::vector<std::pair<mcIdType,mcIdType> > > const bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
std::set<TypeOfField> allEnt;
- for(const auto & it1 : typesF)
- for(auto it2 : it1)
- allEnt.insert(it2);
+ for(std::vector< std::vector<TypeOfField> >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++)
+ for(std::vector<TypeOfField>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
+ allEnt.insert(*it2);
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret(allEnt.size());
- auto it3(allEnt.begin());
+ std::set<TypeOfField>::const_iterator it3(allEnt.begin());
for(std::size_t i=0;i<allEnt.size();i++,it3++)
{
std::vector< std::pair<mcIdType,mcIdType> > its;
ret[i]=shallowCpy();
- mcIdType const newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its));
+ mcIdType newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its));
ret[i]->updateData(newLgth,its);
}
return ret;
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls,locs;
- std::vector< std::vector<std::pair<mcIdType,mcIdType> > > const bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
std::set<TypeOfField> allEnt;
std::size_t nbOfMDPGT(0),ii(0);
for(std::vector< std::vector<TypeOfField> >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++,ii++)
{
nbOfMDPGT=std::max(nbOfMDPGT,locs[ii].size());
- for(auto it2 : *it1)
- allEnt.insert(it2);
+ for(std::vector<TypeOfField>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
+ allEnt.insert(*it2);
}
if(allEnt.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes : this field is expected to be defined only on one spatial discretization !");
{
std::vector< std::pair<mcIdType,mcIdType> > its;
ret[i]=shallowCpy();
- mcIdType const newLgth(ret[i]->keepOnlyGaussDiscretization(i,its));
+ mcIdType newLgth(ret[i]->keepOnlyGaussDiscretization(i,its));
ret[i]->updateData(newLgth,its);
}
return ret;
mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
mcIdType globalCounter(0);
- for(auto & it : _field_per_mesh)
- it->keepOnlySpatialDiscretization(tof,globalCounter,its);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->keepOnlySpatialDiscretization(tof,globalCounter,its);
return globalCounter;
}
mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
mcIdType globalCounter(0);
- for(auto & it : _field_per_mesh)
- it->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its);
return globalCounter;
}
if(oldArr)
newArr->copyStringInfoFrom(*oldArr);
mcIdType pos=0;
- for(const auto & oldStartStop : oldStartStops)
+ for(std::vector< std::pair<mcIdType,mcIdType> >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++)
{
- if(oldStartStop.second<oldStartStop.first)
+ if((*it).second<(*it).first)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : the range in the leaves was invalid !");
- newArr->setContigPartOfSelectedValuesSlice(pos,oldArr,oldStartStop.first,oldStartStop.second,1);
- pos+=oldStartStop.second-oldStartStop.first;
+ newArr->setContigPartOfSelectedValuesSlice(pos,oldArr,(*it).first,(*it).second,1);
+ pos+=(*it).second-(*it).first;
}
setArray(newArr);
return ;
*/
std::string MEDFileAnyTypeField1TSWithoutSDA::FieldNameToMEDFileConvention(const std::string& nonCorrectFieldName)
{
- std::string::size_type const pos0(nonCorrectFieldName.find_last_not_of(' '));
+ std::string::size_type pos0(nonCorrectFieldName.find_last_not_of(' '));
if(pos0==std::string::npos)
return nonCorrectFieldName;
if(pos0+1==nonCorrectFieldName.length())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively : unexpected exception internal error !");
_field_per_mesh.resize(1);
//
- MEDFileMesh *mm(nullptr);
+ MEDFileMesh *mm(0);
if(ms)
{
mm=ms->getMeshWithName(getMeshName());
void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc)
{
allocIfNecessaryTheArrayToReceiveDataFromFile();
- for(auto & it : _field_per_mesh)
- it->loadBigArraysRecursively(fid,nasc);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->loadBigArraysRecursively(fid,nasc);
}
void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc)
{
if(allocIfNecessaryTheArrayToReceiveDataFromFile())
- for(auto & it : _field_per_mesh)
- it->loadBigArraysRecursively(fid,nasc);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->loadBigArraysRecursively(fid,nasc);
}
void MEDFileAnyTypeField1TSWithoutSDA::loadStructureAndBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities)
{
- MEDFileCapability const cap(fid);
+ MEDFileCapability cap(fid);
loadOnlyStructureOfDataRecursively(fid,nasc,ms,entities,&cap);
loadBigArraysRecursively(fid,nasc);
}
void MEDFileAnyTypeField1TSWithoutSDA::loadStructureAndBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const PartDefinition *pd, const MEDFileEntities *entities)
{
- MEDFileCapability const cap(fid);
+ MEDFileCapability cap(fid);
loadOnlyStructureOfDataRecursively(fid,nasc,pd,entities,&cap);
loadBigArraysRecursively(fid,nasc);
}
std::vector<const BigMemoryObject *> ret;
if(getUndergroundDataArray())
ret.push_back(getUndergroundDataArray());
- for(const auto & it : _field_per_mesh)
- ret.push_back((const MEDFileFieldPerMesh *)it);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ ret.push_back((const MEDFileFieldPerMesh *)*it);
return ret;
}
{
const MEDCouplingMesh *mesh(field->getMesh());
//
- TypeOfField const type(field->getTypeOfField());
- std::vector<DataArrayIdType *> const dummy;
+ TypeOfField type(field->getTypeOfField());
+ std::vector<DataArrayIdType *> dummy;
if(mesh)
setMeshName(mesh->getName());
mcIdType start(copyTinyInfoFrom(th,field,arr));
- int const pos(addNewEntryIfNecessary(mesh));
+ int pos(addNewEntryIfNecessary(mesh));
if(type!=ON_NODES)
{
- std::vector<mcIdType> const code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh);
+ std::vector<mcIdType> code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh);
_field_per_mesh[pos]->assignFieldNoProfileNoRenum(start,code,field,arr,glob,nasc);
}
else
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input field is null !");
if(!arrOfVals || !arrOfVals->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input array is null or not allocated !");
- TypeOfField const type=field->getTypeOfField();
+ TypeOfField type=field->getTypeOfField();
std::vector<DataArrayIdType *> idsInPflPerType;
std::vector<DataArrayIdType *> idsPerType;
std::vector<mcIdType> code,code2;
std::vector<const DataArrayIdType *> idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin());
// start of check
MCAuto<MEDCouplingFieldTemplate> field2=field->clone(false);
- mcIdType const nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3);
+ mcIdType nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3);
if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples())
{
std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : The array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !";
mcIdType start(copyTinyInfoFrom(th,field,arrOfVals));
code2=m->getDistributionOfTypes();
//
- mcIdType const pos=addNewEntryIfNecessary(m);
+ mcIdType pos=addNewEntryIfNecessary(m);
_field_per_mesh[pos]->assignFieldProfile(start,profile,code,code2,idsInPflPerType,idsPerType,field,arrOfVals,m,glob,nasc);
}
else
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input profile is null, not allocated or with number of components != 1 !");
std::vector<mcIdType> v(3); v[0]=-1; v[1]=profile->getNumberOfTuples(); v[2]=0;
std::vector<const DataArrayIdType *> idsPerType3(1); idsPerType3[0]=profile;
- mcIdType const nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3);
+ mcIdType nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3);
if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples())
{
std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : For node field, the array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
mcIdType start(copyTinyInfoFrom(th,field,arrOfVals));
- mcIdType const pos(addNewEntryIfNecessary(m));
+ mcIdType pos(addNewEntryIfNecessary(m));
_field_per_mesh[pos]->assignNodeFieldProfile(start,profile,field,arrOfVals,glob,nasc);
}
}
{
if(!field)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !");
- std::string const name(field->getName());
+ std::string name(field->getName());
setName(name.c_str());
if(field->getMesh())
setMeshName(field->getMesh()->getName());
}
else
{
- mcIdType const oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
- mcIdType const newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
+ mcIdType oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
+ mcIdType newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
getOrCreateAndGetArray()->reAlloc(newNbOfTuples);
_nb_of_tuples_to_be_allocated=-3;
return oldNbOfTuples;
bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfMultiDiscPerGeoType() const
{
- for(const auto & it : _field_per_mesh)
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
{
- const MEDFileFieldPerMesh *fpm(it);
+ const MEDFileFieldPerMesh *fpm(*it);
if(!fpm)
continue;
if(fpm->presenceOfMultiDiscPerGeoType())
bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfStructureElements() const
{
- for(const auto & it : _field_per_mesh)
- if(it.isNotNull())
- if(it->presenceOfStructureElements())
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
+ if((*it)->presenceOfStructureElements())
return true;
return false;
}
bool MEDFileAnyTypeField1TSWithoutSDA::onlyStructureElements() const
{
- for(const auto & it : _field_per_mesh)
- if(it.isNotNull())
- if(!it->onlyStructureElements())
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
+ if(!(*it)->onlyStructureElements())
return false;
return true;
}
void MEDFileAnyTypeField1TSWithoutSDA::killStructureElements()
{
- for(auto & it : _field_per_mesh)
- if(it.isNotNull())
- it->killStructureElements();
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
+ (*it)->killStructureElements();
}
void MEDFileAnyTypeField1TSWithoutSDA::keepOnlyStructureElements()
{
- for(auto & it : _field_per_mesh)
- if(it.isNotNull())
- it->keepOnlyStructureElements();
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
+ (*it)->keepOnlyStructureElements();
}
void MEDFileAnyTypeField1TSWithoutSDA::keepOnlyOnSE(const std::string& seName)
{
- for(auto & it : _field_per_mesh)
- if(it.isNotNull())
- it->keepOnlyOnSE(seName);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
+ (*it)->keepOnlyOnSE(seName);
}
void MEDFileAnyTypeField1TSWithoutSDA::getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const
{
- for(const auto & it : _field_per_mesh)
- if(it.isNotNull())
- it->getMeshSENames(ps);
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
+ (*it)->getMeshSENames(ps);
}
MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::fieldOnMesh(const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
pm->fillTypesOfFieldAvailable(types);
if(types.size()!=1)
throw INTERP_KERNEL::Exception(MSG0);
- TypeOfField const type(*types.begin());
+ TypeOfField type(*types.begin());
int meshDimRelToMax(0);
if(type==ON_NODES)
meshDimRelToMax=0;
else
{
int myDim(std::numeric_limits<int>::max());
- bool const isUnique(pm->isUniqueLevel(myDim));
+ bool isUnique(pm->isUniqueLevel(myDim));
if(!isUnique)
throw INTERP_KERNEL::Exception(MSG0);
meshDimRelToMax=myDim-mesh->getMeshDimension();
mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder());
else
mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder());
- int const absDim=getDimension();
- int const meshDimRelToMax=absDim-mm->getMeshDimension();
+ int absDim=getDimension();
+ int meshDimRelToMax=absDim-mm->getMeshDimension();
return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm,arrOut,nasc);
}
}
MEDCouplingFieldDiscretization *disc=ret->getDiscretization();
if(!disc) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel : internal error, no discretization on field !");
- std::vector<DataArray *> const arrOut2(1,arrOut);
+ std::vector<DataArray *> arrOut2(1,arrOut);
// 2 following lines replace ret->renumberCells(cellRenum->getConstPointer()) if not DataArrayDouble
disc->renumberArraysForCell(ret->getMesh(),arrOut2,cellRenum->getConstPointer(),true);
(const_cast<MEDCouplingMesh*>(ret->getMesh()))->renumberCells(cellRenum->getConstPointer(),true);
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !");
- std::set<INTERP_KERNEL::NormalizedCellType> const geoTypes=mesh->getAllGeoTypes();
- std::size_t const nbOfTypes=geoTypes.size();
+ std::set<INTERP_KERNEL::NormalizedCellType> geoTypes=mesh->getAllGeoTypes();
+ std::size_t nbOfTypes=geoTypes.size();
std::vector<mcIdType> code(3*nbOfTypes);
MCAuto<DataArrayIdType> arr1=DataArrayIdType::New();
arr1->alloc(nbOfTypes,1);
mcIdType *arrPtr=arr1->getPointer();
- auto it=geoTypes.begin();
+ std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=geoTypes.begin();
for(std::size_t i=0;i<nbOfTypes;i++,it++)
arrPtr[i]=ToIdType(std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it)));
MCAuto<DataArrayIdType> arr2=arr1->checkAndPreparePermutation();
int i=0;
for(it=geoTypes.begin();it!=geoTypes.end();it++,i++)
{
- mcIdType const pos=arrPtr2[i];
- mcIdType const nbCells=mesh->getNumberOfCellsWithType(*it);
+ mcIdType pos=arrPtr2[i];
+ mcIdType nbCells=mesh->getNumberOfCellsWithType(*it);
code[3*pos]=(mcIdType)(*it);
code[3*pos+1]=nbCells;
code[3*pos+2]=-1;//no profiles
}
- std::vector<const DataArrayIdType *> const idsPerType;//no profiles
+ std::vector<const DataArrayIdType *> idsPerType;//no profiles
DataArrayIdType *da=mesh->checkTypeConsistencyAndContig(code,idsPerType);
if(da)
{
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs);
- std::size_t const nbOfRet=ret0.size();
+ std::size_t nbOfRet=ret0.size();
std::vector< std::vector<DataArrayDouble *> > ret(nbOfRet);
for(std::size_t i=0;i<nbOfRet;i++)
{
const std::vector< std::pair<mcIdType,mcIdType> >& p=ret0[i];
- std::size_t const nbOfRet1=p.size();
+ std::size_t nbOfRet1=p.size();
ret[i].resize(nbOfRet1);
for(std::size_t j=0;j<nbOfRet1;j++)
{
}
MEDFileInt32Field1TSWithoutSDA::MEDFileInt32Field1TSWithoutSDA()
-= default;
+{
+}
MEDFileInt32Field1TSWithoutSDA::MEDFileInt32Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order,
const std::vector<std::string>& infos):MEDFileField1TSNDTemplateWithoutSDA<int>(fieldName,meshName,csit,iteration,order,infos)
{
if(_field_per_mesh.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
- if(_field_per_mesh[0]==nullptr)
+ if(_field_per_mesh[0]==0)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !");
_field_per_mesh[0]->getUndergroundDataArrayExt(entries);
return getUndergroundDataArrayTemplate();
}
MEDFileInt64Field1TSWithoutSDA::MEDFileInt64Field1TSWithoutSDA()
-= default;
+{
+}
MEDFileInt64Field1TSWithoutSDA::MEDFileInt64Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order,
const std::vector<std::string>& infos):MEDFileField1TSNDTemplateWithoutSDA<Int64>(fieldName,meshName,csit,iteration,order,infos)
{
if(_field_per_mesh.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
- if(_field_per_mesh[0]==nullptr)
+ if(_field_per_mesh[0]==0)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !");
_field_per_mesh[0]->getUndergroundDataArrayExt(entries);
return getUndergroundDataArrayTemplate();
}
MEDFileFloatField1TSWithoutSDA::MEDFileFloatField1TSWithoutSDA()
-= default;
+{
+}
MEDFileFloatField1TSWithoutSDA::MEDFileFloatField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order,
const std::vector<std::string>& infos):MEDFileField1TSNDTemplateWithoutSDA<float>(fieldName,meshName,csit,iteration,order,infos)
{
if(_field_per_mesh.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
- if(_field_per_mesh[0]==nullptr)
+ if(_field_per_mesh[0]==0)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !");
_field_per_mesh[0]->getUndergroundDataArrayExt(entries);
return getUndergroundDataArrayTemplate();
//= MEDFileAnyTypeField1TS
MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS()
-= default;
+{
+}
MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::AllocateContentFrom(med_idt fid, const std::string& fieldName, int iteration, int order)
{
if(!found)
{
std::ostringstream oss; oss << "No such iteration (" << iteration << "," << order << ") in existing field '" << fName << "' in file '" << FileNameFromFID(fid) << "' ! Available iterations are : ";
- for(const auto & dtit : dtits)
- oss << "(" << dtit.first << "," << dtit.second << "), ";
+ for(std::vector< std::pair<int,int> >::const_iterator iter=dtits.begin();iter!=dtits.end();iter++)
+ oss << "(" << (*iter).first << "," << (*iter).second << "), ";
throw INTERP_KERNEL::Exception(oss.str());
}
MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
{
- std::string const useless;
+ std::string useless;
MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ret(AllocateContentFrom(fid,useless));
if(loadAll)
ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,entities);
MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, bool loadAll)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,loadAll);
}
MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(med_idt fid, bool loadAll)
{
- MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c(BuildContentFrom(fid,loadAll,nullptr,nullptr));
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c(BuildContentFrom(fid,loadAll,0,0));
MCAuto<MEDFileAnyTypeField1TS> ret(BuildNewInstanceFromContent(c,fid));
ret->loadGlobals(fid);
return ret.retn();
MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,fieldName,loadAll);
}
MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(med_idt fid, const std::string& fieldName, bool loadAll)
{
- MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c(BuildContentFrom(fid,fieldName,loadAll,nullptr,nullptr));
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c(BuildContentFrom(fid,fieldName,loadAll,0,0));
MCAuto<MEDFileAnyTypeField1TS> ret(BuildNewInstanceFromContent(c,fid));
ret->loadGlobals(fid);
return ret.retn();
MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,fieldName,iteration,order,loadAll);
}
MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll)
{
- MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c(BuildContentFrom(fid,fieldName,iteration,order,loadAll,(const MEDFileMeshes *)nullptr,nullptr));
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c(BuildContentFrom(fid,fieldName,iteration,order,loadAll,(const MEDFileMeshes *)0,0));
MCAuto<MEDFileAnyTypeField1TS> ret(BuildNewInstanceFromContent(c,fid));
ret->loadGlobals(fid);
return ret.retn();
MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return NewAdv(fid,fieldName,iteration,order,loadAll,entities);
}
MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::NewAdv(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities)
{
- MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c(BuildContentFrom(fid,fieldName,iteration,order,loadAll,(const MEDFileMeshes *)nullptr,entities));
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c(BuildContentFrom(fid,fieldName,iteration,order,loadAll,(const MEDFileMeshes *)0,entities));
MCAuto<MEDFileAnyTypeField1TS> ret(BuildNewInstanceFromContent(c,fid));
ret->loadGlobals(fid);
return ret.retn();
{
if(checkFieldId)
{
- med_int const nbFields=MEDnField(fid);
+ med_int nbFields=MEDnField(fid);
if(fieldIdCFormat>=nbFields)
{
std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::LocateField2(fileName) : in file \'" << FileNameFromFID(fid) << "\' number of fields is " << nbFields << " ! Trying to request for id " << fieldIdCFormat << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
}
- med_int const ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1));
+ med_int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1));
INTERP_KERNEL::AutoPtr<char> comp(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> unit(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> dtunit(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE));
*/
int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut, std::string& meshName)
{
- med_int const nbFields=MEDnField(fid);
+ med_int nbFields=MEDnField(fid);
bool found=false;
std::vector<std::string> fns(nbFields);
int nbOfStep2(-1);
if(!found)
{
std::ostringstream oss; oss << "No such field '" << fieldName << "' in file '" << FileNameFromFID(fid) << "' ! Available fields are : ";
- for(const auto & fn : fns)
- oss << "\"" << fn << "\" ";
+ for(std::vector<std::string>::const_iterator it=fns.begin();it!=fns.end();it++)
+ oss << "\"" << *it << "\" ";
throw INTERP_KERNEL::Exception(oss.str());
}
return nbOfStep2;
void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob)
{
MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
- std::string const oldPflName=disc->getProfile();
+ std::string oldPflName=disc->getProfile();
std::vector<std::string> vv=getPflsReallyUsedMulti();
- std::size_t const nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
+ std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1))
{
disc->setProfile(newPflName);
void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob)
{
MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
- std::string const oldLocName=disc->getLocalization();
+ std::string oldLocName=disc->getLocalization();
std::vector<std::string> vv=getLocsReallyUsedMulti();
- std::size_t const nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
+ std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
if(forceRenameOnGlob || (!existsLoc(newLocName) && nbOfOcc==1))
{
disc->setLocalization(newLocName);
{
if(getFileName().empty())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::loadArrays : the structure does not come from a file !");
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName()));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
}
{
if(!getFileName().empty())
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName()));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
}
}
void MEDFileAnyTypeField1TS::writeLL(med_idt fid) const
{
- std::size_t const nbComp(getNumberOfComponents());
+ std::size_t nbComp(getNumberOfComponents());
INTERP_KERNEL::AutoPtr<char> comp(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> unit(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE));
for(std::size_t i=0;i<nbComp;i++)
{
- std::string const info=getInfo()[i];
+ std::string info=getInfo()[i];
std::string c,u;
MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,_too_long_str);
if(!content)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitComponents : no content in this ! Unable to split components !");
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit=content->splitComponents();
- std::size_t const sz(contentsSplit.size());
+ std::size_t sz(contentsSplit.size());
std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
if(!content)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitDiscretizations : no content in this ! Unable to split discretization !");
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit(content->splitDiscretizations());
- std::size_t const sz(contentsSplit.size());
+ std::size_t sz(contentsSplit.size());
std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
if(!content)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretization !");
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
- std::size_t const sz(contentsSplit.size());
+ std::size_t sz(contentsSplit.size());
std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
if(content)
{
- const auto *contc=dynamic_cast<const MEDFileField1TSWithoutSDA *>(content);
+ const MEDFileField1TSWithoutSDA *contc=dynamic_cast<const MEDFileField1TSWithoutSDA *>(content);
if(!contc)
throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
MCAuto<MEDFileInt32Field1TSWithoutSDA> newc(contc->convertToInt());
const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
if(content)
{
- const auto *contc=dynamic_cast<const MEDFileField1TSWithoutSDA *>(content);
+ const MEDFileField1TSWithoutSDA *contc=dynamic_cast<const MEDFileField1TSWithoutSDA *>(content);
if(!contc)
throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
MCAuto<MEDFileInt64Field1TSWithoutSDA> newc(contc->convertToInt64());
if(!f)
throw INTERP_KERNEL::Exception("MEDFileInt32Field1TS::ConvertFieldIntToFieldDouble : null input field !");
int t1,t2;
- double const t0(f->getTime(t1,t2));
- std::string const tu(f->getTimeUnit());
+ double t0(f->getTime(t1,t2));
+ std::string tu(f->getTimeUnit());
MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*f));
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*ft));
ret->setTime(t0,t1,t2); ret->setTimeUnit(tu);
if(!f)
throw INTERP_KERNEL::Exception("MEDFileInt64Field1TS::ConvertFieldIntToFieldDouble : null input field !");
int t1,t2;
- double const t0(f->getTime(t1,t2));
- std::string const tu(f->getTimeUnit());
+ double t0(f->getTime(t1,t2));
+ std::string tu(f->getTimeUnit());
MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*f));
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*ft));
ret->setTime(t0,t1,t2); ret->setTimeUnit(tu);
#ifndef __MEDFILEFIELD1TS_HXX__
#define __MEDFILEFIELD1TS_HXX__
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingTraits.hxx"
-#include "MEDFileUtilities.txx"
#include "MEDLoaderDefines.hxx"
#include "MEDFileFieldGlobs.hxx"
#include "MEDFileFieldInternal.hxx"
#include "MEDLoaderTraits.hxx"
-#include "NormalizedGeometricTypes"
#include "med.h"
-#include <string>
-#include <vector>
-#include <utility>
-#include <cstddef>
-#include <ostream>
-#include <map>
namespace MEDCoupling
{
MEDLOADER_EXPORT void keepOnlyOnSE(const std::string& seName);
MEDLOADER_EXPORT void getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const;
MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& infos);
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
MEDLOADER_EXPORT void setFieldNoProfileSBT(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true);
MEDFileField1TSTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order):MEDFileAnyTypeField1TSWithoutSDA(fieldName,meshName,csit,iteration,order) { }
MEDFileField1TSTemplateWithoutSDA() { }
public:
- MEDLOADER_EXPORT void setArray(DataArray *arr) override;
- MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const override;
+ MEDLOADER_EXPORT void setArray(DataArray *arr);
+ MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getOrCreateAndGetArrayTemplate();
MEDLOADER_EXPORT typename Traits<T>::ArrayType const *getOrCreateAndGetArrayTemplate() const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplate() const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
- MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray() override;
- MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const override;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const override;
+ MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray();
+ MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const;
MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits<T>::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts);
MEDLOADER_EXPORT void copyTimeInfoFrom(const typename Traits<T>::FieldType *mcf);
protected:
class MEDFileField1TSWithoutSDA : public MEDFileField1TSTemplateWithoutSDA<double>
{
public:
- MEDLOADER_EXPORT const char *getTypeStr() const override;
+ MEDLOADER_EXPORT const char *getTypeStr() const;
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileField1TSWithoutSDA"); }
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const override;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax);
MEDLOADER_EXPORT static std::vector<mcIdType> CheckSBTMesh(const MEDCouplingMesh *mesh);
public:
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA();
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
- MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const override;
- MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const override;
+ MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const;
+ MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const;
MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *convertToInt() const;
MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *convertToInt64() const;
MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *convertToFloat() const;
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *convertToDouble() const;
protected:
MEDFileField1TSNDTemplateWithoutSDA() { }
- MEDFileField1TSNDTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& /*infos*/):MEDFileField1TSTemplateWithoutSDA<T>(fieldName,meshName,csit,iteration,order) { }
+ MEDFileField1TSNDTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos):MEDFileField1TSTemplateWithoutSDA<T>(fieldName,meshName,csit,iteration,order) { }
};
/*!
MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA();
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32Field1TSWithoutSDA"); }
MEDLOADER_EXPORT static MEDFileInt32Field1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
- MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *deepCopy() const override;
- MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *shallowCpy() const override;
- MEDLOADER_EXPORT const char *getTypeStr() const override;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const override;
+ MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *deepCopy() const;
+ MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *shallowCpy() const;
+ MEDLOADER_EXPORT const char *getTypeStr() const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT DataArrayInt32 *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
protected:
MEDFileInt32Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA();
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64Field1TSWithoutSDA"); }
MEDLOADER_EXPORT static MEDFileInt64Field1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
- MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *deepCopy() const override;
- MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *shallowCpy() const override;
- MEDLOADER_EXPORT const char *getTypeStr() const override;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const override;
+ MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *deepCopy() const;
+ MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *shallowCpy() const;
+ MEDLOADER_EXPORT const char *getTypeStr() const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT DataArrayInt64 *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
protected:
MEDFileInt64Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA();
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFloatField1TSWithoutSDA"); }
MEDLOADER_EXPORT static MEDFileFloatField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
- MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *deepCopy() const override;
- MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *shallowCpy() const override;
- MEDLOADER_EXPORT const char *getTypeStr() const override;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const override;
+ MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *deepCopy() const;
+ MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *shallowCpy() const;
+ MEDLOADER_EXPORT const char *getTypeStr() const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT DataArrayFloat *getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
protected:
MEDFileFloatField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
{
protected:
MEDLOADER_EXPORT MEDFileAnyTypeField1TS();
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr);
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr);
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr);
+ MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
+ MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
+ MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileAnyTypeField1TS"); }
MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c);
MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, int iteration, int order, const PartDefinition *pd, const MEDFileEntities *entities);
MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *AllocateContentFrom(med_idt fid, const std::string& fieldName, int iteration=-1, int order=-1);
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
// direct forwarding to MEDFileAnyTypeField1TSWithoutSDA instance _content
public:
MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
//! underground method see MEDFileField1TSWithoutSDA::setLocNameOnLeaf
MEDLOADER_EXPORT void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const override;
- MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const override;
- MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti() const override;
- MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti() const override;
- MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) override;
- MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
+ MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
+ MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti() const;
+ MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti() const;
+ MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
+ MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
public:
MEDLOADER_EXPORT static int LocateField2(med_idt fid, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut, std::string& meshName);
MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut, std::string& meshName);
MEDLOADER_EXPORT void setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const;
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const override { return this->extractPartImpl(extractDef,mm); }
+ MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
protected:
- ~MEDFileTemplateField1TS() override = default;
+ ~MEDFileTemplateField1TS() { }
MEDFileTemplateField1TS();
MEDFileTemplateField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileAnyTypeField1TS(fid,loadAll,ms) { }
MEDFileTemplateField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileAnyTypeField1TS(fid,fieldName,loadAll,ms) { }
MEDLOADER_EXPORT MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const;
MEDLOADER_EXPORT MEDFileInt64Field1TS *convertToInt64(bool isDeepCpyGlobs=true) const;
public:
- MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeField1TS> buildNewEmpty() const override;
- MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const override;
+ MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeField1TS> buildNewEmpty() const;
+ MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const;
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileField1TS"); }
public:
private:
- med_field_type getMEDFileFieldType() const override { return MED_FLOAT64; }
+ med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
private:
- ~MEDFileField1TS() override = default;
+ ~MEDFileField1TS() { }
MEDFileField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
MEDFileField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms);
MEDFileField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms);
MEDLOADER_EXPORT MEDFileField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
MEDLOADER_EXPORT MEDFileField1TS *convertToInt64(bool isDeepCpyGlobs=true) const;
protected:
- ~MEDFileNDTemplateField1TS() override = default;
+ ~MEDFileNDTemplateField1TS() { }
MEDFileNDTemplateField1TS() { }
MEDFileNDTemplateField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateField1TS<T>(fid,loadAll,ms) { }
MEDFileNDTemplateField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateField1TS<T>(fid,fieldName,loadAll,ms) { }
{
friend class MEDFileTemplateField1TS<Int32>;
public:
- MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeField1TS> buildNewEmpty() const override;
- MEDLOADER_EXPORT MEDFileInt32Field1TS *shallowCpy() const override { return new MEDFileInt32Field1TS(*this); }
+ MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeField1TS> buildNewEmpty() const;
+ MEDLOADER_EXPORT MEDFileInt32Field1TS *shallowCpy() const { return new MEDFileInt32Field1TS(*this); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32Field1TS"); }
public:
MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldDouble> ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt32 *f);
private:
- med_field_type getMEDFileFieldType() const override { return MED_INT32; }
+ med_field_type getMEDFileFieldType() const { return MED_INT32; }
private:
- ~MEDFileInt32Field1TS() override = default;
+ ~MEDFileInt32Field1TS() { }
MEDFileInt32Field1TS() { }
MEDFileInt32Field1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<Int32>(fid,loadAll,ms) { }
MEDFileInt32Field1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<Int32>(fid,fieldName,loadAll,ms) { }
{
friend class MEDFileTemplateField1TS<Int64>;
public:
- MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeField1TS> buildNewEmpty() const override;
- MEDLOADER_EXPORT MEDFileInt64Field1TS *shallowCpy() const override { return new MEDFileInt64Field1TS(*this); }
+ MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeField1TS> buildNewEmpty() const;
+ MEDLOADER_EXPORT MEDFileInt64Field1TS *shallowCpy() const { return new MEDFileInt64Field1TS(*this); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64Field1TS"); }
public:
MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldDouble> ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt64 *f);
private:
- med_field_type getMEDFileFieldType() const override { return MED_INT64; }
+ med_field_type getMEDFileFieldType() const { return MED_INT64; }
private:
- ~MEDFileInt64Field1TS() override = default;
+ ~MEDFileInt64Field1TS() { }
MEDFileInt64Field1TS() { }
MEDFileInt64Field1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<Int64>(fid,loadAll,ms) { }
MEDFileInt64Field1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<Int64>(fid,fieldName,loadAll,ms) { }
{
friend class MEDFileTemplateField1TS<float>;
private:
- med_field_type getMEDFileFieldType() const override { return MED_FLOAT32; }
- MEDLOADER_EXPORT MEDFileFloatField1TS *shallowCpy() const override { return new MEDFileFloatField1TS(*this); }
+ med_field_type getMEDFileFieldType() const { return MED_FLOAT32; }
+ MEDLOADER_EXPORT MEDFileFloatField1TS *shallowCpy() const { return new MEDFileFloatField1TS(*this); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFloatField1TS"); }
- MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeField1TS> buildNewEmpty() const override;
+ MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeField1TS> buildNewEmpty() const;
private:
- ~MEDFileFloatField1TS() override = default;
+ ~MEDFileFloatField1TS() { }
MEDFileFloatField1TS() { }
MEDFileFloatField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<float>(fid,loadAll,ms) { }
MEDFileFloatField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<float>(fid,fieldName,loadAll,ms) { }
// Author : Anthony Geay (EDF R&D)
#include "MEDFileFieldGlobs.hxx"
-#include "MCAuto.hxx"
-#include "MEDFileBasis.hxx"
-#include "MEDCouplingRefCountObject.hxx"
+#include "MEDFileField.txx"
#include "MEDFileMesh.hxx"
#include "MEDLoaderBase.hxx"
+#include "MEDLoaderTraits.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDFileFieldOverView.hxx"
-#include "MEDFileFieldInternal.hxx"
+#include "MEDFileBlowStrEltUp.hxx"
+#include "MEDFileFieldVisitor.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingFieldDiscretization.hxx"
#include "MCType.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "med.h"
-#include "medprofile.h"
-#include "medlocalization.h"
-#include "NormalizedGeometricTypes"
+#include "CellModel.hxx"
#include <algorithm>
-#include <cstddef>
#include <iterator>
-#include <map>
-#include <string>
-#include <vector>
-#include <sstream>
-#include <ostream>
-#include <utility>
using namespace MEDCoupling;
if(id>=(int)_pfls.size())
_pfls.resize(id+1);
MCAuto<DataArrayMedInt> miPfl=DataArrayMedInt::New();
- med_int const lgth(MEDprofileSizeByName(fid,pflName.c_str()));
+ med_int lgth(MEDprofileSizeByName(fid,pflName.c_str()));
miPfl->setName(pflName);
miPfl->alloc(lgth,1);
MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),miPfl->getPointer()));
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
med_int sz;
MEDFILESAFECALLERRD0(MEDprofileInfo,(fid,i+1,pflName,&sz));
- std::string const pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE);
+ std::string pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE);
if(i>=(int)_pfls.size())
_pfls.resize(i+1);
MCAuto<DataArrayMedInt> miPfl=DataArrayMedInt::New();
void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) const
{
- std::size_t const nbOfPfls=_pfls.size();
+ std::size_t nbOfPfls=_pfls.size();
for(std::size_t i=0;i<nbOfPfls;i++)
{
MCAuto<DataArrayMedInt> cpy=DataArrayMedInt_Copy((const DataArrayIdType*)_pfls[i]);
MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,ToMedInt(_pfls[i]->getNumberOfTuples()),cpy->getConstPointer()));
}
//
- std::size_t const nbOfLocs=_locs.size();
+ std::size_t nbOfLocs=_locs.size();
for(std::size_t i=0;i<nbOfLocs;i++)
_locs[i]->writeLL(fid);
}
void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps)
{
std::vector<std::string> pfls=getPfls();
- for(const auto & _pfl : other._pfls)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++)
{
- auto const it2=std::find(pfls.begin(),pfls.end(),_pfl->getName());
+ std::vector<std::string>::iterator it2=std::find(pfls.begin(),pfls.end(),(*it)->getName());
if(it2==pfls.end())
{
- _pfls.push_back(_pfl);
+ _pfls.push_back(*it);
}
else
{
- std::size_t const id=std::distance(pfls.begin(),it2);
- if(!_pfl->isEqual(*_pfls[id]))
+ std::size_t id=std::distance(pfls.begin(),it2);
+ if(!(*it)->isEqual(*_pfls[id]))
{
- std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Profile \"" << _pfl->getName() << "\" already exists and is different from those expecting to be append !";
+ std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Profile \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !";
throw INTERP_KERNEL::Exception(oss.str());
}
}
}
std::vector<std::string> locs=getLocs();
- for(const auto & _loc : other._locs)
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=other._locs.begin();it!=other._locs.end();it++)
{
- auto const it2=std::find(locs.begin(),locs.end(),_loc->getName());
+ std::vector<std::string>::iterator it2=std::find(locs.begin(),locs.end(),(*it)->getName());
if(it2==locs.end())
{
- _locs.push_back(_loc);
+ _locs.push_back(*it);
}
else
{
- std::size_t const id=std::distance(locs.begin(),it2);
- if(!_loc->isEqual(*_locs[id],eps))
+ std::size_t id=std::distance(locs.begin(),it2);
+ if(!(*it)->isEqual(*_locs[id],eps))
{
- std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Localization \"" << _loc->getName() << "\" already exists and is different from those expecting to be append !";
+ std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Localization \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !";
throw INTERP_KERNEL::Exception(oss.str());
}
}
void MEDFileFieldGlobs::checkGlobsPflsPartCoherency(const std::vector<std::string>& pflsUsed) const
{
- for(const auto & it : pflsUsed)
- getProfile(it.c_str());
+ for(std::vector<std::string>::const_iterator it=pflsUsed.begin();it!=pflsUsed.end();it++)
+ getProfile((*it).c_str());
}
void MEDFileFieldGlobs::checkGlobsLocsPartCoherency(const std::vector<std::string>& locsUsed) const
{
- for(const auto & it : locsUsed)
- getLocalization(it.c_str());
+ for(std::vector<std::string>::const_iterator it=locsUsed.begin();it!=locsUsed.end();it++)
+ getLocalization((*it).c_str());
}
void MEDFileFieldGlobs::loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real)
for(unsigned int i=0;i<sz;i++)
loadProfileInFile(fid,i,profiles[i].c_str());
//
- std::vector<std::string> const locs=real.getLocsReallyUsed();
+ std::vector<std::string> locs=real.getLocsReallyUsed();
sz=locs.size();
_locs.resize(sz);
for(std::size_t i=0;i<sz;i++)
void MEDFileFieldGlobs::loadAllGlobals(med_idt fid, const MEDFileEntities *entities)
{
- med_int const nProfil=MEDnProfile(fid);
+ med_int nProfil=MEDnProfile(fid);
for(int i=0;i<nProfil;i++)
loadProfileInFile(fid,i);
- med_int const sz=MEDnLocalization(fid);
+ med_int sz=MEDnLocalization(fid);
_locs.resize(sz);
for(int i=0;i<sz;i++)
{
std::vector<const BigMemoryObject *> MEDFileFieldGlobs::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _pfl : _pfls)
- ret.push_back((const DataArrayIdType *)_pfl);
- for(const auto & _loc : _locs)
- ret.push_back((const MEDFileFieldLoc *)_loc);
+ for(std::vector< MCAuto< DataArrayIdType > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
+ ret.push_back((const DataArrayIdType *)*it);
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++)
+ ret.push_back((const MEDFileFieldLoc *)*it);
return ret;
}
{
MCAuto<MEDFileFieldGlobs> ret=new MEDFileFieldGlobs(*this);
std::size_t i=0;
- for(auto it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
if((const DataArrayIdType *)*it)
ret->_pfls[i]=(*it)->deepCopy();
}
i=0;
- for(auto it=_locs.begin();it!=_locs.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++)
{
if((const MEDFileFieldLoc*)*it)
ret->_locs[i]=(*it)->deepCopy();
MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const
{
MCAuto<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
- for(const auto & it1 : pfls)
+ for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
{
- DataArrayIdType *pfl=const_cast<DataArrayIdType *>(getProfile(it1.c_str()));
+ DataArrayIdType *pfl=const_cast<DataArrayIdType *>(getProfile((*it1).c_str()));
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! pfl null !");
pfl->incrRef();
- MCAuto<DataArrayIdType> const pfl2(pfl);
+ MCAuto<DataArrayIdType> pfl2(pfl);
ret->_pfls.push_back(pfl2);
}
- for(const auto & it2 : locs)
+ for(std::vector<std::string>::const_iterator it2=locs.begin();it2!=locs.end();it2++)
{
- MEDFileFieldLoc *loc=const_cast<MEDFileFieldLoc *>(&getLocalization(it2.c_str()));
+ MEDFileFieldLoc *loc=const_cast<MEDFileFieldLoc *>(&getLocalization((*it2).c_str()));
if(!loc)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! loc null !");
loc->incrRef();
- MCAuto<MEDFileFieldLoc> const loc2(loc);
+ MCAuto<MEDFileFieldLoc> loc2(loc);
ret->_locs.push_back(loc2);
}
ret->setFileName(getFileName());
MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const
{
MCAuto<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
- for(const auto & it1 : pfls)
+ for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
{
- DataArrayIdType *pfl=const_cast<DataArrayIdType *>(getProfile(it1.c_str()));
+ DataArrayIdType *pfl=const_cast<DataArrayIdType *>(getProfile((*it1).c_str()));
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! pfl null !");
ret->_pfls.push_back(pfl->deepCopy());
}
- for(const auto & it2 : locs)
+ for(std::vector<std::string>::const_iterator it2=locs.begin();it2!=locs.end();it2++)
{
- MEDFileFieldLoc *loc=const_cast<MEDFileFieldLoc *>(&getLocalization(it2.c_str()));
+ MEDFileFieldLoc *loc=const_cast<MEDFileFieldLoc *>(&getLocalization((*it2).c_str()));
if(!loc)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! loc null !");
ret->_locs.push_back(loc->deepCopy());
}
MEDFileFieldGlobs::MEDFileFieldGlobs()
-= default;
+{
+}
MEDFileFieldGlobs::~MEDFileFieldGlobs()
-= default;
+{
+}
void MEDFileFieldGlobs::simpleRepr(std::ostream& oss) const
{
void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & _pfl : _pfls)
+ for(std::vector< MCAuto<DataArrayIdType> >::iterator it=_pfls.begin();it!=_pfls.end();it++)
{
- DataArrayIdType *elt(_pfl);
+ DataArrayIdType *elt(*it);
if(elt)
{
- std::string const name(elt->getName());
- for(const auto & it2 : mapOfModif)
+ std::string name(elt->getName());
+ for(std::vector< std::pair<std::vector<std::string>, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++)
{
- if(std::find(it2.first.begin(),it2.first.end(),name)!=it2.first.end())
+ if(std::find((*it2).first.begin(),(*it2).first.end(),name)!=(*it2).first.end())
{
- elt->setName(it2.second.c_str());
+ elt->setName((*it2).second.c_str());
return;
}
}
void MEDFileFieldGlobs::changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & _loc : _locs)
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::iterator it=_locs.begin();it!=_locs.end();it++)
{
- MEDFileFieldLoc *elt(_loc);
+ MEDFileFieldLoc *elt(*it);
if(elt)
{
- std::string const name(elt->getName());
- for(const auto & it2 : mapOfModif)
+ std::string name(elt->getName());
+ for(std::vector< std::pair<std::vector<std::string>, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++)
{
- if(std::find(it2.first.begin(),it2.first.end(),name)!=it2.first.end())
+ if(std::find((*it2).first.begin(),(*it2).first.end(),name)!=(*it2).first.end())
{
- elt->setName(it2.second.c_str());
+ elt->setName((*it2).second.c_str());
return;
}
}
int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const
{
- auto it=std::find_if(_locs.begin(),_locs.end(),MEDCouplingImpl::LocFinder(loc));
+ std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),MEDCouplingImpl::LocFinder(loc));
if(it==_locs.end())
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::getLocalisationId : no such localisation name : \"" << loc << "\" Possible localizations are : ";
int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const
{
- auto it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl));
+ std::vector< MCAuto<DataArrayIdType> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl));
if(it==_pfls.end())
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfileId : no such profile name : \"" << pfl << "\" Possible localizations are : ";
*/
DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName)
{
- std::string const pflNameCpp(pflName);
- auto it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp));
+ std::string pflNameCpp(pflName);
+ std::vector< MCAuto<DataArrayIdType> >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp));
if(it==_pfls.end())
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : ";
void MEDFileFieldGlobs::killStructureElementsInGlobs()
{
std::vector< MCAuto<MEDFileFieldLoc> > newLocs;
- for(auto & _loc : _locs)
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::iterator it=_locs.begin();it!=_locs.end();it++)
{
- if(_loc.isNull())
+ if((*it).isNull())
continue;
- if(!_loc->isOnStructureElement())
- newLocs.push_back(_loc);
+ if(!(*it)->isOnStructureElement())
+ newLocs.push_back(*it);
}
_locs=newLocs;
}
std::vector<std::string> MEDFileFieldGlobs::getPfls() const
{
- std::size_t const sz=_pfls.size();
+ std::size_t sz=_pfls.size();
std::vector<std::string> ret(sz);
for(std::size_t i=0;i<sz;i++)
ret[i]=_pfls[i]->getName();
std::vector<std::string> MEDFileFieldGlobs::getLocs() const
{
- std::size_t const sz=_locs.size();
+ std::size_t sz=_locs.size();
std::vector<std::string> ret(sz);
for(std::size_t i=0;i<sz;i++)
ret[i]=_locs[i]->getName();
bool MEDFileFieldGlobs::existsPfl(const std::string& pflName) const
{
std::vector<std::string> v=getPfls();
- std::string const s(pflName);
+ std::string s(pflName);
return std::find(v.begin(),v.end(),s)!=v.end();
}
bool MEDFileFieldGlobs::existsLoc(const std::string& locName) const
{
std::vector<std::string> v=getLocs();
- std::string const s(locName);
+ std::string s(locName);
return std::find(v.begin(),v.end(),s)!=v.end();
}
{
std::map<mcIdType,std::vector<int> > m;
int i=0;
- for(auto it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
const DataArrayIdType *tmp=(*it);
if(tmp)
{
std::vector<int> ret0;
bool equalityOrNot=false;
- for(auto it3=(*it2).second.begin();it3!=(*it2).second.end();it3++)
+ for(std::vector<int>::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++)
{
- auto it4=it3; it4++;
+ std::vector<int>::const_iterator it4=it3; it4++;
for(;it4!=(*it2).second.end();it4++)
{
if(_pfls[*it3]->isEqualWithoutConsideringStr(*_pfls[*it4]))
return ret;
}
-std::vector< std::vector<int> > MEDFileFieldGlobs::whichAreEqualLocs(double /*eps*/) const
+std::vector< std::vector<int> > MEDFileFieldGlobs::whichAreEqualLocs(double eps) const
{
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::whichAreEqualLocs : no implemented yet ! Sorry !");
}
void MEDFileFieldGlobs::appendProfile(DataArrayIdType *pfl)
{
- std::string const name(pfl->getName());
+ std::string name(pfl->getName());
if(name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendProfile : unsupported profiles with no name !");
- for(const auto & _pfl : _pfls)
- if(name==_pfl->getName())
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
+ if(name==(*it)->getName())
{
- if(!pfl->isEqual(*_pfl))
+ if(!pfl->isEqual(*(*it)))
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::appendProfile : profile \"" << name << "\" already exists and is different from existing !";
throw INTERP_KERNEL::Exception(oss.str());
void MEDFileFieldGlobs::appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w)
{
- std::string const name(locName);
+ std::string name(locName);
if(name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendLoc : unsupported localizations with no name !");
MCAuto<MEDFileFieldLoc> obj=MEDFileFieldLoc::New(locName,geoType,refCoo,gsCoo,w);
- for(const auto & _loc : _locs)
- if(_loc->isName(locName))
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++)
+ if((*it)->isName(locName))
{
- if(!_loc->isEqual(*obj,1e-12))
+ if(!(*it)->isEqual(*obj,1e-12))
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::appendLoc : localization \"" << name << "\" already exists and is different from existing !";
throw INTERP_KERNEL::Exception(oss.str());
std::string MEDFileFieldGlobs::createNewNameOfPfl() const
{
- std::vector<std::string> const names=getPfls();
+ std::vector<std::string> names=getPfls();
return CreateNewNameNotIn("NewPfl_",names);
}
std::string MEDFileFieldGlobs::createNewNameOfLoc() const
{
- std::vector<std::string> const names=getLocs();
+ std::vector<std::string> names=getLocs();
return CreateNewNameNotIn("NewLoc_",names);
}
{
const MEDFileFieldGlobs *glob=_globals;
std::ostringstream oss2; oss2 << glob;
- std::string const stars(oss2.str().length(),'*');
+ std::string stars(oss2.str().length(),'*');
oss << "Globals information on fields (at " << oss2.str() << "):" << "\n************************************" << stars << "\n\n";
if(glob)
glob->simpleRepr(oss);
}
MEDFileFieldGlobsReal::~MEDFileFieldGlobsReal()
-= default;
+{
+}
/*!
* Copies references to profiles and Gauss points from another MEDFileFieldGlobsReal.
void MEDFileFieldGlobsReal::changePflName(const std::string& oldName, const std::string& newName)
{
std::vector< std::pair<std::vector<std::string>, std::string > > mapOfModif(1);
- std::pair<std::vector<std::string>, std::string > const p(std::vector<std::string>(1,std::string(oldName)),std::string(newName));
+ std::pair<std::vector<std::string>, std::string > p(std::vector<std::string>(1,std::string(oldName)),std::string(newName));
mapOfModif[0]=p;
changePflsNames(mapOfModif);
}
void MEDFileFieldGlobsReal::changeLocName(const std::string& oldName, const std::string& newName)
{
std::vector< std::pair<std::vector<std::string>, std::string > > mapOfModif(1);
- std::pair<std::vector<std::string>, std::string > const p(std::vector<std::string>(1,std::string(oldName)),std::string(newName));
+ std::pair<std::vector<std::string>, std::string > p(std::vector<std::string>(1,std::string(oldName)),std::string(newName));
mapOfModif[0]=p;
changeLocsNames(mapOfModif);
}
{
std::vector< std::string > tmp((*it).size());
int j=0;
- for(auto it2=(*it).begin();it2!=(*it).end();it2++,j++)
+ for(std::vector<int>::const_iterator it2=(*it).begin();it2!=(*it).end();it2++,j++)
tmp[j]=std::string(getProfileFromId(*it2)->getName());
- std::pair<std::vector<std::string>, std::string > const p(tmp,tmp.front());
+ std::pair<std::vector<std::string>, std::string > p(tmp,tmp.front());
ret[i]=p;
- std::vector<int> const tmp2((*it).begin()+1,(*it).end());
+ std::vector<int> tmp2((*it).begin()+1,(*it).end());
killProfileIds(tmp2);
}
changePflsRefsNamesGen(ret);
{
std::vector< std::string > tmp((*it).size());
int j=0;
- for(auto it2=(*it).begin();it2!=(*it).end();it2++,j++)
+ for(std::vector<int>::const_iterator it2=(*it).begin();it2!=(*it).end();it2++,j++)
tmp[j]=std::string(getLocalizationFromId(*it2).getName());
- std::pair<std::vector<std::string>, std::string > const p(tmp,tmp.front());
+ std::pair<std::vector<std::string>, std::string > p(tmp,tmp.front());
ret[i]=p;
- std::vector<int> const tmp2((*it).begin()+1,(*it).end());
+ std::vector<int> tmp2((*it).begin()+1,(*it).end());
killLocalizationIds(tmp2);
}
changeLocsRefsNamesGen(ret);
//= MEDFileFieldNameScope
MEDFileFieldNameScope::MEDFileFieldNameScope()
-= default;
+{
+}
MEDFileFieldNameScope::MEDFileFieldNameScope(const std::string& fieldName, const std::string& meshName):_name(fieldName),_mesh_name(meshName)
{
#ifndef __MEDFILEFIELDGLOBS_HXX__
#define __MEDFILEFIELDGLOBS_HXX__
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
#include "MEDLoaderDefines.hxx"
#include "NormalizedGeometricTypes"
+#include "MEDCouplingMemArray.hxx"
#include "MCAuto.hxx"
#include "med.h"
-#include <string>
-#include <cstddef>
-#include <vector>
-#include <ostream>
-#include <utility>
namespace MEDCoupling
{
static MEDFileFieldGlobs *New(med_idt fid);
static MEDFileFieldGlobs *New();
std::string getClassName() const override { return std::string("MEDFileFieldGlobs"); }
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDFileFieldGlobs *deepCopy() const;
MEDFileFieldGlobs *shallowCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const;
MEDFileFieldGlobs *deepCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const;
protected:
MEDFileFieldGlobs(med_idt fid);
MEDFileFieldGlobs();
- ~MEDFileFieldGlobs() override;
+ ~MEDFileFieldGlobs();
protected:
std::vector< MCAuto<DataArrayIdType> > _pfls;
std::vector< MCAuto<MEDFileFieldLoc> > _locs;
MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id, const std::string& pflName);
MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id);
MEDLOADER_EXPORT void loadGlobals(med_idt fid);
- MEDLOADER_EXPORT void loadAllGlobals(med_idt fid, const MEDFileEntities *entities=nullptr);
+ MEDLOADER_EXPORT void loadAllGlobals(med_idt fid, const MEDFileEntities *entities=0);
MEDLOADER_EXPORT void writeGlobals(med_idt fid, const MEDFileWritable& opt) const;
MEDLOADER_EXPORT std::vector<std::string> getPfls() const;
MEDLOADER_EXPORT std::vector<std::string> getLocs() const;
// Author : Anthony Geay (EDF R&D)
#include "MEDFileFieldInternal.hxx"
-#include "InterpKernelAutoPtr.hxx"
-#include "MEDFileBasis.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingPartDefinition.hxx"
#include "MEDFileField.hxx"
#include "MEDFileFieldVisitor.hxx"
#include "MEDFileStructureElement.hxx"
#include "MEDFilterEntity.hxx"
#include "CellModel.hxx"
-#include "med.h"
-#include "NormalizedGeometricTypes"
-#include <string>
-#include <sstream>
-#include <vector>
-#include "medlocalization.h"
-#include <iterator>
-#include <algorithm>
-#include "medmesh.h"
-#include <cstddef>
-#include <ostream>
-#include <limits>
-#include "medfield.h"
-#include <set>
-#include <utility>
-#include <map>
-#include <list>
// From MEDLOader.cxx TU
extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO];
using namespace MEDCoupling;
MEDFileGTKeeper::~MEDFileGTKeeper()
-= default;
+{
+}
MEDFileGTKeeper *MEDFileGTKeeperSta::deepCopy() const
{
bool MEDFileGTKeeperSta::isEqual(const MEDFileGTKeeper *other) const
{
- const auto *otherC(dynamic_cast<const MEDFileGTKeeperSta *>(other));
+ const MEDFileGTKeeperSta *otherC(dynamic_cast<const MEDFileGTKeeperSta *>(other));
if(!otherC)
return false;
return _geo_type==otherC->_geo_type;
bool MEDFileGTKeeperDyn::isEqual(const MEDFileGTKeeper *other) const
{
- const auto *otherC(dynamic_cast<const MEDFileGTKeeperDyn *>(other));
+ const MEDFileGTKeeperDyn *otherC(dynamic_cast<const MEDFileGTKeeperDyn *>(other));
if(!otherC)
return false;
return this==otherC;
_dim=FromMedInt<int>(dim);
_nb_gauss_pt=FromMedInt<int>(nb_gauss_pt);
_name=locName;
- std::string const sectionName(MEDLoaderBase::buildStringFromFortran(sectionmeshname,MED_NAME_SIZE));
+ std::string sectionName(MEDLoaderBase::buildStringFromFortran(sectionmeshname,MED_NAME_SIZE));
if(sectionName.empty())
{
_gt=new MEDFileGTKeeperSta((INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+INTERP_KERNEL::NORM_MAXTYPE,geotype))));
}
else
{
- const auto *entities2(dynamic_cast<const MEDFileAllStaticEntitiesPlusDyn *>(entities));
+ const MEDFileAllStaticEntitiesPlusDyn *entities2(dynamic_cast<const MEDFileAllStaticEntitiesPlusDyn *>(entities));
if(!entities2)
{
std::ostringstream oss; oss << "MEDFileFieldLoc cstr : for loc \"" << _name << "\" presence of non static type ! Expect entities !";
const MEDFileGTKeeper *gt(_gt);
if(!gt)
throw INTERP_KERNEL::Exception("MEDFileFieldLoc::isOnStructureElement : null pointer !");
- const auto *gt2(dynamic_cast<const MEDFileGTKeeperDyn *>(gt));
- return gt2!=nullptr;
+ const MEDFileGTKeeperDyn *gt2(dynamic_cast<const MEDFileGTKeeperDyn *>(gt));
+ return gt2!=NULL;
}
std::size_t MEDFileFieldLoc::getHeapMemorySizeWithoutChildren() const
std::size_t sz=_ref_coo.size();
if(sz%_dim==0)
{
- std::size_t const nbOfTuples=sz/_dim;
+ std::size_t nbOfTuples=sz/_dim;
for(std::size_t i=0;i<nbOfTuples;i++)
{
oss << "(";
sz=_gs_coo.size();
if(sz%_dim==0)
{
- std::size_t const nbOfTuples=sz/_dim;
+ std::size_t nbOfTuples=sz/_dim;
for(std::size_t i=0;i<nbOfTuples;i++)
{
oss << "(";
{
const MEDCouplingFieldDiscretization *disc(field->getDiscretization());
const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(FromIdType<int>(_loc_id)));
- const auto *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
+ const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
if(!disc2)
throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !");
const DataArrayIdType *dai(disc2->getArrayOfDiscIds());
MCAuto<DataArrayIdType> dai2(disc2->getOffsetArr(field->getMesh()));
const mcIdType *dai2Ptr(dai2->getConstPointer());
- mcIdType const nbi(ToIdType(gsLoc.getWeights().size()));
+ mcIdType nbi(ToIdType(gsLoc.getWeights().size()));
MCAuto<DataArrayIdType> da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1));
MCAuto<DataArrayIdType> da3(da2->findIdsEqual(_loc_id));
const mcIdType *da3Ptr(da3->getConstPointer());
mcIdType *da4Ptr(da4->getPointer());
for(mcIdType i=0;i<_nval;i++)
{
- mcIdType const ref=dai2Ptr[offset+da3Ptr[i]];
+ mcIdType ref=dai2Ptr[offset+da3Ptr[i]];
for(mcIdType j=0;j<nbi;j++)
*da4Ptr++=ref+j;
}
{
_profile.clear();
_type=field->getTypeOfField();
- std::string const pflName(multiTypePfl->getName());
+ std::string pflName(multiTypePfl->getName());
std::ostringstream oss; oss << pflName;
if(_type!=ON_NODES)
{
MCAuto<DataArrayIdType> arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end());
arr3->computeOffsetsFull();
MCAuto<DataArrayIdType> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
- mcIdType const trueNval=tmp->getNumberOfTuples();
+ mcIdType trueNval=tmp->getNumberOfTuples();
_nval=idsInPfl->getNumberOfTuples();
getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
_end=_start+trueNval;
}
case ON_GAUSS_PT:
{
- const auto *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(field->getDiscretization());
+ const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(field->getDiscretization());
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
const DataArrayIdType *da1=disc2->getArrayOfDiscIds();
start=_end;
}
-void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate * /*field*/, const DataArray *arrr, MEDFileFieldGlobsReal& /*glob*/)
+void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob)
{
_start=start;
_nval=arrr->getNumberOfTuples();
throw e;
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId, const std::string& /*dummy*/):_type(type),_father(fath),_loc_id(locId)
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId, const std::string& dummy):_type(type),_father(fath),_loc_id(locId)
{
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other):RefCountObject(other),_type(other._type),_father(nullptr),_start(other._start),_end(other._end),_nval(other._nval),_profile(other._profile),_localization(other._localization),_loc_id(other._loc_id),_profile_it(other._profile_it),_pd(other._pd),_tmp_work1(other._tmp_work1)
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other):RefCountObject(other),_type(other._type),_father(0),_start(other._start),_end(other._end),_nval(other._nval),_profile(other._profile),_localization(other._localization),_loc_id(other._loc_id),_profile_it(other._profile_it),_pd(other._pd),_tmp_work1(other._tmp_work1)
{
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(nullptr),_start(-std::numeric_limits<mcIdType>::max()),_end(-std::numeric_limits<mcIdType>::max()),
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(0),_start(-std::numeric_limits<mcIdType>::max()),_end(-std::numeric_limits<mcIdType>::max()),
_nval(-std::numeric_limits<mcIdType>::max()),_loc_id(-std::numeric_limits<int>::max())
{
}
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile : not implemented !");
INTERP_KERNEL::AutoPtr<char> pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
med_int profilesize,nbi;
- med_int const overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ med_int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
{//TODO : manage int32 !
pd->checkConsistencyLight();
INTERP_KERNEL::AutoPtr<char> pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
std::string fieldName(nasc.getName()),meshName(getMeshName());
med_int iteration(getIteration()),order(getOrder()),profilesize,nbi;
- TypeOfField const type(getType());
+ TypeOfField type(getType());
med_geometry_type mgeoti;
med_entity_type menti;
_father->entriesForMEDfile(type,mgeoti,menti);
med_int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
if(zeNVal==0 && type==ON_CELLS)
{//eheh maybe there's a surprise :)
- med_int const zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ med_int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
if(zeNVal1==0)
{
- med_int const zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ med_int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,FromIdType<int>(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
if(zeNVal2!=0)
zeNVal=zeNVal2;
}
{
std::string fieldName(nasc.getName()),meshName(getMeshName());
int iteration(getIteration()),order(getOrder());
- TypeOfField const type(getType());
+ TypeOfField type(getType());
med_geometry_type mgeoti;
med_entity_type menti;
_father->entriesForMEDfile(type,mgeoti,menti);
std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : Invalid start ("<< _start << ") regarding admissible range of allocated array [0," << arr->getNumberOfTuples() << "] !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int const nbOfCompo((int)arr->getNumberOfComponents());
- auto *arrD(dynamic_cast<DataArrayDouble *>(arr));
+ int nbOfCompo((int)arr->getNumberOfComponents());
+ DataArrayDouble *arrD(dynamic_cast<DataArrayDouble *>(arr));
if(arrD)
{
double *startFeeding(arrD->getPointer()+_start*nbOfCompo);
goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast<unsigned char*>(startFeeding));
return ;
}
- auto *arrI(dynamic_cast<DataArrayInt32 *>(arr));
+ DataArrayInt32 *arrI(dynamic_cast<DataArrayInt32 *>(arr));
if(arrI)
{
Int32 *startFeeding(arrI->getPointer()+_start*nbOfCompo);
goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast<unsigned char*>(startFeeding));
return ;
}
- auto *arrI64(dynamic_cast<DataArrayInt64 *>(arr));
+ DataArrayInt64 *arrI64(dynamic_cast<DataArrayInt64 *>(arr));
if(arrI64)
{
Int64 *startFeeding(arrI64->getPointer()+_start*nbOfCompo);
goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast<unsigned char*>(startFeeding));
return ;
}
- auto *arrF(dynamic_cast<DataArrayFloat *>(arr));
+ DataArrayFloat *arrF(dynamic_cast<DataArrayFloat *>(arr));
if(arrF)
{
float *startFeeding(arrF->getPointer()+_start*nbOfCompo);
*/
void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(mcIdType newValueOfStart)
{
- mcIdType const delta=_end-_start;
+ mcIdType delta=_end-_start;
_start=newValueOfStart;
_end=_start+delta;
}
void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(mcIdType deltaNbVal)
{
- mcIdType const nbi((_end-_start)/_nval);
+ mcIdType nbi((_end-_start)/_nval);
_nval+=deltaNbVal;
_end+=nbi*deltaNbVal;
}
void MEDFileFieldPerMeshPerTypePerDisc::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(const auto & it2 : mapOfModif)
+ for(std::vector< std::pair<std::vector<std::string>, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++)
{
- if(std::find(it2.first.begin(),it2.first.end(),_profile)!=it2.first.end())
+ if(std::find((*it2).first.begin(),(*it2).first.end(),_profile)!=(*it2).first.end())
{
- _profile=it2.second;
+ _profile=(*it2).second;
return;
}
}
void MEDFileFieldPerMeshPerTypePerDisc::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(const auto & it2 : mapOfModif)
+ for(std::vector< std::pair<std::vector<std::string>, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++)
{
- if(std::find(it2.first.begin(),it2.first.end(),_localization)!=it2.first.end())
+ if(std::find((*it2).first.begin(),(*it2).first.end(),_localization)!=(*it2).first.end())
{
- _localization=it2.second;
+ _localization=(*it2).second;
return;
}
}
dads.push_back(std::pair<mcIdType,mcIdType>(_start,_end));
geoTypes.push_back(getGeoType());
if(_profile.empty())
- pfls.push_back(nullptr);
+ pfls.push_back(0);
else
{
pfls.push_back(glob->getProfile(_profile.c_str()));
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : no array set !");
if(!arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !");
- const auto *arrD(dynamic_cast<const DataArrayDouble *>(arr));
- const auto *arrI(dynamic_cast<const DataArrayInt32 *>(arr));
- const auto *arrI64(dynamic_cast<const DataArrayInt64 *>(arr));
- const auto *arrF(dynamic_cast<const DataArrayFloat *>(arr));
- const unsigned char *locToWrite=nullptr;
+ const DataArrayDouble *arrD(dynamic_cast<const DataArrayDouble *>(arr));
+ const DataArrayInt32 *arrI(dynamic_cast<const DataArrayInt32 *>(arr));
+ const DataArrayInt64 *arrI64(dynamic_cast<const DataArrayInt64 *>(arr));
+ const DataArrayFloat *arrF(dynamic_cast<const DataArrayFloat *>(arr));
+ const unsigned char *locToWrite=0;
if(arrD)
locToWrite=reinterpret_cast<const unsigned char *>(arrD->getConstPointer()+_start*arr->getNumberOfComponents());
else if(arrI)
{
_loc_id=FromIdType<int>(offset);
std::ostringstream oss;
- std::size_t const nbOfType=codeOfMesh.size()/3;
+ std::size_t nbOfType=codeOfMesh.size()/3;
int found=-1;
for(std::size_t i=0;i<nbOfType && found==-1;i++)
if(getGeoType()==(INTERP_KERNEL::NormalizedCellType)codeOfMesh[3*i])
oss << pfl->getNumberOfTuples() << " whereas the number of ids is set to " << _nval << " for this geometric type !";
throw INTERP_KERNEL::Exception(oss.str());
}
- mcIdType const offset2=codeOfMesh[3*found+2];
- for(long const pflId : *pfl)
+ mcIdType offset2=codeOfMesh[3*found+2];
+ for(const mcIdType *pflId=pfl->begin();pflId!=pfl->end();pflId++)
{
- if(pflId<codeOfMesh[3*found+1])
- *work++=offset2+pflId;
+ if(*pflId<codeOfMesh[3*found+1])
+ *work++=offset2+*pflId;
}
}
return _nval;
int id=0;
std::map<std::pair<std::string,TypeOfField>,int> m;
std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > ret;
- for(auto entrie : entries)
- if(m.find(std::pair<std::string,TypeOfField>(entrie->getLocalization(),entrie->getType()))==m.end())
- m[std::pair<std::string,TypeOfField>(entrie->getLocalization(),entrie->getType())]=id++;
+ for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entries.begin();it!=entries.end();it++)
+ if(m.find(std::pair<std::string,TypeOfField>((*it)->getLocalization(),(*it)->getType()))==m.end())
+ m[std::pair<std::string,TypeOfField>((*it)->getLocalization(),(*it)->getType())]=id++;
ret.resize(id);
- for(auto entrie : entries)
- ret[m[std::pair<std::string,TypeOfField>(entrie->getLocalization(),entrie->getType())]].push_back(entrie);
+ for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entries.begin();it!=entries.end();it++)
+ ret[m[std::pair<std::string,TypeOfField>((*it)->getLocalization(),(*it)->getType())]].push_back(*it);
return ret;
}
{
if(entriesOnSameDisc.empty())
return false;
- TypeOfField const type=entriesOnSameDisc[0]->getType();
+ TypeOfField type=entriesOnSameDisc[0]->getType();
mcIdType szEntities=0,szTuples=0;
- for(auto it : entriesOnSameDisc)
- { szEntities+=it->_nval; szTuples+=it->_end-it->_start; }
- mcIdType const nbi=szTuples/szEntities;
+ for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++)
+ { szEntities+=(*it)->_nval; szTuples+=(*it)->_end-(*it)->_start; }
+ mcIdType nbi=szTuples/szEntities;
if(szTuples%szEntities!=0)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks : internal error the splitting into same dicretization failed !");
MCAuto<DataArrayIdType> renumTuples=DataArrayIdType::New(); renumTuples->alloc(szTuples,1);
std::vector< const DataArrayIdType * > newGeoTypesPerChunk3(entriesOnSameDisc.size());
MCAuto<DataArrayIdType> newGeoTypesPerChunk4=DataArrayIdType::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi);
int id=0;
- for(auto it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++)
+ for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++)
{
- mcIdType const startOfEltIdOfChunk=(*it)->_start;
+ mcIdType startOfEltIdOfChunk=(*it)->_start;
MCAuto<DataArrayIdType> newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
MCAuto<DataArrayIdType> rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges);
MCAuto<DataArrayIdType> idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges);
MCAuto<DataArrayIdType> newGeoTypesEltIdsAllGather=DataArrayIdType::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear();
MCAuto<DataArrayIdType> newGeoTypesEltIdsAllGather2=DataArrayIdType::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear();
MCAuto<DataArrayIdType> diffVals=newGeoTypesEltIdsAllGather->getDifferentValues();
- MCAuto<DataArrayIdType> const renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel();
+ MCAuto<DataArrayIdType> renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel();
//
MCAuto<DataArrayIdType> renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel();
//
{
MCAuto<DataArrayIdType> ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt);
MCAuto<DataArrayIdType> subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end());
- mcIdType const nbEntityElts=subIds->getNumberOfTuples();
+ mcIdType nbEntityElts=subIds->getNumberOfTuples();
bool ret2;
- MCAuto<MEDFileFieldPerMeshPerTypePerDisc> const eltToAdd=MEDFileFieldPerMeshPerTypePerDisc::
+ MCAuto<MEDFileFieldPerMeshPerTypePerDisc> eltToAdd=MEDFileFieldPerMeshPerTypePerDisc::
NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIota(newCode[3*(*idIt)+1]),nbi,
offset+offset2,
li,glob,ret2);
MEDFileFieldGlobsReal& glob,
bool ¬InExisting)
{
- mcIdType const nbMeshEntities=idsOfMeshElt->getNumberOfTuples();
- auto it=entriesOnSameDisc.begin();
+ mcIdType nbMeshEntities=idsOfMeshElt->getNumberOfTuples();
+ std::list< const MEDFileFieldPerMeshPerTypePerDisc *>::iterator it=entriesOnSameDisc.begin();
for(;it!=entriesOnSameDisc.end();it++)
{
if(((INTERP_KERNEL::NormalizedCellType)(*it)->_loc_id)==geoType && (*it)->_nval==nbMeshEntities)
if(it==entriesOnSameDisc.end())
{
notInExisting=true;
- auto *ret=new MEDFileFieldPerMeshPerTypePerDisc;
+ MEDFileFieldPerMeshPerTypePerDisc *ret=new MEDFileFieldPerMeshPerTypePerDisc;
ret->_type=typeF;
ret->_loc_id=(int)geoType;
ret->_nval=nbMeshEntities;
////////////////////////////////////
MEDFileFieldPerMeshPerTypeCommon::~MEDFileFieldPerMeshPerTypeCommon()
-= default;
+{
+}
void MEDFileFieldPerMeshPerTypeCommon::setFather(MEDFileFieldPerMesh *father)
{
void MEDFileFieldPerMeshPerTypeCommon::accept(MEDFileFieldVisitor& visitor) const
{
- for(const auto & it : _field_pm_pt_pd)
- if(it.isNotNull())
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ if((*it).isNotNull())
{
- visitor.newPerMeshPerTypePerDisc(it);
+ visitor.newPerMeshPerTypePerDisc(*it);
}
}
std::vector<const BigMemoryObject *> MEDFileFieldPerMeshPerTypeCommon::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & it : _field_pm_pt_pd)
- ret.push_back((const MEDFileFieldPerMeshPerTypePerDisc *)it);
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ ret.push_back((const MEDFileFieldPerMeshPerTypePerDisc *)*it);
return ret;
}
void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- std::vector<mcIdType> const pos=addNewEntryIfNecessary(field,offset,nbOfCells);
- for(long const po : pos)
- _field_pm_pt_pd[po]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc);
+ std::vector<mcIdType> pos=addNewEntryIfNecessary(field,offset,nbOfCells);
+ for(std::vector<mcIdType>::const_iterator it=pos.begin();it!=pos.end();it++)
+ _field_pm_pt_pd[*it]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc);
}
/*!
*/
void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- std::vector<mcIdType> const pos=addNewEntryIfNecessary(field,idsInPfl);
- for(long const po : pos)
- _field_pm_pt_pd[po]->assignFieldProfile(isPflAlone,start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,arr,mesh,glob,nasc);
+ std::vector<mcIdType> pos=addNewEntryIfNecessary(field,idsInPfl);
+ for(std::vector<mcIdType>::const_iterator it=pos.begin();it!=pos.end();it++)
+ _field_pm_pt_pd[*it]->assignFieldProfile(isPflAlone,start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,arr,mesh,glob,nasc);
}
void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile : input array is null, or not allocated !");
_field_pm_pt_pd.resize(1);
_field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3);
- _field_pm_pt_pd[0]->assignFieldProfile(true,start,pfl,pfl2,pfl2,-1,field,arr,nullptr,glob,nasc);//mesh is not requested so 0 is send.
+ _field_pm_pt_pd[0]->assignFieldProfile(true,start,pfl,pfl2,pfl2,-1,field,arr,0,glob,nasc);//mesh is not requested so 0 is send.
}
std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells)
{
- TypeOfField const type=field->getTypeOfField();
+ TypeOfField type=field->getTypeOfField();
if(type!=ON_GAUSS_PT)
{
- int const locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
- std::size_t const sz=_field_pm_pt_pd.size();
+ int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
+ std::size_t sz=_field_pm_pt_pd.size();
bool found=false;
for(std::size_t j=0;j<sz && !found;j++)
{
else
{
std::vector<mcIdType> ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells);
- std::size_t const sz2=ret2.size();
+ std::size_t sz2=ret2.size();
std::vector<mcIdType> ret3(sz2);
mcIdType k=0;
for(std::size_t i=0;i<sz2;i++)
{
- mcIdType const sz=ToIdType(_field_pm_pt_pd.size());
- mcIdType const locIdToFind=ret2[i];
+ mcIdType sz=ToIdType(_field_pm_pt_pd.size());
+ mcIdType locIdToFind=ret2[i];
bool found=false;
for(mcIdType j=0;j<sz && !found;j++)
{
std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells)
{
const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
- const auto *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
+ const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
const DataArrayIdType *da=disc2->getArrayOfDiscIds();
std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells)
{
- TypeOfField const type=field->getTypeOfField();
+ TypeOfField type=field->getTypeOfField();
if(type!=ON_GAUSS_PT)
{
- int const locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
- std::size_t const sz=_field_pm_pt_pd.size();
+ int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
+ std::size_t sz=_field_pm_pt_pd.size();
bool found=false;
for(std::size_t j=0;j<sz && !found;j++)
{
else
{
std::vector<mcIdType> ret2=addNewEntryIfNecessaryGauss(field,subCells);
- std::size_t const sz2=ret2.size();
+ std::size_t sz2=ret2.size();
std::vector<mcIdType> ret3(sz2);
mcIdType k=0;
for(std::size_t i=0;i<sz2;i++)
{
- mcIdType const sz=ToIdType(_field_pm_pt_pd.size());
- mcIdType const locIdToFind=ret2[i];
+ mcIdType sz=ToIdType(_field_pm_pt_pd.size());
+ mcIdType locIdToFind=ret2[i];
bool found=false;
for(mcIdType j=0;j<sz && !found;j++)
{
std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells)
{
const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
- const auto *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
+ const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
const DataArrayIdType *da=disc2->getArrayOfDiscIds();
bool MEDFileFieldPerMeshPerTypeCommon::isUniqueLevel(int& dim) const
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType()));
- int const curDim((int)cm.getDimension());
+ int curDim((int)cm.getDimension());
if(dim!=std::numeric_limits<int>::max())
{
if(dim!=curDim)
void MEDFileFieldPerMeshPerTypeCommon::fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const
{
- for(const auto & it : _field_pm_pt_pd)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
- it->fillTypesOfFieldAvailable(types);
+ (*it)->fillTypesOfFieldAvailable(types);
}
}
void MEDFileFieldPerMeshPerTypeCommon::fillFieldSplitedByType(std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const
{
- std::size_t const sz=_field_pm_pt_pd.size();
+ std::size_t sz=_field_pm_pt_pd.size();
dads.resize(sz); types.resize(sz); pfls.resize(sz); locs.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
void MEDFileFieldPerMeshPerTypeCommon::getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const
{
- for(const auto & it : _field_pm_pt_pd)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
- globalSz+=it->getNumberOfTuples();
+ globalSz+=(*it)->getNumberOfTuples();
}
nbOfEntries+=(mcIdType)_field_pm_pt_pd.size();
}
bool MEDFileFieldPerMeshPerTypeCommon::presenceOfMultiDiscPerGeoType() const
{
std::size_t nb(0);
- for(const auto & it : _field_pm_pt_pd)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
- const MEDFileFieldPerMeshPerTypePerDisc *fmtd(it);
+ const MEDFileFieldPerMeshPerTypePerDisc *fmtd(*it);
if(fmtd)
nb++;
}
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & it1 : _field_pm_pt_pd)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
{
- std::string const tmp=it1->getProfile();
+ std::string tmp=(*it1)->getProfile();
if(!tmp.empty())
if(ret2.find(tmp)==ret2.end())
{
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & it1 : _field_pm_pt_pd)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
{
- std::string const tmp=it1->getLocalization();
+ std::string tmp=(*it1)->getLocalization();
if(!tmp.empty() && tmp!=MED_GAUSS_ELNO)
if(ret2.find(tmp)==ret2.end())
{
std::vector<std::string> MEDFileFieldPerMeshPerTypeCommon::getPflsReallyUsedMulti() const
{
std::vector<std::string> ret;
- std::set<std::string> const ret2;
- for(const auto & it1 : _field_pm_pt_pd)
+ std::set<std::string> ret2;
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
{
- std::string const tmp=it1->getProfile();
+ std::string tmp=(*it1)->getProfile();
if(!tmp.empty())
ret.push_back(tmp);
}
std::vector<std::string> MEDFileFieldPerMeshPerTypeCommon::getLocsReallyUsedMulti() const
{
std::vector<std::string> ret;
- for(const auto & it1 : _field_pm_pt_pd)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
{
- std::string const tmp=it1->getLocalization();
+ std::string tmp=(*it1)->getLocalization();
if(!tmp.empty() && tmp!=MED_GAUSS_ELNO)
ret.push_back(tmp);
}
void MEDFileFieldPerMeshPerTypeCommon::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & it1 : _field_pm_pt_pd)
- it1->changePflsRefsNamesGen(mapOfModif);
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ (*it1)->changePflsRefsNamesGen(mapOfModif);
}
void MEDFileFieldPerMeshPerTypeCommon::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & it1 : _field_pm_pt_pd)
- it1->changeLocsRefsNamesGen(mapOfModif);
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ (*it1)->changeLocsRefsNamesGen(mapOfModif);
}
MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId)
std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no such locId available (" << locId;
oss2 << ") for geometric type \"" << getGeoTypeRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !";
throw INTERP_KERNEL::Exception(oss2.str().c_str());
- return static_cast<MEDFileFieldPerMeshPerTypePerDisc*>(nullptr);
+ return static_cast<MEDFileFieldPerMeshPerTypePerDisc*>(0);
}
const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId) const
std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no such locId available (" << locId;
oss2 << ") for geometric type \"" << getGeoTypeRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !";
throw INTERP_KERNEL::Exception(oss2.str().c_str());
- return static_cast<const MEDFileFieldPerMeshPerTypePerDisc*>(nullptr);
+ return static_cast<const MEDFileFieldPerMeshPerTypePerDisc*>(0);
}
int MEDFileFieldPerMeshPerTypeCommon::locIdOfLeaf(const MEDFileFieldPerMeshPerTypePerDisc *leaf) const
{
int ret(0);
- for(auto it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,ret++)
{
const MEDFileFieldPerMeshPerTypePerDisc *cand(*it);
if(cand==leaf)
void MEDFileFieldPerMeshPerTypeCommon::fillValues(mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
int i=0;
- for(auto it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
{
(*it)->fillValues(i,startEntryId,entries);
}
void MEDFileFieldPerMeshPerTypeCommon::setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves)
{
_field_pm_pt_pd=leaves;
- for(auto & it : _field_pm_pt_pd)
- it->setFather(this);
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ (*it)->setFather(this);
}
/*!
{
bool ret(false);
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd;
- for(auto & it : _field_pm_pt_pd)
- if(it->getType()==tof)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ if((*it)->getType()==tof)
{
- newPmPtPd.push_back(it);
- std::pair<mcIdType,mcIdType> bgEnd; bgEnd.first=it->getStart(); bgEnd.second=it->getEnd();
- it->setNewStart(globalNum);
- globalNum=it->getEnd();
+ newPmPtPd.push_back(*it);
+ std::pair<mcIdType,mcIdType> bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd();
+ (*it)->setNewStart(globalNum);
+ globalNum=(*it)->getEnd();
its.push_back(bgEnd);
ret=true;
}
if(_field_pm_pt_pd.size()<=idOfDisc)
return false;
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> elt(_field_pm_pt_pd[idOfDisc]);
- std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > const newPmPtPd(1,elt);
+ std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd(1,elt);
std::pair<mcIdType,mcIdType> bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd();
elt->setNewStart(globalNum);
globalNum=elt->getEnd();
void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc)
{
- for(auto & it : _field_pm_pt_pd)
- it->loadOnlyStructureOfDataRecursively(fid,start,nasc);
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc);
}
void MEDFileFieldPerMeshPerTypeCommon::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc)
{
- for(auto & it : _field_pm_pt_pd)
- it->loadBigArray(fid,nasc);
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ (*it)->loadBigArray(fid,nasc);
}
void MEDFileFieldPerMeshPerTypeCommon::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const
{
- for(const auto & it : _field_pm_pt_pd)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
- it->copyOptionsFrom(*this);
- it->writeLL(fid,nasc);
+ (*it)->copyOptionsFrom(*this);
+ (*it)->writeLL(fid,nasc);
}
}
if(meshDim!=(int)cm.getDimension())
return ;
}
- for(const auto & it : _field_pm_pt_pd)
- it->getFieldAtLevel(type,glob,dads,pfls,locs,geoTypes);
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ (*it)->getFieldAtLevel(type,glob,dads,pfls,locs,geoTypes);
}
INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerType::getGeoType() const
void MEDFileFieldPerMeshPerType::getDimension(int& dim) const
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_geo_type));
- int const curDim((int)cm.getDimension());
+ int curDim((int)cm.getDimension());
dim=std::max(dim,curDim);
}
void MEDFileFieldPerMeshPerType::simpleRepr(int bkOffset, std::ostream& oss, int id) const
{
const char startLine[]=" ## ";
- std::string const startLine2(bkOffset,' ');
+ std::string startLine2(bkOffset,' ');
std::string startLine3(startLine2);
startLine3+=startLine;
if(_geo_type!=INTERP_KERNEL::NORM_ERROR)
oss << startLine3 << "Entry geometry type #" << id << " is lying on NODES." << std::endl;
oss << startLine3 << "Entry is defined on " << _field_pm_pt_pd.size() << " localizations." << std::endl;
int i=0;
- for(auto it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
{
const MEDFileFieldPerMeshPerTypePerDisc *cur=(*it);
if(cur)
}
if(type==ON_CELLS)
{
- med_int const nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,mgeoti,pflName,locName));
+ med_int nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,mgeoti,pflName,locName));
for(int i=0;i<nbProfiles2;i++)
_field_pm_pt_pd.push_back(MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(this,ON_GAUSS_NE,i,pd));
}
return ;
// dark side of the force.
{
- med_int const nbProfiles1(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,mgeoti,pflName,locName));
- med_int const nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,mgeoti,pflName,locName));
+ med_int nbProfiles1(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,mgeoti,pflName,locName));
+ med_int nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,mgeoti,pflName,locName));
if(nbProfiles1==0 && nbProfiles2==0)
return ;// OK definitely nothing in field
menti=nbProfiles1>=nbProfiles2?MED_DESCENDING_FACE:MED_DESCENDING_EDGE;//not enough words to describe the beauty
{
MCAuto<MEDFileFieldPerMeshPerType> ret(MEDFileFieldPerMeshPerType::New(father,gt));
std::map<TypeOfField, std::vector< std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc * > > > m;
- for(const auto & pm : pms)
+ for(std::vector<std::pair<int,const MEDFileFieldPerMeshPerType *> >::const_iterator it=pms.begin();it!=pms.end();it++)
{
- for(auto it2=pm.second->_field_pm_pt_pd.begin();it2!=pm.second->_field_pm_pt_pd.end();it2++)
- m[(*it2)->getType()].push_back(std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc * >(pm.first,*it2));
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it2=(*it).second->_field_pm_pt_pd.begin();it2!=(*it).second->_field_pm_pt_pd.end();it2++)
+ m[(*it2)->getType()].push_back(std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc * >((*it).first,*it2));
}
for(std::map<TypeOfField, std::vector< std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc * > > >::const_iterator it=m.begin();it!=m.end();it++)
{
- MCAuto<MEDFileFieldPerMeshPerTypePerDisc> const agg(MEDFileFieldPerMeshPerTypePerDisc::Aggregate(start,(*it).second,dts,(*it).first,ret,extractInfo));
+ MCAuto<MEDFileFieldPerMeshPerTypePerDisc> agg(MEDFileFieldPerMeshPerTypePerDisc::Aggregate(start,(*it).second,dts,(*it).first,ret,extractInfo));
ret->_field_pm_pt_pd.push_back(agg);
}
return ret;
{
if(!entities)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeDyn::NewOnRead : null pointer !");
- const auto *entities2(dynamic_cast<const MEDFileAllStaticEntitiesPlusDyn *>(entities));
+ const MEDFileAllStaticEntitiesPlusDyn *entities2(dynamic_cast<const MEDFileAllStaticEntitiesPlusDyn *>(entities));
if(!entities2)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeDyn::NewOnRead : invalid type of entities !");
const MEDFileStructureElement *se(entities2->getWithGT(idGT));
_se.takeRef(se);
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
- med_int const nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,_se->getDynGT(),pflName,locName));
+ med_int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,_se->getDynGT(),pflName,locName));
_field_pm_pt_pd.resize(nbProfiles);
for(int i=0;i<nbProfiles;i++)
{
- _field_pm_pt_pd[i]=MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(this,_se->getEntity(),i,nullptr);
+ _field_pm_pt_pd[i]=MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(this,_se->getEntity(),i,NULL);
}
}
return _se->getName();
}
-void MEDFileFieldPerMeshPerTypeDyn::getDimension(int& /*dim*/) const
+void MEDFileFieldPerMeshPerTypeDyn::getDimension(int& dim) const
{
throw INTERP_KERNEL::Exception("not implemented yet !");
}
-void MEDFileFieldPerMeshPerTypeDyn::entriesForMEDfile(TypeOfField /*mct*/, med_geometry_type& gt, med_entity_type& ent) const
+void MEDFileFieldPerMeshPerTypeDyn::entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const
{
gt=getDynGT();
ent=MED_STRUCT_ELEMENT;
void MEDFileFieldPerMeshPerTypeDyn::simpleRepr(int bkOffset, std::ostream& oss, int id) const
{
const char startLine[]=" ## ";
- std::string const startLine2(bkOffset,' ');
+ std::string startLine2(bkOffset,' ');
std::string startLine3(startLine2);
startLine3+=startLine;
oss << startLine3 << "Entry geometry type #" << id << " is lying on geometry STRUCTURE_ELEMENT type " << getDynGT() << "." << std::endl;
oss << startLine3 << "Entry is defined on " << _field_pm_pt_pd.size() << " localizations." << std::endl;
int i=0;
- for(auto it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
{
if((*it).isNotNull())
(*it)->simpleRepr(bkOffset,oss,i);
return ret.retn();
}
-void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int /*meshDim*/, TypeOfField /*type*/, const MEDFileFieldGlobsReal * /*glob*/, std::vector< std::pair<mcIdType,mcIdType> >& /*dads*/, std::vector<const DataArrayIdType *>& /*pfls*/, std::vector<int>& /*locs*/, std::vector<INTERP_KERNEL::NormalizedCellType>& /*geoTypes*/) const
+void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
{
throw INTERP_KERNEL::Exception("not implemented yet !");
}
std::vector<const BigMemoryObject *> MEDFileFieldPerMesh::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & it : _field_pm_pt)
- ret.push_back(it);
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ ret.push_back(*it);
return ret;
}
MCAuto< MEDFileFieldPerMesh > ret=new MEDFileFieldPerMesh(*this);
ret->_father=father;
std::size_t i=0;
- for(auto it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
{
if((*it).isNotNull())
ret->_field_pm_pt[i]=(*it)->deepCopy((MEDFileFieldPerMesh *)(ret));
void MEDFileFieldPerMesh::simpleRepr(int bkOffset, std::ostream& oss, int id) const
{
- std::string const startLine(bkOffset,' ');
+ std::string startLine(bkOffset,' ');
oss << startLine << "## Field part (" << id << ") lying on mesh \"" << getMeshName() << "\", Mesh iteration=" << _mesh_iteration << ". Mesh order=" << _mesh_order << "." << std::endl;
oss << startLine << "## Field is defined on " << _field_pm_pt.size() << " types." << std::endl;
int i=0;
- for(auto it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
{
if((*it).isNotNull())
(*it)->simpleRepr(bkOffset,oss,i);
void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(mcIdType& start, const std::vector<mcIdType>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- std::size_t const nbOfTypes=code.size()/3;
+ std::size_t nbOfTypes=code.size()/3;
mcIdType offset=0;
for(std::size_t i=0;i<nbOfTypes;i++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
- mcIdType const nbOfCells=code[3*i+1];
- mcIdType const pos=addNewEntryIfNecessary(type);
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
+ mcIdType nbOfCells=code[3*i+1];
+ mcIdType pos=addNewEntryIfNecessary(type);
_field_pm_pt[pos]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc);
offset+=nbOfCells;
}
*/
void MEDFileFieldPerMesh::assignFieldProfile(mcIdType& start, const DataArrayIdType *multiTypePfl, const std::vector<mcIdType>& code, const std::vector<mcIdType>& code2, const std::vector<DataArrayIdType *>& idsInPflPerType, const std::vector<DataArrayIdType *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- std::size_t const nbOfTypes(code.size()/3);
+ std::size_t nbOfTypes(code.size()/3);
for(std::size_t i=0;i<nbOfTypes;i++)
{
- auto const type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
- mcIdType const pos=addNewEntryIfNecessary(type);
- DataArrayIdType *pfl=nullptr;
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
+ mcIdType pos=addNewEntryIfNecessary(type);
+ DataArrayIdType *pfl=0;
if(code[3*i+2]!=-1)
pfl=idsPerType[code[3*i+2]];
- std::size_t const nbOfTupes2=code2.size()/3;
+ std::size_t nbOfTupes2=code2.size()/3;
std::size_t found=0;
for(;found<nbOfTupes2;found++)
if(code[3*i]==code2[3*found])
void MEDFileFieldPerMesh::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
{
- mcIdType const pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
+ mcIdType pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
_field_pm_pt[pos]->assignNodeFieldNoProfile(start,field,arr,glob);
}
void MEDFileFieldPerMesh::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- mcIdType const pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
+ mcIdType pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
_field_pm_pt[pos]->assignNodeFieldProfile(start,pfl,field,arr,glob,nasc);
}
void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc)
{
- for(auto & it : _field_pm_pt)
- it->loadOnlyStructureOfDataRecursively(fid,start,nasc);
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc);
}
void MEDFileFieldPerMesh::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc)
{
- for(auto & it : _field_pm_pt)
- it->loadBigArraysRecursively(fid,nasc);
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->loadBigArraysRecursively(fid,nasc);
}
void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const
{
- std::size_t const nbOfTypes=_field_pm_pt.size();
+ std::size_t nbOfTypes=_field_pm_pt.size();
for(std::size_t i=0;i<nbOfTypes;i++)
{
_field_pm_pt[i]->copyOptionsFrom(*this);
void MEDFileFieldPerMesh::getDimension(int& dim) const
{
- for(const auto & it : _field_pm_pt)
- it->getDimension(dim);
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->getDimension(dim);
}
bool MEDFileFieldPerMesh::isUniqueLevel(int& dim) const
{
- for(const auto & it : _field_pm_pt)
- if(!it->isUniqueLevel(dim))
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ if(!(*it)->isUniqueLevel(dim))
return false;
return true;
}
void MEDFileFieldPerMesh::fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const
{
- for(const auto & it : _field_pm_pt)
- it->fillTypesOfFieldAvailable(types);
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->fillTypesOfFieldAvailable(types);
}
std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileFieldPerMesh::getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> > & locs) const
{
- std::size_t const sz=_field_pm_pt.size();
+ std::size_t sz=_field_pm_pt.size();
std::vector< std::vector<std::pair<mcIdType,mcIdType> > > ret(sz);
types.resize(sz); typesF.resize(sz); pfls.resize(sz); locs.resize(sz);
for(std::size_t i=0;i<sz;i++)
bool MEDFileFieldPerMesh::presenceOfMultiDiscPerGeoType() const
{
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- if(it.isNull())
+ if((*it).isNull())
continue;
- if(it->presenceOfMultiDiscPerGeoType())
+ if((*it)->presenceOfMultiDiscPerGeoType())
return true;
}
return false;
bool MEDFileFieldPerMesh::presenceOfStructureElements() const
{
- for(const auto & it : _field_pm_pt)
- if(it.isNotNull())
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ if((*it).isNotNull())
{
- const auto *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)it));
+ const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)*it));
if(pt)
return true;
}
bool MEDFileFieldPerMesh::onlyStructureElements() const
{
- for(const auto & it : _field_pm_pt)
- if(it.isNotNull())
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ if((*it).isNotNull())
{
- const auto *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)it));
+ const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)*it));
if(!pt)
return false;
}
void MEDFileFieldPerMesh::killStructureElements()
{
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res;
- for(auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- if(it.isNotNull())
+ if((*it).isNotNull())
{
- const auto *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)it));
+ const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)*it));
if(!pt)
- res.push_back(it);
+ res.push_back(*it);
}
}
_field_pm_pt=res;
void MEDFileFieldPerMesh::keepOnlyStructureElements()
{
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res;
- for(auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- if(it.isNotNull())
+ if((*it).isNotNull())
{
- const auto *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)it));
+ const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)*it));
if(pt)
- res.push_back(it);
+ res.push_back(*it);
}
}
_field_pm_pt=res;
void MEDFileFieldPerMesh::keepOnlyOnSE(const std::string& seName)
{
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res;
- for(auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- if(it.isNotNull())
+ if((*it).isNotNull())
{
- const auto *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)it));
+ const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)*it));
if(!pt)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::keepOnlyOnSE : presence of non SE !");
if(pt->getModelName()==seName)
- res.push_back(it);
+ res.push_back(*it);
}
}
_field_pm_pt=res;
void MEDFileFieldPerMesh::getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const
{
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- if(it.isNotNull())
+ if((*it).isNotNull())
{
- const auto *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)it));
+ const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)*it));
if(pt)
{
ps.push_back(std::pair<std::string,std::string>(getMeshName(),pt->getModelName()));
void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<const DataArrayIdType *>& pfls, const std::vector<int>& locs, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& notNullPfls)
{
int notNullPflsSz=0;
- std::size_t const nbOfArrs=geoTypes.size();
+ std::size_t nbOfArrs=geoTypes.size();
for(std::size_t i=0;i<nbOfArrs;i++)
if(pfls[i])
notNullPflsSz++;
- std::set<INTERP_KERNEL::NormalizedCellType> const geoTypes3(geoTypes.begin(),geoTypes.end());
- std::size_t const nbOfDiffGeoTypes=geoTypes3.size();
+ std::set<INTERP_KERNEL::NormalizedCellType> geoTypes3(geoTypes.begin(),geoTypes.end());
+ std::size_t nbOfDiffGeoTypes=geoTypes3.size();
code.resize(3*nbOfDiffGeoTypes);
notNullPfls.resize(notNullPflsSz);
notNullPflsSz=0;
std::size_t j=0;
for(std::size_t i=0;i<nbOfDiffGeoTypes;i++)
{
- std::size_t const startZone=j;
- INTERP_KERNEL::NormalizedCellType const refType=geoTypes[j];
+ std::size_t startZone=j;
+ INTERP_KERNEL::NormalizedCellType refType=geoTypes[j];
std::vector<const DataArrayIdType *> notNullTmp;
if(pfls[j])
notNullTmp.push_back(pfls[j]);
}
else
break;
- std::vector< std::pair<mcIdType,mcIdType> > const tmpDads(dads.begin()+startZone,dads.begin()+j);
- std::vector<const DataArrayIdType *> const tmpPfls(pfls.begin()+startZone,pfls.begin()+j);
- std::vector<int> const tmpLocs(locs.begin()+startZone,locs.begin()+j);
+ std::vector< std::pair<mcIdType,mcIdType> > tmpDads(dads.begin()+startZone,dads.begin()+j);
+ std::vector<const DataArrayIdType *> tmpPfls(pfls.begin()+startZone,pfls.begin()+j);
+ std::vector<int> tmpLocs(locs.begin()+startZone,locs.begin()+j);
code[3*i]=(mcIdType)refType;
- std::vector<INTERP_KERNEL::NormalizedCellType> const refType2(1,refType);
+ std::vector<INTERP_KERNEL::NormalizedCellType> refType2(1,refType);
code[3*i+1]=ComputeNbOfElems(glob,type,refType2,tmpDads,tmpLocs);
if(notNullTmp.empty())
code[3*i+2]=-1;
*/
mcIdType MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs)
{
- std::size_t const sz=dads.size();
+ std::size_t sz=dads.size();
mcIdType ret=0;
for(std::size_t i=0;i<sz;i++)
{
}
else
{
- int const nbOfGaussPtPerCell=glob->getNbOfGaussPtPerCell(locs[i]);
+ int nbOfGaussPtPerCell=glob->getNbOfGaussPtPerCell(locs[i]);
ret+=(dads[i].second-dads[i].first)/nbOfGaussPtPerCell;
}
}
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- std::vector<std::string> const tmp=it->getPflsReallyUsed();
- for(const auto & it2 : tmp)
- if(ret2.find(it2)==ret2.end())
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsed();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
{
- ret.push_back(it2);
- ret2.insert(it2);
+ ret.push_back(*it2);
+ ret2.insert(*it2);
}
}
return ret;
std::vector<std::string> MEDFileFieldPerMesh::getPflsReallyUsedMulti() const
{
std::vector<std::string> ret;
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- std::vector<std::string> tmp=it->getPflsReallyUsedMulti();
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti();
ret.insert(ret.end(),tmp.begin(),tmp.end());
}
return ret;
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- std::vector<std::string> const tmp=it->getLocsReallyUsed();
- for(const auto & it2 : tmp)
- if(ret2.find(it2)==ret2.end())
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsed();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
{
- ret.push_back(it2);
- ret2.insert(it2);
+ ret.push_back(*it2);
+ ret2.insert(*it2);
}
}
return ret;
std::vector<std::string> MEDFileFieldPerMesh::getLocsReallyUsedMulti() const
{
std::vector<std::string> ret;
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- std::vector<std::string> tmp=it->getLocsReallyUsedMulti();
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti();
ret.insert(ret.end(),tmp.begin(),tmp.end());
}
return ret;
bool MEDFileFieldPerMesh::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
- for(const auto & it : modifTab)
+ for(std::vector< std::pair<std::string,std::string> >::const_iterator it=modifTab.begin();it!=modifTab.end();it++)
{
- if(it.first==getMeshName())
+ if((*it).first==getMeshName())
{
- setMeshName(it.second);
+ setMeshName((*it).second);
return true;
}
}
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::convertMedBallIntoClassic : Only managed for single mesh !");
if(_field_pm_pt[0].isNull())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::convertMedBallIntoClassic : null pointer !");
- auto *pt(dynamic_cast<MEDFileFieldPerMeshPerTypeDyn *>((MEDFileFieldPerMeshPerTypeCommon *)_field_pm_pt[0]));
+ MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<MEDFileFieldPerMeshPerTypeDyn *>((MEDFileFieldPerMeshPerTypeCommon *)_field_pm_pt[0]));
if(!pt)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::convertMedBallIntoClassic : this is expected to be marked as structure element !");
if(pt->getNumberOfLoc()!=1)
DataArray *arr0(getOrCreateAndGetArray());//tony
if(!arr0)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values of field is null !");
- auto *arr(dynamic_cast<DataArrayDouble *>(arr0));//tony
+ DataArrayDouble *arr(dynamic_cast<DataArrayDouble *>(arr0));//tony
if(!arr0)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values is double ! Not managed for the moment !");
mcIdType sz=0;
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArrayDouble storing values of field is null !");
- for(const auto & entrie : entries)
+ for(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >::const_iterator it=entries.begin();it!=entries.end();it++)
{
- if(typesToKeep.find(entrie.first.first)!=typesToKeep.end())
+ if(typesToKeep.find((*it).first.first)!=typesToKeep.end())
{
- entriesKept.push_back(getLeafGivenTypeAndLocId(entrie.first.first,entrie.first.second));
- sz+=entrie.second.second-entrie.second.first;
+ entriesKept.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second));
+ sz+=(*it).second.second-(*it).second.first;
}
else
- otherEntries.push_back(getLeafGivenTypeAndLocId(entrie.first.first,entrie.first.second));
+ otherEntries.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second));
}
MCAuto<DataArrayIdType> renumDefrag=DataArrayIdType::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero();
////////////////////
// tupleIdOfStartOfNewChuncksV[sid-1]=sz2;
MCAuto<DataArrayIdType> explicitIdsOldInArr=DataArrayIdType::New(); explicitIdsOldInArr->alloc(sz,1);
mcIdType *workI=explicitIdsOldInArr->getPointer();
- for(auto itL2 : *itL1)
+ for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*itL1).begin();itL2!=(*itL1).end();itL2++)
{
- mcIdType const delta1=itL2->fillTupleIds(workI); workI+=delta1; sz1+=delta1;
- itL2->setLocId(sz2);
- itL2->_tmp_work1=itL2->getStart();
- mcIdType const delta2=itL2->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2;
+ mcIdType delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1;
+ (*itL2)->setLocId(sz2);
+ (*itL2)->_tmp_work1=(*itL2)->getStart();
+ mcIdType delta2=(*itL2)->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2;
}
renumDefrag->setPartOfValuesSimple3(sid,explicitIdsOldInArr->begin(),explicitIdsOldInArr->end(),0,1,1);
}
explicitIdsOldInMesh->reAlloc(sz2);
- mcIdType const tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2;
+ mcIdType tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2;
////////////////////
- MCAuto<DataArrayIdType> permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=nullptr;
+ MCAuto<DataArrayIdType> permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0;
// perform redispatching of non concerned MEDFileFieldPerMeshPerTypePerDisc
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > otherEntriesNew;
- for(auto otherEntrie : otherEntries)
+ for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=otherEntries.begin();it!=otherEntries.end();it++)
{
- otherEntriesNew.push_back(MEDFileFieldPerMeshPerTypePerDisc::New(*otherEntrie));
- otherEntriesNew.back()->setNewStart(permArrDefrag->getIJ(otherEntrie->getStart(),0));
- otherEntriesNew.back()->setLocId(otherEntrie->getGeoType());
+ otherEntriesNew.push_back(MEDFileFieldPerMeshPerTypePerDisc::New(*(*it)));
+ otherEntriesNew.back()->setNewStart(permArrDefrag->getIJ((*it)->getStart(),0));
+ otherEntriesNew.back()->setLocId((*it)->getGeoType());
}
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > entriesKeptNew;
std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKeptNew2;
- for(auto it : entriesKept)
+ for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesKept.begin();it!=entriesKept.end();it++)
{
- MCAuto<MEDFileFieldPerMeshPerTypePerDisc> elt=MEDFileFieldPerMeshPerTypePerDisc::New(*it);
- mcIdType const newStart=elt->getLocId();
- elt->setLocId(it->getGeoType());
+ MCAuto<MEDFileFieldPerMeshPerTypePerDisc> elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it));
+ mcIdType newStart=elt->getLocId();
+ elt->setLocId((*it)->getGeoType());
elt->setNewStart(newStart);
elt->_tmp_work1=permArrDefrag->getIJ(elt->_tmp_work1,0);
entriesKeptNew.push_back(elt);
MCAuto<DataArrayDouble> arr2=arr->renumber(permArrDefrag->getConstPointer());
// perform redispatching of concerned MEDFileFieldPerMeshPerTypePerDisc -> values are in arr2
MCAuto<DataArrayIdType> explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end());
- std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > const entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2);
+ std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2);
bool ret=false;
- for(const auto & it4 : entriesKeptPerDisc)
+ for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it4=entriesKeptPerDisc.begin();it4!=entriesKeptPerDisc.end();it4++)
{
sid=0;
/*for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*it4).begin();itL2!=(*it4).end();itL2++)
MEDFileFieldPerMeshPerTypePerDisc *curNC=const_cast<MEDFileFieldPerMeshPerTypePerDisc *>(*itL2);
curNC->setNewStart(permArrDefrag->getIJ((*itL2)->getStart(),0)-tupleIdOfStartOfNewChuncks+tupleIdOfStartOfNewChuncksV[sid]);
}*/
- ret=MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(tupleIdOfStartOfNewChuncks,it4,explicitIdsNewInMesh,newCode,
+ ret=MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(tupleIdOfStartOfNewChuncks,*it4,explicitIdsNewInMesh,newCode,
glob,arr2,otherEntriesNew) || ret;
}
if(!ret)
void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret;
- for(auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
std::vector< std::pair<mcIdType,mcIdType> > its2;
- if(it->keepOnlySpatialDiscretization(tof,globalNum,its2))
+ if((*it)->keepOnlySpatialDiscretization(tof,globalNum,its2))
{
- ret.push_back(it);
+ ret.push_back(*it);
its.insert(its.end(),its2.begin(),its2.end());
}
}
void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret;
- for(auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
std::vector< std::pair<mcIdType,mcIdType> > its2;
- if(it->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2))
+ if((*it)->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2))
{
- ret.push_back(it);
+ ret.push_back(*it);
its.insert(its.end(),its2.begin(),its2.end());
}
}
void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves)
{
std::map<INTERP_KERNEL::NormalizedCellType,std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc> > > types;
- for(const auto & leave : leaves)
- types[(INTERP_KERNEL::NormalizedCellType)leave->getLocId()].push_back(leave);
+ for( std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >::const_iterator it=leaves.begin();it!=leaves.end();it++)
+ types[(INTERP_KERNEL::NormalizedCellType)(*it)->getLocId()].push_back(*it);
//
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > fieldPmPt(types.size());
std::map<INTERP_KERNEL::NormalizedCellType,std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc> > >::const_iterator it1=types.begin();
- auto it2=fieldPmPt.begin();
+ std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it2=fieldPmPt.begin();
for(;it1!=types.end();it1++,it2++)
{
MCAuto<MEDFileFieldPerMeshPerType> elt=MEDFileFieldPerMeshPerType::New(this,(INTERP_KERNEL::NormalizedCellType)((*it1).second[0]->getLocId()));
elt->setLeaves((*it1).second);
- MCAuto<MEDFileFieldPerMeshPerTypeCommon> const elt2(DynamicCast<MEDFileFieldPerMeshPerType,MEDFileFieldPerMeshPerTypeCommon>(elt));
+ MCAuto<MEDFileFieldPerMeshPerTypeCommon> elt2(DynamicCast<MEDFileFieldPerMeshPerType,MEDFileFieldPerMeshPerTypeCommon>(elt));
*it2=elt2;
}
_field_pm_pt=fieldPmPt;
void MEDFileFieldPerMesh::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & it : _field_pm_pt)
- it->changePflsRefsNamesGen(mapOfModif);
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->changePflsRefsNamesGen(mapOfModif);
}
void MEDFileFieldPerMesh::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & it : _field_pm_pt)
- it->changeLocsRefsNamesGen(mapOfModif);
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->changeLocsRefsNamesGen(mapOfModif);
}
/*!
std::vector<int> locs;
std::vector<mcIdType>code;
std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
- for(const auto & it : _field_pm_pt)
- it->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
// Sort by types
SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType);
if(code.empty())
throw INTERP_KERNEL::Exception(oss.str());
}
//
- std::vector< MCAuto<DataArrayIdType> > const notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< MCAuto<DataArrayIdType> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
if(type!=ON_NODES)
{
return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
else
{
- MCAuto<DataArrayIdType> const arr2(arr);
+ MCAuto<DataArrayIdType> arr2(arr);
return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc);
}
}
{
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !");
- mcIdType const nb=code[1];
+ mcIdType nb=code[1];
if(code[2]==-1)
{
if(nb!=mesh->getNumberOfNodes())
std::vector<int> locs;
std::vector<mcIdType> code;
std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
- for(const auto & it : _field_pm_pt)
- it->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
// Sort by types
SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType);
if(code.empty())
std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !";
throw INTERP_KERNEL::Exception(oss.str());
}
- std::vector< MCAuto<DataArrayIdType> > const notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< MCAuto<DataArrayIdType> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
if(type!=ON_NODES)
{
{
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !");
- mcIdType const nb=code[1];
+ mcIdType nb=code[1];
if(code[2]==-1)
{
if(nb!=mesh->getNumberOfNodes())
throw INTERP_KERNEL::Exception(oss.str());
}
}
- return finishField4(dads,code[2]==-1?nullptr:notNullPflsPerGeoType3[0],mesh->getNumberOfNodes(),pfl);
+ return finishField4(dads,code[2]==-1?0:notNullPflsPerGeoType3[0],mesh->getNumberOfNodes(),pfl);
}
//
- return nullptr;
+ return 0;
}
void MEDFileFieldPerMesh::accept(MEDFileFieldVisitor& visitor) const
{
- for(const auto & it : _field_pm_pt)
- if(it.isNotNull())
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ if((*it).isNotNull())
{
- visitor.newPerMeshPerTypeEntry(it);
- it->accept(visitor);
- visitor.endPerMeshPerTypeEntry(it);
+ visitor.newPerMeshPerTypeEntry(*it);
+ (*it)->accept(visitor);
+ visitor.endPerMeshPerTypeEntry(*it);
}
}
{
mcIdType globalSz=0;
mcIdType nbOfEntries=0;
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- it->getSizes(globalSz,nbOfEntries);
+ (*it)->getSizes(globalSz,nbOfEntries);
}
entries.resize(nbOfEntries);
nbOfEntries=0;
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- it->fillValues(nbOfEntries,entries);
+ (*it)->fillValues(nbOfEntries,entries);
}
}
MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId)
{
- for(auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- if(it->getGeoType()==typ)
- return it->getLeafGivenLocId(locId);
+ if((*it)->getGeoType()==typ)
+ return (*it)->getLeafGivenLocId(locId);
}
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl;
oss << "Possibilities are : ";
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(it->getGeoType());
+ const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType());
oss << "\"" << cm2.getRepr() << "\", ";
}
throw INTERP_KERNEL::Exception(oss.str());
const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const
{
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- if(it->getGeoType()==typ)
- return it->getLeafGivenLocId(locId);
+ if((*it)->getGeoType()==typ)
+ return (*it)->getLeafGivenLocId(locId);
}
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl;
oss << "Possibilities are : ";
- for(const auto & it : _field_pm_pt)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(it->getGeoType());
+ const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType());
oss << "\"" << cm2.getRepr() << "\", ";
}
throw INTERP_KERNEL::Exception(oss.str());
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> ret(new MEDFileFieldPerMeshPerTypePerDisc(father,tof));
if(pms.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : empty input vector !");
- for(const auto & pm : pms)
+ for(std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it=pms.begin();it!=pms.end();it++)
{
- if(!pm.second)
+ if(!(*it).second)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : presence of null pointer !");
- if(!pm.second->getProfile().empty())
+ if(!(*it).second->getProfile().empty())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for profiles !");
- if(!pm.second->getLocalization().empty())
+ if(!(*it).second->getLocalization().empty())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for gauss pts !");
}
- INTERP_KERNEL::NormalizedCellType const gt(pms[0].second->getGeoType());
+ INTERP_KERNEL::NormalizedCellType gt(pms[0].second->getGeoType());
std::size_t i(0);
std::vector< std::pair<int,int> > filteredDTS;
- for(auto it=dts.begin();it!=dts.end();it++,i++)
- for(const auto & it2 : *it)
- if(it2.first==gt)
- filteredDTS.push_back(std::pair<int,int>(i,it2.second));
+ for(std::vector< std::vector< std::pair<int,mcIdType> > >::const_iterator it=dts.begin();it!=dts.end();it++,i++)
+ for(std::vector< std::pair<int,mcIdType> >::const_iterator it2=(*it).begin();it2!=(*it).end();it2++)
+ if((*it2).first==gt)
+ filteredDTS.push_back(std::pair<int,int>(i,(*it2).second));
if(pms.size()!=filteredDTS.size())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for generated profiles !");
- auto it1(pms.begin());
+ std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it1(pms.begin());
std::vector< std::pair<int,int> >::const_iterator it2(filteredDTS.begin());
mcIdType zeStart(start),nval(0);
for(;it1!=pms.end();it1++,it2++)
MCAuto<MEDFileFieldPerMesh> ret(new MEDFileFieldPerMesh(father,pms[0]->getMeshName(),pms[0]->getMeshIteration(),pms[0]->getMeshOrder()));
std::map<INTERP_KERNEL::NormalizedCellType, std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> > > m;
std::size_t i(0);
- for(auto it=pms.begin();it!=pms.end();it++,i++)
+ for(std::vector<const MEDFileFieldPerMesh *>::const_iterator it=pms.begin();it!=pms.end();it++,i++)
{
const std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >& v((*it)->_field_pm_pt);
- for(const auto & it2 : v)
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it2=v.begin();it2!=v.end();it2++)
{
- INTERP_KERNEL::NormalizedCellType const gt(it2->getGeoType());
- const auto *elt(dynamic_cast<const MEDFileFieldPerMeshPerType *>((const MEDFileFieldPerMeshPerTypeCommon *)it2));
+ INTERP_KERNEL::NormalizedCellType gt((*it2)->getGeoType());
+ const MEDFileFieldPerMeshPerType *elt(dynamic_cast<const MEDFileFieldPerMeshPerType *>((const MEDFileFieldPerMeshPerTypeCommon *)(*it2)));
if(!elt)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::Aggregate : not managed for structelement !");
m[gt].push_back(std::pair<int,const MEDFileFieldPerMeshPerType *>(i,elt));
for(std::map<INTERP_KERNEL::NormalizedCellType, std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> > >::const_iterator it=m.begin();it!=m.end();it++)
{
MCAuto<MEDFileFieldPerMeshPerType> agg(MEDFileFieldPerMeshPerType::Aggregate(start,(*it).second,dts,(*it).first,ret,extractInfo));
- MCAuto<MEDFileFieldPerMeshPerTypeCommon> const agg2(DynamicCast<MEDFileFieldPerMeshPerType,MEDFileFieldPerMeshPerTypeCommon>(agg));
+ MCAuto<MEDFileFieldPerMeshPerTypeCommon> agg2(DynamicCast<MEDFileFieldPerMeshPerType,MEDFileFieldPerMeshPerTypeCommon>(agg));
ret->_field_pm_pt.push_back(agg2);
}
return ret;
int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type)
{
int i=0;
- std::size_t const pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type));
- auto it2=_field_pm_pt.begin();
- for(auto it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
+ std::size_t pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type));
+ std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it2=_field_pm_pt.begin();
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
{
- INTERP_KERNEL::NormalizedCellType const curType=(*it)->getGeoType();
+ INTERP_KERNEL::NormalizedCellType curType=(*it)->getGeoType();
if(type==curType)
return i;
else
{
- std::size_t const pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType));
+ std::size_t pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType));
if(pos>pos2)
it2=it+1;
}
}
- std::size_t const ret=std::distance(_field_pm_pt.begin(),it2);
+ std::size_t ret=std::distance(_field_pm_pt.begin(),it2);
_field_pm_pt.insert(it2,MEDFileFieldPerMeshPerType::New(this,type));
return (int)ret;
}
if(type==ON_GAUSS_PT)
{
mcIdType offset=0;
- std::size_t const nbOfArrs=dads.size();
+ std::size_t nbOfArrs=dads.size();
for(std::size_t i=0;i<nbOfArrs;i++)
{
- std::vector<std::pair<mcIdType,mcIdType> > const dads2(1,dads[i]); const std::vector<int> locs2(1,locs[i]);
+ std::vector<std::pair<mcIdType,mcIdType> > dads2(1,dads[i]); const std::vector<int> locs2(1,locs[i]);
const std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes2(1,INTERP_KERNEL::NORM_ERROR);
- mcIdType const nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2);
+ mcIdType nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2);
MCAuto<DataArrayIdType> di=DataArrayIdType::New();
di->alloc(nbOfElems,1);
di->iota(offset);
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
const std::vector<std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
- const std::vector<INTERP_KERNEL::NormalizedCellType>& /*geoTypes*/,
+ const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
if(da->isIota(mesh->getNumberOfCells()))
if(da->isIota(mesh->getNumberOfNodes()))
return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
// Treatment of particular case where nodal field on pfl is requested with a meshDimRelToMax=1.
- const auto *meshu=dynamic_cast<const MEDCouplingUMesh *>(mesh);
+ const MEDCouplingUMesh *meshu=dynamic_cast<const MEDCouplingUMesh *>(mesh);
if(meshu)
{
- if(meshu->getNodalConnectivity()==nullptr)
+ if(meshu->getNodalConnectivity()==0)
{
MCAuto<MEDCouplingFieldDouble> ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc);
- mcIdType const nb=da->getNbOfElems();
+ mcIdType nb=da->getNbOfElems();
const mcIdType *ptr=da->getConstPointer();
- auto *meshuc=const_cast<MEDCouplingUMesh *>(meshu);
+ MEDCouplingUMesh *meshuc=const_cast<MEDCouplingUMesh *>(meshu);
meshuc->allocateCells(nb);
for(mcIdType i=0;i<nb;i++)
meshuc->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,ptr+i);
//
MCAuto<MEDCouplingFieldDouble> ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
isPfl=true;
- DataArrayIdType *arr2=nullptr;
+ DataArrayIdType *arr2=0;
MCAuto<DataArrayIdType> cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
MCAuto<MEDCouplingMesh> mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2);
- MCAuto<DataArrayIdType> const arr3(arr2);
- mcIdType const nnodes=mesh2->getNumberOfNodes();
+ MCAuto<DataArrayIdType> arr3(arr2);
+ mcIdType nnodes=mesh2->getNumberOfNodes();
if(nnodes==(mcIdType)da->getNbOfElems())
{
MCAuto<DataArrayIdType> da3=da->transformWithIndArrR(arr2->begin(),arr2->end());
oss << " - if definitely the node profile has no link with mesh connectivity use MEDFileField1TS::getFieldWithProfile or MEDFileFieldMultiTS::getFieldWithProfile methods instead !";
throw INTERP_KERNEL::Exception(oss.str());
}
- return nullptr;
+ return 0;
}
/*!
MCAuto<DataArrayIdType> safePfl(pflOut);
MCAuto<DataArray> da=getOrCreateAndGetArray()->selectByTupleRanges(dads);
const std::vector<std::string>& infos=getInfo();
- std::size_t const nbOfComp=infos.size();
+ std::size_t nbOfComp=infos.size();
for(std::size_t i=0;i<nbOfComp;i++)
da->setInfoOnComponent(i,infos[i].c_str());
safePfl->incrRef();
public:
static MFFPMIter *NewCell(const MEDFileEntities *entities);
static bool IsPresenceOfNode(const MEDFileEntities *entities);
- virtual ~MFFPMIter() = default;
+ virtual ~MFFPMIter() { }
virtual void begin() = 0;
virtual bool finished() const = 0;
virtual void next() = 0;
class MFFPMIterSimple : public MFFPMIter
{
public:
- MFFPMIterSimple() = default;
- void begin() override { _pos=0; }
- bool finished() const override { return _pos>=MED_N_CELL_FIXED_GEO; }
- void next() override { _pos++; }
- int current() const override { return _pos; }
+ MFFPMIterSimple():_pos(0) { }
+ void begin() { _pos=0; }
+ bool finished() const { return _pos>=MED_N_CELL_FIXED_GEO; }
+ void next() { _pos++; }
+ int current() const { return _pos; }
private:
- int _pos{0};
+ int _pos;
};
class MFFPMIter2 : public MFFPMIter
{
public:
MFFPMIter2(const std::vector<INTERP_KERNEL::NormalizedCellType>& cts);
- void begin() override { _it=_ids.begin(); }
- bool finished() const override { return _it==_ids.end(); }
- void next() override { _it++; }
- int current() const override { return *_it; }
+ void begin() { _it=_ids.begin(); }
+ bool finished() const { return _it==_ids.end(); }
+ void next() { _it++; }
+ int current() const { return *_it; }
private:
std::vector<int> _ids;
std::vector<int>::const_iterator _it;
return new MFFPMIterSimple;
else
{
- const auto *entities2(dynamic_cast<const MEDFileStaticEntities *>(entities));
+ const MEDFileStaticEntities *entities2(dynamic_cast<const MEDFileStaticEntities *>(entities));
if(entities2)
{
std::vector<INTERP_KERNEL::NormalizedCellType> tmp;
const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& myEnt(entities2->getEntries());
- for(const auto & it : myEnt)
+ for(std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >::const_iterator it=myEnt.begin();it!=myEnt.end();it++)
{
- if(it.first==ON_CELLS || it.first==ON_GAUSS_NE || it.first==ON_GAUSS_PT)
- tmp.push_back(it.second);
+ if((*it).first==ON_CELLS || (*it).first==ON_GAUSS_NE || (*it).first==ON_GAUSS_PT)
+ tmp.push_back((*it).second);
}
return new MFFPMIter2(tmp);
}
return true;
else
{
- const auto *entities2(dynamic_cast<const MEDFileStaticEntities *>(entities));
+ const MEDFileStaticEntities *entities2(dynamic_cast<const MEDFileStaticEntities *>(entities));
if(entities2)
{
const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& myEnt(entities2->getEntries());
- for(const auto & it : myEnt)
- if(it.first==ON_NODES)
+ for(std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >::const_iterator it=myEnt.begin();it!=myEnt.end();it++)
+ if((*it).first==ON_NODES)
return true;
return false;
}
MFFPMIter2::MFFPMIter2(const std::vector<INTERP_KERNEL::NormalizedCellType>& cts)
{
- std::size_t const sz(cts.size());
+ std::size_t sz(cts.size());
_ids.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
INTERP_KERNEL::AutoPtr<char> meshName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> pflName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> locName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
- const auto *mmu(dynamic_cast<const MEDFileUMesh *>(mm));
+ const MEDFileUMesh *mmu(dynamic_cast<const MEDFileUMesh *>(mm));
INTERP_KERNEL::AutoCppPtr<MFFPMIter> iter0(MFFPMIter::NewCell(entities));
// for each geometric type inside my mesh, check if there is a field profile ie if the field is defined on this type of cells (whether the discretization is on cells or on gauss_ne)
// and if this is the case, retrieve the part to be read and build a new MedFileField from it
for(iter0->begin();!iter0->finished();iter0->next())
{
- med_int const nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
- std::string const name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
- med_int const nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
- std::string const name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
+ med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
+ med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
if(nbProfile>0 || nbProfile2>0)
{
- const PartDefinition *pd(nullptr);
+ const PartDefinition *pd(0);
if(mmu)
pd=mmu->getPartDefAtLevel(mmu->getRelativeLevOnGeoType(typmai2[iter0->current()]),typmai2[iter0->current()]);
_field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[iter0->current()],nasc,pd));
if(MFFPMIter::IsPresenceOfNode(entities))
{
// if there is a profile on nodes for the current field, retrieve the part to be read and build a new MedFileField from it
- med_int const nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName));
+ med_int nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName));
if(nbProfile>0)
{
- const PartDefinition *pd(nullptr);
+ const PartDefinition *pd(0);
if(mmu)
pd=mmu->getPartDefAtLevel(1,INTERP_KERNEL::NORM_ERROR);
_field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_NODES,INTERP_KERNEL::NORM_ERROR,nasc,pd));
}
if(!entities)
return ;
- std::vector<int> const dynGT(entities->getDynGTAvail());
- for(int const it : dynGT)
+ std::vector<int> dynGT(entities->getDynGTAvail());
+ for(std::vector<int>::const_iterator it=dynGT.begin();it!=dynGT.end();it++)
{
- med_int const nbPfl(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,it,pflName,locName));
+ med_int nbPfl(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,*it,pflName,locName));
if(nbPfl>0)
{
- _field_pm_pt.push_back(MEDFileFieldPerMeshPerTypeDyn::NewOnRead(fid,this,entities,it,nasc));
+ _field_pm_pt.push_back(MEDFileFieldPerMeshPerTypeDyn::NewOnRead(fid,this,entities,*it,nasc));
setMeshName(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE));
}
}
iter0=MFFPMIter::NewCell(entities);
for(iter0->begin();!iter0->finished();iter0->next())
{
- med_int const nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
- std::string const name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
- med_int const nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
- std::string const name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
+ med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
+ med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
if(nbProfile>0 || nbProfile2>0)
{
- _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[iter0->current()],nasc,nullptr));
+ _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[iter0->current()],nasc,NULL));
if(nbProfile>0)
setMeshName(name0);
else
INTERP_KERNEL::AutoCppPtr<MFFPMIter> iter0(MFFPMIter::NewCell(entities));
for(iter0->begin();!iter0->finished();iter0->next())
{
- med_int const nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
- std::string const name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
- med_int const nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
- std::string const name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
+ med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
+ med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName));
+ std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1));
if(nbProfile>0 || nbProfile2>0)
{
_field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[iter0->current()],nasc,pd));
if(MFFPMIter::IsPresenceOfNode(entities))
{
- med_int const nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName));
+ med_int nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName));
if(nbProfile>0)
{
_field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_NODES,INTERP_KERNEL::NORM_ERROR,nasc,pd));
#ifndef __MEDFILEFIELDINTERNAL_HXX__
#define __MEDFILEFIELDINTERNAL_HXX__
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingTraits.hxx"
#include "MEDLoaderDefines.hxx"
#include "MEDFileUtilities.hxx"
#include "NormalizedGeometricTypes"
#include "med.h"
-#include <ostream>
-#include <cstddef>
-#include <set>
#include <string>
#include <list>
-#include <vector>
-#include <utility>
namespace MEDCoupling
{
{
public:
MEDFileGTKeeperSta(INTERP_KERNEL::NormalizedCellType gt):_geo_type(gt) { }
- MEDFileGTKeeper *deepCopy() const override;
- INTERP_KERNEL::NormalizedCellType getGeoType() const override;
- std::string getRepr() const override;
- bool isEqual(const MEDFileGTKeeper *other) const override;
+ MEDFileGTKeeper *deepCopy() const;
+ INTERP_KERNEL::NormalizedCellType getGeoType() const;
+ std::string getRepr() const;
+ bool isEqual(const MEDFileGTKeeper *other) const;
private:
INTERP_KERNEL::NormalizedCellType _geo_type;
};
{
public:
MEDFileGTKeeperDyn(const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileStructureElement *se);
- MEDFileGTKeeper *deepCopy() const override;
- INTERP_KERNEL::NormalizedCellType getGeoType() const override;
- std::string getRepr() const override;
- bool isEqual(const MEDFileGTKeeper *other) const override;
+ MEDFileGTKeeper *deepCopy() const;
+ INTERP_KERNEL::NormalizedCellType getGeoType() const;
+ std::string getRepr() const;
+ bool isEqual(const MEDFileGTKeeper *other) const;
const MEDFileUMesh *getMesh() const { return _mesh; }
const MEDFileUMesh *getSection() const { return _section; }
const MEDFileStructureElement *getSE() const { return _se; }
static MEDFileFieldLoc *New(med_idt fid, const std::string& locName);
static MEDFileFieldLoc *New(med_idt fid, int i, const MEDFileEntities *entities);
static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDFileFieldLoc *deepCopy() const;
bool isOnStructureElement() const;
const MEDFileGTKeeper *getUndergroundGTKeeper() const { return _gt; }
static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId);
static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
std::string getClassName() const override { return std::string("MEDFileFieldPerMeshPerTypePerDisc"); }
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const;
void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
{
public:
std::string getClassName() const override { return std::string("MEDFileFieldPerMeshPerTypeCommon"); }
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
void setFather(MEDFileFieldPerMesh *father);
void accept(MEDFileFieldVisitor& visitor) const;
public:
- ~MEDFileFieldPerMeshPerTypeCommon() override;
+ virtual ~MEDFileFieldPerMeshPerTypeCommon();
virtual void getDimension(int& dim) const = 0;
virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0;
virtual INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const = 0;
static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
static MCAuto<MEDFileFieldPerMeshPerType> Aggregate(mcIdType &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
public:// overload of abstract methods
- void getDimension(int& dim) const override;
+ void getDimension(int& dim) const;
INTERP_KERNEL::NormalizedCellType getGeoType() const override;
INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const override;
- void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const override;
- void simpleRepr(int bkOffset, std::ostream& oss, int id) const override;
- std::string getGeoTypeRepr() const override;
- MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const override;
- void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const override;
+ void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const;
+ void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
+ std::string getGeoTypeRepr() const;
+ MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const;
+ void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
private:
MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *father, INTERP_KERNEL::NormalizedCellType gt);
int getDynGT() const;
std::string getModelName() const;
public:
- void getDimension(int& dim) const override;
+ void getDimension(int& dim) const;
INTERP_KERNEL::NormalizedCellType getGeoType() const override;
INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const override;
- void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const override;
- void simpleRepr(int bkOffset, std::ostream& oss, int id) const override;
- std::string getGeoTypeRepr() const override;
- MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const override;
- void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const override;
+ void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const;
+ void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
+ std::string getGeoTypeRepr() const;
+ MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const;
+ void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
private:
MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileStructureElement *se, const MEDFileFieldNameScope& nasc);
private:
static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const PartDefinition *pd, const MEDFileEntities *entities);
std::string getClassName() const override { return std::string("MEDFileFieldPerMesh"); }
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const;
void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
void copyTinyInfoFrom(const MEDCouplingMesh *mesh);
MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const PartDefinition *pd, const MEDFileEntities *entities);
MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
- MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& /*meshName*/, int meshIt, int meshOrd):_mesh_iteration(meshIt),_mesh_order(meshOrd),_father(fath) { }
+ MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_mesh_iteration(meshIt),_mesh_order(meshOrd),_father(fath) { }
private:
int _mesh_iteration;
int _mesh_order;
// Author : Anthony Geay (EDF R&D)
#include "MEDFileFieldMultiTS.hxx"
-#include "MEDFileField.txx"
-#include "MCType.hxx"
-#include "MEDFileFieldGlobs.hxx"
-#include "MEDFileEntities.hxx"
-#include "InterpKernelException.hxx"
-#include "MCAuto.hxx"
-#include "MEDFileField1TS.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "InterpKernelAutoPtr.hxx"
-#include "MEDFileBasis.hxx"
-#include "MCIdType.hxx"
-#include "MEDFileFieldOverView.hxx"
#include "MEDFileFieldVisitor.hxx"
#include "MEDFileSafeCaller.txx"
-#include "MEDFileUtilities.hxx"
#include "MEDLoaderBase.hxx"
+#include "MEDFileField.txx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
-#include "NormalizedGeometricTypes"
-#include "med.h"
-#include "medfield.h"
-#include "MEDLoaderTraits.hxx"
-
-#include <cstddef>
-#include <iterator>
-#include <algorithm>
-#include <ostream>
-#include <set>
-#include <cmath>
-#include <limits>
-#include <list>
+
#include <sstream>
-#include <string>
-#include <vector>
-#include <utility>
using namespace MEDCoupling;
//= MEDFileAnyTypeFieldMultiTSWithoutSDA
MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA()
-= default;
+{
+}
MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileFieldNameScope(fieldName,meshName)
{
{
med_field_type typcha;
std::string dtunitOut,meshName;
- int const nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,fieldId,false,_name,typcha,_infos,dtunitOut,meshName));
+ int nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,fieldId,false,_name,typcha,_infos,dtunitOut,meshName));
setMeshName(meshName);
setDtUnit(dtunitOut.c_str());
loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,typcha,loadAll,ms,entities);
std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(_mesh_name.capacity()+_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto<MEDFileField1TSWithoutSDA>));
- for(const auto & _info : _infos)
- ret+=_info.capacity();
+ for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
+ ret+=(*it).capacity();
return ret;
}
std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _time_step : _time_steps)
- ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)_time_step);
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it);
return ret;
}
{
MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
ret->setInfo(_infos);
- int const sz=(int)_time_steps.size();
+ int sz=(int)_time_steps.size();
for(const int *id=startIds;id!=endIds;id++)
{
if(*id>=0 && *id<sz)
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2(int bg, int end, int step) const
{
static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2";
- mcIdType const nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+ mcIdType nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
ret->setInfo(_infos);
- std::size_t const sz=_time_steps.size();
+ std::size_t sz=_time_steps.size();
std::size_t j=bg;
for(int i=0;i<nbOfEntriesToKeep;i++,j+=step)
{
{
int id=0;
MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
- for(auto it=_time_steps.begin();it!=_time_steps.end();it++,id++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
{
const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
if(!cur)
continue;
- std::pair<int,int> const p(cur->getIteration(),cur->getOrder());
+ std::pair<int,int> p(cur->getIteration(),cur->getOrder());
if(std::find(timeSteps.begin(),timeSteps.end(),p)!=timeSteps.end())
ids->pushBackSilent(id);
}
{
int id=0;
MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
- for(auto it=_time_steps.begin();it!=_time_steps.end();it++,id++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
{
const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
if(!cur)
continue;
- std::pair<int,int> const p(cur->getIteration(),cur->getOrder());
+ std::pair<int,int> p(cur->getIteration(),cur->getOrder());
if(std::find(timeSteps.begin(),timeSteps.end(),p)==timeSteps.end())
ids->pushBackSilent(id);
}
bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfStructureElements() const
{
- for(const auto & _time_step : _time_steps)
- if(_time_step.isNotNull())
- if(_time_step->presenceOfStructureElements())
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
+ if((*it)->presenceOfStructureElements())
return true;
return false;
}
bool MEDFileAnyTypeFieldMultiTSWithoutSDA::onlyStructureElements() const
{
- for(const auto & _time_step : _time_steps)
- if(_time_step.isNotNull())
- if(!_time_step->onlyStructureElements())
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
+ if(!(*it)->onlyStructureElements())
return false;
return true;
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::killStructureElements()
{
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
- for(auto & _time_step : _time_steps)
- if(_time_step.isNotNull())
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
{
- if(_time_step->presenceOfStructureElements())
+ if((*it)->presenceOfStructureElements())
{
- if(!_time_step->onlyStructureElements())
+ if(!(*it)->onlyStructureElements())
{
- _time_step->killStructureElements();
- ret.push_back(_time_step);
+ (*it)->killStructureElements();
+ ret.push_back(*it);
}
}
else
{
- ret.push_back(_time_step);
+ ret.push_back(*it);
}
}
_time_steps=ret;
void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyStructureElements()
{
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
- for(auto & _time_step : _time_steps)
- if(_time_step.isNotNull())
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
{
- if(_time_step->presenceOfStructureElements())
+ if((*it)->presenceOfStructureElements())
{
- if(!_time_step->onlyStructureElements())
- _time_step->keepOnlyStructureElements();
- ret.push_back(_time_step);
+ if(!(*it)->onlyStructureElements())
+ (*it)->keepOnlyStructureElements();
+ ret.push_back(*it);
}
}
_time_steps=ret;
void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyOnSE(const std::string& seName)
{
- std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > const ret;
- for(auto & _time_step : _time_steps)
- if(_time_step.isNotNull())
- _time_step->keepOnlyOnSE(seName);
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
+ (*it)->keepOnlyOnSE(seName);
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const
{
std::vector< std::pair<std::string,std::string> > ps2;
- for(const auto & _time_step : _time_steps)
- if(_time_step.isNotNull())
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
{
- _time_step->getMeshSENames(ps2);
+ (*it)->getMeshSENames(ps2);
break;
}
if(ps2.empty())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : this appears to not contain SE only !");
- for(const auto & _time_step : _time_steps)
- if(_time_step.isNotNull())
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
{
std::vector< std::pair<std::string,std::string> > ps3;
- _time_step->getMeshSENames(ps3);
+ (*it)->getMeshSENames(ps3);
if(ps2!=ps3)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : For the moment only homogeneous SE def through time managed !");
}
- for(const auto & it : ps2)
+ for(std::vector< std::pair<std::string,std::string> >::const_iterator it=ps2.begin();it!=ps2.end();it++)
{
- auto const it2(std::find(ps.begin(),ps.end(),it));
+ std::vector< std::pair<std::string,std::string> >::iterator it2(std::find(ps.begin(),ps.end(),*it));
if(it2==ps.end())
- ps.push_back(it);
+ ps.push_back(*it);
}
}
bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const
{
- for(const auto & _time_step : _time_steps)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- const MEDFileAnyTypeField1TSWithoutSDA *cur(_time_step);
+ const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
if(!cur)
continue;
if(cur->presenceOfMultiDiscPerGeoType())
int MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepPos(int iteration, int order) const
{
int ret=0;
- for(auto it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
{
const MEDFileAnyTypeField1TSWithoutSDA *pt(*it);
if(pt->isDealingTS(iteration,order))
return ret;
}
std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepPos : Muli timestep field on time (" << iteration << "," << order << ") does not exist ! Available (iteration,order) are :\n";
- std::vector< std::pair<int,int> > const vp=getIterations();
- for(const auto & it2 : vp)
- oss << "(" << it2.first << "," << it2.second << ") ";
+ std::vector< std::pair<int,int> > vp=getIterations();
+ for(std::vector< std::pair<int,int> >::const_iterator it2=vp.begin();it2!=vp.end();it2++)
+ oss << "(" << (*it2).first << "," << (*it2).second << ") ";
throw INTERP_KERNEL::Exception(oss.str());
}
bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
bool ret(false);
- for(const auto & it : modifTab)
+ for(std::vector< std::pair<std::string,std::string> >::const_iterator it=modifTab.begin();it!=modifTab.end();it++)
{
- if(it.first==getMeshName())
+ if((*it).first==getMeshName())
{
- setMeshName(it.second);
+ setMeshName((*it).second);
ret=true;
}
}
- for(auto & _time_step : _time_steps)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- MEDFileAnyTypeField1TSWithoutSDA *cur(_time_step);
+ MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
if(cur)
ret=cur->changeMeshNames(modifTab) || ret;
}
MEDFileFieldGlobsReal& glob)
{
bool ret=false;
- for(auto & _time_step : _time_steps)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- MEDFileAnyTypeField1TSWithoutSDA *f1ts(_time_step);
+ MEDFileAnyTypeField1TSWithoutSDA *f1ts(*it);
if(f1ts)
ret=f1ts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret;
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::accept(MEDFileFieldVisitor& visitor) const
{
- for(const auto & _time_step : _time_steps)
- if(_time_step.isNotNull())
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
{
- visitor.newTimeStepEntry(_time_step);
- _time_step->accept(visitor);
- visitor.endTimeStepEntry(_time_step);
+ visitor.newTimeStepEntry(*it);
+ (*it)->accept(visitor);
+ visitor.endTimeStepEntry(*it);
}
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
{
- std::string const startLine(bkOffset,' ');
+ std::string startLine(bkOffset,' ');
oss << startLine << "Field multi time steps [Type=" << getTypeStr() << "]";
if(fmtsId>=0)
oss << " (" << fmtsId << ")";
oss << " has the following name: \"" << _name << "\"." << std::endl;
oss << startLine << "Field multi time steps has " << _infos.size() << " components with the following infos :" << std::endl;
- for(const auto & _info : _infos)
+ for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
{
- oss << startLine << " - \"" << _info << "\"" << std::endl;
+ oss << startLine << " - \"" << *it << "\"" << std::endl;
}
int i=0;
- for(auto it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
{
- std::string const chapter(17,(char)('0'+i));
+ std::string chapter(17,(char)('0'+i));
oss << startLine << chapter << std::endl;
const MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
if(cur)
std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeSteps(std::vector<double>& ret1) const
{
- std::size_t const sz=_time_steps.size();
+ std::size_t sz=_time_steps.size();
std::vector< std::pair<int,int> > ret(sz);
ret1.resize(sz);
for(std::size_t i=0;i<sz;i++)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope()
{
- std::size_t const nbOfCompo=_infos.size();
- for(auto & _time_step : _time_steps)
+ std::size_t nbOfCompo=_infos.size();
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- MEDFileAnyTypeField1TSWithoutSDA *cur=_time_step;
+ MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
if(cur)
{
if((cur->getInfo()).size()!=nbOfCompo)
//
INTERP_KERNEL::AutoCppPtr<MEDFileEntities> entitiesFast;
const MEDFileEntities *entitiesForSubInstances(entities);
- MEDFileCapability const mfcap(fid);
+ MEDFileCapability mfcap(fid);
if( ( !entities || entities->areAllStaticPresentAndNoDyn() ) && mfcap.isFastReader())
{// no entities
- med_int const nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT));
+ med_int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT));
INTERP_KERNEL::AutoPtr<med_entity_type> types(new med_entity_type[nentitype]);
med_int usedbyncs;
MEDFILESAFECALLERRD0(MEDfieldEntityType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types,&usedbyncs));
std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesFastP;
for(int i=0;i<nentitype;i++)
{
- med_int const ngeotype(MEDfieldnGeometryType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i]));
+ med_int ngeotype(MEDfieldnGeometryType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i]));
INTERP_KERNEL::AutoPtr<med_geometry_type> geotypes(new med_geometry_type[ngeotype]);
med_int geousedbyncs;
MEDFILESAFECALLERRD0(MEDfieldGeometryType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i],geotypes,&geousedbyncs));
for(med_int j=0;j<ngeotype;j++)
{
- std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> const p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),ConvertGeometryType(geotypes[j]));
+ std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),ConvertGeometryType(geotypes[j]));
entitiesFastP.push_back(p);
}
}
}
for(int i=0;i<nbPdt;i++)
{
- std::vector< std::pair<int,int> > const ts;
+ std::vector< std::pair<int,int> > ts;
med_int numdt=0,numo=0;
med_float dt=0.0;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,_name.c_str(),i+1,&numdt,&numo,&dt));
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !");
checkThatNbOfCompoOfTSMatchThis();
std::vector<std::string> infos(getInfo());
- std::size_t const nbComp=infos.size();
+ std::size_t nbComp=infos.size();
INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
for(unsigned int i=0;i<nbComp;i++)
{
- std::string const info=infos[i];
+ std::string info=infos[i];
std::string c,u;
MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,opts.getTooLongStrPolicy());
if(_name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::write : MED file does not accept field with empty name !");
MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),ToMedInt(nbComp),comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
- std::size_t const nbOfTS=_time_steps.size();
+ std::size_t nbOfTS=_time_steps.size();
for(std::size_t i=0;i<nbOfTS;i++)
_time_steps[i]->writeLL(fid,opts,*this);
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc)
{
- for(auto & _time_step : _time_steps)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- MEDFileAnyTypeField1TSWithoutSDA *elt(_time_step);
+ MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
if(elt)
elt->loadBigArraysRecursively(fid,nasc);
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc)
{
- for(auto & _time_step : _time_steps)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- MEDFileAnyTypeField1TSWithoutSDA *elt(_time_step);
+ MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
if(elt)
elt->loadBigArraysRecursivelyIfNecessary(fid,nasc);
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays()
{
- for(auto & _time_step : _time_steps)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- MEDFileAnyTypeField1TSWithoutSDA *elt(_time_step);
+ MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
if(elt)
elt->unloadArrays();
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS()
{
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
- for(const auto & _time_step : _time_steps)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- const MEDFileAnyTypeField1TSWithoutSDA *tmp=_time_step;
+ const MEDFileAnyTypeField1TSWithoutSDA *tmp=(*it);
if(tmp)
- newTS.push_back(_time_step);
+ newTS.push_back(*it);
}
_time_steps=newTS;
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds)
{
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
- int const maxId=(int)_time_steps.size();
+ int maxId=(int)_time_steps.size();
int ii=0;
std::set<int> idsToDel;
for(const int *id=startIds;id!=endIds;id++,ii++)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step)
{
static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2";
- mcIdType const nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+ mcIdType nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
if(nbOfEntriesToKill==0)
return ;
- std::size_t const sz=_time_steps.size();
+ std::size_t sz=_time_steps.size();
std::vector<bool> b(sz,true);
int j=bg;
for(mcIdType i=0;i<nbOfEntriesToKill;i++,j+=step)
{
int ret=0;
std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : ";
- for(auto it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
{
const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
if(tmp)
int ret=0;
std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : ";
oss.precision(15);
- for(auto it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
{
const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
if(tmp)
{
int it2,ord;
- double const ti=tmp->getTime(it2,ord);
+ double ti=tmp->getTime(it2,ord);
if(fabs(time-ti)<eps)
return ret;
else
std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const
{
- std::size_t const lgth=_time_steps.size();
+ std::size_t lgth=_time_steps.size();
std::vector< std::pair<int,int> > ret(lgth);
for(std::size_t i=0;i<lgth;i++)
_time_steps[i]->fillIteration(ret[i]);
throw INTERP_KERNEL::Exception(oss.str());
}
const MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
- if(item==nullptr)
+ if(item==0)
{
std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
oss << "\nTry to use following method eraseEmptyTS !";
throw INTERP_KERNEL::Exception(oss.str());
}
MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
- if(item==nullptr)
+ if(item==0)
{
std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
oss << "\nTry to use following method eraseEmptyTS !";
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & _time_step : _time_steps)
+ for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- std::vector<std::string> const tmp=_time_step->getPflsReallyUsed2();
- for(const auto & it2 : tmp)
- if(ret2.find(it2)==ret2.end())
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
{
- ret.push_back(it2);
- ret2.insert(it2);
+ ret.push_back(*it2);
+ ret2.insert(*it2);
}
}
return ret;
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(const auto & _time_step : _time_steps)
+ for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- std::vector<std::string> const tmp=_time_step->getLocsReallyUsed2();
- for(const auto & it2 : tmp)
- if(ret2.find(it2)==ret2.end())
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
{
- ret.push_back(it2);
- ret2.insert(it2);
+ ret.push_back(*it2);
+ ret2.insert(*it2);
}
}
return ret;
std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const
{
std::vector<std::string> ret;
- for(const auto & _time_step : _time_steps)
+ for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- std::vector<std::string> tmp=_time_step->getPflsReallyUsedMulti2();
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
ret.insert(ret.end(),tmp.begin(),tmp.end());
}
return ret;
std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const
{
std::vector<std::string> ret;
- for(const auto & _time_step : _time_steps)
+ for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
- std::vector<std::string> tmp=_time_step->getLocsReallyUsedMulti2();
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti2();
ret.insert(ret.end(),tmp.begin(),tmp.end());
}
return ret;
void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & _time_step : _time_steps)
- _time_step->changePflsRefsNamesGen2(mapOfModif);
+ for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ (*it)->changePflsRefsNamesGen2(mapOfModif);
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(auto & _time_step : _time_steps)
- _time_step->changeLocsRefsNamesGen2(mapOfModif);
+ for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ (*it)->changeLocsRefsNamesGen2(mapOfModif);
}
std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const
{
- std::size_t const lgth=_time_steps.size();
+ std::size_t lgth=_time_steps.size();
std::vector< std::vector<TypeOfField> > ret(lgth);
for(std::size_t i=0;i<lgth;i++)
_time_steps[i]->fillTypesOfFieldAvailable(ret[i]);
{
MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=shallowCpy();
std::size_t i=0;
- for(auto it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
{
if((const MEDFileAnyTypeField1TSWithoutSDA *)*it)
ret->_time_steps[i]=(*it)->deepCopy();
}
for(std::size_t i=0;i<sz2;i++)
{
- std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > const ret1=_time_steps[i]->splitComponents();
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret1=_time_steps[i]->splitComponents();
if(ret1.size()!=sz)
{
std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents : At rank #" << i << " number of components is " << ret1.size() << " whereas it should be for all time steps " << sz << " !";
*/
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const
{
- std::size_t const sz(_time_steps.size());
+ std::size_t sz(_time_steps.size());
std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
for(std::size_t i=0;i<sz;i++)
{
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ret2;
std::vector< TypeOfField > types;
- for(const auto & item : items)
- for(const auto & it1 : item)
+ for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
{
- std::vector<TypeOfField> ts=it1->getTypesOfFieldAvailable();
+ std::vector<TypeOfField> ts=(*it1)->getTypesOfFieldAvailable();
if(ts.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : it appears that the splitting of MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations has returned invalid result !");
- auto const it2=std::find(types.begin(),types.end(),ts[0]);
+ std::vector< TypeOfField >::iterator it2=std::find(types.begin(),types.end(),ts[0]);
if(it2==types.end())
types.push_back(ts[0]);
}
ret.resize(types.size()); ret2.resize(types.size());
- for(const auto & item : items)
- for(const auto & it1 : item)
+ for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
{
- TypeOfField const typ=it1->getTypesOfFieldAvailable()[0];
- std::size_t const pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ));
- ret2[pos].push_back(it1);
+ TypeOfField typ=(*it1)->getTypesOfFieldAvailable()[0];
+ std::size_t pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ));
+ ret2[pos].push_back(*it1);
}
for(std::size_t i=0;i<types.size();i++)
{
MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
- for(auto & it1 : ret2[i])
- elt->pushBackTimeStep(it1);//also updates infos in elt
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++)
+ elt->pushBackTimeStep(*it1);//also updates infos in elt
ret[i]=elt;
elt->MEDFileFieldNameScope::operator=(*this);
}
*/
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const
{
- std::size_t const sz(_time_steps.size());
+ std::size_t sz(_time_steps.size());
std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
std::size_t szOut(std::numeric_limits<std::size_t>::max());
for(std::size_t i=0;i<sz;i++)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis() const
{
- std::size_t const sz=_infos.size();
+ std::size_t sz=_infos.size();
int j=0;
- for(auto it=_time_steps.begin();it!=_time_steps.end();it++,j++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++)
{
const MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
if(elt)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ts)
{
- int const sz=(int)_time_steps.size();
+ int sz=(int)_time_steps.size();
if(i<0 || i>=sz)
{
std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element at place #" << i << " should be in [0," << sz << ") !";
std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=getTimeStepEntry(iteration,order);
- const auto *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
+ const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2 : mismatch of type of field expecting FLOAT64 !");
return myF1TSC->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
MCAuto<MEDFileInt32FieldMultiTSWithoutSDA> ret(new MEDFileInt32FieldMultiTSWithoutSDA);
ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
int i=0;
- for(auto it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
{
const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it);
if(eltToConv)
{
- const auto *eltToConvC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(eltToConv);
+ const MEDFileField1TSWithoutSDA *eltToConvC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(eltToConv);
if(!eltToConvC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type FLOAT64 !");
- MCAuto<MEDFileAnyTypeField1TSWithoutSDA> const elt=eltToConvC->convertToInt();
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> elt=eltToConvC->convertToInt();
ret->setIteration(i,elt);
}
}
//= MEDFileAnyTypeFieldMultiTS
MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS()
-= default;
+{
+}
MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
try:MEDFileFieldGlobsReal(fid)
{
case MED_FLOAT64:
{
- ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr);
+ ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
break;
}
case MED_INT32:
{
- ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr);
+ ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
break;
}
case MED_INT64:
{
- ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr);
+ ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
break;
}
case MED_FLOAT32:
{
- ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr);
+ ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
break;
}
case MED_INT:
{
if(sizeof(med_int)==sizeof(int))
{
- ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr);
+ ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
break;
}
}
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid)
{
MEDFileAnyTypeFieldMultiTS *ret(BuildNewInstanceFromContent(c));
- std::string const fileName(FileNameFromFID(fid));
+ std::string fileName(FileNameFromFID(fid));
ret->setFileName(fileName);
return ret;
}
*/
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, bool loadAll)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,loadAll);
}
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, bool loadAll)
{
- MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,loadAll,nullptr));
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,loadAll,0));
MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
ret->loadGlobals(fid);
return ret.retn();
*/
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,fieldName,loadAll);
}
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, const std::string& fieldName, bool loadAll)
{
- MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,fieldName,loadAll,nullptr,nullptr));
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,fieldName,loadAll,0,0));
MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
ret->loadGlobals(fid);
return ret.retn();
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const
{
- MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> const c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds);
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds);
MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
ret->_content=c;
return ret.retn();
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const
{
- MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> const c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step);
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step);
MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
ret->_content=c;
return ret.retn();
void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(const std::vector<MEDFileAnyTypeField1TS *>& f1ts)
{
- for(auto f1t : f1ts)
- pushBackTimeStep(f1t);
+ for(std::vector<MEDFileAnyTypeField1TS *>::const_iterator it=f1ts.begin();it!=f1ts.end();it++)
+ pushBackTimeStep(*it);
}
void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(MEDFileAnyTypeFieldMultiTS *fmts)
{
if(!fmts)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps : Input fmts is NULL !");
- int const nbOfTS(fmts->getNumberOfTS());
+ int nbOfTS(fmts->getNumberOfTS());
for(int i=0;i<nbOfTS;i++)
{
MCAuto<MEDFileAnyTypeField1TS> elt(fmts->getTimeStepAtPos(i));
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !");
checkCoherencyOfType(f1ts);
f1ts->incrRef();
- MCAuto<MEDFileAnyTypeField1TS> const f1tsSafe(f1ts);
+ MCAuto<MEDFileAnyTypeField1TS> f1tsSafe(f1ts);
MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase();
c->incrRef();
MCAuto<MEDFileAnyTypeField1TSWithoutSDA> cSafe(c);
{
if(getFileName().empty())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::loadArrays : the structure does not come from a file !");
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName()));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
}
{
if(!getFileName().empty())
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName()));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
}
}
if(!content)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitComponents : no content in this ! Unable to split components !");
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit=content->splitComponents();
- std::size_t const sz(contentsSplit.size());
+ std::size_t sz(contentsSplit.size());
std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
if(!content)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitDiscretizations : no content in this ! Unable to split discretizations !");
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitDiscretizations());
- std::size_t const sz(contentsSplit.size());
+ std::size_t sz(contentsSplit.size());
std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
if(!content)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretizations !");
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
- std::size_t const sz(contentsSplit.size());
+ std::size_t sz(contentsSplit.size());
std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
*/
MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStep(int iteration, int order) const
{
- int const pos=getPosOfTimeStep(iteration,order);
+ int pos=getPosOfTimeStep(iteration,order);
return getTimeStepAtPos(pos);
}
*/
MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime(double time, double eps) const
{
- int const pos=getPosGivenTime(time,eps);
+ int pos=getPosGivenTime(time,eps);
return getTimeStepAtPos(pos);
}
std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
while(!lstFMTS.empty())
{
- auto it(lstFMTS.begin());
+ std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
MEDFileAnyTypeFieldMultiTS *curIt(*it);
if(!curIt)
throw INTERP_KERNEL::Exception(msg);
- std::vector< std::pair<int,int> > const refIts=curIt->getIterations();
+ std::vector< std::pair<int,int> > refIts=curIt->getIterations();
std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
elt.push_back(curIt); it=lstFMTS.erase(it);
while(it!=lstFMTS.end())
curIt=*it;
if(!curIt)
throw INTERP_KERNEL::Exception(msg);
- std::vector< std::pair<int,int> > const curIts=curIt->getIterations();
+ std::vector< std::pair<int,int> > curIts=curIt->getIterations();
if(refIts==curIts)
{ elt.push_back(curIt); it=lstFMTS.erase(it); }
else
std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
if(vectFMTS.empty())
return ret;
- auto it(vectFMTS.begin());
+ std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it(vectFMTS.begin());
MEDFileAnyTypeFieldMultiTS *frstElt(*it);
if(!frstElt)
throw INTERP_KERNEL::Exception(msg);
std::vector< MCAuto<MEDFileFastCellSupportComparator> > cmps;
std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > retCell=SplitPerCommonSupportNotNodesAlg(vectFMTSNotNodes,mesh,cmps);
ret=retCell;
- for(auto vectFMTSNode : vectFMTSNodes)
+ for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it2=vectFMTSNodes.begin();it2!=vectFMTSNodes.end();it2++)
{
i=0;
bool isFetched(false);
{
if((*it0).empty())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : internal error !");
- if(cmps[i]->isCompatibleWithNodesDiscr(vectFMTSNode))
- { ret[i].push_back(vectFMTSNode); isFetched=true; }
+ if(cmps[i]->isCompatibleWithNodesDiscr(*it2))
+ { ret[i].push_back(*it2); isFetched=true; }
}
if(!isFetched)
{
- std::vector<MEDFileAnyTypeFieldMultiTS *> const tmp(1,vectFMTSNode);
+ std::vector<MEDFileAnyTypeFieldMultiTS *> tmp(1,*it2);
MCAuto<MEDFileMeshStruct> tmp2(MEDFileMeshStruct::New(mesh));
- ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,vectFMTSNode));
+ ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2));
}
}
fsc=cmps;
std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
while(!lstFMTS.empty())
{
- auto it(lstFMTS.begin());
+ std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
MEDFileAnyTypeFieldMultiTS *ref(*it);
std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
elt.push_back(ref); it=lstFMTS.erase(it);
std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh \""<< f1->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int const nts=f0->getNumberOfTS();
+ int nts=f0->getNumberOfTS();
if(nts!=f1->getNumberOfTS())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : number of time steps are not the same !");
if(nts==0)
throw INTERP_KERNEL::Exception("AggregateHelperF1TS : empty vector !");
std::size_t sz(f1tss.size()),i(0);
std::vector< typename MLFieldTraits<T>::F1TSWSDAType const *> f1tsw(sz);
- for(auto it=f1tss.begin();it!=f1tss.end();it++,i++)
+ for(typename std::vector< typename MLFieldTraits<T>::F1TSType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++,i++)
{
typename MLFieldTraits<T>::F1TSType const *elt(*it);
if(!elt)
throw INTERP_KERNEL::Exception("AggregateHelperF1TS : presence of a null pointer !");
f1tsw[i]=dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType const *>(elt->contentNotNullBase());
}
- auto *retc(dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType *>(ret->contentNotNullBase()));
+ typename MLFieldTraits<T>::F1TSWSDAType *retc(dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType *>(ret->contentNotNullBase()));
if(!retc)
throw INTERP_KERNEL::Exception("AggregateHelperF1TS : internal error 1 !");
retc->aggregate(f1tsw,dts);
MCAuto< typename MLFieldTraits<T>::FMTSType > ret(MLFieldTraits<T>::FMTSType::New());
if(fmtss.empty())
throw INTERP_KERNEL::Exception("AggregateHelperFMTS : empty vector !");
- std::size_t const sz(fmtss.size());
- for(auto it=fmtss.begin();it!=fmtss.end();it++)
+ std::size_t sz(fmtss.size());
+ for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
{
typename MLFieldTraits<T>::FMTSType const *elt(*it);
if(!elt)
throw INTERP_KERNEL::Exception("AggregateHelperFMTS : presence of null pointer !");
}
- int const nbTS(fmtss[0]->getNumberOfTS());
- for(auto it=fmtss.begin();it!=fmtss.end();it++)
+ int nbTS(fmtss[0]->getNumberOfTS());
+ for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
if((*it)->getNumberOfTS()!=nbTS)
throw INTERP_KERNEL::Exception("AggregateHelperFMTS : all fields must have the same number of TS !");
for(int iterTS=0;iterTS<nbTS;iterTS++)
std::size_t i(0);
std::vector< typename MLFieldTraits<T>::F1TSType const *> f1tss(sz);
std::vector< MCAuto<typename MLFieldTraits<T>::F1TSType> > f1tss2(sz);
- for(auto it=fmtss.begin();it!=fmtss.end();it++,i++)
+ for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++,i++)
{ f1tss2[i]=(*it)->getTimeStepAtPos(iterTS); f1tss[i]=f1tss2[i]; }
MCAuto<MEDFileAnyTypeField1TS> f1ts(AggregateHelperF1TS<T>(f1tss,dts));
ret->pushBackTimeStep(f1ts);
{
if(fmtss.empty())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !");
- std::size_t const sz(fmtss.size());
+ std::size_t sz(fmtss.size());
std::vector<const MEDFileFieldMultiTS *> fmtss1;
std::vector<const MEDFileInt32FieldMultiTS *> fmtss2;
std::vector<const MEDFileInt64FieldMultiTS *> fmtss3;
- for(auto fmts : fmtss)
+ for(std::vector<const MEDFileAnyTypeFieldMultiTS *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
{
- if(!fmts)
+ if(!(*it))
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : presence of null instance in input vector !");
- const auto *elt1(dynamic_cast<const MEDFileFieldMultiTS *>(fmts));
+ const MEDFileFieldMultiTS *elt1(dynamic_cast<const MEDFileFieldMultiTS *>(*it));
if(elt1)
{
fmtss1.push_back(elt1);
continue;
}
- const auto *elt2(dynamic_cast<const MEDFileInt32FieldMultiTS *>(fmts));
+ const MEDFileInt32FieldMultiTS *elt2(dynamic_cast<const MEDFileInt32FieldMultiTS *>(*it));
if(elt2)
{
fmtss2.push_back(elt2);
continue;
}
- const auto *elt3(dynamic_cast<const MEDFileInt64FieldMultiTS *>(fmts));
+ const MEDFileInt64FieldMultiTS *elt3(dynamic_cast<const MEDFileInt64FieldMultiTS *>(*it));
if(elt3)
{
fmtss3.push_back(elt3);
const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
if(content)
{
- const auto *contc=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(content);
+ const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(content);
if(!contc)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
MCAuto<MEDFileInt32FieldMultiTSWithoutSDA> newc(contc->convertToInt());
}
MEDFileAnyTypeFieldMultiTSIterator::~MEDFileAnyTypeFieldMultiTSIterator()
-= default;
+{
+}
MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTSIterator::nextt()
{
if(fmts)
return fmts->getTimeStepAtPos(_iter_id++);
else
- return nullptr;
+ return 0;
}
else
- return nullptr;
+ return 0;
}
//= MEDFileInt32FieldMultiTS
#pragma once
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingTraits.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCType.hxx"
#include "MEDLoaderDefines.hxx"
#include "MEDFileField1TS.hxx"
#include "MEDFileFieldGlobs.hxx"
#include "MEDLoaderTraits.hxx"
-#include "MEDFileUtilities.txx"
-#include <string>
-#include "med.h"
-#include <vector>
-#include <cstddef>
-#include <utility>
-#include <ostream>
-#include "NormalizedGeometricTypes"
-#include <map>
+#include "MEDFileUtilities.hxx"
namespace MEDCoupling
{
MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
public:
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileAnyTypeFieldMultiTSWithoutSDA"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCopy() const;
MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitComponents() const;
MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitDiscretizations() const;
{
public:
MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSWSDAType *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
- MEDLOADER_EXPORT const char *getTypeStr() const override;
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const override;
- MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const override;
+ MEDLOADER_EXPORT const char *getTypeStr() const;
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const;
+ MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const;
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileTemplateFieldMultiTSWithoutSDA"); }
protected:
MEDFileTemplateFieldMultiTSWithoutSDA() { }
/** \param [in] fieldId field id in C mode */
MEDFileTemplateFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { }
MEDFileTemplateFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
- void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const override;
+ void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const;
};
class MEDFileFieldMultiTSWithoutSDA : public MEDFileTemplateFieldMultiTSWithoutSDA<double>
MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA<double>(fid,fieldId,loadAll,ms,entities) { }
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA *convertToInt() const;
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const override { return new MEDFileFieldMultiTSWithoutSDA(*this); }
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileFieldMultiTSWithoutSDA(*this); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFieldMultiTSWithoutSDA"); }
MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeFieldMultiTS> createNewWithSDA() const override;
protected:
MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileTemplateFieldMultiTSWithoutSDA<double>(fieldName,meshName) { }
MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA<double>(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
- med_field_type getMEDFileFieldType() const override { return MED_FLOAT64; }
+ med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
public:
- MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA() = default;
+ MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA() { }
};
template<class T>
friend class MEDFileTemplateFieldMultiTSWithoutSDA<Int32>;
public:
MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<Int32>(fid,fieldId,loadAll,ms,entities) { }
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const override { return new MEDFileInt32FieldMultiTSWithoutSDA(*this); }
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileInt32FieldMultiTSWithoutSDA(*this); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32FieldMultiTSWithoutSDA"); }
MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeFieldMultiTS> createNewWithSDA() const override;
protected:
MEDFileInt32FieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA<Int32>(fieldName,meshName) { }
MEDFileInt32FieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<Int32>(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
- med_field_type getMEDFileFieldType() const override { return MED_INT32; }
+ med_field_type getMEDFileFieldType() const { return MED_INT32; }
public:
- MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA() = default;
+ MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA() { }
};
class MEDFileInt64FieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA<Int64>
friend class MEDFileTemplateFieldMultiTSWithoutSDA<Int64>;
public:
MEDLOADER_EXPORT MEDFileInt64FieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<Int64>(fid,fieldId,loadAll,ms,entities) { }
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const override { return new MEDFileInt64FieldMultiTSWithoutSDA(*this); }
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileInt64FieldMultiTSWithoutSDA(*this); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64FieldMultiTSWithoutSDA"); }
MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeFieldMultiTS> createNewWithSDA() const override;
protected:
MEDFileInt64FieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA<Int64>(fieldName,meshName) { }
MEDFileInt64FieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<Int64>(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
- med_field_type getMEDFileFieldType() const override { return MED_INT64; }
+ med_field_type getMEDFileFieldType() const { return MED_INT64; }
public:
- MEDLOADER_EXPORT MEDFileInt64FieldMultiTSWithoutSDA() = default;
+ MEDLOADER_EXPORT MEDFileInt64FieldMultiTSWithoutSDA() { }
};
class MEDFileFloatFieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA<float>
friend class MEDFileTemplateFieldMultiTSWithoutSDA<float>;
public:
MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<float>(fid,fieldId,loadAll,ms,entities) { }
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const override { return new MEDFileFloatFieldMultiTSWithoutSDA(*this); }
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileFloatFieldMultiTSWithoutSDA(*this); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFloatFieldMultiTSWithoutSDA"); }
MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeFieldMultiTS> createNewWithSDA() const override;
protected:
MEDFileFloatFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA<float>(fieldName,meshName) { }
MEDFileFloatFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<float>(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
- med_field_type getMEDFileFieldType() const override { return MED_FLOAT32; }
+ med_field_type getMEDFileFieldType() const { return MED_FLOAT32; }
public:
- MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA() = default;
+ MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA() { }
};
class MEDFileAnyTypeFieldMultiTSIterator;
protected:
MEDFileAnyTypeFieldMultiTS();
MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
- MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr);
+ MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid);
static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
MEDLOADER_EXPORT void loadArraysIfNecessary();
MEDLOADER_EXPORT void unloadArrays();
MEDLOADER_EXPORT void unloadArraysWithoutDataLoss();
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *deepCopy() const;
MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitComponents() const;
MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitDiscretizations() const;
MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const = 0;
MEDLOADER_EXPORT static MCAuto<MEDFileAnyTypeFieldMultiTS> Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts);
public:
- MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const override;
- MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const override;
- MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti() const override;
- MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti() const override;
- MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) override;
- MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) override;
+ MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
+ MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
+ MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti() const;
+ MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti() const;
+ MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
+ MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
protected:
MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase();
const MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase() const;
MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent);
MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const;
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const override { return this->extractPartImpl(extractDef,mm); }
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
//
MEDLOADER_EXPORT typename Traits<T>::FieldType *field(int iteration, int order, const MEDFileMesh *mesh) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
MEDLOADER_EXPORT void appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
//
- MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *getTimeStepAtPos(int pos) const override;
+ MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *getTimeStepAtPos(int pos) const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArray(int iteration, int order) const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *buildNewEmptyImpl() const;
- MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const override;
+ MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
protected:
const typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull() const;
typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull();
void appendFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller);
protected:
- ~MEDFileTemplateFieldMultiTS() override = default;
+ ~MEDFileTemplateFieldMultiTS() { }
MEDFileTemplateFieldMultiTS();
MEDFileTemplateFieldMultiTS(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent);
MEDFileTemplateFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
- MEDFileTemplateFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr);
+ MEDFileTemplateFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
};
class MEDFileIntFieldMultiTS;
{
friend class MEDFileTemplateFieldMultiTS<double>;
public:
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const override;
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
MEDLOADER_EXPORT MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFieldMultiTS"); }
//
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
- MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const override { return buildNewEmptyImpl(); }
+ MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); }
public:
private:
- ~MEDFileFieldMultiTS() override = default;
+ ~MEDFileFieldMultiTS() { }
MEDFileFieldMultiTS() { }
MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
- MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr);
+ MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
};
template<class T>
public:
MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
protected:
- ~MEDFileNDTemplateFieldMultiTS() override = default;
+ ~MEDFileNDTemplateFieldMultiTS() { }
MEDFileNDTemplateFieldMultiTS() { }
MEDFileNDTemplateFieldMultiTS(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS<T>(other,shallowCopyOfContent) { }
MEDFileNDTemplateFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateFieldMultiTS<T>(fid,loadAll,ms) { }
{
friend class MEDFileTemplateFieldMultiTS<Int32>;
public:
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const override { return new MEDFileInt32FieldMultiTS(*this); }
- MEDLOADER_EXPORT MEDFileInt32FieldMultiTS *buildNewEmpty() const override { return buildNewEmptyImpl(); }
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileInt32FieldMultiTS(*this); }
+ MEDLOADER_EXPORT MEDFileInt32FieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32FieldMultiTS"); }
private:
- ~MEDFileInt32FieldMultiTS() override = default;
+ ~MEDFileInt32FieldMultiTS() { }
MEDFileInt32FieldMultiTS() { }
MEDFileInt32FieldMultiTS(const MEDFileInt32FieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS<Int32>(other,shallowCopyOfContent) { }
MEDFileInt32FieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS<Int32>(fid,loadAll,ms) { }
- MEDFileInt32FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr):MEDFileNDTemplateFieldMultiTS<Int32>(fid,fieldName,loadAll,ms,entities) { }
+ MEDFileInt32FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS<Int32>(fid,fieldName,loadAll,ms,entities) { }
};
/*!
{
friend class MEDFileTemplateFieldMultiTS<Int64>;
public:
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const override { return new MEDFileInt64FieldMultiTS(*this); }
- MEDLOADER_EXPORT MEDFileInt64FieldMultiTS *buildNewEmpty() const override { return buildNewEmptyImpl(); }
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileInt64FieldMultiTS(*this); }
+ MEDLOADER_EXPORT MEDFileInt64FieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64FieldMultiTS"); }
private:
- ~MEDFileInt64FieldMultiTS() override = default;
+ ~MEDFileInt64FieldMultiTS() { }
MEDFileInt64FieldMultiTS() { }
MEDFileInt64FieldMultiTS(const MEDFileInt64FieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS<Int64>(other,shallowCopyOfContent) { }
MEDFileInt64FieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS<Int64>(fid,loadAll,ms) { }
- MEDFileInt64FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr):MEDFileNDTemplateFieldMultiTS<Int64>(fid,fieldName,loadAll,ms,entities) { }
+ MEDFileInt64FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS<Int64>(fid,fieldName,loadAll,ms,entities) { }
};
/*!
{
friend class MEDFileTemplateFieldMultiTS<float>;
public:
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const override { return new MEDFileFloatFieldMultiTS(*this); }
- MEDLOADER_EXPORT MEDFileFloatFieldMultiTS *buildNewEmpty() const override { return buildNewEmptyImpl(); }
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileFloatFieldMultiTS(*this); }
+ MEDLOADER_EXPORT MEDFileFloatFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); }
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFloatFieldMultiTS"); }
private:
- ~MEDFileFloatFieldMultiTS() override = default;
+ ~MEDFileFloatFieldMultiTS() { }
MEDFileFloatFieldMultiTS() { }
MEDFileFloatFieldMultiTS(const MEDFileFloatFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS<float>(other,shallowCopyOfContent) { }
MEDFileFloatFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS<float>(fid,loadAll,ms) { }
- MEDFileFloatFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr):MEDFileNDTemplateFieldMultiTS<float>(fid,fieldName,loadAll,ms,entities) { }
+ MEDFileFloatFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS<float>(fid,fieldName,loadAll,ms,entities) { }
};
class MEDFileAnyTypeFieldMultiTSIterator
// Author : Anthony Geay (CEA/DEN)
#include "MEDFileFieldOverView.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingPartDefinition.hxx"
-#include "MEDCoupling1GTUMesh.hxx"
-#include "MEDCouplingPointSet.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingStructuredMesh.hxx"
#include "MEDFileField.hxx"
-#include "MEDFileFieldInternal.hxx"
#include "MEDFileMesh.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
#include "CellModel.hxx"
-#include <cstddef>
-#include <vector>
-#include <algorithm>
-#include "NormalizedGeometricTypes"
-#include <set>
-#include <utility>
-#include <iterator>
-#include <functional>
-#include <sstream>
-#include <limits>
-#include <ostream>
using namespace MEDCoupling;
std::size_t MEDFileMeshStruct::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(0);
- for(const auto & it0 : _geo_types_distrib)
- ret+=it0.capacity()*sizeof(int);
+ for(std::vector< std::vector<mcIdType> >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++)
+ ret+=(*it0).capacity()*sizeof(int);
ret+=_geo_types_distrib.capacity()*sizeof(std::vector<mcIdType>);
return ret;
}
if(!levs.empty())
{
_geo_types_distrib.resize(-(*std::min_element(levs.begin(),levs.end()))+1);
- for(int const lev : levs)
- _geo_types_distrib[-lev]=mesh->getDistributionOfTypes(lev);
+ for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
+ _geo_types_distrib[-(*lev)]=mesh->getDistributionOfTypes(*lev);
}
}
int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const
{
int j=0;
- for(auto it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--)
{
- std::size_t const sz=(*it1).size();
+ std::size_t sz=(*it1).size();
if(sz%3!=0)
throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getLevelOfGeoType : internal error in code !");
- std::size_t const nbGeo=sz/3;
+ std::size_t nbGeo=sz/3;
for(std::size_t i=0;i<nbGeo;i++)
if((*it1)[3*i]==(int)t)
return j;
*/
mcIdType MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const
{
- for(const auto & it1 : _geo_types_distrib)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
{
- std::size_t const sz=it1.size();
+ std::size_t sz=(*it1).size();
if(sz%3!=0)
throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getNumberOfElemsOfGeoType : internal error in code !");
- std::size_t const nbGeo=sz/3;
+ std::size_t nbGeo=sz/3;
for(std::size_t i=0;i<nbGeo;i++)
- if(it1[3*i]==(int)t)
- return it1[3*i+1];
+ if((*it1)[3*i]==(int)t)
+ return (*it1)[3*i+1];
}
throw INTERP_KERNEL::Exception("The specified geometric type is not present in the mesh structure !");
}
*/
bool MEDFileMeshStruct::doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const
{
- for(const auto & it1 : _geo_types_distrib)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
{
- std::size_t const sz=it1.size();
+ std::size_t sz=(*it1).size();
if(sz%3!=0)
throw INTERP_KERNEL::Exception("MEDFileMeshStruct::doesManageGeoType : internal error in code !");
- std::size_t const nbGeo=sz/3;
+ std::size_t nbGeo=sz/3;
for(std::size_t i=0;i<nbGeo;i++)
- if(it1[3*i]==(int)t)
+ if((*it1)[3*i]==(int)t)
return true;
}
return false;
static const char MSG[]="MEDFileMeshStruct::appendIfImplicitType : the distribution does not looks like structured standard !";
if(_geo_types_distrib.size()!=1)
throw INTERP_KERNEL::Exception(MSG);
- std::size_t const sz(_geo_types_distrib[0].size());
+ std::size_t sz(_geo_types_distrib[0].size());
if(sz%3!=0)
throw INTERP_KERNEL::Exception("MEDFileMeshStruct::appendIfImplicitType : internal error in code !");
- std::size_t const nbGeo(sz/3);
+ std::size_t nbGeo(sz/3);
if(nbGeo!=1)
throw INTERP_KERNEL::Exception(MSG);
std::vector<mcIdType> arr(3); arr[0]=(mcIdType)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1;
int MEDFileMeshStruct::getNumberOfGeoTypesInLev(int relativeLev) const
{
- int const pos(-relativeLev);
+ int pos(-relativeLev);
if(pos<0 || pos>=(int)_geo_types_distrib.size())
throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getNumberOfGeoTypesInLev : invalid level specified !");
- std::size_t const sz=_geo_types_distrib[pos].size();
+ std::size_t sz=_geo_types_distrib[pos].size();
if(sz%3!=0)
throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getNumberOfGeoTypesInLev : internal error in code !");
return (int)(sz/3);
{
if(!m)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New : null input pointer !");
- const auto *um(dynamic_cast<const MEDFileUMesh *>(m));
+ const MEDFileUMesh *um(dynamic_cast<const MEDFileUMesh *>(m));
if(um)
return MEDUMeshMultiLev::New(um,levs);
- const auto *cm(dynamic_cast<const MEDFileCMesh *>(m));
+ const MEDFileCMesh *cm(dynamic_cast<const MEDFileCMesh *>(m));
if(cm)
return MEDCMeshMultiLev::New(cm,levs);
- const auto *clm(dynamic_cast<const MEDFileCurveLinearMesh *>(m));
+ const MEDFileCurveLinearMesh *clm(dynamic_cast<const MEDFileCurveLinearMesh *>(m));
if(clm)
return MEDCurveLinearMeshMultiLev::New(clm,levs);
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !");
{
if(!m)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : null input pointer !");
- const auto *um(dynamic_cast<const MEDFileUMesh *>(m));
+ const MEDFileUMesh *um(dynamic_cast<const MEDFileUMesh *>(m));
if(um)
return MEDUMeshMultiLev::New(um,gts,pfls,nbEntities);
- const auto *cm(dynamic_cast<const MEDFileCMesh *>(m));
+ const MEDFileCMesh *cm(dynamic_cast<const MEDFileCMesh *>(m));
if(cm)
return MEDCMeshMultiLev::New(cm,gts,pfls,nbEntities);
- const auto *clm(dynamic_cast<const MEDFileCurveLinearMesh *>(m));
+ const MEDFileCurveLinearMesh *clm(dynamic_cast<const MEDFileCurveLinearMesh *>(m));
if(clm)
return MEDCurveLinearMeshMultiLev::New(clm,gts,pfls,nbEntities);
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !");
cr->incrRef();
}
-bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal * /*globs*/) const
+bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const
{
if(fst.getType()==ON_NODES)
{
if(fst.getNumberOfItems()!=1)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::isFastlyTheSameStruct : unexpected situation for nodes !");
const MEDFileField1TSStructItem2& p(fst[0]);
- std::string const pflName(p.getPflName());
+ std::string pflName(p.getPflName());
const DataArrayIdType *nr(_node_reduction);
if(pflName.empty() && !nr)
return true;
}
else
{
- std::size_t const sz(fst.getNumberOfItems());
+ std::size_t sz(fst.getNumberOfItems());
if(sz!=_geo_types.size())
return false;
mcIdType strt(0);
{
const DataArrayIdType *fids(_cell_fam_ids);
if(!fids)
- { famIds=nullptr; isWithoutCopy=true; return ; }
- std::size_t const sz(_geo_types.size());
+ { famIds=0; isWithoutCopy=true; return ; }
+ std::size_t sz(_geo_types.size());
bool presenceOfPfls(false);
for(std::size_t i=0;i<sz && !presenceOfPfls;i++)
{
for(std::size_t i=0;i<sz;i++)
{
const DataArrayIdType *pfl(_pfls[i]);
- mcIdType const lgth(_nb_entities[i]);
+ mcIdType lgth(_nb_entities[i]);
if(pfl)
{
MCAuto<DataArrayIdType> tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1));
{
const DataArrayIdType *nids(_cell_num_ids);
if(!nids)
- { numIds=nullptr; isWithoutCopy=true; return ; }
- std::size_t const sz(_geo_types.size());
+ { numIds=0; isWithoutCopy=true; return ; }
+ std::size_t sz(_geo_types.size());
bool presenceOfPfls(false);
for(std::size_t i=0;i<sz && !presenceOfPfls;i++)
{
for(std::size_t i=0;i<sz;i++)
{
const DataArrayIdType *pfl(_pfls[i]);
- mcIdType const lgth(_nb_entities[i]);
+ mcIdType lgth(_nb_entities[i]);
if(pfl)
{
MCAuto<DataArrayIdType> tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1));
{
const DataArrayIdType *fids(_node_fam_ids);
if(!fids)
- { famIds=nullptr; isWithoutCopy=true; return ; }
+ { famIds=0; isWithoutCopy=true; return ; }
const DataArrayIdType *nr(_node_reduction);
if(nr)
{
{
const DataArrayIdType *fids(_node_num_ids);
if(!fids)
- { numIds=nullptr; isWithoutCopy=true; return ; }
+ { numIds=0; isWithoutCopy=true; return ; }
const DataArrayIdType *nr(_node_reduction);
if(nr)
{
*/
DataArrayIdType *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const
{
- const auto *umesh(dynamic_cast<const MEDFileUMesh *>(_mesh));
+ const MEDFileUMesh *umesh(dynamic_cast<const MEDFileUMesh *>(_mesh));
if(!umesh)
return nullptr;
const PartDefinition *pd(umesh->getPartDefAtLevel(1));
std::string MEDMeshMultiLev::getPflNameOfId(int id) const
{
- std::size_t const sz(_pfls.size());
+ std::size_t sz(_pfls.size());
if(id<0 || id>=(int)sz)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getPflNameOfId : invalid input id !");
const DataArrayIdType *pfl(_pfls[id]);
*/
mcIdType MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const
{
- std::size_t const sz(_nb_entities.size());
+ std::size_t sz(_nb_entities.size());
for(std::size_t i=0;i<sz;i++)
if(_geo_types[i]==t)
return _nb_entities[i];
if(fst.getNumberOfItems()!=1)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes !");
const MEDFileField1TSStructItem2& p(fst[0]);
- std::string const pflName(p.getPflName());
+ std::string pflName(p.getPflName());
const DataArrayIdType *nr(_node_reduction);
if(pflName.empty() && !nr)
return vals->deepCopy();
}
else
{
- std::size_t const sz(fst.getNumberOfItems());
- std::set<INTERP_KERNEL::NormalizedCellType> const s(_geo_types.begin(),_geo_types.end());
+ std::size_t sz(fst.getNumberOfItems());
+ std::set<INTERP_KERNEL::NormalizedCellType> s(_geo_types.begin(),_geo_types.end());
if(s.size()!=_geo_types.size())
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 2 !");
std::vector< const DataArray *> arr(s.size());
std::vector< MCAuto<DataArray> > arrSafe(s.size());
int iii(0);
- mcIdType const nc(ToIdType(vals->getNumberOfComponents()));
- std::vector<std::string> const compInfo(vals->getInfoOnComponents());
- for(auto it=_geo_types.begin();it!=_geo_types.end();it++,iii++)
+ mcIdType nc(ToIdType(vals->getNumberOfComponents()));
+ std::vector<std::string> compInfo(vals->getInfoOnComponents());
+ for(std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator it=_geo_types.begin();it!=_geo_types.end();it++,iii++)
{
const DataArrayIdType *thisP(_pfls[iii]);
std::vector<const MEDFileField1TSStructItem2 *> ps;
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 1 !");
if(ps.size()==1)
{
- int const nbi(ps[0]->getNbOfIntegrationPts(globs));
+ int nbi(ps[0]->getNbOfIntegrationPts(globs));
const DataArrayIdType *otherP(ps[0]->getPfl(globs));
const std::pair<int,int>& strtStop(ps[0]->getStartStop());
MCAuto<DataArray> ret(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
int jj(0);
for(std::vector<const MEDFileField1TSStructItem2 *>::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++)
{
- int const nbi((*it2)->getNbOfIntegrationPts(globs));
+ int nbi((*it2)->getNbOfIntegrationPts(globs));
const DataArrayIdType *otherPfl((*it2)->getPfl(globs));
const std::pair<int,int>& strtStop((*it2)->getStartStop());
MCAuto<DataArray> ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
*/
void MEDMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr)
{
- mcIdType const nbOfVertices(verticesToAdd->getNumberOfTuples());
- std::size_t const sz(_pfls.size());
+ mcIdType nbOfVertices(verticesToAdd->getNumberOfTuples());
+ std::size_t sz(_pfls.size());
_pfls.resize(sz+1);
_geo_types.resize(sz+1,INTERP_KERNEL::NORM_POINT1);
_nb_entities.resize(sz+1,nbOfVertices);
MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes)
{
- std::size_t const sz(_geo_types.size());
+ std::size_t sz(_geo_types.size());
if(sz!=pfls.size() || sz!=nbEntities.size())
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::MEDMeshMultiLev : input vector must have the same size !");
_pfls.resize(sz);
}
}
-MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other)
-= default;
+MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other):RefCountObject(other),_mesh(other._mesh),_pfls(other._pfls),_geo_types(other._geo_types),_nb_entities(other._nb_entities),_node_reduction(other._node_reduction),_nb_nodes(other._nb_nodes),_cell_fam_ids(other._cell_fam_ids),_cell_num_ids(other._cell_num_ids),_node_fam_ids(other._node_fam_ids),_node_num_ids(other._node_num_ids)
+{
+}
//=
if(!m)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev constructor : null input pointer !");
std::vector<MEDCoupling1GTUMesh *> v;
- for(int const lev : levs)
+ for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
- std::vector<MEDCoupling1GTUMesh *> vTmp(m->getDirectUndergroundSingleGeoTypeMeshes(lev));
+ std::vector<MEDCoupling1GTUMesh *> vTmp(m->getDirectUndergroundSingleGeoTypeMeshes(*it));
v.insert(v.end(),vTmp.begin(),vTmp.end());
}
- std::size_t const sz(v.size());
+ std::size_t sz(v.size());
if(v.empty())
{
_coords=m->getCoords(); _coords->incrRef();
_nb_entities[i]=obj->getNumberOfCells();
}
// ids fields management
- bool const cellFamIdsNoCpy(levs.size()==1);
+ bool cellFamIdsNoCpy(levs.size()==1);
if(cellFamIdsNoCpy)
{
const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(levs[0]));
if(f && !tmps.empty())
_cell_fam_ids=DataArrayIdType::Aggregate(tmps);
}
- bool const cellNumIdsNoCpy(levs.size()==1);
+ bool cellNumIdsNoCpy(levs.size()==1);
if(cellNumIdsNoCpy)
{
const DataArrayIdType *tmp(m->getNumberFieldAtLevel(levs[0]));
MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
{
- std::size_t const sz(gts.size());
+ std::size_t sz(gts.size());
if(sz<1)
throw INTERP_KERNEL::Exception("constructor of MEDUMeshMultiLev : number of different geo type must be >= 1 !");
- unsigned const dim(INTERP_KERNEL::CellModel::GetCellModel(gts[0]).getDimension());
+ unsigned dim(INTERP_KERNEL::CellModel::GetCellModel(gts[0]).getDimension());
_parts.resize(sz);
bool isSameDim(true),isNoPfl(true);
for(std::size_t i=0;i<sz;i++)
_parts[i]=elt;
}
// ids fields management
- int const lev((int)dim-m->getMeshDimension());
+ int lev((int)dim-m->getMeshDimension());
if(isSameDim && isNoPfl && m->getGeoTypesAtLevel(lev)==gts)//optimized part
{
const DataArrayIdType *famIds(m->getFamilyFieldAtLevel(lev));
{
if(!pflNodes || !pflNodes->isAllocated())
return ;
- std::size_t const sz(_parts.size());
+ std::size_t sz(_parts.size());
std::vector< MCAuto<DataArrayIdType> > a(sz);
std::vector< const DataArrayIdType *> aa(sz);
for(std::size_t i=0;i<sz;i++)
MCAuto<MEDCoupling1GTUMesh> m(_parts[i]);
if(pfl)
m=dynamic_cast<MEDCoupling1GTUMesh *>(_parts[i]->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
- DataArrayIdType *cellIds=nullptr;
+ DataArrayIdType *cellIds=0;
m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
- MCAuto<DataArrayIdType> const cellIdsSafe(cellIds);
+ MCAuto<DataArrayIdType> cellIdsSafe(cellIds);
MCAuto<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
mcIdType tmp=-1;
MCAuto<DataArrayIdType> o2n(m2->getNodeIdsInUse(tmp));
return new MEDUMeshMultiLev(*this);
}
-MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDUMeshMultiLev& other)
-= default;
+MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDUMeshMultiLev& other):MEDMeshMultiLev(other),_parts(other._parts),_coords(other._coords)
+{
+}
MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto<MEDCoupling1GTUMesh>& part):MEDMeshMultiLev(other)
{
_parts[0]=part;
_geo_types.resize(1); _geo_types[0]=part->getCellModelEnum();
_nb_entities.resize(1); _nb_entities[0]=part->getNumberOfCells();
- _pfls.resize(1); _pfls[0]=nullptr;
+ _pfls.resize(1); _pfls[0]=0;
}
/*!
*/
bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const
{
- const DataArrayDouble *tmp(nullptr);
+ const DataArrayDouble *tmp(0);
if(_parts.empty())
tmp=_coords;
else
mcIdType szBCE(0),szD(0),szF(0);
bool isPolyh(false);
int iii(0);
- for(auto it=_parts.begin();it!=_parts.end();it++,iii++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++)
{
const MEDCoupling1GTUMesh *cur(*it);
if(!cur)
else
{ cur2=dynamic_cast<MEDCoupling1GTUMesh *>(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; }
//
- mcIdType const curNbCells(cur->getNumberOfCells());
+ mcIdType curNbCells(cur->getNumberOfCells());
szBCE+=curNbCells;
if((*it)->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
szD+=cur->getNodalConnectivity()->getNumberOfTuples()+curNbCells;
MCAuto<DataArrayByte> b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer());
MCAuto<DataArrayIdType> c(DataArrayIdType::New()); c->alloc(szBCE,1); mcIdType *cPtr(c->getPointer());
MCAuto<DataArrayIdType> d(DataArrayIdType::New()); d->alloc(szD,1); mcIdType *dPtr(d->getPointer());
- MCAuto<DataArrayIdType> e(DataArrayIdType::New()),f(DataArrayIdType::New()); mcIdType *ePtr(nullptr),*fPtr(nullptr);
+ MCAuto<DataArrayIdType> e(DataArrayIdType::New()),f(DataArrayIdType::New()); mcIdType *ePtr(0),*fPtr(0);
if(isPolyh)
{ e->alloc(szBCE,1); ePtr=e->getPointer(); f->alloc(szF,1); fPtr=f->getPointer(); }
mcIdType k(0);
iii=0;
- for(auto it=_parts.begin();it!=_parts.end();it++,iii++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++)
{
const MEDCoupling1GTUMesh *cur(*it);
//
else
{ cur2=dynamic_cast<MEDCoupling1GTUMesh *>(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; }
//
- mcIdType const curNbCells(cur->getNumberOfCells());
- int const gt((int)cur->getCellModelEnum());
+ mcIdType curNbCells(cur->getNumberOfCells());
+ int gt((int)cur->getCellModelEnum());
if(gt<0 || gt>=PARAMEDMEM_2_VTKTYPE_LGTH)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : invalid geometric type !");
- unsigned char const gtvtk(PARAMEDMEM_2_VTKTYPE[gt]);
+ unsigned char gtvtk(PARAMEDMEM_2_VTKTYPE[gt]);
if(gtvtk==255)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : no VTK type for the requested INTERP_KERNEL geometric type !");
std::fill(bPtr,bPtr+curNbCells,gtvtk); bPtr+=curNbCells;
- const auto *scur(dynamic_cast<const MEDCoupling1SGTUMesh *>(cur));
- const auto *dcur(dynamic_cast<const MEDCoupling1DGTUMesh *>(cur));
+ const MEDCoupling1SGTUMesh *scur(dynamic_cast<const MEDCoupling1SGTUMesh *>(cur));
+ const MEDCoupling1DGTUMesh *dcur(dynamic_cast<const MEDCoupling1DGTUMesh *>(cur));
const mcIdType *connPtr(cur->getNodalConnectivity()->begin());
if(!scur && !dcur)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : internal error !");
{
if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA27)
{
- mcIdType const nnpc(scur->getNumberOfNodesPerCell());
+ mcIdType nnpc(scur->getNumberOfNodesPerCell());
for(mcIdType i=0;i<curNbCells;i++,connPtr+=nnpc)
{
*dPtr++=nnpc;
mcIdType kk(0);
for(int i=0;i<curNbCells;i++,connIPtr++)
{
- mcIdType const nbFace(ToIdType(std::count(connPtr+connIPtr[0],connPtr+connIPtr[1],-1)+1));
+ mcIdType nbFace(ToIdType(std::count(connPtr+connIPtr[0],connPtr+connIPtr[1],-1)+1));
*fPtr++=nbFace;
const mcIdType *work(connPtr+connIPtr[0]);
for(int j=0;j<nbFace;j++)
}
}
if(!isPolyh)
- reorderNodesIfNecessary(a,d,nullptr);
+ reorderNodesIfNecessary(a,d,0);
else
reorderNodesIfNecessary(a,d,f);
if(a->getNumberOfComponents()!=3)
a=a->changeNbOfComponents(3,0.);
coords=a.retn(); types=b.retn(); cellLocations=c.retn(); cells=d.retn();
if(!isPolyh)
- { faceLocations=nullptr; faces=nullptr; }
+ { faceLocations=0; faces=0; }
else
{ faceLocations=e.retn(); faces=f.retn(); }
return _mesh->isObjectInTheProgeny(coords);
coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end()));
return ;
}
- mcIdType const sz(coords->getNumberOfTuples());
+ mcIdType sz(coords->getNumberOfTuples());
std::vector<bool> b(sz,false);
const mcIdType *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end());
while(work!=endW)
{
- mcIdType const nb(*work++);
+ mcIdType nb(*work++);
for(mcIdType i=0;i<nb && work!=endW;i++,work++)
{
if(*work>=0 && *work<sz)
work=polyhedNodalConnVTK->begin(); endW=polyhedNodalConnVTK->end();
while(work!=endW)
{
- mcIdType const nb(*work++);
+ mcIdType nb(*work++);
for(mcIdType i=0;i<nb && work!=endW;i++)
{
- mcIdType const nb2(*work++);
+ mcIdType nb2(*work++);
for(mcIdType j=0;j<nb2 && work!=endW;j++,work++)
{
if(*work>=0 && *work<sz)
}
}
}
- std::size_t const szExp(std::count(b.begin(),b.end(),true));
+ std::size_t szExp(std::count(b.begin(),b.end(),true));
if(ToIdType(szExp)!=nr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::reorderNodesIfNecessary : internal error #3 !");
// Go renumbering !
mcIdType *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples());
while(work2!=endW2)
{
- mcIdType const nb(*work2++);
+ mcIdType nb(*work2++);
for(mcIdType i=0;i<nb && work2!=endW2;i++,work2++)
*work2=permPtr[o2nPtrc[*work2]];
}
work2=polyhedNodalConnVTK->getPointer(); endW2=polyhedNodalConnVTK->getPointer()+polyhedNodalConnVTK->getNumberOfTuples();
while(work2!=endW2)
{
- mcIdType const nb(*work2++);
+ mcIdType nb(*work2++);
for(mcIdType i=0;i<nb && work2!=endW2;i++)
{
- mcIdType const nb2(*work2++);
+ mcIdType nb2(*work2++);
for(mcIdType j=0;j<nb2 && work2!=endW2;j++,work2++)
*work2=permPtr[o2nPtrc[*work2]];
}
void MEDUMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr)
{
- mcIdType const nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1
+ mcIdType nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1
MEDMeshMultiLev::appendVertices(verticesToAdd,nr);
MCAuto<MEDCoupling1SGTUMesh> elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1));
elt->allocateCells(nbOfCells);
//=
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& /*lev*/):MEDMeshMultiLev(m),_is_internal(true)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev):MEDMeshMultiLev(m),_is_internal(true)
{
initStdFieldOfIntegers(m);
}
void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMesh *m)
{
// ids fields management
- const DataArrayIdType *tmp(nullptr);
+ const DataArrayIdType *tmp(0);
tmp=m->getFamilyFieldAtLevel(0);
if(tmp)
{
_cell_num_ids=const_cast<DataArrayIdType *>(tmp);
}
//
- tmp=nullptr;
+ tmp=0;
tmp=m->getFamilyFieldAtLevel(1);
if(tmp)
{
void MEDStructuredMeshMultiLev::moveFaceToCell() const
{
- const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_fam_ids=_face_fam_ids; const_cast<MEDStructuredMeshMultiLev *>(this)->_face_fam_ids=nullptr;
- const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_num_ids=_face_num_ids; const_cast<MEDStructuredMeshMultiLev *>(this)->_face_num_ids=nullptr;
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_fam_ids=_face_fam_ids; const_cast<MEDStructuredMeshMultiLev *>(this)->_face_fam_ids=0;
+ const_cast<MEDStructuredMeshMultiLev *>(this)->_cell_num_ids=_face_num_ids; const_cast<MEDStructuredMeshMultiLev *>(this)->_face_num_ids=0;
}
bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMultiLev *&ret) const
{
- ret=nullptr;
+ ret=0;
if(_geo_types.empty())
return false;
if(_geo_types.size()!=1)
throw INTERP_KERNEL::Exception("MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase only one geo types supported at most supported for the moment !");
- INTERP_KERNEL::NormalizedCellType const gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(_mesh->getMeshDimension()));
+ INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(_mesh->getMeshDimension()));
if(_geo_types[0]==gt)
return false;
MEDCoupling1GTUMesh *facesIfPresent((static_cast<const MEDFileStructuredMesh *>(_mesh))->getImplicitFaceMesh());
if(!facesIfPresent)
return false;
- const DataArrayIdType *pfl(nullptr),*nr(_node_reduction);
+ const DataArrayIdType *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
- MCAuto<MEDCoupling1GTUMesh> const facesIfPresent2(facesIfPresent); facesIfPresent->incrRef();
+ MCAuto<MEDCoupling1GTUMesh> facesIfPresent2(facesIfPresent); facesIfPresent->incrRef();
moveFaceToCell();
MCAuto<MEDUMeshMultiLev> ret2(new MEDUMeshMultiLev(*this,facesIfPresent2));
if(pfl)
void MEDStructuredMeshMultiLev::dealWithImplicitUnstructuredMesh(const MEDFileMesh *m)
{
- const DataArrayIdType *tmp(nullptr);
+ const DataArrayIdType *tmp(0);
tmp=m->getFamilyFieldAtLevel(-1);
if(tmp)
{
{
m=dynamic_cast<MEDCoupling1SGTUMesh *>(m->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
}
- DataArrayIdType *cellIds=nullptr;
+ DataArrayIdType *cellIds=0;
m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
- MCAuto<DataArrayIdType> const cellIdsSafe(cellIds);
+ MCAuto<DataArrayIdType> cellIdsSafe(cellIds);
MCAuto<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
mcIdType tmp=-1;
_node_reduction=m2->getNodeIdsInUse(tmp);
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : null input pointer !");
if(levs.size()!=1 || levs[0]!=0)
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : levels supported is 0 only !");
- int const sdim(m->getSpaceDimension());
+ int sdim(m->getSpaceDimension());
_coords.resize(sdim);
for(int i=0;i<sdim;i++)
{
- auto *elt(const_cast<DataArrayDouble *>(m->getMesh()->getCoordsAt(i)));
+ DataArrayDouble *elt(const_cast<DataArrayDouble *>(m->getMesh()->getCoordsAt(i)));
if(!elt)
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !");
elt->incrRef();
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : null input pointer !");
if(gts.size()!=1 || pfls.size()!=1)
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : lengths of gts and pfls must be equal to one !");
- int const mdim(m->getMeshDimension());
- INTERP_KERNEL::NormalizedCellType const gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(mdim));
+ int mdim(m->getMeshDimension());
+ INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(mdim));
if(gt==gts[0])
{
_coords.resize(mdim);
for(int i=0;i<mdim;i++)
{
- auto *elt(const_cast<DataArrayDouble *>(m->getMesh()->getCoordsAt(i)));
+ DataArrayDouble *elt(const_cast<DataArrayDouble *>(m->getMesh()->getCoordsAt(i)));
if(!elt)
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !");
_coords[i]=elt; _coords[i]->incrRef();
dealWithImplicitUnstructuredMesh(m);
}
-MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDCMeshMultiLev& other)
-= default;
+MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDCMeshMultiLev& other):MEDStructuredMeshMultiLev(other),_coords(other._coords)
+{
+}
std::vector<mcIdType> MEDCMeshMultiLev::getNodeGridStructure() const
{
MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const
{
- MEDMeshMultiLev *retSpecific(nullptr);
+ MEDMeshMultiLev *retSpecific(0);
if(prepareForImplicitUnstructuredMeshCase(retSpecific))
return retSpecific;
- const DataArrayIdType *pfl(nullptr),*nr(_node_reduction);
+ const DataArrayIdType *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
MCAuto<DataArrayIdType> nnr;
if(nr)
{ nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); }
ret->_nb_entities[0]=pfl->getNumberOfTuples();
- ret->_pfls[0]=nullptr;
+ ret->_pfls[0]=0;
std::vector< MCAuto<DataArrayDouble> > coords(_coords.size());
for(std::size_t i=0;i<_coords.size();i++)
coords[i]=_coords[i]->selectByTupleIdSafeSlice(cellParts[i].first,cellParts[i].second+1,1);
std::vector< DataArrayDouble * > MEDCMeshMultiLev::buildVTUArrays(bool& isInternal) const
{
isInternal=_is_internal;
- std::size_t const sz(_coords.size());
+ std::size_t sz(_coords.size());
std::vector< DataArrayDouble * > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor : null input pointer !");
if(levs.size()!=1 || levs[0]!=0)
throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor : levels supported is 0 only !");
- auto *coords(const_cast<DataArrayDouble *>(m->getMesh()->getCoords()));
+ DataArrayDouble *coords(const_cast<DataArrayDouble *>(m->getMesh()->getCoords()));
if(!coords)
throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : no coords set !");
coords->incrRef();
throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !");
if(gts.size()!=1 || pfls.size()!=1)
throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : lengths of gts and pfls must be equal to one !");
- INTERP_KERNEL::NormalizedCellType const gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension()));
+ INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension()));
if(gt==gts[0])
{
- auto *coords(const_cast<DataArrayDouble *>(m->getMesh()->getCoords()));
+ DataArrayDouble *coords(const_cast<DataArrayDouble *>(m->getMesh()->getCoords()));
if(!coords)
throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : no coords set !");
coords->incrRef();
dealWithImplicitUnstructuredMesh(m);
}
-MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other)
-= default;
+MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other):MEDStructuredMeshMultiLev(other),_coords(other._coords),_structure(other._structure)
+{
+}
std::vector<mcIdType> MEDCurveLinearMeshMultiLev::getNodeGridStructure() const
{
MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const
{
- MEDMeshMultiLev *retSpecific(nullptr);
+ MEDMeshMultiLev *retSpecific(0);
if(prepareForImplicitUnstructuredMeshCase(retSpecific))
return retSpecific;
- const DataArrayIdType *pfl(nullptr),*nr(_node_reduction);
+ const DataArrayIdType *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
MCAuto<DataArrayIdType> nnr;
if(nr)
{ nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); }
ret->_nb_entities[0]=pfl->getNumberOfTuples();
- ret->_pfls[0]=nullptr;
+ ret->_pfls[0]=0;
ret->_coords=_coords->selectByTupleIdSafe(p->begin(),p->end());
ret->_structure=st;
ret2=(MEDCurveLinearMeshMultiLev *)ret; ret2->incrRef();
//=
MEDFileField1TSStructItem2::MEDFileField1TSStructItem2()
-= default;
+{
+}
MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<mcIdType,mcIdType>& b, const std::string& c, const std::string& d):_geo_type(a),_start_end(b),_pfl(DataArrayIdType::New()),_loc(d),_nb_of_entity(-1)
{
{
if(!mst->doesManageGeoType(_geo_type))
{
- auto *mstUnConstCasted(const_cast<MEDFileMeshStruct *>(mst));
+ MEDFileMeshStruct *mstUnConstCasted(const_cast<MEDFileMeshStruct *>(mst));
mstUnConstCasted->appendIfImplicitType(_geo_type);
}
- mcIdType const nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
+ mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
checkInRange(nbOfEnt,1,globs);
}
void MEDFileField1TSStructItem2::checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs)
{
- mcIdType const nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
+ mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
checkInRange(nbOfEnt,(int)cm.getNumberOfNodes(),globs);
}
if(_loc.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT : no localization specified !");
const MEDFileFieldLoc& loc=globs->getLocalization(_loc.c_str());
- mcIdType const nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
+ mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
checkInRange(nbOfEnt,loc.getNumberOfGaussPoints(),globs);
}
if(!_pfl->isAllocated())
{
if(_pfl->getName().empty())
- return nullptr;
+ return 0;
else
return globs->getProfile(_pfl->getName().c_str());
}
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : empty input !");
if(objs.size()==1)
return MEDFileField1TSStructItem2(*objs[0]);
- INTERP_KERNEL::NormalizedCellType const gt(objs[0]->_geo_type);
- mcIdType const nbEntityRef(objs[0]->_nb_of_entity);
- std::size_t const sz(objs.size());
+ INTERP_KERNEL::NormalizedCellType gt(objs[0]->_geo_type);
+ mcIdType nbEntityRef(objs[0]->_nb_of_entity);
+ std::size_t sz(objs.size());
std::vector<const DataArrayIdType *> arrs(sz);
for(std::size_t i=0;i<sz;i++)
{
}
MCAuto<DataArrayIdType> arr(DataArrayIdType::Aggregate(arrs));
arr->sort();
- mcIdType const oldNbTuples(arr->getNumberOfTuples());
+ mcIdType oldNbTuples(arr->getNumberOfTuples());
arr=arr->buildUnique();
if(oldNbTuples!=arr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : some entities are present several times !");
if(arr->isIota(nbEntityRef))
{
- std::pair<mcIdType,mcIdType> const p(0,nbEntityRef);
+ std::pair<mcIdType,mcIdType> p(0,nbEntityRef);
std::string a,b;
MEDFileField1TSStructItem2 ret(gt,p,a,b);
ret._nb_of_entity=nbEntityRef;
else
{
arr->setName(NEWLY_CREATED_PFL_NAME);
- std::pair<mcIdType,mcIdType> const p(0,oldNbTuples);
+ std::pair<mcIdType,mcIdType> p(0,oldNbTuples);
std::string a,b;
MEDFileField1TSStructItem2 ret(gt,p,a,b);
ret._nb_of_entity=nbEntityRef;
std::size_t MEDFileField1TSStructItem2::getHeapMemorySizeWithoutChildren() const
{
- std::size_t const ret(_loc.capacity());
+ std::size_t ret(_loc.capacity());
return ret;
}
{
case ON_NODES:
{
- mcIdType const nbOfEnt=mst->getNumberOfNodes();
+ mcIdType nbOfEnt=mst->getNumberOfNodes();
if(_items.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::checkWithMeshStruct : for nodes field only one subdivision supported !");
_items[0].checkInRange(nbOfEnt,1,globs);
}
case ON_CELLS:
{
- for(auto & _item : _items)
- _item.checkWithMeshStructForCells(mst,globs);
+ for(std::vector< MEDFileField1TSStructItem2 >::iterator it=_items.begin();it!=_items.end();it++)
+ (*it).checkWithMeshStructForCells(mst,globs);
break;
}
case ON_GAUSS_NE:
{
- for(auto & _item : _items)
- _item.checkWithMeshStructForGaussNE(mst,globs);
+ for(std::vector< MEDFileField1TSStructItem2 >::iterator it=_items.begin();it!=_items.end();it++)
+ (*it).checkWithMeshStructForGaussNE(mst,globs);
break;
}
case ON_GAUSS_PT:
{
- for(auto & _item : _items)
- _item.checkWithMeshStructForGaussPT(mst,globs);
+ for(std::vector< MEDFileField1TSStructItem2 >::iterator it=_items.begin();it!=_items.end();it++)
+ (*it).checkWithMeshStructForGaussPT(mst,globs);
break;
}
default:
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::simplifyMeOnCellEntity : must be on ON_CELLS, ON_GAUSS_NE or ON_GAUSS_PT !");
std::vector< std::pair< INTERP_KERNEL::NormalizedCellType, std::vector<std::size_t> > > m;
std::size_t i=0;
- for(auto it=_items.begin();it!=_items.end();it++,i++)
+ for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++)
{
- auto const it0(std::find_if(m.begin(),m.end(),CmpGeo((*it).getGeo())));
+ std::vector< std::pair< INTERP_KERNEL::NormalizedCellType, std::vector<std::size_t> > >::iterator it0(std::find_if(m.begin(),m.end(),CmpGeo((*it).getGeo())));
if(it0==m.end())
m.push_back(std::pair< INTERP_KERNEL::NormalizedCellType, std::vector<std::size_t> >((*it).getGeo(),std::vector<std::size_t>(1,i)));
else
ret._type=ON_CELLS;
return ret;
}
- std::size_t const sz(m.size());
+ std::size_t sz(m.size());
std::vector< MEDFileField1TSStructItem2 > items(sz);
for(i=0;i<sz;i++)
{
if(other._items.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isCompatibleWithNodesDiscr : other is on nodes but number of subparts !");
int theFirstLevFull;
- bool const ret0=isFullyOnOneLev(meshSt,theFirstLevFull);
+ bool ret0=isFullyOnOneLev(meshSt,theFirstLevFull);
const MEDFileField1TSStructItem2& otherNodeIt(other._items[0]);
- mcIdType const nbOfNodes(meshSt->getNumberOfNodes());
+ mcIdType nbOfNodes(meshSt->getNumberOfNodes());
if(otherNodeIt.getPflName().empty())
{//on all nodes
if(!ret0)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : works only for ON_CELLS discretization !");
if(_items.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : items vector is empty !");
- int const nbOfLevs(meshSt->getNumberOfLevs());
+ int nbOfLevs(meshSt->getNumberOfLevs());
if(nbOfLevs==0)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : no levels in input mesh structure !");
std::vector<int> levs(nbOfLevs);
theFirstLevFull=1;
std::set<INTERP_KERNEL::NormalizedCellType> gts;
- for(const auto & _item : _items)
+ for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++)
{
- if(!_item.getPflName().empty())
+ if(!(*it).getPflName().empty())
return false;
- INTERP_KERNEL::NormalizedCellType const gt(_item.getGeo());
+ INTERP_KERNEL::NormalizedCellType gt((*it).getGeo());
if(gts.find(gt)!=gts.end())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : internal error !");
gts.insert(gt);
- int const pos(meshSt->getLevelOfGeoType(_item.getGeo()));
+ int pos(meshSt->getLevelOfGeoType((*it).getGeo()));
levs[-pos]++;
}
for(int i=0;i<nbOfLevs;i++)
std::size_t MEDFileField1TSStructItem::getHeapMemorySizeWithoutChildren() const
{
- std::size_t const ret(_items.size()*sizeof(MEDFileField1TSStructItem2));
+ std::size_t ret(_items.size()*sizeof(MEDFileField1TSStructItem2));
return ret;
}
std::vector<const BigMemoryObject *> MEDFileField1TSStructItem::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _item : _items)
- ret.push_back(&_item);
+ for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++)
+ ret.push_back(&(*it));
return ret;
}
MEDMeshMultiLev *MEDFileField1TSStructItem::buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const
{
- std::size_t const sz(_items.size());
+ std::size_t sz(_items.size());
std::vector<INTERP_KERNEL::NormalizedCellType> a0(sz);
std::vector<const DataArrayIdType *> a1(sz);
std::vector<mcIdType> a2(sz);
std::size_t i(0);
- for(auto it=_items.begin();it!=_items.end();it++,i++)
+ for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++)
{
a0[i]=(*it).getGeo();
a1[i]=(*it).getPfl(globs);
else
return ret;
}
- for(const auto & _item : _items)
+ for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++)
{
- INTERP_KERNEL::NormalizedCellType const elt(_item.getGeo());
- auto const it2(std::find(ret.begin(),ret.end(),elt));
+ INTERP_KERNEL::NormalizedCellType elt((*it).getGeo());
+ std::vector<INTERP_KERNEL::NormalizedCellType>::iterator it2(std::find(ret.begin(),ret.end(),elt));
if(it2==ret.end())
ret.push_back(elt);
}
std::vector< std::vector<TypeOfField> > typesF;
std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
std::vector< std::vector<std::pair<mcIdType,mcIdType> > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs);
- std::size_t const nbOfGeoTypes(geoTypes.size());
+ std::size_t nbOfGeoTypes(geoTypes.size());
if(nbOfGeoTypes==0)
throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref !");
if(typesF[0].empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : internal error #1 bis !");
- TypeOfField const atype(typesF[0][0]);
+ TypeOfField atype(typesF[0][0]);
for(std::size_t i=0;i<nbOfGeoTypes;i++)
{
- std::size_t const sz=typesF[i].size();
+ std::size_t sz=typesF[i].size();
if(strtEnds[i].size()<1 || sz<1 || pfls[i].size()<1)
throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : internal error #1 !");
//
bool MEDFileField1TSStruct::isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const
{
- MEDFileField1TSStructItem const b(MEDFileField1TSStructItem::BuildItemFrom(other,mst));
- for(const auto & it : _already_checked)
+ MEDFileField1TSStructItem b(MEDFileField1TSStructItem::BuildItemFrom(other,mst));
+ for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++)
{
- if(it==b)
+ if((*it)==b)
return true;
}
return false;
{
if(_already_checked.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isSupportSameAs : no ref !");
- MEDFileField1TSStructItem const b(MEDFileField1TSStructItem::BuildItemFrom(other,meshSt));
+ MEDFileField1TSStructItem b(MEDFileField1TSStructItem::BuildItemFrom(other,meshSt));
if(!_already_checked[0].isEntityCell() || !b.isEntityCell())
throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isSupportSameAs : only available on cell entities !");
- MEDFileField1TSStructItem const other1(b.simplifyMeOnCellEntity(other));
+ MEDFileField1TSStructItem other1(b.simplifyMeOnCellEntity(other));
int found=-1,i=0;
for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++)
if((*it).isComputed())
bool ret(false);
if(found==-1)
{
- MEDFileField1TSStructItem const this1(_already_checked[0].simplifyMeOnCellEntity(other));
+ MEDFileField1TSStructItem this1(_already_checked[0].simplifyMeOnCellEntity(other));
ret=this1.isCellSupportEqual(other1,other);
if(ret)
_already_checked.push_back(this1);
{
if(_already_checked.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isCompatibleWithNodesDiscr : no ref !");
- MEDFileField1TSStructItem const other1(MEDFileField1TSStructItem::BuildItemFrom(other,meshSt));
+ MEDFileField1TSStructItem other1(MEDFileField1TSStructItem::BuildItemFrom(other,meshSt));
if(_already_checked[0].isEntityCell())
{
int found=-1,i=0;
bool ret(false);
if(found==-1)
{
- MEDFileField1TSStructItem const this1(_already_checked[0].simplifyMeOnCellEntity(other));
+ MEDFileField1TSStructItem this1(_already_checked[0].simplifyMeOnCellEntity(other));
ret=this1.isCompatibleWithNodesDiscr(other1,meshSt,other);
if(ret)
_already_checked.push_back(this1);
std::size_t MEDFileField1TSStruct::getHeapMemorySizeWithoutChildren() const
{
- std::size_t const ret(_already_checked.capacity()*sizeof(MEDFileField1TSStructItem));
+ std::size_t ret(_already_checked.capacity()*sizeof(MEDFileField1TSStructItem));
return ret;
}
std::vector<const BigMemoryObject *> MEDFileField1TSStruct::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & it : _already_checked)
- ret.push_back(&it);
+ for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++)
+ ret.push_back(&(*it));
return ret;
}
std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileField1TSStruct::getGeoTypes(const MEDFileMesh *m) const
{
std::vector<INTERP_KERNEL::NormalizedCellType> ret;
- for(const auto & it : _already_checked)
+ for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++)
{
- std::vector<INTERP_KERNEL::NormalizedCellType> const ret2(it.getGeoTypes(m));
- for(auto it2 : ret2)
+ std::vector<INTERP_KERNEL::NormalizedCellType> ret2((*it).getGeoTypes(m));
+ for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it2=ret2.begin();it2!=ret2.end();it2++)
{
- if(it2==INTERP_KERNEL::NORM_ERROR)
+ if(*it2==INTERP_KERNEL::NORM_ERROR)
continue;
- auto const it3(std::find(ret.begin(),ret.end(),it2));
+ std::vector<INTERP_KERNEL::NormalizedCellType>::iterator it3(std::find(ret.begin(),ret.end(),*it2));
if(it3==ret.end())
- ret.push_back(it2);
+ ret.push_back(*it2);
}
}
return ret;
std::size_t refSz(std::numeric_limits<std::size_t>::max());
bool ret(false);
int i(0);
- for(auto it=_already_checked.begin();it!=_already_checked.end();it++,i++)
+ for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++)
{
if((*it).getType()!=ON_NODES)
{
ret=true;
- std::size_t const sz((*it).getNumberOfItems());
+ std::size_t sz((*it).getNumberOfItems());
if(refSz>sz)
{ pos=i; refSz=sz; }
}
bool MEDFileField1TSStruct::presenceOfPartialNodeDiscr(int& pos) const
{
int i(0);
- for(auto it=_already_checked.begin();it!=_already_checked.end();it++,i++)
+ for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++)
{
if((*it).getType()==ON_NODES)
{
- std::size_t const sz((*it).getNumberOfItems());
+ std::size_t sz((*it).getNumberOfItems());
if(sz==1)
{
if(!(*it)[0].getPflName().empty())
if(!m)
throw INTERP_KERNEL::Exception("MEDFileFastCellSupportComparator constructor : null input mesh struct !");
_mesh_comp=const_cast<MEDFileMeshStruct *>(m); _mesh_comp->incrRef();
- int const nbPts=ref->getNumberOfTS();
+ int nbPts=ref->getNumberOfTS();
_f1ts_cmps.resize(nbPts);
for(int i=0;i<nbPts;i++)
{
std::size_t MEDFileFastCellSupportComparator::getHeapMemorySizeWithoutChildren() const
{
- std::size_t const ret(_f1ts_cmps.capacity()*sizeof(MCAuto<MEDFileField1TSStruct>));
+ std::size_t ret(_f1ts_cmps.capacity()*sizeof(MCAuto<MEDFileField1TSStruct>));
return ret;
}
const MEDFileMeshStruct *mst(_mesh_comp);
if(mst)
ret.push_back(mst);
- for(const auto & _f1ts_cmp : _f1ts_cmps)
- ret.push_back((const MEDFileField1TSStruct *)_f1ts_cmp);
+ for(std::vector< MCAuto<MEDFileField1TSStruct> >::const_iterator it=_f1ts_cmps.begin();it!=_f1ts_cmps.end();it++)
+ ret.push_back((const MEDFileField1TSStruct *)*it);
return ret;
}
bool MEDFileFastCellSupportComparator::isEqual(const MEDFileAnyTypeFieldMultiTS *other)
{
- int const nbPts=other->getNumberOfTS();
+ int nbPts=other->getNumberOfTS();
if(nbPts!=(int)_f1ts_cmps.size())
{
std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::isEqual : unexpected nb of time steps in input ! Should be " << _f1ts_cmps.size() << " it is in reality " << nbPts << " !";
bool MEDFileFastCellSupportComparator::isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other)
{
- int const nbPts=other->getNumberOfTS();
+ int nbPts=other->getNumberOfTS();
if(nbPts!=(int)_f1ts_cmps.size())
{
std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::isCompatibleWithNodesDiscr : unexpected nb of time steps in input ! Should be " << _f1ts_cmps.size() << " it is in reality " << nbPts << " !";
#ifndef __MEDFILEFIELDOVERVIEW_HXX__
#define __MEDFILEFIELDOVERVIEW_HXX__
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "CellModel.hxx"
#include "MEDLoaderDefines.hxx"
#include "MCAuto.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCoupling1GTUMesh.hxx"
-#include "NormalizedGeometricTypes"
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelException.hxx"
-#include <string>
-#include <cstddef>
-#include <utility>
#include <vector>
namespace MEDCoupling
public:
MEDLOADER_EXPORT static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
std::string getClassName() const override { return std::string("MEDFileMeshStruct"); }
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
const MEDFileMesh *getTheMesh() const { return _mesh; }
mcIdType getNumberOfNodes() const { return _nb_nodes; }
bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const;
class MEDMeshMultiLev : public RefCountObject
{
public:
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
std::string getClassName() const override { return std::string("MEDMeshMultiLev"); }
public:
static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
public:
static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<int>& levs);
static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
- void selectPartOfNodes(const DataArrayIdType *pflNodes) override;
+ void selectPartOfNodes(const DataArrayIdType *pflNodes);
std::string getClassName() const override { return std::string("MEDUMeshMultiLev"); }
- MEDMeshMultiLev *prepare() const override;
+ MEDMeshMultiLev *prepare() const;
MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto<MEDCoupling1GTUMesh>& part);
MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const;
protected:
- void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) override;
+ void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr);
private:
void reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const;
private:
class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
{
public:
- void selectPartOfNodes(const DataArrayIdType *pflNodes) override;
+ void selectPartOfNodes(const DataArrayIdType *pflNodes);
virtual std::vector<mcIdType> getNodeGridStructure() const = 0;
std::string getClassName() const override { return std::string("MEDStructuredMeshMultiLev"); }
protected:
public:
static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector<int>& levs);
static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
- std::vector<mcIdType> getNodeGridStructure() const override;
+ std::vector<mcIdType> getNodeGridStructure() const;
std::string getClassName() const override { return std::string("MEDCMeshMultiLev"); }
- MEDMeshMultiLev *prepare() const override;
+ MEDMeshMultiLev *prepare() const;
MEDLOADER_EXPORT std::vector< DataArrayDouble * > buildVTUArrays(bool& isInternal) const;
private:
MEDCMeshMultiLev(const MEDCMeshMultiLev& other);
static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs);
static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls , const std::vector<mcIdType>& nbEntities);
std::string getClassName() const override { return std::string("MEDCurveLinearMeshMultiLev"); }
- std::vector<mcIdType> getNodeGridStructure() const override;
- MEDMeshMultiLev *prepare() const override;
+ std::vector<mcIdType> getNodeGridStructure() const;
+ MEDMeshMultiLev *prepare() const;
MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector<mcIdType>& nodeStrct, bool& isInternal) const;
private:
MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other);
void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
//
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
//
const DataArrayIdType *getPfl(const MEDFileFieldGlobsReal *globs) const;
INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; }
void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
bool operator==(const MEDFileField1TSStructItem& other) const;
std::string getClassName() const override { return std::string("MEDFileField1TSStructItem"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
bool isEntityCell() const;
bool isComputed() const { return _computed; }
TypeOfField getType() const { return _type; }
public:
static MEDFileField1TSStruct *New(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst);
void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
- std::size_t getHeapMemorySizeWithoutChildren() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
std::string getClassName() const override { return std::string("MEDFileField1TSStruct"); }
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
bool isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const;
bool isSupportSameAs(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt);
bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt);
MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const;
bool isEqual(const MEDFileAnyTypeFieldMultiTS *other);
bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other);
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
private:
MEDFileFastCellSupportComparator(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
private:
#ifndef __MEDFILEFIELDVISITOR_HXX__
#define __MEDFILEFIELDVISITOR_HXX__
+#include "MEDLoaderDefines.hxx"
#include "MEDFileField.hxx"
namespace MEDCoupling
virtual void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) = 0;
//
virtual void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) = 0;
- virtual ~MEDFileFieldVisitor() = default;
+ virtual ~MEDFileFieldVisitor() { }
};
}
//
#include "MEDFileJoint.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
#include "MEDFileBasis.hxx"
-#include "MEDFileUtilities.hxx"
+#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileSafeCaller.txx"
#include "CellModel.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "med.h"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <vector>
-#include <string>
-#include "medfile.h"
-#include <sstream>
-#include "medsubdomain.h"
-#include <ostream>
-#include <utility>
-#include <algorithm>
-#include <iterator>
// From MEDLOader.cxx TU
extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO];
*/
void MEDFileJointCorrespondence::write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const
{
- med_access_mode const medmod=MEDFileUtilities::TraduceWriteMode(mode);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),medmod);
+ med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
std::ostringstream oss; oss << "MEDFileJointCorrespondence : error on attempt to write in file : \"" << fileName << "\"";
MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str());
const DataArrayIdType* tmp=getCorrespondence();
oss << "- Correspondence : <<";
- for(long const it : *tmp)
- oss<< it << " ";
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
+ oss<< *it << " ";
}
else
{
MEDFileJointOneStep *MEDFileJointOneStep::New(int dt, int it)
{
- auto* j = new MEDFileJointOneStep();
+ MEDFileJointOneStep* j = new MEDFileJointOneStep();
j->setOrder( dt );
j->setIteration( it );
return j;
MEDFileJointOneStep *MEDFileJointOneStep::New(const std::string& fileName, const std::string& mName, const std::string& jointName, int num)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY);
return new MEDFileJointOneStep(fid, mName, jointName, num);
}
*/
void MEDFileJointOneStep::write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const
{
- med_access_mode const medmod=MEDFileUtilities::TraduceWriteMode(mode);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),medmod);
+ med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
std::ostringstream oss; oss << "MEDFileJointOneStep : error on attempt to write in file : \"" << fileName << "\"";
MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str());
if ( _correspondences.empty() )
void MEDFileJointOneStep::writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName) const
{
- for(const auto & _correspondence : _correspondences)
+ for(std::vector< MCAuto<MEDFileJointCorrespondence> >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++)
{
- _correspondence->writeLL(fid, localMeshName, jointName, getOrder(), getIteration());
+ (*it)->writeLL(fid, localMeshName, jointName, getOrder(), getIteration());
}
}
{
std::vector< MCAuto<MEDFileJointCorrespondence> > correspondences(_correspondences.size());
std::size_t i=0;
- for(auto it=_correspondences.begin();it!=_correspondences.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileJointCorrespondence> >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++,i++)
if((const MEDFileJointCorrespondence *)*it)
correspondences[i]=(*it)->deepCopy();
MCAuto<MEDFileJointOneStep> ret= new MEDFileJointOneStep;
std::ostringstream oss;
oss << "(*************************************)\n(* JOINT_ONE_STEP INFORMATION: *)\n(*************************************)\n";
oss << "- Number of the correspondences : <<" << _correspondences.size() << ">>\n";
- for(const auto & _correspondence : _correspondences)
+ for(std::vector< MCAuto<MEDFileJointCorrespondence> >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++)
{
- oss << _correspondence->simpleRepr();
+ oss << (*it)->simpleRepr();
}
return oss.str();
}
MEDFileJoint *MEDFileJoint::New(const std::string& fileName, const std::string& mName, int curJoint)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY);
return new MEDFileJoint(fid,mName,curJoint);
}
MEDFileJoint *MEDFileJoint::New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum)
{
- auto* j = new MEDFileJoint();
+ MEDFileJoint* j = new MEDFileJoint();
j->setJointName( jointName );
j->setLocalMeshName( locMeshName );
j->setRemoteMeshName( remoteMeshName );
}
MEDFileJoint::MEDFileJoint()
-= default;
+{
+}
/*!
* Returns a new MEDFileJoint holding the mesh data that has been read from a given MED
// if ( _loc_mesh_name.empty() )
// throw INTERP_KERNEL::Exception("MEDFileJoint::write : name of a local mesh not defined!");
MEDFILESAFECALLERWR0(MEDsubdomainJointCr,(fid,getLocalMeshName().c_str(),getJointName().c_str(),getDescription().c_str(),getDomainNumber(),getRemoteMeshName().c_str()));
- for(const auto & it : _joint)
- it->writeLL(fid, getLocalMeshName(),getJointName());
+ for(std::vector< MCAuto<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++)
+ (*it)->writeLL(fid, getLocalMeshName(),getJointName());
}
void MEDFileJoint::pushStep(MEDFileJointOneStep* step)
return false;
if(_domain_number!=other->_domain_number)
return false;
- int const nbTS(getNumberOfSteps());
+ int nbTS(getNumberOfSteps());
if(nbTS!=other->getNumberOfSteps())
return false;
std::vector<bool> found(nbTS,false);
{
std::vector< MCAuto<MEDFileJointOneStep> > joint(_joint.size());
std::size_t i=0;
- for(auto it=_joint.begin();it!=_joint.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++,i++)
if((const MEDFileJointOneStep *)*it)
joint[i]=(*it)->deepCopy();
MCAuto<MEDFileJoint> ret=new MEDFileJoint(*this);
bool MEDFileJoint::changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
- for(const auto & it : modifTab)
+ for(std::vector< std::pair<std::string,std::string> >::const_iterator it=modifTab.begin();it!=modifTab.end();it++)
{
- if(it.first==_joint_name)
+ if((*it).first==_joint_name)
{
- _joint_name=it.second;
+ _joint_name=(*it).second;
return true;
}
}
oss << "- Description : <<" << getDescription() << ">>\n";
oss << "- Joint name : <<" << getJointName() << ">>\n";
oss << "- Domain number : " << getDomainNumber() << "\n";
- for(const auto & it : _joint)
+ for(std::vector< MCAuto<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++)
{
- oss << it->simpleRepr();
+ oss << (*it)->simpleRepr();
}
return oss.str();
}
MEDFileJoints *MEDFileJoints::New(const std::string& fileName, const std::string& meshName)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY);
return new MEDFileJoints( fid, meshName );
}
void MEDFileJoints::writeLL(med_idt fid) const
{
- for(const auto & _joint : _joints)
- _joint->writeLL(fid);
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++)
+ (*it)->writeLL(fid);
}
std::string MEDFileJoints::getMeshName() const
MEDFileJoint *MEDFileJoints::getJointWithName(const std::string& jname) const
{
std::vector<std::string> js=getJointsNames();
- auto const it=std::find(js.begin(),js.end(),jname);
+ std::vector<std::string>::iterator it=std::find(js.begin(),js.end(),jname);
if(it==js.end())
{
std::ostringstream oss; oss << "MEDFileJoints::getJointWithName : Joint \"" << jname << "\" does not exist in this ! Existing are : ";
{
std::vector<std::string> ret(_joints.size());
int i=0;
- for(auto it=_joints.begin();it!=_joints.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++)
{
const MEDFileJoint *f=(*it);
if(f)
bool MEDFileJoints::changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
bool ret=false;
- for(auto & _joint : _joints)
+ for(std::vector< MCAuto<MEDFileJoint> >::iterator it=_joints.begin();it!=_joints.end();it++)
{
- MEDFileJoint *cur(_joint);
+ MEDFileJoint *cur(*it);
if(cur)
ret=cur->changeJointNames(modifTab) || ret;
}
}
MEDFileJoints::MEDFileJoints()
-= default;
+{
+}
MEDFileJoints::MEDFileJoints(med_idt fid, const std::string& meshName)
{
- med_int const num_joint=MEDnSubdomainJoint(fid, meshName.c_str() );
+ med_int num_joint=MEDnSubdomainJoint(fid, meshName.c_str() );
for(int i = 1; i <= num_joint; i++)
_joints.push_back(MEDFileJoint::New(fid,meshName,i));
}
{
std::vector< MCAuto<MEDFileJoint> > joints(_joints.size());
std::size_t i=0;
- for(auto it=_joints.begin();it!=_joints.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++)
if((const MEDFileJoint *)*it)
joints[i]=(*it)->deepCopy();
MCAuto<MEDFileJoints> ret=MEDFileJoints::New();
std::vector<const BigMemoryObject *> MEDFileJoints::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _joint : _joints)
- ret.push_back((const MEDFileJoint *)_joint);
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++)
+ ret.push_back((const MEDFileJoint *)*it);
return ret;
}
void MEDFileJoints::simpleReprWithoutHeader(std::ostream& oss) const
{
- int const nbOfJoints=getNumberOfJoints();
+ int nbOfJoints=getNumberOfJoints();
oss << "There are " << nbOfJoints << " joints with the following names : \n";
std::vector<std::string> jns=getJointsNames();
for(int i=0;i<nbOfJoints;i++)
oss << " - #" << i << " \"" << jns[i] << "\"\n";
- for(const auto & _joint : _joints)
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++)
{
- oss << _joint->simpleRepr();
+ oss << (*it)->simpleRepr();
}
}
#ifndef __MEDFILEJOINT_HXX__
#define __MEDFILEJOINT_HXX__
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDFileUtilities.hxx"
-#include "MCType.hxx"
#include "MEDLoaderDefines.hxx"
+#include "MEDFileUtilities.txx"
+#include "MEDCouplingMemArray.hxx"
#include "MCAuto.hxx"
#include "NormalizedGeometricTypes"
-#include <string>
-#include <cstddef>
-#include <vector>
-#include "med.h"
-#include <utility>
-#include <ostream>
namespace MEDCoupling
{
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileJointCorrespondence"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT MEDFileJointCorrespondence *deepCopy() const;
MEDLOADER_EXPORT MEDFileJointCorrespondence *shallowCpy() const;
MEDLOADER_EXPORT bool isEqual(const MEDFileJointCorrespondence *other) const;
MEDLOADER_EXPORT static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
MEDLOADER_EXPORT static MEDFileJointOneStep *New(med_idt fid, const std::string& mName, const std::string& jointName, int number=1);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileJointOneStep"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT MEDFileJointOneStep *deepCopy() const;
MEDLOADER_EXPORT MEDFileJointOneStep *shallowCpy() const;
MEDLOADER_EXPORT bool isEqual(const MEDFileJointOneStep *other) const;
MEDLOADER_EXPORT static MEDFileJoint *New(med_idt fid, const std::string& mName, int num);
MEDLOADER_EXPORT static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum );
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileJoint"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT MEDFileJoint *deepCopy() const;
MEDLOADER_EXPORT MEDFileJoint *shallowCpy() const;
MEDLOADER_EXPORT bool isEqual(const MEDFileJoint *other) const;
MEDLOADER_EXPORT int getNumberOfSteps() const;
MEDLOADER_EXPORT MEDFileJointOneStep *getStepAtPos(int i) const;
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT std::string simpleRepr() const;
private:
MEDLOADER_EXPORT static MEDFileJoints *New(med_idt fid, const std::string& meshName);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileJoints"); }
MEDLOADER_EXPORT MEDFileJoints *deepCopy() const;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT std::string simpleRepr() const;
MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const;
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT std::string getMeshName() const;
MEDLOADER_EXPORT int getNumberOfJoints() const;
MEDLOADER_EXPORT MEDFileJoint *getJointAtPos(int i) const;
MEDLOADER_EXPORT void setJointAtPos(int i, MEDFileJoint *joint);
MEDLOADER_EXPORT void destroyJointAtPos(int i);
private:
- ~MEDFileJoints() override = default;
+ ~MEDFileJoints() { }
MEDFileJoints();
MEDFileJoints(med_idt fid, const std::string& meshName);
private:
// Author : Anthony Geay (CEA/DEN)
#include "MEDFileMesh.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MCAuto.hxx"
-#include "MEDFileEquivalence.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingPartDefinition.hxx"
-#include "CellModel.hxx"
-#include "MEDCouplingPointSet.hxx"
-#include "MEDCouplingStructuredMesh.hxx"
-#include "MEDFileBasis.hxx"
-#include "MEDCouplingCurveLinearMesh.hxx"
-#include "InterpKernelException.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDFileFieldOverView.hxx"
#include "MEDFileField.hxx"
-#include "MEDFileMeshReadSelector.hxx"
-#include "MEDFileUtilities.hxx"
-#include "MEDFileMeshLL.hxx"
-#include "MEDFileJoint.hxx"
#include "MEDLoader.hxx"
+#include "MEDLoaderNS.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDLoaderBase.hxx"
#include "CrackAlgo.hxx"
-#include "MEDLoaderNS.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingMemArray.txx"
-// #include "MEDFileMeshElt.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "med.h"
-#include "NormalizedGeometricTypes"
-#include "MEDLoaderTraits.hxx"
-#include "medfile.h"
-#include "medmesh.h"
-#include <algorithm>
#include <cstddef>
-#include <functional>
-#include <iterator>
#include <limits>
#include <cmath>
-#include <map>
-#include <set>
-#include <list>
-#include <sstream>
-#include <ostream>
-#include <utility>
-#include <vector>
-#include <string>
+#include <memory>
+#include <numeric>
// From MEDLOader.cxx TU
extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO];
std::size_t MEDFileMesh::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(_dt_unit.capacity()+_name.capacity()+_univ_name.capacity()+_desc_name.capacity());
- for(const auto & _group : _groups)
+ for(std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.begin();it!=_groups.end();it++)
{
- ret+=_group.first.capacity()+_group.second.capacity()*sizeof(std::string);
- for(const auto & it2 : _group.second)
- ret+=it2.capacity();
+ ret+=(*it).first.capacity()+(*it).second.capacity()*sizeof(std::string);
+ for(std::vector<std::string>::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++)
+ ret+=(*it2).capacity();
}
- for(const auto & _familie : _families)
- ret+=_familie.first.capacity()+sizeof(mcIdType);
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
+ ret+=(*it).first.capacity()+sizeof(mcIdType);
return ret;
}
*/
MEDFileMesh *MEDFileMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,mrs);
}
MEDFileMesh *MEDFileMesh::New(med_idt fid, MEDFileMeshReadSelector *mrs)
{
- std::vector<std::string> ms((MEDLoaderNS::getMeshNamesFid(fid)));
+ std::vector<std::string> ms(MEDLoaderNS::getMeshNamesFid(fid));
if(ms.empty())
{
std::ostringstream oss; oss << "MEDFileMesh::New : no meshes in file \"" << FileNameFromFID(fid) << "\" !";
*/
MEDFileMesh *MEDFileMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs, MEDFileJoints* joints)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,mName,dt,it,mrs,joints);
}
-MEDFileMesh *MEDFileMesh::New(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs, MEDFileJoints* /*joints*/)
+MEDFileMesh *MEDFileMesh::New(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs, MEDFileJoints* joints)
{
MEDCoupling::MEDCouplingMeshType meshType;
int dummy0,dummy1;
bool MEDFileMesh::changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
- for(const auto & it : modifTab)
+ for(std::vector< std::pair<std::string,std::string> >::const_iterator it=modifTab.begin();it!=modifTab.end();it++)
{
- if(it.first==_name)
+ if((*it).first==_name)
{
- _name=it.second;
+ _name=(*it).second;
return true;
}
}
*/
std::vector<std::string> MEDFileMesh::getFamiliesOnGroup(const std::string& name) const
{
- std::string const oname(name);
- auto const it=_groups.find(oname);
+ std::string oname(name);
+ std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.find(oname);
if(it==_groups.end())
{
std::vector<std::string> grps=getGroupsNames();
std::vector<std::string> MEDFileMesh::getFamiliesOnGroups(const std::vector<std::string>& grps) const
{
std::set<std::string> fams;
- for(const auto & grp : grps)
+ for(std::vector<std::string>::const_iterator it=grps.begin();it!=grps.end();it++)
{
- auto const it2=_groups.find(grp);
+ std::map<std::string, std::vector<std::string> >::const_iterator it2=_groups.find(*it);
if(it2==_groups.end())
{
- std::ostringstream oss; oss << "No such group in mesh \"" << _name << "\" : " << grp;
+ std::ostringstream oss; oss << "No such group in mesh \"" << _name << "\" : " << *it;
std::vector<std::string> grps2=getGroupsNames(); oss << "\" !\nAvailable groups are :";
std::copy(grps2.begin(),grps2.end(),std::ostream_iterator<std::string>(oss," "));
throw INTERP_KERNEL::Exception(oss.str().c_str());
*/
std::vector<mcIdType> MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const
{
- std::string const oname(name);
- auto const it=_groups.find(oname);
+ std::string oname(name);
+ std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.find(oname);
std::vector<std::string> grps=getGroupsNames();
if(it==_groups.end())
{
*/
void MEDFileMesh::setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams)
{
- std::string const oname(name);
+ std::string oname(name);
_groups[oname]=fams;
- for(const auto & fam : fams)
+ for(std::vector<std::string>::const_iterator it1=fams.begin();it1!=fams.end();it1++)
{
- auto const it2=_families.find(fam);
+ std::map<std::string,mcIdType>::iterator it2=_families.find(*it1);
if(it2==_families.end())
- _families[fam]=0;
+ _families[*it1]=0;
}
}
*/
void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds)
{
- std::string const oname(name);
+ std::string oname(name);
std::vector<std::string> fams(famIds.size());
int i=0;
- for(auto it1=famIds.begin();it1!=famIds.end();it1++,i++)
+ for(std::vector<mcIdType>::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++)
{
- std::string const name2=getFamilyNameGivenId(*it1);
+ std::string name2=getFamilyNameGivenId(*it1);
fams[i]=name2;
}
_groups[oname]=fams;
std::vector<std::string> MEDFileMesh::getGroupsOnFamily(const std::string& name) const
{
std::vector<std::string> ret;
- for(const auto & _group : _groups)
+ for(std::map<std::string, std::vector<std::string> >::const_iterator it1=_groups.begin();it1!=_groups.end();it1++)
{
- for(auto it2=_group.second.begin();it2!=_group.second.end();it2++)
+ for(std::vector<std::string>::const_iterator it2=(*it1).second.begin();it2!=(*it1).second.end();it2++)
if((*it2)==name)
{
- ret.push_back(_group.first);
+ ret.push_back((*it1).first);
break;
}
}
*/
void MEDFileMesh::setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps)
{
- std::string const fName(famName);
+ std::string fName(famName);
const std::map<std::string,mcIdType>::const_iterator it=_families.find(fName);
if(it==_families.end())
{
std::copy(fams.begin(),fams.end(),std::ostream_iterator<std::string>(oss," "));
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(const auto & grp : grps)
+ for(std::vector<std::string>::const_iterator it3=grps.begin();it3!=grps.end();it3++)
{
- auto const it2=_groups.find(grp);
+ std::map< std::string, std::vector<std::string> >::iterator it2=_groups.find(*it3);
if(it2!=_groups.end())
(*it2).second.push_back(fName);
else
{
- std::vector<std::string> const grps2(1,fName);
- _groups[grp]=grps2;
+ std::vector<std::string> grps2(1,fName);
+ _groups[*it3]=grps2;
}
}
}
{
std::vector<std::string> ret(_groups.size());
int i=0;
- for(auto it=_groups.begin();it!=_groups.end();it++,i++)
+ for(std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.begin();it!=_groups.end();it++,i++)
ret[i]=(*it).first;
return ret;
}
{
std::vector<std::string> ret(_families.size());
int i=0;
- for(auto it=_families.begin();it!=_families.end();it++,i++)
+ for(std::map<std::string, mcIdType >::const_iterator it=_families.begin();it!=_families.end();it++,i++)
ret[i]=(*it).first;
return ret;
}
std::vector<std::string> MEDFileMesh::getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const
{
std::vector<std::string> ret;
- std::vector<std::string> const allGrps(getGroupsNames());
+ std::vector<std::string> allGrps(getGroupsNames());
const DataArrayIdType *arr=getFamilyFieldAtLevel(meshDimRelToMaxExt);
if(!arr)
return ret;
for(auto it2 : it.second)
{
auto it3 = _families.find( it2 );
- mcIdType const famIdToTest = (*it3).second;
+ mcIdType famIdToTest = (*it3).second;
if( famIdsInUse.find(famIdToTest) != famIdsInUse.end() )
{
ret.push_back( it.first );
*/
std::vector<mcIdType> MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const
{
- std::vector<std::string> const fams(getFamiliesOnGroup(grp));
+ std::vector<std::string> fams(getFamiliesOnGroup(grp));
return getFamsNonEmptyLevelsExt(fams);
}
*/
std::vector<mcIdType> MEDFileMesh::getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const
{
- std::vector<std::string> const fams(getFamiliesOnGroups(grps));
+ std::vector<std::string> fams(getFamiliesOnGroups(grps));
return getFamsNonEmptyLevels(fams);
}
*/
std::vector<mcIdType> MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const
{
- std::vector<std::string> const fams(getFamiliesOnGroups(grps));
+ std::vector<std::string> fams(getFamiliesOnGroups(grps));
return getFamsNonEmptyLevelsExt(fams);
}
*/
std::vector<mcIdType> MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const
{
- std::vector<std::string> const fams(getFamiliesOnGroup(grp));
+ std::vector<std::string> fams(getFamiliesOnGroup(grp));
return getFamsNonEmptyLevels(fams);
}
*/
std::vector<mcIdType> MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const
{
- std::vector<std::string> const fams(1,std::string(fam));
+ std::vector<std::string> fams(1,std::string(fam));
return getFamsNonEmptyLevels(fams);
}
*/
std::vector<mcIdType> MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const
{
- std::vector<std::string> const fams(1,std::string(fam));
+ std::vector<std::string> fams(1,std::string(fam));
return getFamsNonEmptyLevelsExt(fams);
}
}
newFams[grps[0]]=(*it).second;
std::vector<std::string>& grps2=groups[grps[0]];
- std::size_t const pos=std::distance(grps2.begin(),std::find(grps2.begin(),grps2.end(),(*it).first));
+ std::size_t pos=std::distance(grps2.begin(),std::find(grps2.begin(),grps2.end(),(*it).first));
grps2[pos]=grps[0];
}
else
void MEDFileMesh::removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name)
{
- auto const it(_groups.find(name));
+ std::map<std::string, std::vector<std::string> >::iterator it(_groups.find(name));
std::vector<std::string> grps(getGroupsNames());
if(it==_groups.end())
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const std::vector<std::string> &famsOnGrp((*it).second);
- std::vector<mcIdType> const famIds(getFamiliesIdsOnGroup(name));
+ std::vector<mcIdType> famIds(getFamiliesIdsOnGroup(name));
const DataArrayIdType *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt));
if(!famArr)
return ;
if(idsToKill->empty())
return ;
std::vector<std::string> newFamsOnGrp;
- for(const auto & itt : famsOnGrp)
+ for(std::vector<std::string>::const_iterator itt=famsOnGrp.begin();itt!=famsOnGrp.end();itt++)
{
- if(!idsToKill->presenceOfValue(getFamilyId(itt)))
- newFamsOnGrp.push_back(itt);
+ if(!idsToKill->presenceOfValue(getFamilyId(*itt)))
+ newFamsOnGrp.push_back(*itt);
}
(*it).second=newFamsOnGrp;
}
*/
void MEDFileMesh::removeGroup(const std::string& name)
{
- auto const it=_groups.find(name);
+ std::map<std::string, std::vector<std::string> >::iterator it=_groups.find(name);
std::vector<std::string> grps(getGroupsNames());
if(it==_groups.end())
{
*/
void MEDFileMesh::removeFamily(const std::string& name)
{
- std::string const oname(name);
- auto const it=_families.find(oname);
+ std::string oname(name);
+ std::map<std::string, mcIdType >::iterator it=_families.find(oname);
std::vector<std::string> fams=getFamiliesNames();
if(it==_families.end())
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
_families.erase(it);
- for(auto & _group : _groups)
+ for(std::map<std::string, std::vector<std::string> >::iterator it3=_groups.begin();it3!=_groups.end();it3++)
{
- std::vector<std::string>& v=_group.second;
- auto const it4=std::find(v.begin(),v.end(),oname);
+ std::vector<std::string>& v=(*it3).second;
+ std::vector<std::string>::iterator it4=std::find(v.begin(),v.end(),oname);
if(it4!=v.end())
v.erase(it4);
}
else
{
ret.push_back((*it).first);
- std::vector<std::string> const grpsOnEraseFam=getGroupsOnFamily((*it).first);
- for(const auto & it2 : grpsOnEraseFam)
+ std::vector<std::string> grpsOnEraseFam=getGroupsOnFamily((*it).first);
+ for(std::vector<std::string>::const_iterator it2=grpsOnEraseFam.begin();it2!=grpsOnEraseFam.end();it2++)
{
- auto const it3=grps.find(it2);//it3!=grps.empty() thanks to copy
+ std::map<std::string, std::vector<std::string> >::iterator it3=grps.find(*it2);//it3!=grps.empty() thanks to copy
std::vector<std::string>& famv=(*it3).second;
- auto const it4=std::find(famv.begin(),famv.end(),(*it).first);//it4!=famv.end() thanks to copy
+ std::vector<std::string>::iterator it4=std::find(famv.begin(),famv.end(),(*it).first);//it4!=famv.end() thanks to copy
famv.erase(it4);
}
}
*/
void MEDFileMesh::removeFamiliesReferedByNoGroups()
{
- std::map<std::string,mcIdType> const fams;
+ std::map<std::string,mcIdType> fams;
std::set<std::string> sfams;
for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
sfams.insert((*it).first);
for(std::map<std::string, std::vector<std::string> >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++)
- for(const auto & it1 : (*it0).second)
- sfams.erase(it1);
- for(const auto & sfam : sfams)
- if(sfam!=DFT_FAM_NAME)
- _families.erase(sfam);
+ for(std::vector<std::string>::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++)
+ sfams.erase(*it1);
+ for(std::set<std::string>::const_iterator it=sfams.begin();it!=sfams.end();it++)
+ if(*it!=DFT_FAM_NAME)
+ _families.erase(*it);
}
/*!
checkOrphanFamilyZero();
removeFamiliesReferedByNoGroups();
//
- std::vector<int> const levels(getNonEmptyLevelsExt());
+ std::vector<int> levels(getNonEmptyLevelsExt());
std::set<mcIdType> idsRefed;
for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
}
}
}
- for(int const level : levels)
+ for(std::vector<int>::const_iterator it=levels.begin();it!=levels.end();it++)
{
- const DataArrayIdType *fams(nullptr);
+ const DataArrayIdType *fams(0);
try
{
- fams=getFamilyFieldAtLevel(level);
+ fams=getFamilyFieldAtLevel(*it);
}
catch(INTERP_KERNEL::Exception& ) { }
if(!fams)
continue;
std::vector<bool> v(fams->getNumberOfTuples(),false);
- for(long const pt : idsRefed)
- fams->switchOnTupleEqualTo(pt,v);
+ for(std::set<mcIdType>::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++)
+ fams->switchOnTupleEqualTo(*pt,v);
MCAuto<DataArrayIdType> unfetchedIds(DataArrayIdType::BuildListOfSwitchedOff(v));
if(!unfetchedIds->empty())
{
MCAuto<DataArrayIdType> newFams(fams->deepCopy());
newFams->setPartOfValuesSimple3(0,unfetchedIds->begin(),unfetchedIds->end(),0,1,1);
- setFamilyFieldArr(level,newFams);
+ setFamilyFieldArr(*it,newFams);
}
}
removeOrphanFamilies();
for(auto fam : _families)
{
std::vector<std::string> grps( this->getGroupsOnFamily( fam.first ) );
- std::set<std::string> const sgrps(grps.begin(),grps.end());
+ std::set<std::string> sgrps(grps.begin(),grps.end());
setOfFamilies[sgrps].push_back(fam.first);
}
//
std::map<std::string, std::vector<std::string> > newGroups(_groups);
std::map<std::string,mcIdType> newFams(_families);
- std::vector<int> const levels(getNonEmptyLevelsExt());
+ std::vector<int> levels(getNonEmptyLevelsExt());
std::map<mcIdType, std::vector<mcIdType> > famIdsToSubstitute;
// iterate on all different set of groups
std::set<std::string> familiesToKill;
{
if( setOfCommonGrp.second.size()<=1 )
continue;
- std::string const newFamName(setOfCommonGrp.second[0]);
+ std::string newFamName(setOfCommonGrp.second[0]);
auto newFamID(_families[newFamName]);
for(auto grpToBeModified : setOfCommonGrp.first)
{
// apply modifications in datastructure
for(auto famIdsSubstSession : famIdsToSubstitute)
{
- for(int const level : levels)
+ for(std::vector<int>::const_iterator it=levels.begin();it!=levels.end();it++)
{
DataArrayIdType *fams(nullptr);
try
{
- fams=getFamilyFieldAtLevel(level);
+ fams=getFamilyFieldAtLevel(*it);
}
catch(INTERP_KERNEL::Exception& ) { }
if(!fams)
*/
void MEDFileMesh::checkOrphanFamilyZero() const
{
- for(const auto & _group : _groups)
+ for(std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.begin();it!=_groups.end();it++)
{
- if(std::find(_group.second.begin(),_group.second.end(),DFT_FAM_NAME)!=_group.second.end())
+ if(std::find((*it).second.begin(),(*it).second.end(),DFT_FAM_NAME)!=(*it).second.end())
{
- std::ostringstream oss; oss << "MEDFileMesh::rearrangeFamilies : Groups \"" << _group.first << "\" is lying on family \"" << DFT_FAM_NAME << "\" !";
+ std::ostringstream oss; oss << "MEDFileMesh::rearrangeFamilies : Groups \"" << (*it).first << "\" is lying on family \"" << DFT_FAM_NAME << "\" !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
*/
void MEDFileMesh::changeGroupName(const std::string& oldName, const std::string& newName)
{
- std::string const oname(oldName);
- auto const it=_groups.find(oname);
+ std::string oname(oldName);
+ std::map<std::string, std::vector<std::string> >::iterator it=_groups.find(oname);
std::vector<std::string> grps=getGroupsNames();
if(it==_groups.end())
{
std::copy(grps.begin(),grps.end(),std::ostream_iterator<std::string>(oss," "));
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::string const nname(newName);
- auto const it2=_groups.find(nname);
+ std::string nname(newName);
+ std::map<std::string, std::vector<std::string> >::iterator it2=_groups.find(nname);
if(it2!=_groups.end())
{
std::ostringstream oss; oss << "Such groupname \"" << newName << "\" already exists ! Kill it before !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::vector<std::string> const cpy=(*it).second;
+ std::vector<std::string> cpy=(*it).second;
_groups.erase(it);
_groups[newName]=cpy;
}
*/
void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string& newName)
{
- std::string const oname(oldName);
- auto const it=_families.find(oname);
+ std::string oname(oldName);
+ std::map<std::string, mcIdType >::iterator it=_families.find(oname);
std::vector<std::string> fams=getFamiliesNames();
if(it==_families.end())
{
std::copy(fams.begin(),fams.end(),std::ostream_iterator<std::string>(oss," "));
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::string const nname(newName);
- auto const it2=_families.find(nname);
+ std::string nname(newName);
+ std::map<std::string, mcIdType >::iterator it2=_families.find(nname);
if(it2!=_families.end())
{
std::ostringstream oss; oss << "Such familyname \"" << newName << " already exists ! Kill it before !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType const cpy=(*it).second;
+ mcIdType cpy=(*it).second;
_families.erase(it);
_families[newName]=cpy;
- for(auto & _group : _groups)
+ for(std::map<std::string, std::vector<std::string> >::iterator it3=_groups.begin();it3!=_groups.end();it3++)
{
- std::vector<std::string>& v=_group.second;
- auto const it4=std::find(v.begin(),v.end(),oname);
+ std::vector<std::string>& v=(*it3).second;
+ std::vector<std::string>::iterator it4=std::find(v.begin(),v.end(),oname);
if(it4!=v.end())
(*it4)=nname;
}
* \return bool - \c true if number of families and their ids are the same in the two
* meshes. Families with the id == \c 0 are not considered.
*/
-bool MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& /*what*/) const
+bool MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& what) const
{
if(_families==other->_families)
return true;
std::map<std::string,mcIdType> fam0;
std::map<std::string,mcIdType> fam1;
- for(const auto & _familie : _families)
- if(_familie.second!=0)
- fam0[_familie.first]=_familie.second;
- for(const auto & _familie : other->_families)
- if(_familie.second!=0)
- fam1[_familie.first]=_familie.second;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
+ if((*it).second!=0)
+ fam0[(*it).first]=(*it).second;
+ for(std::map<std::string,mcIdType>::const_iterator it=other->_families.begin();it!=other->_families.end();it++)
+ if((*it).second!=0)
+ fam1[(*it).first]=(*it).second;
return fam0==fam1;
}
if(_groups==other->_groups)
return true;
bool ret=true;
- std::size_t const sz=_groups.size();
+ std::size_t sz=_groups.size();
if(sz!=other->_groups.size())
{
what="Groups differ because not same number !\n";
}
if(ret)
{
- auto it1=_groups.begin();
+ std::map<std::string, std::vector<std::string> >::const_iterator it1=_groups.begin();
for(std::size_t i=0;i<sz && ret;i++,it1++)
{
- auto const it2=other->_groups.find((*it1).first);
+ std::map<std::string, std::vector<std::string> >::const_iterator it2=other->_groups.find((*it1).first);
if(it2!=other->_groups.end())
{
- std::set<std::string> const s1((*it1).second.begin(),(*it1).second.end());
- std::set<std::string> const s2((*it2).second.begin(),(*it2).second.end());
+ std::set<std::string> s1((*it1).second.begin(),(*it1).second.end());
+ std::set<std::string> s2((*it2).second.begin(),(*it2).second.end());
ret=(s1==s2);
}
else
{
std::ostringstream oss; oss << "Groups description differs :\n";
oss << "First group description :\n";
- for(const auto & _group : _groups)
+ for(std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.begin();it!=_groups.end();it++)
{
- oss << " Group \"" << _group.first << "\" on following families :\n";
- for(const auto & it2 : _group.second)
- oss << " \"" << it2 << "\n";
+ oss << " Group \"" << (*it).first << "\" on following families :\n";
+ for(std::vector<std::string>::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++)
+ oss << " \"" << *it2 << "\n";
}
oss << "Second group description :\n";
- for(const auto & _group : other->_groups)
+ for(std::map<std::string, std::vector<std::string> >::const_iterator it=other->_groups.begin();it!=other->_groups.end();it++)
{
- oss << " Group \"" << _group.first << "\" on following families :\n";
- for(const auto & it2 : _group.second)
- oss << " \"" << it2 << "\n";
+ oss << " Group \"" << (*it).first << "\" on following families :\n";
+ for(std::vector<std::string>::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++)
+ oss << " \"" << *it2 << "\n";
}
what+=oss.str();
}
*/
bool MEDFileMesh::existsGroup(const std::string& groupName) const
{
- std::string const grpName(groupName);
+ std::string grpName(groupName);
return _groups.find(grpName)!=_groups.end();
}
*/
bool MEDFileMesh::existsFamily(mcIdType famId) const
{
- for(const auto & _familie : _families)
- if(_familie.second==famId)
+ for(std::map<std::string,mcIdType>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
+ if((*it2).second==famId)
return true;
return false;
}
*/
bool MEDFileMesh::existsFamily(const std::string& familyName) const
{
- std::string const fname(familyName);
+ std::string fname(familyName);
return _families.find(fname)!=_families.end();
}
*/
void MEDFileMesh::setFamilyId(const std::string& familyName, mcIdType id)
{
- std::string const fname(familyName);
+ std::string fname(familyName);
_families[fname]=id;
}
void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, mcIdType id)
{
- std::string const fname(familyName);
+ std::string fname(familyName);
for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
if((*it).second==id)
{
*/
void MEDFileMesh::addFamily(const std::string& familyName, mcIdType famId)
{
- std::string const fname(familyName);
- std::map<std::string,mcIdType>::const_iterator const it=_families.find(fname);
+ std::string fname(familyName);
+ std::map<std::string,mcIdType>::const_iterator it=_families.find(fname);
if(it==_families.end())
{
for(std::map<std::string,mcIdType>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
*/
void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName)
{
- std::string const grpName(groupName);
+ std::string grpName(groupName);
std::vector<int> levs=getNonEmptyLevelsExt();
if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)==levs.end())
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt);
- if(fieldFamIds==nullptr)
+ if(fieldFamIds==0)
throw INTERP_KERNEL::Exception("MEDFileMesh::createGroupOnAll : Family field arr ids is not defined for this level !");
MCAuto<DataArrayIdType> famIds=fieldFamIds->getDifferentValues();
std::vector<std::string> familiesOnWholeGroup;
- for(long const it : *famIds)
+ for(const mcIdType *it=famIds->begin();it!=famIds->end();it++)
{
bool tmp;
- familiesOnWholeGroup.push_back(findOrCreateAndGiveFamilyWithId(it,tmp));
+ familiesOnWholeGroup.push_back(findOrCreateAndGiveFamilyWithId(*it,tmp));
}
_groups[grpName]=familiesOnWholeGroup;
}
*/
bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& vMeshDimRelToMaxExt)
{
- std::set<int> const levsInput(vMeshDimRelToMaxExt.begin(),vMeshDimRelToMaxExt.end());
+ std::set<int> levsInput(vMeshDimRelToMaxExt.begin(),vMeshDimRelToMaxExt.end());
std::vector<int> levs=getNonEmptyLevelsExt();
- std::set<int> const levs2(levs.begin(),levs.end());
+ std::set<int> levs2(levs.begin(),levs.end());
std::vector<int> levsToTest;
std::set_difference(levs2.begin(),levs2.end(),levsInput.begin(),levsInput.end(),std::back_insert_iterator< std::vector<int> >(levsToTest));
- std::set<mcIdType> const famIds2(famIds.begin(),famIds.end());
+ std::set<mcIdType> famIds2(famIds.begin(),famIds.end());
bool ret=true;
mcIdType maxFamId=1;
if(!_families.empty())
maxFamId=getMaxFamilyId()+1;
- std::vector<std::string> const allFams=getFamiliesNames();
- for(int const it : levsToTest)
+ std::vector<std::string> allFams=getFamiliesNames();
+ for(std::vector<int>::const_iterator it=levsToTest.begin();it!=levsToTest.end();it++)
{
- const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(it);
+ const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(*it);
if(fieldFamIds)
{
- MCAuto<DataArrayIdType> const famIds3=fieldFamIds->getDifferentValues();
+ MCAuto<DataArrayIdType> famIds3=fieldFamIds->getDifferentValues();
std::vector<mcIdType> tmp;
std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
- for(long const it2 : tmp)
+ for(std::vector<mcIdType>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
{
ret=false;
- std::string const famName=getFamilyNameGivenId(it2);
+ std::string famName=getFamilyNameGivenId(*it2);
std::ostringstream oss; oss << "Family_" << maxFamId;
- std::string const zeName=CreateNameNotIn(oss.str(),allFams);
+ std::string zeName=CreateNameNotIn(oss.str(),allFams);
addFamilyOnAllGroupsHaving(famName,zeName);
_families[zeName]=maxFamId;
- (const_cast<DataArrayIdType *>(fieldFamIds))->changeValue(it2,maxFamId);
+ (const_cast<DataArrayIdType *>(fieldFamIds))->changeValue(*it2,maxFamId);
maxFamId++;
}
}
*/
void MEDFileMesh::addFamilyOnGrp(const std::string& grpName, const std::string& famName)
{
- std::string const grpn(grpName);
- std::string const famn(famName);
+ std::string grpn(grpName);
+ std::string famn(famName);
if(grpn.empty() || famn.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::addFamilyOnGrp : input strings must be non null !");
std::vector<std::string> fams=getFamiliesNames();
std::copy(fams.begin(),fams.end(),std::ostream_iterator<std::string>(oss," ")); oss << ".";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- auto const it=_groups.find(grpn);
+ std::map<std::string, std::vector<std::string> >::iterator it=_groups.find(grpn);
if(it==_groups.end())
{
_groups[grpn].push_back(famn);
}
else
{
- auto const it2=std::find((*it).second.begin(),(*it).second.end(),famn);
+ std::vector<std::string>::iterator it2=std::find((*it).second.begin(),(*it).second.end(),famn);
if(it2==(*it).second.end())
(*it).second.push_back(famn);
}
*/
void MEDFileMesh::addFamilyOnAllGroupsHaving(const std::string& famName, const std::string& otherFamName)
{
- std::string const famNameCpp(famName);
- std::string const otherCpp(otherFamName);
- for(auto & _group : _groups)
+ std::string famNameCpp(famName);
+ std::string otherCpp(otherFamName);
+ for(std::map<std::string, std::vector<std::string> >::iterator it=_groups.begin();it!=_groups.end();it++)
{
- std::vector<std::string>& v=_group.second;
+ std::vector<std::string>& v=(*it).second;
if(std::find(v.begin(),v.end(),famNameCpp)!=v.end())
{
v.push_back(otherCpp);
std::vector<std::string> grpsNames(getGroupsNames());
if(std::find(grpsNames.begin(),grpsNames.end(),grpName)==grpsNames.end())
return ;
- std::vector<mcIdType> const famIds(getFamiliesIdsOnGroup(grpName));
+ std::vector<mcIdType> famIds(getFamiliesIdsOnGroup(grpName));
if(famArr->presenceOfValue(famIds))
{
std::ostringstream oss; oss << "MEDFileUMesh::addGroup : Group with name \"" << grpName << "\" already exists at specified level ! Destroy it before calling this method !";
{
if(!ids)
throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : NULL pointer in input !");
- std::string const grpName(ids->getName());
+ std::string grpName(ids->getName());
if(grpName.empty())
throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : empty group name ! MED file format do not accept empty group name !");
ids->checkStrictlyMonotonic(true);
else
{
familyIds.push_back(isNodeGroup?maxVal:-maxVal); idsPerfamiliyIds.push_back(ids2);
- std::string const locFamName=FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created);
+ std::string locFamName=FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created);
fams.push_back(locFamName);
if(existsFamily(*famId))
{
- std::string const locFamName2=getFamilyNameGivenId(*famId); std::vector<std::string> v(2); v[0]=locFamName2; v[1]=locFamName;
+ std::string locFamName2=getFamilyNameGivenId(*famId); std::vector<std::string> v(2); v[0]=locFamName2; v[1]=locFamName;
ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId),v);
}
maxVal++;
{
familyIds.push_back(isNodeGroup?maxVal:-maxVal); idsPerfamiliyIds.push_back(ret0); // modifying all other groups on *famId to lie on maxVal and on maxVal+1
familyIds.push_back(isNodeGroup?maxVal+1:-maxVal-1); idsPerfamiliyIds.push_back(ids2);//grp lie only on maxVal+1
- std::string const n2(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal+1:-maxVal-1,created)); fams.push_back(n2);
+ std::string n2(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal+1:-maxVal-1,created)); fams.push_back(n2);
if(existsFamily(*famId))
{
- std::string const n1(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created)); std::vector<std::string> v(2); v[0]=n1; v[1]=n2;
+ std::string n1(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created)); std::vector<std::string> v(2); v[0]=n1; v[1]=n2;
ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId),v);
}
maxVal+=2;
famArr->setPartOfValuesSimple3(familyIds[i],da->begin(),da->end(),0,1,1);
}
_families=families;
- auto const itt(groups.find(grpName));
+ std::map<std::string, std::vector<std::string> >::iterator itt(groups.find(grpName));
if(itt!=groups.end())
{
std::vector<std::string>& famsOnGrp((*itt).second);
void MEDFileMesh::ChangeAllGroupsContainingFamily(std::map<std::string, std::vector<std::string> >& groups, const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames)
{
- std::string const fam(familyNameToChange);
- for(auto & group : groups)
+ std::string fam(familyNameToChange);
+ for(std::map<std::string, std::vector<std::string> >::iterator it=groups.begin();it!=groups.end();it++)
{
- std::vector<std::string>& fams(group.second);
- auto const it2=std::find(fams.begin(),fams.end(),fam);
+ std::vector<std::string>& fams((*it).second);
+ std::vector<std::string>::iterator it2=std::find(fams.begin(),fams.end(),fam);
if(it2!=fams.end())
{
fams.erase(it2);
*/
mcIdType MEDFileMesh::getFamilyId(const std::string& name) const
{
- auto const it=_families.find(name);
+ std::map<std::string, mcIdType>::const_iterator it=_families.find(name);
if(it==_families.end())
{
std::vector<std::string> fams(getFamiliesNames());
{
std::vector<mcIdType> ret(fams.size());
int i=0;
- for(auto it=fams.begin();it!=fams.end();it++,i++)
+ for(std::vector<std::string>::const_iterator it=fams.begin();it!=fams.end();it++,i++)
{
- auto const it2=_families.find(*it);
+ std::map<std::string, mcIdType>::const_iterator it2=_families.find(*it);
if(it2==_families.end())
{
std::vector<std::string> fams2=getFamiliesNames();
if(_families.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !");
mcIdType ret=-std::numeric_limits<mcIdType>::max();
- for(const auto & _familie : _families)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
- ret=std::max(std::abs(_familie.second),ret);
+ ret=std::max(std::abs((*it).second),ret);
}
return ret;
}
if(_families.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !");
mcIdType ret=-std::numeric_limits<mcIdType>::max();
- for(const auto & _familie : _families)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
- ret=std::max(_familie.second,ret);
+ ret=std::max((*it).second,ret);
}
return ret;
}
if(_families.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::getMinFamilyId : no families set !");
mcIdType ret=std::numeric_limits<mcIdType>::max();
- for(const auto & _familie : _families)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
- ret=std::min(_familie.second,ret);
+ ret=std::min((*it).second,ret);
}
return ret;
}
mcIdType MEDFileMesh::getTheMaxAbsFamilyId() const
{
mcIdType m1=-std::numeric_limits<mcIdType>::max();
- for(const auto & _familie : _families)
- m1=std::max(std::abs(_familie.second),m1);
- mcIdType const m2=getMaxAbsFamilyIdInArrays();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
+ m1=std::max(std::abs((*it).second),m1);
+ mcIdType m2=getMaxAbsFamilyIdInArrays();
return std::max(m1,m2);
}
mcIdType MEDFileMesh::getTheMaxFamilyId() const
{
mcIdType m1=-std::numeric_limits<mcIdType>::max();
- for(const auto & _familie : _families)
- m1=std::max(_familie.second,m1);
- mcIdType const m2=getMaxFamilyIdInArrays();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
+ m1=std::max((*it).second,m1);
+ mcIdType m2=getMaxFamilyIdInArrays();
return std::max(m1,m2);
}
mcIdType MEDFileMesh::getTheMinFamilyId() const
{
mcIdType m1=std::numeric_limits<mcIdType>::max();
- for(const auto & _familie : _families)
- m1=std::min(_familie.second,m1);
- mcIdType const m2=getMinFamilyIdInArrays();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
+ m1=std::min((*it).second,m1);
+ mcIdType m2=getMinFamilyIdInArrays();
return std::min(m1,m2);
}
{
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
std::set<mcIdType> v;
- for(const auto & _familie : _families)
- v.insert(_familie.second);
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
+ v.insert((*it).second);
ret->alloc((mcIdType)v.size(),1);
std::copy(v.begin(),v.end(),ret->getPointer());
return ret.retn();
*/
DataArrayIdType *MEDFileMesh::computeAllFamilyIdsInUse() const
{
- std::vector<int> const famLevs=getFamArrNonEmptyLevelsExt();
+ std::vector<int> famLevs=getFamArrNonEmptyLevelsExt();
MCAuto<DataArrayIdType> ret;
- for(int const famLev : famLevs)
+ for(std::vector<int>::const_iterator it=famLevs.begin();it!=famLevs.end();it++)
{
- const DataArrayIdType *arr=getFamilyFieldAtLevel(famLev);//arr not null due to spec of getFamArrNonEmptyLevelsExt
+ const DataArrayIdType *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt
MCAuto<DataArrayIdType> dv=arr->getDifferentValues();
if((DataArrayIdType *) ret)
ret=dv->buildUnion(ret);
*/
bool MEDFileMesh::ensureDifferentFamIdsPerLevel()
{
- std::vector<int> const levs=getNonEmptyLevelsExt();
- std::set<mcIdType> const allFamIds;
+ std::vector<int> levs=getNonEmptyLevelsExt();
+ std::set<mcIdType> allFamIds;
mcIdType maxId=getMaxFamilyId()+1;
std::map<int,std::vector<mcIdType> > famIdsToRenum;
- for(int const lev : levs)
+ for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
- const DataArrayIdType *fam=getFamilyFieldAtLevel(lev);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(*it);
if(fam)
{
MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
std::set<mcIdType> r2;
std::set_intersection(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r2,r2.end()));
if(!r2.empty())
- famIdsToRenum[lev].insert(famIdsToRenum[lev].end(),r2.begin(),r2.end());
+ famIdsToRenum[*it].insert(famIdsToRenum[*it].end(),r2.begin(),r2.end());
std::set<mcIdType> r3;
std::set_union(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r3,r3.end()));
}
MCAuto<DataArrayIdType> allIds=getAllFamiliesIdsReferenced();
for(std::map<int,std::vector<mcIdType> >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++)
{
- auto *fam=const_cast<DataArrayIdType *>(getFamilyFieldAtLevel((*it2).first));
+ DataArrayIdType *fam=const_cast<DataArrayIdType *>(getFamilyFieldAtLevel((*it2).first));
mcIdType *famIdsToChange=fam->getPointer();
std::map<mcIdType,mcIdType> ren;
- for(auto it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++)
+ for(std::vector<mcIdType>::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++)
{
if(allIds->presenceOfValue(*it3))
{
- std::string const famName=getFamilyNameGivenId(*it3);
- std::vector<std::string> const grps=getGroupsOnFamily(famName);
+ std::string famName=getFamilyNameGivenId(*it3);
+ std::vector<std::string> grps=getGroupsOnFamily(famName);
ren[*it3]=maxId;
bool dummy;
- std::string const newFam=findOrCreateAndGiveFamilyWithId(maxId,dummy);
- for(const auto & grp : grps)
- addFamilyOnGrp(grp,newFam);
+ std::string newFam=findOrCreateAndGiveFamilyWithId(maxId,dummy);
+ for(std::vector<std::string>::const_iterator it4=grps.begin();it4!=grps.end();it4++)
+ addFamilyOnGrp((*it4),newFam);
}
}
MCAuto<DataArrayIdType> ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size());
- for(long const id : *ids)
- famIdsToChange[id]=ren[famIdsToChange[id]];
+ for(const mcIdType *id=ids->begin();id!=ids->end();id++)
+ famIdsToChange[*id]=ren[famIdsToChange[*id]];
}
return false;
}
std::map<mcIdType,mcIdType> ren;
for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++)
ren[*it]=refId;
- mcIdType const nbOfTuples=fam->getNumberOfTuples();
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
{
if(allIds->presenceOfValue(*it))
{
- std::string const famName=getFamilyNameGivenId(*it);
+ std::string famName=getFamilyNameGivenId(*it);
families[famName]=ren[*it];
famsFetched.insert(famName);
}
std::map<mcIdType,mcIdType> ren;
for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--)
ren[*it]=refId;
- mcIdType const nbOfTuples=fam->getNumberOfTuples();
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
{
if(allIds->presenceOfValue(*it))
{
- std::string const famName=getFamilyNameGivenId(*it);
+ std::string famName=getFamilyNameGivenId(*it);
families[famName]=ren[*it];
famsFetched.insert(famName);
}
}
}
}
- for(int const it2 : levsS)
+ for(std::set<int>::const_iterator it2=levsS.begin();it2!=levsS.end();it2++)
{
- auto *fam=const_cast<DataArrayIdType*>(getFamilyFieldAtLevel(it2));
+ DataArrayIdType *fam=const_cast<DataArrayIdType*>(getFamilyFieldAtLevel(*it2));
if(fam)
{
MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
for(const mcIdType *it3=tmp->begin();it3!=tmp->end();it3++)
if(allIds->presenceOfValue(*it3))
{
- std::string const famName=getFamilyNameGivenId(*it3);
+ std::string famName=getFamilyNameGivenId(*it3);
families[famName]=0;
famsFetched.insert(famName);
}
}
//
std::vector<std::string> allFams=getFamiliesNames();
- std::set<std::string> const allFamsS(allFams.begin(),allFams.end());
+ std::set<std::string> allFamsS(allFams.begin(),allFams.end());
std::set<std::string> unFetchedIds;
std::set_difference(allFamsS.begin(),allFamsS.end(),famsFetched.begin(),famsFetched.end(),std::inserter(unFetchedIds,unFetchedIds.end()));
- for(const auto & unFetchedId : unFetchedIds)
- families[unFetchedId]=_families[unFetchedId];
+ for(std::set<std::string>::const_iterator it4=unFetchedIds.begin();it4!=unFetchedIds.end();it4++)
+ families[*it4]=_families[*it4];
_families=families;
}
std::map<mcIdType,mcIdType> ren;
for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++)
ren[*it]=refId;
- mcIdType const nbOfTuples=fam->getNumberOfTuples();
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
{
if(allIds->presenceOfValue(*it))
{
- std::string const famName=getFamilyNameGivenId(*it);
+ std::string famName=getFamilyNameGivenId(*it);
families[famName]=ren[*it];
famsFetched.insert(famName);
}
}
}
refId=-1;
- for(auto it2=levsS.rbegin();it2!=levsS.rend();it2++)
+ for(std::set<int>::const_reverse_iterator it2=levsS.rbegin();it2!=levsS.rend();it2++)
{
const DataArrayIdType *fam=getFamilyFieldAtLevel(*it2);
if(fam)
std::map<mcIdType,mcIdType> ren;
for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--)
ren[*it]=refId;
- mcIdType const nbOfTuples=fam->getNumberOfTuples();
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
{
if(allIds->presenceOfValue(*it))
{
- std::string const famName=getFamilyNameGivenId(*it);
+ std::string famName=getFamilyNameGivenId(*it);
families[famName]=ren[*it];
famsFetched.insert(famName);
}
}
//
std::vector<std::string> allFams=getFamiliesNames();
- std::set<std::string> const allFamsS(allFams.begin(),allFams.end());
+ std::set<std::string> allFamsS(allFams.begin(),allFams.end());
std::set<std::string> unFetchedIds;
std::set_difference(allFamsS.begin(),allFamsS.end(),famsFetched.begin(),famsFetched.end(),std::inserter(unFetchedIds,unFetchedIds.end()));
- for(const auto & unFetchedId : unFetchedIds)
- families[unFetchedId]=_families[unFetchedId];
+ for(std::set<std::string>::const_iterator it4=unFetchedIds.begin();it4!=unFetchedIds.end();it4++)
+ families[*it4]=_families[*it4];
_families=families;
}
*/
std::string MEDFileMesh::getFamilyNameGivenId(mcIdType id) const
{
- for(const auto & _familie : _families)
- if(_familie.second==id)
- return _familie.first;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
+ if((*it).second==id)
+ return (*it).first;
std::ostringstream oss; oss << "MEDFileUMesh::getFamilyNameGivenId : no such family id : " << id;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
*/
DataArrayIdType *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum) const
{
- std::vector<std::string> const fams2=getFamiliesOnGroups(grps);
+ std::vector<std::string> fams2=getFamiliesOnGroups(grps);
return getFamiliesArr(meshDimRelToMaxExt,fams2,renum);
}
std::vector<std::string> grpsName2(grps.size());
int i=0;
- for(auto it=grps.begin();it!=grps.end();it++,i++)
+ for(std::vector<const DataArrayIdType *>::const_iterator it=grps.begin();it!=grps.end();it++,i++)
{
grpsName.insert((*it)->getName());
grpsName2[i]=(*it)->getName();
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsAtLevel : groups name must be different each other !");
if(grpsName.find(std::string(""))!=grpsName.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsAtLevel : groups name must be different empty string !");
- mcIdType const sz=getSizeAtLevel(meshDimRelToMaxExt);
+ mcIdType sz=getSizeAtLevel(meshDimRelToMaxExt);
MCAuto<DataArrayIdType> fam;
std::vector< std::vector<mcIdType> > fidsOfGroups;
if(!renum)
grps2[ii]=MEDFileUMeshSplitL1::Renumber(getRevNumberFieldAtLevel(meshDimRelToMaxExt),grps[ii]);
grps2[ii]->setName(grps[ii]->getName());
}
- std::vector<const DataArrayIdType *> const grps3(grps2.begin(),grps2.end());
+ std::vector<const DataArrayIdType *> grps3(grps2.begin(),grps2.end());
fam=DataArrayIdType::MakePartition(grps3,sz,fidsOfGroups);
}
mcIdType offset=1;
if(!_families.empty())
offset=getMaxAbsFamilyId()+1;
TranslateFamilyIds(meshDimRelToMaxExt==1?offset:-offset,fam,fidsOfGroups);
- MCAuto<DataArrayIdType> const ids=fam->getDifferentValues();
+ MCAuto<DataArrayIdType> ids=fam->getDifferentValues();
appendFamilyEntries(ids,fidsOfGroups,grpsName2);
setFamilyFieldArr(meshDimRelToMaxExt,fam);
}
void MEDFileMesh::appendFamilyEntries(const DataArrayIdType *famIds, const std::vector< std::vector<mcIdType> >& fidsOfGrps, const std::vector<std::string>& grpNames)
{
std::map<mcIdType,std::string> famInv;
- for(long const famId : *famIds)
+ for(const mcIdType *it=famIds->begin();it!=famIds->end();it++)
{
std::ostringstream oss;
- oss << "Family_" << famId;
- _families[oss.str()]=famId;
- famInv[famId]=oss.str();
+ oss << "Family_" << (*it);
+ _families[oss.str()]=(*it);
+ famInv[*it]=oss.str();
}
int i=0;
- for(auto it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++)
{
- for(long const it2 : *it1)
+ for(std::vector<mcIdType>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
{
- _groups[grpNames[i]].push_back(famInv[it2]);
+ _groups[grpNames[i]].push_back(famInv[*it2]);
}
}
}
std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileMesh::getAllGeoTypes() const
{
- std::vector<int> const levs(getNonEmptyLevels());
+ std::vector<int> levs(getNonEmptyLevels());
std::vector<INTERP_KERNEL::NormalizedCellType> ret;
- for(int const lev : levs)
+ for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
- std::vector<INTERP_KERNEL::NormalizedCellType> elts(getGeoTypesAtLevel(lev));
+ std::vector<INTERP_KERNEL::NormalizedCellType> elts(getGeoTypesAtLevel(*it));
ret.insert(ret.end(),elts.begin(),elts.end());
}
return ret;
void MEDFileMesh::TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector<mcIdType> >& famIdsPerGrp)
{
famArr->applyLin(offset>0?1:-1,offset,0);
- for(auto & it1 : famIdsPerGrp)
+ for(std::vector< std::vector<mcIdType> >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++)
{
if(offset<0)
- std::transform(it1.begin(),it1.end(),it1.begin(),std::negate<mcIdType>());
- std::transform(it1.begin(),it1.end(),it1.begin(),std::bind(std::plus<mcIdType>(),std::placeholders::_1,offset));
+ std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate<mcIdType>());
+ std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind(std::plus<mcIdType>(),std::placeholders::_1,offset));
}
}
if(std::find(namesToAvoid.begin(),namesToAvoid.end(),nameTry)==namesToAvoid.end())
return nameTry;
//attempt #1
- std::size_t const len=nameTry.length();
+ std::size_t len=nameTry.length();
for(std::size_t ii=1;ii<len;ii++)
{
std::string tmp=nameTry.substr(ii,len-ii);
}
//attempt #3
std::string tmp2;
- for(const auto & it2 : namesToAvoid)
- tmp2+=it2;
+ for(std::vector<std::string>::const_iterator it2=namesToAvoid.begin();it2!=namesToAvoid.end();it2++)
+ tmp2+=(*it2);
if(std::find(namesToAvoid.begin(),namesToAvoid.end(),tmp2)==namesToAvoid.end())
return tmp2;
throw INTERP_KERNEL::Exception("MEDFileMesh::CreateNameNotIn : impossible to find a not already used name !");
mcIdType MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector<mcIdType>& code, mcIdType strt)
{
- std::size_t const nbOfChunks=code.size()/3;
+ std::size_t nbOfChunks=code.size()/3;
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDFileMesh::PutInThirdComponentOfCodeOffset : code has invalid size : should be of size 3*x !");
mcIdType ret=strt;
_name=m->getName();
else
{
- std::string const name(m->getName());
+ std::string name(m->getName());
if(!name.empty())
{
if(_name!=name)
_desc_name=m->getDescription();
else
{
- std::string const name(m->getDescription());
+ std::string name(m->getDescription());
if(!name.empty())
{
if(_desc_name!=name)
void MEDFileMesh::getFamilyRepr(std::ostream& oss) const
{
oss << "(**************************)\n(* FAMILIES OF THE MESH : *)\n(**************************)\n";
- for(const auto & _familie : _families)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
- oss << "- Family with name \"" << _familie.first << "\" with number " << _familie.second << std::endl;
+ oss << "- Family with name \"" << (*it).first << "\" with number " << (*it).second << std::endl;
oss << " - Groups lying on this family : ";
- std::vector<std::string> grps=getGroupsOnFamily(_familie.first);
+ std::vector<std::string> grps=getGroupsOnFamily((*it).first);
std::copy(grps.begin(),grps.end(),std::ostream_iterator<std::string>(oss," "));
oss << std::endl << std::endl;
}
*/
MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,mName,dt,it,mrs);
}
*/
MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,mrs);
}
template<class T>
T *NewForTheFirstMeshInFile(med_idt fid, MEDFileMeshReadSelector *mrs)
{
- std::vector<std::string> ms((MEDLoaderNS::getMeshNamesFid(fid)));
+ std::vector<std::string> ms(MEDLoaderNS::getMeshNamesFid(fid));
if(ms.empty())
{
std::ostringstream oss; oss << MLMeshTraits<T>::ClassName << "::New : no meshes in file \"" << MEDFileWritable::FileNameFromFID(fid) << "\" !";
MCAuto<MEDFileUMesh> MEDFileUMesh::LoadConnectivityOnlyPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid const fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY));
+ MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY));
return MEDFileUMesh::LoadConnectivityOnlyPartOf(fid,mName,types,slicPerTyp,dt,it,mrs);
}
MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid const fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY));
+ MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY));
return MEDFileUMesh::LoadPartOf(fid,mName,types,slicPerTyp,dt,it,mrs);
}
void MEDFileUMesh::LoadPartCoords(const std::string& fileName, const std::string& mName, int dt, int it, const std::vector<std::string>& infosOnComp, mcIdType startNodeId, mcIdType stopNodeId,
MCAuto<DataArrayDouble>& coords, MCAuto<PartDefinition>& partCoords, MCAuto<DataArrayIdType>& famCoords, MCAuto<DataArrayIdType>& numCoords, MCAuto<DataArrayAsciiChar>& nameCoords)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
MEDFileUMeshL2::LoadPartCoords(fid,infosOnComp,mName,dt,it,startNodeId,stopNodeId,coords,partCoords,famCoords,numCoords,nameCoords);
}
ret.push_back((const DataArrayIdType *)_rev_num_coords);
ret.push_back((const DataArrayAsciiChar *)_name_coords);
ret.push_back((const PartDefinition *)_part_coords);
- for(const auto & _m : _ms)
- ret.push_back((const MEDFileUMeshSplitL1*) _m);
- for(const auto & it : _elt_str)
- ret.push_back((const MEDFileEltStruct4Mesh *)it);
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ ret.push_back((const MEDFileUMeshSplitL1*) *it);
+ for(std::vector< MCAuto<MEDFileEltStruct4Mesh> >::const_iterator it=_elt_str.begin();it!=_elt_str.end();it++)
+ ret.push_back((const MEDFileEltStruct4Mesh *)*it);
return ret;
}
if(_name_coords.isNotNull())
ret->_name_coords=_name_coords->deepCopy();
std::size_t i=0;
- for(auto it=_ms.begin();it!=_ms.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
ret->_ms[i]=(*it)->deepCopy(ret->_coords);
{
if(!MEDFileMesh::isEqual(other,eps,what))
return false;
- const auto *otherC=dynamic_cast<const MEDFileUMesh *>(other);
+ const MEDFileUMesh *otherC=dynamic_cast<const MEDFileUMesh *>(other);
if(!otherC)
{
what="Mesh types differ ! This is unstructured and other is NOT !";
otherC->clearNonDiscrAttributes();
const DataArrayDouble *coo1=_coords;
const DataArrayDouble *coo2=otherC->_coords;
- if((coo1==nullptr && coo2!=nullptr) || (coo1!=nullptr && coo2==nullptr))
+ if((coo1==0 && coo2!=0) || (coo1!=0 && coo2==0))
{
what="Mismatch of coordinates ! One is defined and not other !";
return false;
}
if(coo1)
{
- bool const ret=coo1->isEqual(*coo2,eps);
+ bool ret=coo1->isEqual(*coo2,eps);
if(!ret)
{
what="Coords differ !";
}
{
const DataArrayIdType *famc1(_fam_coords),*famc2(otherC->_fam_coords);
- if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr))
+ if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of families arr on nodes ! One is defined and not other !";
return false;
}
if(famc1)
{
- bool const ret=famc1->isEqual(*famc2);
+ bool ret=famc1->isEqual(*famc2);
if(!ret)
{
what="Families arr on node differ !";
}
{
const DataArrayIdType *numc1(_num_coords),*numc2(otherC->_num_coords);
- if((numc1==nullptr && numc2!=nullptr) || (numc1!=nullptr && numc2==nullptr))
+ if((numc1==0 && numc2!=0) || (numc1!=0 && numc2==0))
{
what="Mismatch of numbering arr on nodes ! One is defined and not other !";
return false;
}
if(numc1)
{
- bool const ret=numc1->isEqual(*numc2);
+ bool ret=numc1->isEqual(*numc2);
if(!ret)
{
what="Numbering arr on node differ !";
}
{
const DataArrayIdType *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords);
- if((gnumc1==nullptr && gnumc2!=nullptr) || (gnumc1!=nullptr && gnumc2==nullptr))
+ if((gnumc1==0 && gnumc2!=0) || (gnumc1!=0 && gnumc2==0))
{
what="Mismatch of numbering arr on nodes ! One is defined and not other !";
return false;
}
if(gnumc1)
{
- bool const ret=gnumc1->isEqual(*gnumc2);
+ bool ret=gnumc1->isEqual(*gnumc2);
if(!ret)
{
what="Global numbering arr on node differ !";
}
{
const DataArrayAsciiChar *namec1(_name_coords),*namec2(otherC->_name_coords);
- if((namec1==nullptr && namec2!=nullptr) || (namec1!=nullptr && namec2==nullptr))
+ if((namec1==0 && namec2!=0) || (namec1!=0 && namec2==0))
{
what="Mismatch of naming arr on nodes ! One is defined and not other !";
return false;
}
if(namec1)
{
- bool const ret=namec1->isEqual(*namec2);
+ bool ret=namec1->isEqual(*namec2);
if(!ret)
{
what="Names arr on node differ !";
what="Number of levels differs !";
return false;
}
- std::size_t const sz=_ms.size();
+ std::size_t sz=_ms.size();
for(std::size_t i=0;i<sz;i++)
{
const MEDFileUMeshSplitL1 *s1=_ms[i];
const MEDFileUMeshSplitL1 *s2=otherC->_ms[i];
- if((s1==nullptr && s2!=nullptr) || (s1!=nullptr && s2==nullptr))
+ if((s1==0 && s2!=0) || (s1!=0 && s2==0))
{
what="Mismatch of presence of sub levels !";
return false;
}
if(s1)
{
- bool const ret=s1->isEqual(s2,eps,what);
+ bool ret=s1->isEqual(s2,eps,what);
if(!ret)
return false;
}
}
else
{
- mcIdType const nbCoo = _coords->getNumberOfTuples();
+ mcIdType nbCoo = _coords->getNumberOfTuples();
if (_fam_coords.isNotNull())
_fam_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node family array!");
if (_num_coords.isNotNull())
{
_num_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node numbering array!");
mcIdType pos;
- mcIdType const maxValue=_num_coords->getMaxValue(pos);
+ mcIdType maxValue=_num_coords->getMaxValue(pos);
if (!_rev_num_coords || _rev_num_coords->getNumberOfTuples() != (maxValue+1))
throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): inconsistent internal revert node numbering array!");
}
if (_name_coords)
_name_coords->checkNbOfTuplesAndComp(nbCoo,MED_SNAME_SIZE,"MEDFileUMesh::checkConsistency(): inconsistent internal coord name array!");
// Now sub part check:
- for (const auto & _m : _ms)
- _m->checkConsistency();
+ for (std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();
+ it != _ms.end(); it++)
+ (*it)->checkConsistency();
}
}
// For all sub-levels, numbering is either always null or with void intersection:
if (_ms.size())
{
- auto it=_ms.begin();
+ std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();
std::vector< const DataArrayIdType * > v;
- bool const voidOrNot = ((*it)->_num == nullptr);
+ bool voidOrNot = ((*it)->_num == 0);
for (it++; it != _ms.end(); it++)
- if( ((*it)->_num == nullptr) != voidOrNot )
+ if( ((*it)->_num == 0) != voidOrNot )
throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): inconsistent numbering between mesh sub-levels!");
else if (!voidOrNot)
v.push_back((*it)->_num);
_num_coords.nullify();
_rev_num_coords.nullify();
_global_num_coords.nullify();
- for (auto & _m : _ms)
+ for (std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin(); it != _ms.end(); it++)
{
- _m->_num.nullify();
- _m->_rev_num.nullify();
- _m->_global_num.nullify();
+ (*it)->_num.nullify();
+ (*it)->_rev_num.nullify();
+ (*it)->_global_num.nullify();
}
}
_num_coords.iAmATrollConstCast()->setName("");//This parameter is not discriminant for comparison
if(_name_coords.isNotNull())
_name_coords.iAmATrollConstCast()->setName("");//This parameter is not discriminant for comparison
- for(const auto & _m : _ms)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
- if(_m.isNotNull())
- _m->clearNonDiscrAttributes();
+ if((*it).isNotNull())
+ (*it)->clearNonDiscrAttributes();
}
}
void MEDFileUMesh::setName(const std::string& name)
{
- for(auto & _m : _ms)
- if(_m.isNotNull())
- _m->setName(name);
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
+ if((*it).isNotNull())
+ (*it)->setName(name);
MEDFileMesh::setName(name);
}
MEDFileUMesh::MEDFileUMesh()
-= default;
+{
+}
MEDFileUMesh::MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
try
void MEDFileMesh::loadEquivalences(med_idt fid)
{
- int const nbOfEq(MEDFileEquivalences::PresenceOfEquivalences(fid,_name));
+ int nbOfEq(MEDFileEquivalences::PresenceOfEquivalences(fid,_name));
if(nbOfEq>0)
_equiv=MEDFileEquivalences::Load(fid,nbOfEq,this);
}
void MEDFileUMesh::dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl2, const std::string& mName, MEDFileMeshReadSelector *mrs)
{
- int const lev=loaderl2.getNumberOfLevels();
+ int lev=loaderl2.getNumberOfLevels();
_ms.resize(lev);
for(int i=0;i<lev;i++)
{
if(!loaderl2.emptyLev(i))
_ms[i]=new MEDFileUMeshSplitL1(loaderl2,mName,i);
else
- _ms[i]=nullptr;
+ _ms[i]=0;
}
MEDFileMeshL2::ReadFamiliesAndGrps(fid,mName,_families,_groups,mrs);
//
}
MEDFileUMesh::~MEDFileUMesh()
-= default;
+{
+}
void MEDFileUMesh::writeMeshLL(med_idt fid) const
{
INTERP_KERNEL::AutoPtr<char> desc=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str);
MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str);
- int const spaceDim=(int)(coo?coo->getNumberOfComponents():0);
+ int spaceDim=(int)(coo?coo->getNumberOfComponents():0);
int mdim(0);
if(!_ms.empty())
mdim=getMeshDimension();
INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
for(int i=0;i<spaceDim;i++)
{
- std::string const info=coo->getInfoOnComponent(i);
+ std::string info=coo->getInfoOnComponent(i);
std::string c,u;
MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MEDFileMeshL2::TraduceAxisTypeRev(getAxisType()),comp,unit));
if(_univ_wr_status)
MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
- std::string const meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
+ std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDFileUMeshL2::WriteCoords(fid,meshName,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords,_global_num_coords);
- for(const auto & _m : _ms)
- if(_m.isNotNull())
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ if(it->isNotNull())
{
- _m->checkCoordsConsistency(coo);
- _m->write(fid,meshName,mdim);
+ (*it)->checkCoordsConsistency(coo);
+ (*it)->write(fid,meshName,mdim);
}
MEDFileUMeshL2::WriteFamiliesAndGrps(fid,meshName,_families,_groups,_too_long_str);
}
{
std::vector<int> ret;
int lev=0;
- for(auto it=_ms.begin();it!=_ms.end();it++,lev--)
- if((const MEDFileUMeshSplitL1 *)(*it)!=nullptr)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
+ if((const MEDFileUMeshSplitL1 *)(*it)!=0)
if(!(*it)->empty())
ret.push_back(lev);
return ret;
if(famCoo)
ret.push_back(1);
int lev=0;
- for(auto it=_ms.begin();it!=_ms.end();it++,lev--)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
{
const MEDFileUMeshSplitL1 *cur(*it);
if(cur)
if(_num_coords.isNotNull())
ret.push_back(1);
int lev=0;
- for(auto it=_ms.begin();it!=_ms.end();it++,lev--)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
{
const MEDFileUMeshSplitL1 *cur(*it);
if(cur)
if(nameCoo)
ret.push_back(1);
int lev=0;
- for(auto it=_ms.begin();it!=_ms.end();it++,lev--)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
{
const MEDFileUMeshSplitL1 *cur(*it);
if(cur)
std::vector<mcIdType> MEDFileUMesh::getFamsNonEmptyLevels(const std::vector<std::string>& fams) const
{
std::vector<mcIdType> ret;
- std::vector<int> const levs(getNonEmptyLevels());
- std::vector<mcIdType> const famIds(getFamiliesIds(fams));
- for(int lev : levs)
- if(_ms[-lev]->presenceOfOneFams(famIds))
- ret.push_back(lev);
+ std::vector<int> levs(getNonEmptyLevels());
+ std::vector<mcIdType> famIds(getFamiliesIds(fams));
+ for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
+ if(_ms[-(*it)]->presenceOfOneFams(famIds))
+ ret.push_back(*it);
return ret;
}
const DataArrayIdType *famCoords(_fam_coords);
if(!famCoords)
return ret0;
- std::vector<mcIdType> const famIds(getFamiliesIds(fams));
+ std::vector<mcIdType> famIds(getFamiliesIds(fams));
if(famCoords->presenceOfValue(famIds))
{
std::vector<mcIdType> ret(ret0.size()+1);
mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
if((const DataArrayIdType *)_fam_coords)
{
- mcIdType const val=_fam_coords->getMaxValue(tmp);
+ mcIdType val=_fam_coords->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
- for(const auto & _m : _ms)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
- if((const MEDFileUMeshSplitL1 *)_m)
+ if((const MEDFileUMeshSplitL1 *)(*it))
{
- const DataArrayIdType *da=_m->getFamilyField();
+ const DataArrayIdType *da=(*it)->getFamilyField();
if(da)
{
- mcIdType const val=da->getMaxValue(tmp);
+ mcIdType val=da->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
}
mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
if((const DataArrayIdType *)_fam_coords)
{
- mcIdType const val=_fam_coords->getMaxValue(tmp);
+ mcIdType val=_fam_coords->getMaxValue(tmp);
ret=std::max(ret,val);
}
- for(const auto & _m : _ms)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
- if((const MEDFileUMeshSplitL1 *)_m)
+ if((const MEDFileUMeshSplitL1 *)(*it))
{
- const DataArrayIdType *da=_m->getFamilyField();
+ const DataArrayIdType *da=(*it)->getFamilyField();
if(da)
{
- mcIdType const val=da->getMaxValue(tmp);
+ mcIdType val=da->getMaxValue(tmp);
ret=std::max(ret,val);
}
}
mcIdType ret=std::numeric_limits<mcIdType>::max(),tmp=-1;
if((const DataArrayIdType *)_fam_coords)
{
- mcIdType const val=_fam_coords->getMinValue(tmp);
+ mcIdType val=_fam_coords->getMinValue(tmp);
ret=std::min(ret,val);
}
- for(const auto & _m : _ms)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
- if((const MEDFileUMeshSplitL1 *)_m)
+ if((const MEDFileUMeshSplitL1 *)(*it))
{
- const DataArrayIdType *da=_m->getFamilyField();
+ const DataArrayIdType *da=(*it)->getFamilyField();
if(da)
{
- mcIdType const val=da->getMinValue(tmp);
+ mcIdType val=da->getMinValue(tmp);
ret=std::min(ret,val);
}
}
int MEDFileUMesh::getMeshDimension() const
{
int lev=0;
- for(auto it=_ms.begin();it!=_ms.end();it++,lev++)
- if((const MEDFileUMeshSplitL1 *)(*it)!=nullptr)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev++)
+ if((const MEDFileUMeshSplitL1 *)(*it)!=0)
return (*it)->getMeshDimension()+lev;
throw INTERP_KERNEL::Exception("MEDFileUMesh::getMeshDimension : impossible to find a mesh dimension !");
}
oss << _coords->getNumberOfTuples() << std::endl;
else
oss << MSG1 << std::endl;
- std::size_t const nbOfLev=_ms.size();
+ std::size_t nbOfLev=_ms.size();
oss << "- Number of levels allocated : " << nbOfLev << std::endl;
for(std::size_t i=0;i<nbOfLev;i++)
{
return false;
}
-mcIdType MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType /*gt*/) const
+mcIdType MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const
{
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildImplicitPartIfAny : unstructured meshes do not have implicit part !");
}
void MEDFileUMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const
{
- std::size_t const sz(st.getNumberOfItems());
+ std::size_t sz(st.getNumberOfItems());
for(std::size_t i=0;i<sz;i++)
{
- INTERP_KERNEL::NormalizedCellType const curGt(st[i].getGeo());
+ INTERP_KERNEL::NormalizedCellType curGt(st[i].getGeo());
const MEDCoupling1GTUMesh *m(getDirectUndergroundSingleGeoTypeMesh(curGt));
if(st[i].getPflName().empty())
m->computeNodeIdsAlg(nodesFetched);
if(!coords)
throw INTERP_KERNEL::Exception("MEDFileUMesh::cartesianize : coordinates are null !");
MCAuto<DataArrayDouble> coordsCart(_coords->cartesianize(getAxisType()));
- for(auto & _m : ret->_ms)
- if((const MEDFileUMeshSplitL1 *)_m)
- _m=_m->shallowCpyUsingCoords(coordsCart);
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=ret->_ms.begin();it!=ret->_ms.end();it++)
+ if((const MEDFileUMeshSplitL1 *)(*it))
+ *it=(*it)->shallowCpyUsingCoords(coordsCart);
ret->_coords=coordsCart;
ret->setAxisType(AX_CART);
return ret.retn();
bool MEDFileUMesh::presenceOfStructureElements() const
{
- for(const auto & it : _elt_str)
- if(it.isNotNull())
+ for(std::vector< MCAuto<MEDFileEltStruct4Mesh> >::const_iterator it=_elt_str.begin();it!=_elt_str.end();it++)
+ if((*it).isNotNull())
return true;
return false;
}
{
return tmp;
}
- return nullptr;
+ return 0;
}
/*!
{
checkCartesian();
synchronizeTinyInfoOnLeaves();
- std::vector<std::string> const fams2=getFamiliesOnGroups(grps);
+ std::vector<std::string> fams2=getFamiliesOnGroups(grps);
MCAuto<MEDCouplingUMesh> zeRet=getFamilies(meshDimRelToMaxExt,fams2,renum);
if(grps.size()==1 && ((MEDCouplingUMesh *)zeRet))
zeRet->setName(grps[0]);
if(!famIds.empty())
zeRet=l1->getFamilyPart(&famIds[0],&famIds[0]+famIds.size(),renum);
else
- zeRet=l1->getFamilyPart(nullptr,nullptr,renum);
+ zeRet=l1->getFamilyPart(0,0,renum);
if(fams.size()==1 && ((MEDCouplingUMesh *)zeRet))
zeRet->setName(fams[0]);
return zeRet.retn();
if(!famIds.empty())
da=_fam_coords->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
- da=_fam_coords->findIdsEqualList(nullptr,nullptr);
+ da=_fam_coords->findIdsEqualList(0,0);
if(renum)
return MEDFileUMeshSplitL1::Renumber(_num_coords,da);
else
if(!famIds.empty())
return l1->getFamilyPartArr(&famIds[0],&famIds[0]+famIds.size(),renum);
else
- return l1->getFamilyPartArr(nullptr,nullptr,renum);
+ return l1->getFamilyPartArr(0,0,renum);
}
/*!
if(!renum)
{
MEDCouplingUMesh *umesh=MEDCouplingUMesh::New();
- MCAuto<DataArrayDouble> const cc=_coords->deepCopy();
+ MCAuto<DataArrayDouble> cc=_coords->deepCopy();
umesh->setCoords(cc);
MEDFileUMeshSplitL1::ClearNonDiscrAttributes(umesh);
umesh->setName(getName());
*/
void MEDFileUMesh::declarePartsUpdated() const
{
- for(const auto & _m : _ms)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
- const MEDFileUMeshSplitL1 *elt(_m);
+ const MEDFileUMeshSplitL1 *elt(*it);
if(elt)
elt->declarePartsUpdated();
}
*/
void MEDFileUMesh::forceComputationOfParts() const
{
- for(const auto & _m : _ms)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
- const MEDFileUMeshSplitL1 *elt(_m);
+ const MEDFileUMeshSplitL1 *elt(*it);
if(elt)
elt->forceComputationOfParts();
}
{
checkCartesian();
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(gt));
- int const lev=(int)cm.getDimension()-getMeshDimension();
+ int lev=(int)cm.getDimension()-getMeshDimension();
const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe(lev));
return sp->getDirectUndergroundSingleGeoTypeMesh(gt);
}
{
std::vector< std::pair<int,mcIdType> > ret;
std::vector<int> nel(getNonEmptyLevels());
- for(auto it=nel.rbegin();it!=nel.rend();it++)
+ for(std::vector<int>::reverse_iterator it=nel.rbegin();it!=nel.rend();it++)
{
- std::vector<INTERP_KERNEL::NormalizedCellType> const gt(getGeoTypesAtLevel(*it));
- for(auto it1 : gt)
+ std::vector<INTERP_KERNEL::NormalizedCellType> gt(getGeoTypesAtLevel(*it));
+ for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it1=gt.begin();it1!=gt.end();it1++)
{
- mcIdType const nbCells(getNumberOfCellsWithType(it1));
- ret.push_back(std::pair<int,mcIdType>(it1,nbCells));
+ mcIdType nbCells(getNumberOfCellsWithType(*it1));
+ ret.push_back(std::pair<int,mcIdType>(*it1,nbCells));
}
}
ret.push_back(std::pair<int,mcIdType>(INTERP_KERNEL::NORM_ERROR,getNumberOfNodes()));
DataArrayIdType *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
- int const lev=(int)cm.getDimension()-getMeshDimension();
+ int lev=(int)cm.getDimension()-getMeshDimension();
const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe(lev));
return sp->extractFamilyFieldOnGeoType(gt);
}
DataArrayIdType *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
- int const lev=(int)cm.getDimension()-getMeshDimension();
+ int lev=(int)cm.getDimension()-getMeshDimension();
const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe(lev));
return sp->extractNumberFieldOnGeoType(gt);
}
int MEDFileUMesh::getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
- int const ret((int)cm.getDimension()-getMeshDimension());
+ int ret((int)cm.getDimension()-getMeshDimension());
getMeshAtLevSafe(ret);//To test that returned value corresponds to a valid level.
return ret;
}
throw INTERP_KERNEL::Exception("Dimension request is invalid : asking for node level (1) !");
if(meshDimRelToMaxExt>1)
throw INTERP_KERNEL::Exception("Dimension request is invalid (>1) !");
- int const tracucedRk=-meshDimRelToMaxExt;
+ int tracucedRk=-meshDimRelToMaxExt;
if(tracucedRk>=(int)_ms.size())
throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !");
- if((const MEDFileUMeshSplitL1 *)_ms[tracucedRk]==nullptr)
+ if((const MEDFileUMeshSplitL1 *)_ms[tracucedRk]==0)
throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !");
return _ms[tracucedRk];
}
throw INTERP_KERNEL::Exception("Dimension request is invalid : asking for node level (1) !");
if(meshDimRelToMaxExt>1)
throw INTERP_KERNEL::Exception("Dimension request is invalid (>1) !");
- int const tracucedRk=-meshDimRelToMaxExt;
+ int tracucedRk=-meshDimRelToMaxExt;
if(tracucedRk>=(int)_ms.size())
throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !");
- if((const MEDFileUMeshSplitL1 *)_ms[tracucedRk]==nullptr)
+ if((const MEDFileUMeshSplitL1 *)_ms[tracucedRk]==0)
throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !");
return _ms[tracucedRk];
}
if(-meshDimRelToMax>=(int)_ms.size())
throw INTERP_KERNEL::Exception("MEDFileUMesh::checkMeshDimCoherency : The meshdim of mesh is not managed by 'this' !");
int i=0;
- for(auto it=_ms.begin();it!=_ms.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++)
{
- if(((const MEDFileUMeshSplitL1*) (*it))!=nullptr)
+ if(((const MEDFileUMeshSplitL1*) (*it))!=0)
{
- int const ref=(*it)->getMeshDimension();
+ int ref=(*it)->getMeshDimension();
if(ref+i!=meshDim-meshDimRelToMax)
throw INTERP_KERNEL::Exception("MEDFileUMesh::checkMeshDimCoherency : no coherency between levels !");
}
if(coords==(DataArrayDouble *)_coords)
return ;
coords->checkAllocated();
- mcIdType const nbOfTuples(coords->getNumberOfTuples());
+ mcIdType nbOfTuples(coords->getNumberOfTuples());
_coords.takeRef(coords);
_fam_coords=DataArrayIdType::New();
_fam_coords->alloc(nbOfTuples,1);
_fam_coords->fillWithZero();
_num_coords.nullify(); _rev_num_coords.nullify(); _name_coords.nullify(); _global_num_coords.nullify();
- for(auto & _m : _ms)
- if((MEDFileUMeshSplitL1 *)_m)
- _m->setCoords(coords);
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
+ if((MEDFileUMeshSplitL1 *)(*it))
+ (*it)->setCoords(coords);
}
/*!
if(coords==(DataArrayDouble *)_coords)
return ;
coords->checkAllocated();
- mcIdType const nbOfTuples(coords->getNumberOfTuples());
+ mcIdType nbOfTuples(coords->getNumberOfTuples());
if(_coords.isNull())
{
_coords=coords;
}
else
{
- mcIdType const oldNbTuples(_coords->getNumberOfTuples());
+ mcIdType oldNbTuples(_coords->getNumberOfTuples());
if(oldNbTuples!=nbOfTuples)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setCoordsForced : number of tuples is not the same -> invoke setCoords instead !");
_coords=coords;
coords->incrRef();
}
- for(auto & _m : _ms)
- if((MEDFileUMeshSplitL1 *)_m)
- _m->setCoords(coords);
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
+ if((MEDFileUMeshSplitL1 *)(*it))
+ (*it)->setCoords(coords);
}
/*!
*/
void MEDFileUMesh::optimizeFamilies()
{
- std::vector<int> const levs=getNonEmptyLevelsExt();
+ std::vector<int> levs=getNonEmptyLevelsExt();
std::set<mcIdType> allFamsIds;
- for(int const lev : levs)
+ for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
- const DataArrayIdType *ffield=getFamilyFieldAtLevel(lev);
+ const DataArrayIdType *ffield=getFamilyFieldAtLevel(*it);
MCAuto<DataArrayIdType> ids=ffield->getDifferentValues();
std::set<mcIdType> res;
std::set_union(ids->begin(),ids->end(),allFamsIds.begin(),allFamsIds.end(),std::inserter(res,res.begin()));
if(allFamsIds.find((*it).second)!=allFamsIds.end())
famNamesToKill.insert((*it).first);
}
- for(const auto & it : famNamesToKill)
- _families.erase(it);
- std::vector<std::string> const grpNamesToKill;
- for(auto & _group : _groups)
+ for(std::set<std::string>::const_iterator it=famNamesToKill.begin();it!=famNamesToKill.end();it++)
+ _families.erase(*it);
+ std::vector<std::string> grpNamesToKill;
+ for(std::map<std::string, std::vector<std::string> >::iterator it=_groups.begin();it!=_groups.end();it++)
{
std::vector<std::string> tmp;
- for(const auto & it2 : _group.second)
+ for(std::vector<std::string>::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++)
{
- if(famNamesToKill.find(it2)==famNamesToKill.end())
- tmp.push_back(it2);
+ if(famNamesToKill.find(*it2)==famNamesToKill.end())
+ tmp.push_back(*it2);
}
if(!tmp.empty())
- _group.second=tmp;
+ (*it).second=tmp;
else
- tmp.push_back(_group.first);
+ tmp.push_back((*it).first);
}
- for(const auto & it : grpNamesToKill)
- _groups.erase(it);
+ for(std::vector<std::string>::const_iterator it=grpNamesToKill.begin();it!=grpNamesToKill.end();it++)
+ _groups.erase(*it);
}
/**
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : This method works only for mesh defined on level 0 and -1 !");
MUMesh m0=getMeshAtLevel(0);
MUMesh m1=getMeshAtLevel(-1);
- mcIdType const nbNodes=m0->getNumberOfNodes();
+ mcIdType nbNodes=m0->getNumberOfNodes();
MUMesh m11=getGroup(-1,grpNameM1);
- DataArrayIdType *tmp00=nullptr, *tmp11=nullptr,*tmp22=nullptr;
+ DataArrayIdType *tmp00=0, *tmp11=0,*tmp22=0;
// !!! The core of the duplication logic is in these 2 methods:
// !!!
// node renumbering of cells in m1 impacted by duplication of node but not in group 'grpNameM1' on level -1
DAInt descTmp0=DataArrayIdType::New(),descITmp0=DataArrayIdType::New(),revDescTmp0=DataArrayIdType::New(),revDescITmp0=DataArrayIdType::New();
MUMesh tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0);
- descTmp0=nullptr; descITmp0=nullptr; revDescTmp0=nullptr; revDescITmp0=nullptr;
+ descTmp0=0; descITmp0=0; revDescTmp0=0; revDescITmp0=0;
DAInt cellsInM1ToRenumW2=tmp0Desc->getCellIdsLyingOnNodes(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),false);
MUMesh cellsInM1ToRenumW3=static_cast<MEDCouplingUMesh *>(tmp0Desc->buildPartOfMySelf(cellsInM1ToRenumW2->begin(),cellsInM1ToRenumW2->end(),true));
- DataArrayIdType *cellsInM1ToRenumW4Tmp=nullptr;
+ DataArrayIdType *cellsInM1ToRenumW4Tmp=0;
m1->areCellsIncludedIn(cellsInM1ToRenumW3,2,cellsInM1ToRenumW4Tmp);
DAInt cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp);
DAInt cellsInM1ToRenumW5=cellsInM1ToRenumW4->findIdsInRange(0,m1->getNumberOfCells());
else
idd=getMinFamilyId()-1;
mcIdType globStart=0,start=0,end,globEnd;
- mcIdType const nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples();
+ mcIdType nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples();
for(mcIdType i=0;i<nbOfChunks;i++)
{
globEnd=globStart+szOfCellGrpOfSameType->getIJ(i,0);
fam=_fam_coords;
if(fam)
{
- mcIdType const newNbOfNodes=getCoords()->getNumberOfTuples();
+ mcIdType newNbOfNodes=getCoords()->getNumberOfTuples();
newFam=DataArrayIdType::New(); newFam->alloc(newNbOfNodes,1);
newFam->setPartOfValues1(fam,0,nbNodes,1,0,1,1,true);
newFam->setPartOfValuesSimple1(0,nbNodes,newNbOfNodes,1,0,1,1);
_num_coords.nullify(); _rev_num_coords.nullify(); _global_num_coords.nullify();
- for (auto & _m : _ms)
+ for (std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();
+ it != _ms.end(); it++)
{
- _m->_num = nullptr;
- _m->_rev_num = nullptr;
+ (*it)->_num = 0;
+ (*it)->_rev_num = 0;
}
nodesDuplicated=nodeIdsToDuplicate.retn();
cellsModified=cellsToModifyConn0.retn();
*/
bool MEDFileUMesh::unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell)
{
- o2nRenumCell=nullptr; oldCode.clear(); newCode.clear();
+ o2nRenumCell=0; oldCode.clear(); newCode.clear();
std::vector<int> levs=getNonEmptyLevels();
bool ret=false;
std::vector< const DataArrayIdType* > renumCellsSplited;//same than memorySaverIfThrow
std::vector< MCAuto<DataArrayIdType> > memorySaverIfThrow;//same than renumCellsSplited only in case of throw
mcIdType start=0;
mcIdType end=0;
- for(auto it=levs.rbegin();it!=levs.rend();it++)
+ for(std::vector<int>::reverse_iterator it=levs.rbegin();it!=levs.rend();it++)
{
MCAuto<MEDCouplingUMesh> m=getMeshAtLevel(*it);
std::vector<mcIdType> code1=m->getDistributionOfTypes();
end=PutInThirdComponentOfCodeOffset(code1,start);
oldCode.insert(oldCode.end(),code1.begin(),code1.end());
- bool const hasChanged=m->unPolyze();
- DataArrayIdType *fake=nullptr;
+ bool hasChanged=m->unPolyze();
+ DataArrayIdType *fake=0;
MCAuto<DataArrayIdType> o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER,
MEDCouplingUMesh::MEDMEM_ORDER+MEDCouplingUMesh::N_MEDMEM_ORDER,fake);
fake->decrRef();
/*! \cond HIDDEN_ITEMS */
struct MEDLoaderAccVisit1
{
- MEDLoaderAccVisit1() = default;
+ MEDLoaderAccVisit1():_new_nb_of_nodes(0) { }
mcIdType operator()(bool val) { return val?_new_nb_of_nodes++:-1; }
- mcIdType _new_nb_of_nodes{0};
+ mcIdType _new_nb_of_nodes;
};
/*! \endcond */
const DataArrayDouble *coo(getCoords());
if(!coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::zipCoords : no coordinates set in this !");
- mcIdType const nbOfNodes(coo->getNumberOfTuples());
+ mcIdType nbOfNodes(coo->getNumberOfTuples());
std::vector<bool> nodeIdsInUse(nbOfNodes,false);
- std::vector<int> const neLevs(getNonEmptyLevels());
- for(int const neLev : neLevs)
+ std::vector<int> neLevs(getNonEmptyLevels());
+ for(std::vector<int>::const_iterator lev=neLevs.begin();lev!=neLevs.end();lev++)
{
- const MEDFileUMeshSplitL1 *zeLev(getMeshAtLevSafe(neLev));
+ const MEDFileUMeshSplitL1 *zeLev(getMeshAtLevSafe(*lev));
if(zeLev->isMeshStoredSplitByType())
{
- std::vector<MEDCoupling1GTUMesh *> const ms(zeLev->getDirectUndergroundSingleGeoTypeMeshes());
- for(auto m : ms)
- if(m)
- m->computeNodeIdsAlg(nodeIdsInUse);
+ std::vector<MEDCoupling1GTUMesh *> ms(zeLev->getDirectUndergroundSingleGeoTypeMeshes());
+ for(std::vector<MEDCoupling1GTUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++)
+ if(*it)
+ (*it)->computeNodeIdsAlg(nodeIdsInUse);
}
else
{
mesh->computeNodeIdsAlg(nodeIdsInUse);
}
}
- auto nbrOfNodesInUse((mcIdType)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true));
+ mcIdType nbrOfNodesInUse((mcIdType)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true));
if(nbrOfNodesInUse==nbOfNodes)
- return nullptr;//no need to update _part_coords
+ return 0;//no need to update _part_coords
MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(nbOfNodes,1);
std::transform(nodeIdsInUse.begin(),nodeIdsInUse.end(),ret->getPointer(),MEDLoaderAccVisit1());
MCAuto<DataArrayIdType> ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse));
- MCAuto<DataArrayDouble> const newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end()));
+ MCAuto<DataArrayDouble> newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end()));
MCAuto<DataArrayIdType> newFamCoords;
MCAuto<DataArrayAsciiChar> newNameCoords;
if((const DataArrayIdType *)_fam_coords)
if(_name_coords.isNotNull())
newNameCoords=static_cast<DataArrayAsciiChar *>(_name_coords->selectByTupleIdSafe(ret2->begin(),ret2->end()));
_coords=newCoords; _fam_coords=newFamCoords; _num_coords=newNumCoords; _global_num_coords=newGlobalNumCoords; _name_coords=newNameCoords; _rev_num_coords.nullify();
- for(auto & _m : _ms)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
{
- if((MEDFileUMeshSplitL1*)_m)
+ if((MEDFileUMeshSplitL1*)*it)
{
- _m->renumberNodesInConn(ret->begin());
- _m->setCoords(_coords);
+ (*it)->renumberNodesInConn(ret->begin());
+ (*it)->setCoords(_coords);
}
}
// updates _part_coords
*/
DataArrayIdType *MEDFileUMesh::computeFetchedNodeIds() const
{
- std::vector<int> const neLevs(this->getNonEmptyLevels());
+ std::vector<int> neLevs(this->getNonEmptyLevels());
std::vector<bool> nodesHighlighted(this->getNumberOfNodes(),false);
for(auto lev : neLevs)
{
{
std::vector<int> levs(getNonEmptyLevels());
std::vector<bool> fetchedNodes(getNumberOfNodes(),false);
- for(const auto & it : extractDef)
+ for(std::map<int, MCAuto<DataArrayIdType> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
{
- if(it.first>1)
+ if((*it).first>1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid key ! Must be <=1 !");
- if(it.second.isNull())
+ if((*it).second.isNull())
throw INTERP_KERNEL::Exception("MEDFileUMesh::deduceNodeSubPartFromCellSubPart : presence of a value with null pointer !");
- if(it.first==1)
+ if((*it).first==1)
continue;
- if(std::find(levs.begin(),levs.end(),it.first)==levs.end())
+ if(std::find(levs.begin(),levs.end(),(*it).first)==levs.end())
{
- std::ostringstream oss; oss << "MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid level " << it.first << " ! Not present in this !";
+ std::ostringstream oss; oss << "MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid level " << (*it).first << " ! Not present in this !";
throw INTERP_KERNEL::Exception(oss.str());
}
- MCAuto<MEDCouplingUMesh> m(getMeshAtLevel(it.first));
- MCAuto<MEDCouplingUMesh> mPart(m->buildPartOfMySelf(it.second->begin(),it.second->end(),true));
+ MCAuto<MEDCouplingUMesh> m(getMeshAtLevel((*it).first));
+ MCAuto<MEDCouplingUMesh> mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true));
mPart->computeNodeIdsAlg(fetchedNodes);
}
return DataArrayIdType::BuildListOfSwitchedOn(fetchedNodes);
{
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New()); ret->setName(getName()); ret->copyFamGrpMapsFrom(*this);
std::vector<int> levs(getNonEmptyLevels());
- for(const auto & it : extractDef)
+ for(std::map<int, MCAuto<DataArrayIdType> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
{
- if(it.first>1)
+ if((*it).first>1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : invalid key ! Must be <=1 !");
- if(it.second.isNull())
+ if((*it).second.isNull())
throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : presence of a value with null pointer !");
- if(it.first==1)
+ if((*it).first==1)
continue;
- if(std::find(levs.begin(),levs.end(),it.first)==levs.end())
+ if(std::find(levs.begin(),levs.end(),(*it).first)==levs.end())
{
- std::ostringstream oss; oss << "MEDFileUMesh::extractPart : invalid level " << it.first << " ! Not present in this !";
+ std::ostringstream oss; oss << "MEDFileUMesh::extractPart : invalid level " << (*it).first << " ! Not present in this !";
throw INTERP_KERNEL::Exception(oss.str());
}
- MCAuto<MEDCouplingUMesh> m(getMeshAtLevel(it.first));
- MCAuto<MEDCouplingUMesh> mPart(m->buildPartOfMySelf(it.second->begin(),it.second->end(),true));
- ret->setMeshAtLevel(it.first,mPart);
- const DataArrayIdType *fam(getFamilyFieldAtLevel(it.first)),*num(getNumberFieldAtLevel(it.first));
+ MCAuto<MEDCouplingUMesh> m(getMeshAtLevel((*it).first));
+ MCAuto<MEDCouplingUMesh> mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true));
+ ret->setMeshAtLevel((*it).first,mPart);
+ const DataArrayIdType *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first));
if(fam)
{
- MCAuto<DataArrayIdType> famPart(fam->selectByTupleIdSafe(it.second->begin(),it.second->end()));
- ret->setFamilyFieldArr(it.first,famPart);
+ MCAuto<DataArrayIdType> famPart(fam->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
+ ret->setFamilyFieldArr((*it).first,famPart);
}
if(num)
{
- MCAuto<DataArrayIdType> numPart(num->selectByTupleIdSafe(it.second->begin(),it.second->end()));
- ret->setFamilyFieldArr(it.first,numPart);
+ MCAuto<DataArrayIdType> numPart(num->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
+ ret->setFamilyFieldArr((*it).first,numPart);
}
}
- auto const it2(extractDef.find(1));
+ std::map<int, MCAuto<DataArrayIdType> >::const_iterator it2(extractDef.find(1));
if(it2!=extractDef.end())
{
const DataArrayDouble *coo(ret->getCoords());
MCAuto<DataArrayIdType> numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
ret->setFamilyFieldArr(1,numPart);
}
- for(const auto & it3 : extractDef)
+ for(std::map<int, MCAuto<DataArrayIdType> >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++)
{
- if(it3.first==1)
+ if((*it3).first==1)
continue;
- MCAuto<MEDCouplingUMesh> m(ret->getMeshAtLevel(it3.first));
+ MCAuto<MEDCouplingUMesh> m(ret->getMeshAtLevel((*it3).first));
m->renumberNodesInConn(o2nNodes->begin());
- ret->setMeshAtLevel(it3.first,m);
+ ret->setMeshAtLevel((*it3).first,m);
}
}
return ret.retn();
m1D->checkConsistencyLight();
if(m1D->getMeshDimension()!=1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : input mesh must have a mesh dimension equal to one !");
- mcIdType const nbRep(m1D->getNumberOfCells());
+ mcIdType nbRep(m1D->getNumberOfCells());
std::vector<int> levs(getNonEmptyLevels());
- std::vector<std::string> const grps(getGroupsNames());
+ std::vector<std::string> grps(getGroupsNames());
std::vector< MCAuto<MEDCouplingUMesh> > zeList;
- DataArrayDouble *coords(nullptr);
- std::size_t const nbOfLevsOut(levs.size()+1);
+ DataArrayDouble *coords(0);
+ std::size_t nbOfLevsOut(levs.size()+1);
std::vector< MCAuto<DataArrayIdType> > o2ns(nbOfLevsOut);
- for(int const lev : levs)
+ for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
- MCAuto<MEDCouplingUMesh> item(getMeshAtLevel(lev));
+ MCAuto<MEDCouplingUMesh> item(getMeshAtLevel(*lev));
item=item->clone(false);
- item->changeSpaceDimension(3+lev,0.);//no problem non const but change DataArrayDouble for coordinates do not alter data
+ item->changeSpaceDimension(3+(*lev),0.);//no problem non const but change DataArrayDouble for coordinates do not alter data
MCAuto<MEDCouplingUMesh> tmp(static_cast<MEDCouplingUMesh *>(m1D->deepCopy()));
- tmp->changeSpaceDimension(3+lev,0.);
+ tmp->changeSpaceDimension(3+(*lev),0.);
MCAuto<MEDCouplingUMesh> elt(item->buildExtrudedMesh(tmp,policy));
zeList.push_back(elt);
- if(lev==0)
+ if(*lev==0)
coords=elt->getCoords();
}
if(!coords)
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : internal error !");
- for(auto & it : zeList)
+ for(std::vector< MCAuto<MEDCouplingUMesh> >::iterator it=zeList.begin();it!=zeList.end();it++)
{
- it->setName(getName());
- it->setCoords(coords);
+ (*it)->setName(getName());
+ (*it)->setCoords(coords);
}
for(std::size_t ii=0;ii!=zeList.size();ii++)
{
- int const lev(levs[ii]);
+ int lev(levs[ii]);
MCAuto<MEDCouplingUMesh> elt(zeList[ii]);
if(lev<=-1)
{
//
for(std::size_t ii=0;ii!=zeList.size();ii++)
{
- int const lev(levs[ii]);
+ int lev(levs[ii]);
std::vector< MCAuto<DataArrayIdType> > outGrps;
std::vector< const DataArrayIdType * > outGrps2;
if(lev<=-1)
{
- for(const auto & grp : grps)
+ for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MCAuto<DataArrayIdType> grpArr(getGroupArr(lev+1,grp));
+ MCAuto<DataArrayIdType> grpArr(getGroupArr(lev+1,*grp));
if(!grpArr->empty())
{
MCAuto<DataArrayIdType> grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy());
- mcIdType const offset0(zeList[ii]->getNumberOfCells());
- mcIdType const offset1(offset0+getNumberOfCellsAtLevel(lev+1));
+ mcIdType offset0(zeList[ii]->getNumberOfCells());
+ mcIdType offset1(offset0+getNumberOfCellsAtLevel(lev+1));
grpArr1->applyLin(1,offset0); grpArr2->applyLin(1,offset1);
std::ostringstream oss; oss << grpArr2->getName() << "_top";
grpArr2->setName(oss.str());
}
}
//
- for(const auto & grp : grps)
+ for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MCAuto<DataArrayIdType> grpArr(getGroupArr(lev,grp));
+ MCAuto<DataArrayIdType> grpArr(getGroupArr(lev,*grp));
if(!grpArr->empty())
{
- mcIdType const nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev));
+ mcIdType nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev));
std::vector< MCAuto<DataArrayIdType> > grpArrs(nbRep);
std::vector< const DataArrayIdType *> grpArrs2(nbRep);
for(int iii=0;iii<nbRep;iii++)
}
MCAuto<DataArrayIdType> grpArrExt(DataArrayIdType::Aggregate(grpArrs2));
grpArrExt->transformWithIndArr(o2ns[ii]->begin(),o2ns[ii]->end());
- std::ostringstream grpName; grpName << grp << "_extruded";
+ std::ostringstream grpName; grpName << *grp << "_extruded";
grpArrExt->setName(grpName.str());
outGrps.push_back(grpArrExt);
outGrps2.push_back(grpArrExt);
}
std::vector< MCAuto<DataArrayIdType> > outGrps;
std::vector< const DataArrayIdType * > outGrps2;
- for(const auto & grp : grps)
+ for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MCAuto<DataArrayIdType> grpArr1(getGroupArr(levs.back(),grp));
+ MCAuto<DataArrayIdType> grpArr1(getGroupArr(levs.back(),*grp));
if(grpArr1->empty())
continue;
MCAuto<DataArrayIdType> grpArr2(grpArr1->deepCopy());
- std::ostringstream grpName; grpName << grp << "_top";
+ std::ostringstream grpName; grpName << *grp << "_top";
grpArr2->setName(grpName.str());
grpArr2->applyLin(1,getNumberOfCellsAtLevel(levs.back()));
outGrps.push_back(grpArr1); outGrps.push_back(grpArr2);
{
checkCartesian();
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
- mcIdType const initialNbNodes(getNumberOfNodes());
+ mcIdType initialNbNodes(getNumberOfNodes());
MCAuto<MEDCouplingUMesh> m0Tmp(getMeshAtLevel(0));
MCAuto<MEDCouplingUMesh> m0(dynamic_cast<MEDCouplingUMesh *>(m0Tmp->deepCopy()));
{
- MCAuto<DataArrayIdType> const notUsed(m0->convertLinearCellsToQuadratic(conversionType));
+ MCAuto<DataArrayIdType> notUsed(m0->convertLinearCellsToQuadratic(conversionType));
}
DataArrayDouble *zeCoords(m0->getCoords());
ret->setMeshAtLevel(0,m0);
- std::vector<int> const levs(getNonEmptyLevels());
+ std::vector<int> levs(getNonEmptyLevels());
const DataArrayIdType *famField(getFamilyFieldAtLevel(0));
if(famField)
{
}
ret->copyFamGrpMapsFrom(*this);
MCAuto<DataArrayDouble> partZeCoords(zeCoords->selectByTupleIdSafeSlice(initialNbNodes,zeCoords->getNumberOfTuples(),1));
- for(int const lev : levs)
+ for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
- if(lev==0)
+ if(*lev==0)
continue;
- MCAuto<MEDCouplingUMesh> m1Tmp(getMeshAtLevel(lev));
+ MCAuto<MEDCouplingUMesh> m1Tmp(getMeshAtLevel(*lev));
MCAuto<MEDCouplingUMesh> m1(dynamic_cast<MEDCouplingUMesh *>(m1Tmp->deepCopy()));
if(m1->getMeshDimension()!=0)
{
{
- MCAuto<DataArrayIdType> const notUsed(m1->convertLinearCellsToQuadratic(conversionType));
+ MCAuto<DataArrayIdType> notUsed(m1->convertLinearCellsToQuadratic(conversionType));
}//kill unused notUsed var
MCAuto<DataArrayDouble> m1Coords(m1->getCoords()->selectByTupleIdSafeSlice(initialNbNodes,m1->getNumberOfNodes(),1));
- DataArrayIdType *b(nullptr);
- bool const a(partZeCoords->areIncludedInMe(m1Coords,eps,b));
- MCAuto<DataArrayIdType> const bSafe(b);
+ DataArrayIdType *b(0);
+ bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b));
+ MCAuto<DataArrayIdType> bSafe(b);
if(!a)
{
- std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << lev << " problem to identify nodes generated !";
+ std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << *lev << " problem to identify nodes generated !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
b->applyLin(1,initialNbNodes);
m1->renumberNodesInConn(renum->begin());
}
m1->setCoords(zeCoords);
- ret->setMeshAtLevel(lev,m1);
- famField=getFamilyFieldAtLevel(lev);
+ ret->setMeshAtLevel(*lev,m1);
+ famField=getFamilyFieldAtLevel(*lev);
if(famField)
{
MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
- ret->setFamilyFieldArr(lev,famFieldCpy);
+ ret->setFamilyFieldArr(*lev,famFieldCpy);
}
}
return ret.retn();
m0->zipCoords();
DataArrayDouble *zeCoords(m0->getCoords());
ret->setMeshAtLevel(0,m0);
- std::vector<int> const levs(getNonEmptyLevels());
+ std::vector<int> levs(getNonEmptyLevels());
const DataArrayIdType *famField(getFamilyFieldAtLevel(0));
if(famField)
{
ret->setFamilyFieldArr(1,fam);
}
ret->copyFamGrpMapsFrom(*this);
- for(int const lev : levs)
+ for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
- if(lev==0)
+ if(*lev==0)
continue;
- MCAuto<MEDCouplingUMesh> m1Tmp(getMeshAtLevel(lev));
+ MCAuto<MEDCouplingUMesh> m1Tmp(getMeshAtLevel(*lev));
MCAuto<MEDCouplingUMesh> m1(dynamic_cast<MEDCouplingUMesh *>(m1Tmp->deepCopy()));
m1->convertQuadraticCellsToLinear();
m1->zipCoords();
- DataArrayIdType *b(nullptr);
- bool const a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b));
- MCAuto<DataArrayIdType> const bSafe(b);
+ DataArrayIdType *b(0);
+ bool a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b));
+ MCAuto<DataArrayIdType> bSafe(b);
if(!a)
{
- std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << lev << " problem to identify nodes generated !";
+ std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << *lev << " problem to identify nodes generated !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
m1->renumberNodesInConn(b->begin());
m1->setCoords(zeCoords);
- ret->setMeshAtLevel(lev,m1);
- famField=getFamilyFieldAtLevel(lev);
+ ret->setMeshAtLevel(*lev,m1);
+ famField=getFamilyFieldAtLevel(*lev);
if(famField)
{
MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
- ret->setFamilyFieldArr(lev,famFieldCpy);
+ ret->setFamilyFieldArr(*lev,famFieldCpy);
}
}
return ret.retn();
}
const MEDFileUMesh *ref(meshes[0]);
int spaceDim(ref->getSpaceDimension()),meshDim(ref->getMeshDimension());
- std::vector<int> const levs(ref->getNonEmptyLevels());
+ std::vector<int> levs(ref->getNonEmptyLevels());
std::map<int, std::vector<const DataArrayIdType *> > m_fam,m_renum;
std::map<int, std::vector< MCAuto< MEDCouplingUMesh > > > m_mesh2;
std::map<int, std::vector<const MEDCouplingUMesh *> > m_mesh;
for(const auto& it3 : locMap1)
{
const std::string& famName = it3.first;
- mcIdType const famNum = it3.second;
+ mcIdType famNum = it3.second;
if (famNumMap_rev.count(famNum) || famNumMap.count(famName)) // Family number, or family name is already used!
{
bool needsRenum = true;
fam_conflict = true;
std::ostringstream oss;
oss << "Family_" << --min_fam_num; // New ID
- std::string const new_name(oss.str());
+ std::string new_name(oss.str());
substitute[famName] = new_name;
substituteN[famNum] = min_fam_num;
famNumMap[new_name] = min_fam_num;
for(const auto& level : levs)
{
- MCAuto<MEDCouplingUMesh> const locMesh(msh->getMeshAtLevel(level));
+ MCAuto<MEDCouplingUMesh> locMesh(msh->getMeshAtLevel(level));
m_mesh[level].push_back(locMesh); m_mesh2[level].push_back(locMesh);
m_renum[level].push_back(msh->getNumberFieldAtLevel(level));
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
MCAuto<DataArrayDouble> coo(DataArrayDouble::Aggregate(coos));
ret->setCoords(coo);
- if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayIdType *)nullptr)==fam_coos.end())
+ if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayIdType *)0)==fam_coos.end())
{
MCAuto<DataArrayIdType> fam_coo(DataArrayIdType::Aggregate(fam_coos));
ret->setFamilyFieldArr(1,fam_coo);
}
- if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayIdType *)nullptr)==num_coos.end())
+ if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayIdType *)0)==num_coos.end())
{
MCAuto<DataArrayIdType> num_coo(DataArrayIdType::Aggregate(num_coos));
ret->setRenumFieldArr(1,num_coo);
MCAuto<MEDCouplingUMesh> m3D(getMeshAtLevel(0)),m2D(getMeshAtLevel(-1));
if(m3D.isNull() || m2D.isNull())
throw INTERP_KERNEL::Exception("MEDFileUMesh::convertToExtrudedMesh : this must be defined both at level 0 and level -1 !");
- mcIdType const zeId(std::numeric_limits<med_int>::max()-getFamilyId(GetSpeStr4ExtMesh()));
+ mcIdType zeId(std::numeric_limits<med_int>::max()-getFamilyId(GetSpeStr4ExtMesh()));
MCAuto<MEDCouplingMappedExtrudedMesh> ret(MEDCouplingMappedExtrudedMesh::New(m3D,m2D,zeId));
return ret.retn();
}
{
clearNonDiscrAttributes();
forceComputationOfParts();
- tinyDouble.clear(); tinyInt.clear(); tinyStr.clear(); bigArraysI.clear(); bigArrayD=nullptr;
+ tinyDouble.clear(); tinyInt.clear(); tinyStr.clear(); bigArraysI.clear(); bigArrayD=0;
std::vector<mcIdType> layer0;
layer0.push_back(getAxisType());//0 i
layer0.push_back(_order); //1 i
}
_fam_coords=bigArraysI.back(); bigArraysI.pop_back();
_num_coords=bigArraysI.back(); bigArraysI.pop_back();
- _part_coords=nullptr;
+ _part_coords=0;
mcIdType isPd(layer0.back()); layer0.pop_back();
if(isPd!=-1)
{
for(mcIdType i=0;i<nbLevs;i++)
{
mcIdType lev(levs[i]);
- mcIdType const pos(-lev);
+ mcIdType pos(-lev);
_ms[pos]=MEDFileUMeshSplitL1::Unserialize(_name,_coords,layer1,bigArraysI);
}
}
const DataArrayDouble *coords(_coords);
if(!coords)
throw INTERP_KERNEL::Exception("MEDFileUMesh::addNodeGroup : no coords set !");
- mcIdType const nbOfNodes(coords->getNumberOfTuples());
+ mcIdType nbOfNodes(coords->getNumberOfTuples());
if(_fam_coords.isNull())
{ _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); }
//
*/
void MEDFileUMesh::setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName)
{
- std::string const oldName=getFamilyNameGivenId(id);
+ std::string oldName=getFamilyNameGivenId(id);
_families.erase(oldName);
_families[newFamName]=id;
}
std::vector<int>::const_iterator it=std::find(levSet.begin(),levSet.end(),meshDimRelToMax);
if(it==levSet.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::removeMeshAtLevel : the requested level is not existing !");
- int const pos=(-meshDimRelToMax);
- _ms[pos]=nullptr;
+ int pos=(-meshDimRelToMax);
+ _ms[pos]=0;
}
/*!
*/
void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m)
{
- MCAuto<MEDFileUMeshSplitL1> const elt(new MEDFileUMeshSplitL1(m));
+ MCAuto<MEDFileUMeshSplitL1> elt(new MEDFileUMeshSplitL1(m));
checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt;
}
*/
void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld)
{
- MCAuto<MEDFileUMeshSplitL1> const elt(new MEDFileUMeshSplitL1(m,newOrOld));
+ MCAuto<MEDFileUMeshSplitL1> elt(new MEDFileUMeshSplitL1(m,newOrOld));
checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt;
}
std::vector<int> levSet=getNonEmptyLevels();
if(std::find(levSet.begin(),levSet.end(),meshDimRelToMax)==levSet.end())
{
- if((DataArrayDouble *)_coords==nullptr)
+ if((DataArrayDouble *)_coords==0)
{
DataArrayDouble *c=m->getCoords();
if(c)
}
if(m->getCoords()!=_coords)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setMeshAtLevel : Invalid Given Mesh ! The coordinates are not the same ! try to use tryToShareSameCoords !");
- int const sz=(-meshDimRelToMax)+1;
+ int sz=(-meshDimRelToMax)+1;
if(sz>=(int)_ms.size())
_ms.resize(sz);
checkMeshDimCoherency(m->getMeshDimension(),meshDimRelToMax);
const MEDCouplingUMesh *mRef=ms[0];
if(!mRef)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setMeshes : null instance in the first element of input meshes !");
- std::string const name(mRef->getName());
+ std::string name(mRef->getName());
const DataArrayDouble *coo(mRef->getCoords());
std::set<int> s;
int zeDim=-1;
{
if(ms.empty())
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsFromScratch : expecting a non empty vector !");
- int const sz=(-meshDimRelToMax)+1;
+ int sz=(-meshDimRelToMax)+1;
if(sz>=(int)_ms.size())
_ms.resize(sz);
checkMeshDimCoherency(ms[0]->getMeshDimension(),meshDimRelToMax);
DataArrayDouble *coo=checkMultiMesh(ms);
- if((DataArrayDouble *)_coords==nullptr)
+ if((DataArrayDouble *)_coords==0)
{
coo->incrRef();
_coords=coo;
{
if(ms.empty())
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsOnSetMesh : expecting a non empty vector !");
- int const sz=(-meshDimRelToMax)+1;
+ int sz=(-meshDimRelToMax)+1;
if(sz>=(int)_ms.size())
_ms.resize(sz);
checkMeshDimCoherency(ms[0]->getMeshDimension(),meshDimRelToMax);
DataArrayDouble *coo=checkMultiMesh(ms);
- if((DataArrayDouble *)_coords==nullptr)
+ if((DataArrayDouble *)_coords==0)
{
coo->incrRef();
_coords=coo;
int i=0;
for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++,i++)
{
- DataArrayIdType *arr=nullptr;
+ DataArrayIdType *arr=0;
bool test=m->areCellsIncludedIn(*it,_zipconn_pol,arr);
corr[i]=arr;
if(!test)
{
if(!famArr)
{
- _fam_coords=nullptr;
+ _fam_coords=0;
return ;
}
DataArrayDouble *coo(_coords);
}
if(meshDimRelToMaxExt>1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setFamilyFieldArr : Dimension request is invalid (>1) !");
- int const traducedRk=-meshDimRelToMaxExt;
+ int traducedRk=-meshDimRelToMaxExt;
if(traducedRk>=(int)_ms.size())
throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !");
- if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==nullptr)
+ if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==0)
throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !");
return _ms[traducedRk]->setFamilyArr(famArr);
}
}
if(meshDimRelToMaxExt>1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setRenumArr : Dimension request is invalid (>1) !");
- int const traducedRk=-meshDimRelToMaxExt;
+ int traducedRk=-meshDimRelToMaxExt;
if(traducedRk>=(int)_ms.size())
throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !");
- if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==nullptr)
+ if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==0)
throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !");
return _ms[traducedRk]->setRenumArr(renumArr);
}
{
if(!nameArr)
{
- _name_coords=nullptr;
+ _name_coords=0;
return ;
}
DataArrayDouble *coo(_coords);
}
if(meshDimRelToMaxExt>1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setNameFieldAtLevel : Dimension request is invalid (>1) !");
- int const traducedRk=-meshDimRelToMaxExt;
+ int traducedRk=-meshDimRelToMaxExt;
if(traducedRk>=(int)_ms.size())
throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !");
- if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==nullptr)
+ if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==0)
throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !");
return _ms[traducedRk]->setNameArr(nameArr);
}
if(_num_coords.isNotNull())
{
mcIdType pos;
- mcIdType const maxValue=_num_coords->getMaxValue(pos);
+ mcIdType maxValue=_num_coords->getMaxValue(pos);
_rev_num_coords=_num_coords->invertArrayN2O2O2N(maxValue+1);
}
}
mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
if((const DataArrayIdType *)_fam_nodes)
{
- mcIdType const val=_fam_nodes->getMaxValue(tmp);
+ mcIdType val=_fam_nodes->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
if((const DataArrayIdType *)_fam_cells)
{
- mcIdType const val=_fam_cells->getMaxValue(tmp);
+ mcIdType val=_fam_cells->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
if((const DataArrayIdType *)_fam_faces)
{
- mcIdType const val=_fam_faces->getMaxValue(tmp);
+ mcIdType val=_fam_faces->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
return ret;
mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
if((const DataArrayIdType *)_fam_nodes)
{
- mcIdType const val=_fam_nodes->getMaxValue(tmp);
+ mcIdType val=_fam_nodes->getMaxValue(tmp);
ret=std::max(ret,val);
}
if((const DataArrayIdType *)_fam_cells)
{
- mcIdType const val=_fam_cells->getMaxValue(tmp);
+ mcIdType val=_fam_cells->getMaxValue(tmp);
ret=std::max(ret,val);
}
if((const DataArrayIdType *)_fam_faces)
{
- mcIdType const val=_fam_faces->getMaxValue(tmp);
+ mcIdType val=_fam_faces->getMaxValue(tmp);
ret=std::max(ret,val);
}
return ret;
mcIdType ret=std::numeric_limits<mcIdType>::max(),tmp=-1;
if((const DataArrayIdType *)_fam_nodes)
{
- mcIdType const val=_fam_nodes->getMinValue(tmp);
+ mcIdType val=_fam_nodes->getMinValue(tmp);
ret=std::min(ret,val);
}
if((const DataArrayIdType *)_fam_cells)
{
- mcIdType const val=_fam_cells->getMinValue(tmp);
+ mcIdType val=_fam_cells->getMinValue(tmp);
ret=std::min(ret,val);
}
if((const DataArrayIdType *)_fam_faces)
{
- mcIdType const val=_fam_faces->getMinValue(tmp);
+ mcIdType val=_fam_faces->getMinValue(tmp);
ret=std::min(ret,val);
}
return ret;
{
if(!MEDFileMesh::isEqual(other,eps,what))
return false;
- const auto *otherC=dynamic_cast<const MEDFileStructuredMesh *>(other);
+ const MEDFileStructuredMesh *otherC=dynamic_cast<const MEDFileStructuredMesh *>(other);
if(!otherC)
{
what="Mesh types differ ! This is structured and other is NOT !";
}
const DataArrayIdType *famc1=_fam_nodes;
const DataArrayIdType *famc2=otherC->_fam_nodes;
- if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr))
+ if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of families arr on nodes ! One is defined and not other !";
return false;
}
if(famc1)
{
- bool const ret=famc1->isEqual(*famc2);
+ bool ret=famc1->isEqual(*famc2);
if(!ret)
{
what="Families arr on nodes differ !";
}
famc1=_fam_cells;
famc2=otherC->_fam_cells;
- if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr))
+ if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of families arr on cells ! One is defined and not other !";
return false;
}
if(famc1)
{
- bool const ret=famc1->isEqual(*famc2);
+ bool ret=famc1->isEqual(*famc2);
if(!ret)
{
what="Families arr on cells differ !";
}
famc1=_fam_faces;
famc2=otherC->_fam_faces;
- if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr))
+ if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of families arr on faces ! One is defined and not other !";
return false;
}
if(famc1)
{
- bool const ret=famc1->isEqual(*famc2);
+ bool ret=famc1->isEqual(*famc2);
if(!ret)
{
what="Families arr on faces differ !";
}
famc1=_num_nodes;
famc2=otherC->_num_nodes;
- if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr))
+ if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of numbering arr on nodes ! One is defined and not other !";
return false;
}
if(famc1)
{
- bool const ret=famc1->isEqual(*famc2);
+ bool ret=famc1->isEqual(*famc2);
if(!ret)
{
what="Numbering arr on nodes differ !";
}
famc1=_num_cells;
famc2=otherC->_num_cells;
- if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr))
+ if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of numbering arr on cells ! One is defined and not other !";
return false;
}
if(famc1)
{
- bool const ret=famc1->isEqual(*famc2);
+ bool ret=famc1->isEqual(*famc2);
if(!ret)
{
what="Numbering arr on cells differ !";
}
famc1=_num_faces;
famc2=otherC->_num_faces;
- if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr))
+ if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of numbering arr on faces ! One is defined and not other !";
return false;
}
if(famc1)
{
- bool const ret=famc1->isEqual(*famc2);
+ bool ret=famc1->isEqual(*famc2);
if(!ret)
{
what="Numbering arr on faces differ !";
}
const DataArrayAsciiChar *d1=_names_cells;
const DataArrayAsciiChar *d2=otherC->_names_cells;
- if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr))
+ if((d1==0 && d2!=0) || (d1!=0 && d2==0))
{
what="Mismatch of naming arr on cells ! One is defined and not other !";
return false;
}
if(d1)
{
- bool const ret=d1->isEqual(*d2);
+ bool ret=d1->isEqual(*d2);
if(!ret)
{
what="Naming arr on cells differ !";
}
d1=_names_faces;
d2=otherC->_names_faces;
- if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr))
+ if((d1==0 && d2!=0) || (d1!=0 && d2==0))
{
what="Mismatch of naming arr on faces ! One is defined and not other !";
return false;
}
if(d1)
{
- bool const ret=d1->isEqual(*d2);
+ bool ret=d1->isEqual(*d2);
if(!ret)
{
what="Naming arr on faces differ !";
}
d1=_names_nodes;
d2=otherC->_names_nodes;
- if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr))
+ if((d1==0 && d2!=0) || (d1!=0 && d2==0))
{
what="Mismatch of naming arr on nodes ! One is defined and not other !";
return false;
}
if(d1)
{
- bool const ret=d1->isEqual(*d2);
+ bool ret=d1->isEqual(*d2);
if(!ret)
{
what="Naming arr on nodes differ !";
if(!famIds.empty())
da=_fam_nodes->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
- da=_fam_nodes->findIdsEqualList(nullptr,nullptr);
+ da=_fam_nodes->findIdsEqualList(0,0);
if(renum)
return MEDFileUMeshSplitL1::Renumber(_num_nodes,da);
else
if(!famIds.empty())
da=_fam_cells->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
- da=_fam_cells->findIdsEqualList(nullptr,nullptr);
+ da=_fam_cells->findIdsEqualList(0,0);
if(renum)
return MEDFileUMeshSplitL1::Renumber(_num_cells,da);
else
if(!famIds.empty())
da=_fam_faces->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
- da=_fam_faces->findIdsEqualList(nullptr,nullptr);
+ da=_fam_faces->findIdsEqualList(0,0);
if(renum)
return MEDFileUMeshSplitL1::Renumber(_num_faces,da);
else
{
case 0:
{
- mcIdType const nbCells(mesh->getNumberOfCells());
+ mcIdType nbCells(mesh->getNumberOfCells());
if(famArr)
famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of cells of mesh !");
_fam_cells=famArr;
}
case 1:
{
- mcIdType const nbNodes(mesh->getNumberOfNodes());
+ mcIdType nbNodes(mesh->getNumberOfNodes());
if(famArr)
famArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
_fam_nodes=famArr;
}
case -1:
{
- mcIdType const nbCells(mesh->getNumberOfCellsOfSubLevelMesh());
+ mcIdType nbCells(mesh->getNumberOfCellsOfSubLevelMesh());
if(famArr)
famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of faces of mesh !");
_fam_faces=famArr;
{
case 0:
{
- mcIdType const nbCells=mesh->getNumberOfCells();
+ mcIdType nbCells=mesh->getNumberOfCells();
renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of cells of mesh !");
_num_cells=renumArr;
break;
}
case 1:
{
- mcIdType const nbNodes=mesh->getNumberOfNodes();
+ mcIdType nbNodes=mesh->getNumberOfNodes();
renumArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
_num_nodes=renumArr;
break;
}
case -1:
{
- mcIdType const nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
+ mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of faces of mesh !");
_num_faces=renumArr;
break;
{
case 0:
{
- mcIdType const nbCells=mesh->getNumberOfCells();
+ mcIdType nbCells=mesh->getNumberOfCells();
nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of cells of mesh !");
_names_cells=nameArr;
break;
}
case 1:
{
- mcIdType const nbNodes=mesh->getNumberOfNodes();
+ mcIdType nbNodes=mesh->getNumberOfNodes();
nameArr->checkNbOfTuplesAndComp(nbNodes,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of nodes of mesh !");
_names_nodes=nameArr;
break;
}
case -1:
{
- mcIdType const nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
+ mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of faces of mesh !");
_names_faces=nameArr;
break;
nameArr->incrRef();
}
-void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int /*meshDimRelToMaxExt*/, DataArrayIdType * /*globalNumArr*/)
+void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr)
{
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setGlobalNumFieldAtLevel : not implemented yet !");
}
if((const DataArrayIdType *)_num_cells)
{
mcIdType pos;
- mcIdType const maxValue=_num_cells->getMaxValue(pos);
+ mcIdType maxValue=_num_cells->getMaxValue(pos);
_rev_num_cells=_num_cells->invertArrayN2O2O2N(maxValue+1);
return _rev_num_cells;
}
if((const DataArrayIdType *)_num_nodes)
{
mcIdType pos;
- mcIdType const maxValue=_num_nodes->getMaxValue(pos);
+ mcIdType maxValue=_num_nodes->getMaxValue(pos);
_rev_num_nodes=_num_nodes->invertArrayN2O2O2N(maxValue+1);
return _rev_num_nodes;
}
}
}
-MCAuto<DataArrayIdType> MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int /*meshDimRelToMaxExt*/) const
+MCAuto<DataArrayIdType> MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
{
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !");
}
*/
bool MEDFileStructuredMesh::unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell)
{
- oldCode.clear(); newCode.clear(); o2nRenumCell=nullptr;
+ oldCode.clear(); newCode.clear(); o2nRenumCell=0;
return false;
}
void MEDFileStructuredMesh::releaseImplicitPartIfAny() const
{
- _faces_if_necessary=nullptr;
+ _faces_if_necessary=0;
}
/*!
}
case -1:
{
- int const mdim(cmesh->getMeshDimension());
+ int mdim(cmesh->getMeshDimension());
if(mdim<1)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGeoTypesAtLevel : only one level available for structured meshes ! Input 0 is mandatory or 0D mesh !");
std::vector<INTERP_KERNEL::NormalizedCellType> ret(1,MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(mdim-1));
const DataArrayIdType *arr(globs->getProfile(st[0].getPflName()));
const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before
mcIdType sz(ToIdType(nodesFetched.size()));
- for(long const work : *arr)
+ for(const mcIdType *work=arr->begin();work!=arr->end();work++)
{
std::vector<mcIdType> conn;
- cmesh->getNodeIdsOfCell(work,conn);
+ cmesh->getNodeIdsOfCell(*work,conn);
for(std::vector<mcIdType>::const_iterator it=conn.begin();it!=conn.end();it++)
if(*it>=0 && *it<sz)
nodesFetched[*it]=true;
med_geometry_type MEDFileStructuredMesh::GetGeoTypeFromMeshDim(int meshDim)
{
- INTERP_KERNEL::NormalizedCellType const ct(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(meshDim));
+ INTERP_KERNEL::NormalizedCellType ct(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(meshDim));
return typmai3[ct];
}
MCAuto<DataArrayIdType>& famCells, MCAuto<DataArrayIdType>& numCells, MCAuto<DataArrayAsciiChar>& namesCells)
{
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- med_geometry_type const geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim);
+ med_geometry_type geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim);
mcIdType nbOfElt(0);
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf);
if(nbOfElt>0)
{
if(!mrs || mrs->isNodeFamilyFieldReading())
{
- mcIdType const nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
if(nbOfElt>nbNodes)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::loadStrMeshFromFile : invalid size of family node array regarding number of nodes in this ! File seems to be corrupted !");
MCAuto<DataArrayMedInt> miFamNodes=DataArrayMedInt::New();
_names_nodes->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end
}
}
- int const meshDim(getStructuredMesh()->getMeshDimension());
+ int meshDim(getStructuredMesh()->getMeshDimension());
LoadStrMeshDAFromFile(fid,meshDim,dt,it,mName,mrs,_fam_cells,_num_cells,_names_cells);
if(meshDim>=1)
LoadStrMeshDAFromFile(fid,meshDim-1,dt,it,mName,mrs,_fam_faces,_num_faces,_names_faces);
void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& maa) const
{
- int const meshDim(getStructuredMesh()->getMeshDimension());
+ int meshDim(getStructuredMesh()->getMeshDimension());
med_geometry_type geoTypeReq(GetGeoTypeFromMeshDim(meshDim)),geoTypeReq2(GetGeoTypeFromMeshDim(meshDim-1));
//
if((const DataArrayIdType *)_fam_cells)
*/
MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,mrs);
}
*/
MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,mName,dt,it,mrs);
}
{
if(!MEDFileStructuredMesh::isEqual(other,eps,what))
return false;
- const auto *otherC=dynamic_cast<const MEDFileCMesh *>(other);
+ const MEDFileCMesh *otherC=dynamic_cast<const MEDFileCMesh *>(other);
if(!otherC)
{
what="Mesh types differ ! This is cartesian and other is NOT !";
otherC->clearNonDiscrAttributes();
const MEDCouplingCMesh *coo1=_cmesh;
const MEDCouplingCMesh *coo2=otherC->_cmesh;
- if((coo1==nullptr && coo2!=nullptr) || (coo1!=nullptr && coo2==nullptr))
+ if((coo1==0 && coo2!=0) || (coo1!=0 && coo2==0))
{
what="Mismatch of cartesian meshes ! One is defined and not other !";
return false;
}
if(coo1)
{
- bool const ret=coo1->isEqual(coo2,eps);
+ bool ret=coo1->isEqual(coo2,eps);
if(!ret)
{
what="cartesian meshes differ !";
}
MEDFileCMesh::MEDFileCMesh()
-= default;
+{
+}
MEDFileCMesh::MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
try
MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str);
MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str);
MEDLoaderBase::safeStrCpy(_dt_unit.c_str(),MED_LNAME_SIZE,dtunit,_too_long_str);
- int const spaceDim(_cmesh->getSpaceDimension());
+ int spaceDim(_cmesh->getSpaceDimension());
INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
for(int i=0;i<spaceDim;i++)
{
- std::string const info(_cmesh->getCoordsAt(i)->getInfoOnComponent(0));
+ std::string info(_cmesh->getCoordsAt(i)->getInfoOnComponent(0));
std::string c,u;
MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,ToMedInt(da->getNumberOfTuples()),da->getConstPointer()));
}
//
- std::string const meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
+ std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDFileStructuredMesh::writeStructuredLL(fid,meshName);
}
MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,mrs);
}
MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,mName,dt,it,mrs);
}
{
if(!MEDFileStructuredMesh::isEqual(other,eps,what))
return false;
- const auto *otherC=dynamic_cast<const MEDFileCurveLinearMesh *>(other);
+ const MEDFileCurveLinearMesh *otherC=dynamic_cast<const MEDFileCurveLinearMesh *>(other);
if(!otherC)
{
what="Mesh types differ ! This is curve linear and other is NOT !";
otherC->clearNonDiscrAttributes();
const MEDCouplingCurveLinearMesh *coo1=_clmesh;
const MEDCouplingCurveLinearMesh *coo2=otherC->_clmesh;
- if((coo1==nullptr && coo2!=nullptr) || (coo1!=nullptr && coo2==nullptr))
+ if((coo1==0 && coo2!=0) || (coo1!=0 && coo2==0))
{
what="Mismatch of curve linear meshes ! One is defined and not other !";
return false;
}
if(coo1)
{
- bool const ret=coo1->isEqual(coo2,eps);
+ bool ret=coo1->isEqual(coo2,eps);
if(!ret)
{
what="curve linear meshes differ !";
}
MEDFileCurveLinearMesh::MEDFileCurveLinearMesh()
-= default;
+{
+}
MEDFileCurveLinearMesh::MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
try
MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str);
MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str);
MEDLoaderBase::safeStrCpy(_dt_unit.c_str(),MED_LNAME_SIZE,dtunit,_too_long_str);
- int const spaceDim=_clmesh->getSpaceDimension();
- int const meshDim=_clmesh->getMeshDimension();
+ int spaceDim=_clmesh->getSpaceDimension();
+ int meshDim=_clmesh->getMeshDimension();
INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
const DataArrayDouble *coords=_clmesh->getCoords();
throw INTERP_KERNEL::Exception("MEDFileCurveLinearMesh::writeMeshLL : no coordinates set !");
for(int i=0;i<spaceDim;i++)
{
- std::string const info(_clmesh->getCoords()->getInfoOnComponent(i));
+ std::string info(_clmesh->getCoords()->getInfoOnComponent(i));
std::string c,u;
MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin()));
//
- std::string const meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
+ std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDFileStructuredMesh::writeStructuredLL(fid,meshName);
}
MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const std::string& fileName)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid);
}
MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const std::string& fileName, const std::string& mName)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,mName);
}
{
if ( MEDFileMesh* m = getOneTimeStep() )
return m->getJoints();
- return nullptr;
+ return 0;
}
/*!
for(std::vector< MCAuto<MEDFileMesh> >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
{
if ( jointsWritten )
- const_cast<MEDFileMesh&>(**it).setJoints( nullptr );
+ const_cast<MEDFileMesh&>(**it).setJoints( 0 );
else
jointsWritten = true;
void MEDFileMeshMultiTS::loadFromFile(med_idt fid, const std::string& mName)
{
- MEDFileJoints *joints(nullptr);
+ MEDFileJoints *joints(0);
if ( !_mesh_one_ts.empty() && getOneTimeStep() )
{
// joints of mName already read, pass them to MEDFileMesh::New() to prevent repeated reading
joints = getOneTimeStep()->getJoints();
}
_mesh_one_ts.clear(); //for the moment to be improved
- _mesh_one_ts.push_back( MEDFileMesh::New(fid,mName,-1,-1,nullptr, joints ));
+ _mesh_one_ts.push_back( MEDFileMesh::New(fid,mName,-1,-1,0, joints ));
}
MEDFileMeshMultiTS::MEDFileMeshMultiTS()
-= default;
+{
+}
MEDFileMeshMultiTS::MEDFileMeshMultiTS(med_idt fid)
try
MEDFileMeshes *MEDFileMeshes::New(const std::string& fileName)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid);
}
}
MEDFileMeshes::MEDFileMeshes()
-= default;
+{
+}
MEDFileMeshes::MEDFileMeshes(med_idt fid)
try
void MEDFileMeshes::simpleReprWithoutHeader(std::ostream& oss) const
{
- int const nbOfMeshes=getNumberOfMeshes();
+ int nbOfMeshes=getNumberOfMeshes();
oss << "There are " << nbOfMeshes << " meshes with the following names : \n";
std::vector<std::string> mns=getMeshesNames();
for(int i=0;i<nbOfMeshes;i++)
}
MEDFileMeshesIterator::~MEDFileMeshesIterator()
-= default;
+{
+}
MEDFileMesh *MEDFileMeshesIterator::nextt()
{
if(ms)
return ms->getMeshAtPos(_iter_id++);
else
- return nullptr;
+ return 0;
}
else
- return nullptr;
+ return 0;
}
INTERP_KERNEL::NormalizedCellType MEDFileMesh::ConvertFromMEDFileGeoType(med_geometry_type geoType)
#ifndef __MEDFILEMESH_HXX__
#define __MEDFILEMESH_HXX__
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDFileUtilities.txx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "MEDCoupling1GTUMesh.hxx"
-#include "MEDCouplingPointSet.hxx"
-#include "MEDCouplingStructuredMesh.hxx"
-#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingCurveLinearMesh.hxx"
#include "MEDLoaderDefines.hxx"
#include "MEDFileMeshLL.hxx"
+#include "MEDFileUtilities.txx"
#include "MEDCouplingPartDefinition.hxx"
#include "MEDFileMeshReadSelector.hxx"
#include "MEDFileJoint.hxx"
#include "MEDFileEquivalence.hxx"
-#include "med.h"
-#include "NormalizedGeometricTypes"
-#include <cstddef>
-#include <functional>
#include <map>
-#include <string>
-#include <ostream>
-#include <vector>
-#include <utility>
#include <list>
#include <set>
#include <memory>
class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
{
public:
- MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=nullptr);
- MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=nullptr);
+ MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT static MEDFileMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileMesh>(db); }
- MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr, MEDFileJoints* joints=nullptr);
- MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr, MEDFileJoints* joints=nullptr);
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0, MEDFileJoints* joints=0);
+ MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0, MEDFileJoints* joints=0);
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT virtual MEDFileMesh *createNewEmpty() const = 0;
MEDLOADER_EXPORT virtual MEDFileMesh *deepCopy() const = 0;
MEDLOADER_EXPORT virtual MEDFileMesh *shallowCpy() const = 0;
MEDLOADER_EXPORT void setJoints( MEDFileJoints* joints );
MEDFileEquivalences *getEquivalences() { return _equiv; }
const MEDFileEquivalences *getEquivalences() const { return _equiv; }
- void killEquivalences() { _equiv=(MEDFileEquivalences *)nullptr; }
+ void killEquivalences() { _equiv=(MEDFileEquivalences *)0; }
void initializeEquivalences() { _equiv=MEDFileEquivalences::New(this); }
MEDLOADER_EXPORT static INTERP_KERNEL::NormalizedCellType ConvertFromMEDFileGeoType(med_geometry_type geoType);
MEDLOADER_EXPORT static med_geometry_type ConvertToMEDFileGeoType(INTERP_KERNEL::NormalizedCellType geoType);
static std::string CreateNameNotIn(const std::string& nameTry, const std::vector<std::string>& namesToAvoid);
static mcIdType PutInThirdComponentOfCodeOffset(std::vector<mcIdType>& code, mcIdType strt);
void writeJoints(med_idt fid) const;
- void loadJointsFromFile(med_idt fid, MEDFileJoints *toUseInstedOfReading=nullptr);
+ void loadJointsFromFile(med_idt fid, MEDFileJoints *toUseInstedOfReading=0);
void loadEquivalences(med_idt fid);
void deepCpyEquivalences(const MEDFileMesh& other);
bool areEquivalencesEqual(const MEDFileMesh *other, std::string& what) const;
{
friend class MEDFileMesh;
public:
- MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=nullptr);
- MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=nullptr);
+ MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT static MEDFileUMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileUMesh>(db); }
MEDLOADER_EXPORT static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
MEDLOADER_EXPORT static MEDFileUMesh *New();
MEDLOADER_EXPORT static MCAuto<MEDFileUMesh> LoadConnectivityOnlyPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOfFromUserDistrib(med_idt fid, const std::string& mName, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
+ MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOfFromUserDistrib(med_idt fid, const std::string& mName, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT static void LoadPartCoords(const std::string& fileName, const std::string& mName, int dt, int it, const std::vector<std::string>& infosOnComp, mcIdType startNodeId, mcIdType stopNodeId,
MCAuto<DataArrayDouble>& coords, MCAuto<PartDefinition>& partCoords, MCAuto<DataArrayIdType>& famCoords, MCAuto<DataArrayIdType>& numCoords, MCAuto<DataArrayAsciiChar>& nameCoords);
MEDLOADER_EXPORT static const char *GetSpeStr4ExtMesh() { return SPE_FAM_STR_EXTRUDED_MESH; }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const override;
- MEDLOADER_EXPORT MEDFileUMesh *deepCopy() const override;
- MEDLOADER_EXPORT MEDFileUMesh *shallowCpy() const override;
- MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const;
+ MEDLOADER_EXPORT MEDFileUMesh *deepCopy() const;
+ MEDLOADER_EXPORT MEDFileUMesh *shallowCpy() const;
+ MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
MEDLOADER_EXPORT void checkConsistency() const;
MEDLOADER_EXPORT void checkSMESHConsistency() const;
MEDLOADER_EXPORT void clearNodeAndCellNumbers();
- MEDLOADER_EXPORT void clearNonDiscrAttributes() const override;
- MEDLOADER_EXPORT void setName(const std::string& name) override;
+ MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
+ MEDLOADER_EXPORT void setName(const std::string& name);
MEDLOADER_EXPORT const std::vector< MCAuto<MEDFileEltStruct4Mesh> >& getAccessOfUndergroundEltStrs() const { return _elt_str; }
//
- MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const override;
- MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const override;
- MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const override;
- MEDLOADER_EXPORT int getMeshDimension() const override;
- MEDLOADER_EXPORT int getSpaceDimension() const override;
- MEDLOADER_EXPORT std::string simpleRepr() const override;
- MEDLOADER_EXPORT std::string advancedRepr() const override;
- MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) override;
- MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const override;
+ MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const;
+ MEDLOADER_EXPORT int getMeshDimension() const;
+ MEDLOADER_EXPORT int getSpaceDimension() const;
+ MEDLOADER_EXPORT std::string simpleRepr() const;
+ MEDLOADER_EXPORT std::string advancedRepr() const;
+ MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
+ MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT const PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const;
- MEDLOADER_EXPORT mcIdType getNumberOfNodes() const override;
- MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT bool hasImplicitPart() const override;
- MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const override;
- MEDLOADER_EXPORT void releaseImplicitPartIfAny() const override;
- MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const override;
- MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const override;
- MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const override;
- MEDLOADER_EXPORT MEDFileMesh *cartesianize() const override;
- MEDLOADER_EXPORT bool presenceOfStructureElements() const override;
- MEDLOADER_EXPORT void killStructureElements() override;
- MEDLOADER_EXPORT std::vector<int> getNonEmptyLevels() const override;
- MEDLOADER_EXPORT std::vector<int> getNonEmptyLevelsExt() const override;
- MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const override;
- MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const override;
- MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const override;
- MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const override;
- MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const override;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodes() const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT bool hasImplicitPart() const;
+ MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT void releaseImplicitPartIfAny() const;
+ MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const;
+ MEDLOADER_EXPORT MEDFileMesh *cartesianize() const;
+ MEDLOADER_EXPORT bool presenceOfStructureElements() const;
+ MEDLOADER_EXPORT void killStructureElements();
+ MEDLOADER_EXPORT std::vector<int> getNonEmptyLevels() const;
+ MEDLOADER_EXPORT std::vector<int> getNonEmptyLevelsExt() const;
+ MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
+ MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const;
+ MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
MEDLOADER_EXPORT DataArrayDouble *getCoords() const;
MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
- MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const override;
- MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const override;
- MEDLOADER_EXPORT std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const override;
+ MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
+ MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
MEDLOADER_EXPORT std::vector< std::pair<int,mcIdType> > getAllDistributionOfTypes() const;
MEDLOADER_EXPORT MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
MEDLOADER_EXPORT void setCoords(DataArrayDouble *coords);
MEDLOADER_EXPORT void setCoordsForced(DataArrayDouble *coords);
MEDLOADER_EXPORT void eraseGroupsAtLevel(int meshDimRelToMaxExt);
- MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr) override;
- MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr) override;
- MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) override;
- MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) override;
- MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids) override;
- MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) override;
+ MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
+ MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
+ MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
+ MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
+ MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids);
+ MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
MEDLOADER_EXPORT void removeMeshAtLevel(int meshDimRelToMax);
MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
MEDLOADER_EXPORT std::map<mcIdType, std::map<mcIdType, mcIdType>> crackAlong(const std::string &grpNameM1, bool grpMustBeFullyDup=true);
MEDLOADER_EXPORT void openCrack(const std::map<mcIdType, std::map<mcIdType, mcIdType>> & c2o2nN, const double & factor);
MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated, DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified);
- MEDLOADER_EXPORT bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell) override;
+ MEDLOADER_EXPORT bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell);
MEDLOADER_EXPORT DataArrayIdType *zipCoords();
MEDLOADER_EXPORT DataArrayIdType *computeFetchedNodeIds() const;
MEDLOADER_EXPORT DataArrayIdType *deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const;
MEDLOADER_EXPORT void unserialize(std::vector<double>& tinyDouble, std::vector<mcIdType>& tinyInt, std::vector<std::string>& tinyStr,
std::vector< MCAuto<DataArrayIdType> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
private:
- MEDLOADER_EXPORT ~MEDFileUMesh() override;
- void writeMeshLL(med_idt fid) const override;
+ MEDLOADER_EXPORT ~MEDFileUMesh();
+ void writeMeshLL(med_idt fid) const;
MEDFileUMesh();
MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, std::function<void(MEDFileUMeshL2&,med_idt fid, MeshOrStructMeshCls*,const std::string&,const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>&,int,int,MEDFileMeshReadSelector *)> functorOnUMeshL2, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- void loadPartUMeshFromFileFromUserDistrib(med_idt fid, const std::string& mName, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, std::function<void(MEDFileUMeshL2&,med_idt, MeshOrStructMeshCls*,const std::string&,const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>&,int,int,MEDFileMeshReadSelector *)> functorOnUMeshL2, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) override;
+ void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, std::function<void(MEDFileUMeshL2&,med_idt fid, MeshOrStructMeshCls*,const std::string&,const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>&,int,int,MEDFileMeshReadSelector *)> functorOnUMeshL2, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ void loadPartUMeshFromFileFromUserDistrib(med_idt fid, const std::string& mName, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, std::function<void(MEDFileUMeshL2&,med_idt, MeshOrStructMeshCls*,const std::string&,const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>&,int,int,MEDFileMeshReadSelector *)> functorOnUMeshL2, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
void dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl2, const std::string& mName, MEDFileMeshReadSelector *mrs);
const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const;
MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt);
void checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const;
DataArrayDouble *checkMultiMesh(const std::vector<const MEDCouplingUMesh *>& ms) const;
- void synchronizeTinyInfoOnLeaves() const override;
- void changeFamilyIdArr(mcIdType oldId, mcIdType newId) override;
- std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const override;
+ void synchronizeTinyInfoOnLeaves() const;
+ void changeFamilyIdArr(mcIdType oldId, mcIdType newId);
+ std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const;
MCAuto<MEDFileUMeshSplitL1>& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m);
static std::vector<std::shared_ptr<std::vector<mcIdType>>>
findConnectedComponents(
{
friend class MEDFileMesh;
public:
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const override;
- MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const override;
- MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const override;
- MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const override;
- MEDLOADER_EXPORT void clearNonDiscrAttributes() const override;
- MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const override;
- MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) override;
- MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr) override;
- MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr) override;
- MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) override;
- MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) override;
- MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids) override;
- MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) override;
- MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT std::vector<int> getNonEmptyLevels() const override;
- MEDLOADER_EXPORT std::vector<int> getNonEmptyLevelsExt() const override;
- MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const override;
- MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const override;
- MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const override;
- MEDLOADER_EXPORT MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const override;
- MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const override;
- MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const override;
- MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT mcIdType getNumberOfNodes() const override;
- MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const override;
- MEDLOADER_EXPORT bool hasImplicitPart() const override;
- MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const override;
- MEDLOADER_EXPORT void releaseImplicitPartIfAny() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const;
+ MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
+ MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
+ MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
+ MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
+ MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
+ MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
+ MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
+ MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids);
+ MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
+ MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT std::vector<int> getNonEmptyLevels() const;
+ MEDLOADER_EXPORT std::vector<int> getNonEmptyLevelsExt() const;
+ MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
+ MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const;
+ MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const;
+ MEDLOADER_EXPORT MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodes() const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT bool hasImplicitPart() const;
+ MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT void releaseImplicitPartIfAny() const;
MEDLOADER_EXPORT MEDCoupling1SGTUMesh *getImplicitFaceMesh() const;
- MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const override;
- MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const override;
- MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const override;
- MEDLOADER_EXPORT bool presenceOfStructureElements() const override { return false; }
+ MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const;
+ MEDLOADER_EXPORT bool presenceOfStructureElements() const { return false; }
MEDLOADER_EXPORT virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0;
// tools
- MEDLOADER_EXPORT bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell) override;
+ MEDLOADER_EXPORT bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell);
protected:
- ~MEDFileStructuredMesh() override = default;
- void changeFamilyIdArr(mcIdType oldId, mcIdType newId) override;
- std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const override;
+ ~MEDFileStructuredMesh() { }
+ void changeFamilyIdArr(mcIdType oldId, mcIdType newId);
+ std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const;
void deepCpyAttributes();
void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
void writeStructuredLL(med_idt fid, const std::string& maa) const;
friend class MEDFileMesh;
public:
MEDLOADER_EXPORT static MEDFileCMesh *New();
- MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=nullptr);
- MEDLOADER_EXPORT static MEDFileCMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=nullptr);
+ MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileCMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT static MEDFileCMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileCMesh>(db); }
- MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- MEDLOADER_EXPORT static MEDFileCMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
+ MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileCMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileCMesh"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const override;
- MEDLOADER_EXPORT MEDFileCMesh *deepCopy() const override;
- MEDLOADER_EXPORT MEDFileCMesh *shallowCpy() const override;
- MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const override;
- MEDLOADER_EXPORT int getMeshDimension() const override;
- MEDLOADER_EXPORT int getSpaceDimension() const override;
- MEDLOADER_EXPORT std::string simpleRepr() const override;
- MEDLOADER_EXPORT std::string advancedRepr() const override;
- MEDLOADER_EXPORT void clearNonDiscrAttributes() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const;
+ MEDLOADER_EXPORT MEDFileCMesh *deepCopy() const;
+ MEDLOADER_EXPORT MEDFileCMesh *shallowCpy() const;
+ MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
+ MEDLOADER_EXPORT int getMeshDimension() const;
+ MEDLOADER_EXPORT int getSpaceDimension() const;
+ MEDLOADER_EXPORT std::string simpleRepr() const;
+ MEDLOADER_EXPORT std::string advancedRepr() const;
+ MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
MEDLOADER_EXPORT const MEDCouplingCMesh *getMesh() const;
MEDLOADER_EXPORT void setMesh(MEDCouplingCMesh *m);
- MEDLOADER_EXPORT MEDFileMesh *cartesianize() const override;
+ MEDLOADER_EXPORT MEDFileMesh *cartesianize() const;
private:
- ~MEDFileCMesh() override = default;
- const MEDCouplingStructuredMesh *getStructuredMesh() const override;
- void writeMeshLL(med_idt fid) const override;
+ ~MEDFileCMesh() { }
+ const MEDCouplingStructuredMesh *getStructuredMesh() const;
+ void writeMeshLL(med_idt fid) const;
MEDFileCMesh();
- void synchronizeTinyInfoOnLeaves() const override;
+ void synchronizeTinyInfoOnLeaves() const;
MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) override;
+ void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
private:
MCAuto<MEDCouplingCMesh> _cmesh;
};
friend class MEDFileMesh;
public:
MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New();
- MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=nullptr);
- MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=nullptr);
+ MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileCurveLinearMesh>(db); }
- MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
+ MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileCurveLinearMesh"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const override;
- MEDLOADER_EXPORT MEDFileCurveLinearMesh *deepCopy() const override;
- MEDLOADER_EXPORT MEDFileCurveLinearMesh *shallowCpy() const override;
- MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const override;
- MEDLOADER_EXPORT int getMeshDimension() const override;
- MEDLOADER_EXPORT int getSpaceDimension() const override;
- MEDLOADER_EXPORT std::string simpleRepr() const override;
- MEDLOADER_EXPORT std::string advancedRepr() const override;
- MEDLOADER_EXPORT void clearNonDiscrAttributes() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const;
+ MEDLOADER_EXPORT MEDFileCurveLinearMesh *deepCopy() const;
+ MEDLOADER_EXPORT MEDFileCurveLinearMesh *shallowCpy() const;
+ MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
+ MEDLOADER_EXPORT int getMeshDimension() const;
+ MEDLOADER_EXPORT int getSpaceDimension() const;
+ MEDLOADER_EXPORT std::string simpleRepr() const;
+ MEDLOADER_EXPORT std::string advancedRepr() const;
+ MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
MEDLOADER_EXPORT const MEDCouplingCurveLinearMesh *getMesh() const;
MEDLOADER_EXPORT void setMesh(MEDCouplingCurveLinearMesh *m);
- MEDLOADER_EXPORT MEDFileMesh *cartesianize() const override;
+ MEDLOADER_EXPORT MEDFileMesh *cartesianize() const;
private:
- ~MEDFileCurveLinearMesh() override = default;
+ ~MEDFileCurveLinearMesh() { }
MEDFileCurveLinearMesh();
MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- const MEDCouplingStructuredMesh *getStructuredMesh() const override;
- void synchronizeTinyInfoOnLeaves() const override;
- void writeMeshLL(med_idt fid) const override;
- void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) override;//to imp
+ const MEDCouplingStructuredMesh *getStructuredMesh() const;
+ void synchronizeTinyInfoOnLeaves() const;
+ void writeMeshLL(med_idt fid) const;
+ void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);//to imp
private:
MCAuto<MEDCouplingCurveLinearMesh> _clmesh;
};
MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileMeshMultiTS"); }
MEDLOADER_EXPORT MEDFileMeshMultiTS *deepCopy() const;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT std::string getName() const;
MEDLOADER_EXPORT void setName(const std::string& newMeshName);
MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
MEDLOADER_EXPORT void cartesianizeMe();
MEDLOADER_EXPORT MEDFileMesh *getOneTimeStep() const;
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
MEDLOADER_EXPORT MEDFileJoints *getJoints() const;
MEDLOADER_EXPORT void setJoints(MEDFileJoints* joints);
MEDLOADER_EXPORT bool presenceOfStructureElements() const;
MEDLOADER_EXPORT void killStructureElements();
private:
- ~MEDFileMeshMultiTS() override = default;
+ ~MEDFileMeshMultiTS() { }
void loadFromFile(med_idt fid, const std::string& mName);
MEDFileMeshMultiTS();
MEDFileMeshMultiTS(med_idt fid);
MEDLOADER_EXPORT static MEDFileMeshes *New(const std::string& fileName);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileMeshes"); }
MEDLOADER_EXPORT MEDFileMeshes *deepCopy() const;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT std::string simpleRepr() const;
MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const;
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT int getNumberOfMeshes() const;
MEDLOADER_EXPORT MEDFileMeshesIterator *iterator();
MEDLOADER_EXPORT MEDFileMesh *getMeshAtPos(int i) const;
MEDLOADER_EXPORT bool presenceOfStructureElements() const;
MEDLOADER_EXPORT void killStructureElements();
private:
- ~MEDFileMeshes() override = default;
+ ~MEDFileMeshes() { }
void checkConsistencyLight() const;
void loadFromFile(med_idt fid);
MEDFileMeshes();
// Author : Anthony Geay (CEA/DEN)
#include "MEDFileMeshElt.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingPartDefinition.hxx"
-#include "MEDCoupling1GTUMesh.hxx"
-#include "MCIdType.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDFileMeshReadSelector.hxx"
#include "MEDFileBasis.hxx"
#include "CellModel.hxx"
#include "MEDFilterEntity.hxx"
-#include "med.h"
-#include "NormalizedGeometricTypes"
-#include "medmesh.h"
-#include <algorithm>
-#include <cstddef>
-#include <functional>
#include <iostream>
-#include <vector>
-#include <iterator>
-#include <sstream>
// From MEDLOader.cxx TU
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- _fam=nullptr;
+ _fam=0;
if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
if(!mrs || mrs->isCellFamilyFieldReading())
_fam=FromMedIntArray<mcIdType>( miFam );
}
}
- _num=nullptr;
+ _num=0;
if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
if(!mrs || mrs->isCellNumFieldReading())
MCAuto<DataArrayMedInt> miNum=DataArrayMedInt::New();
miNum->alloc(curNbOfElem,1);
if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,miNum->getPointer())!=0)
- miNum=nullptr;
+ miNum=0;
_num=FromMedIntArray<mcIdType>(miNum);
}
}
- _names=nullptr;
+ _names=0;
if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NAME,MED_NODAL,&changement,&transformation)>0)
{
if(!mrs || mrs->isCellNameFieldReading())
_names=DataArrayAsciiChar::New();
_names->alloc(curNbOfElem+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
if(MEDmeshEntityNameRd(fid,mName,dt,it,entity,geoElt,_names->getPointer())!=0)
- _names=nullptr;
+ _names=0;
else
_names->reAlloc(curNbOfElem);//not a bug to avoid the memory corruption due to last \0 at the end
}
{
med_entity_type whichEntity;
if(!isExisting(fid,mName,dt,it,geoElt,whichEntity))
- return nullptr;
+ return 0;
return new MEDFileUMeshPerType(fid,mName,dt,it,mdim,geoElt,geoElt2,whichEntity,mrs);
}
MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, mcIdType strt, mcIdType stp, mcIdType step, MEDFileMeshReadSelector *mrs)
{
- int const geoElt2i((int)geoElt2);
+ int geoElt2i((int)geoElt2);
if(geoElt2i<0 || geoElt2i>=INTERP_KERNEL::NORM_MAXTYPE)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::NewPart : Not recognized MEDCoupling/MEDLoader geometric type !");
- med_geometry_type const geoElt(typmai3[geoElt2]);
+ med_geometry_type geoElt(typmai3[geoElt2]);
med_entity_type whichEntity;
if(!isExisting(fid,mName,dt,it,geoElt,whichEntity))
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::NewPart : The specified geo type is not present in the specified mesh !");
MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, const std::vector<mcIdType>& distrib, MEDFileMeshReadSelector *mrs)
{
- int const geoElt2i((int)geoElt2);
+ int geoElt2i((int)geoElt2);
if(geoElt2i<0 || geoElt2i>=INTERP_KERNEL::NORM_MAXTYPE)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::NewPart : Not recognized MEDCoupling/MEDLoader geometric type !");
- med_geometry_type const geoElt(typmai3[geoElt2]);
+ med_geometry_type geoElt(typmai3[geoElt2]);
med_entity_type whichEntity;
if(!isExisting(fid,mName,dt,it,geoElt,whichEntity))
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::NewPart : The specified geo type is not present in the specified mesh !");
for(int i=0;i<3;i++)
{
med_bool changement,transformation;
- mcIdType const tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
if(tmp>nbOfElt)
{
nbOfElt=tmp;
}
MEDFileUMeshPerType::MEDFileUMeshPerType()
-= default;
+{
+}
MEDFileUMeshPerType::MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
if(!cm.isDynamic())
{
med_entity_type entity, const std::vector<mcIdType>& distrib, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
MCAuto<DataArrayIdType> listOfIds=DataArrayIdType::New();
listOfIds->useArray(distrib.data(),false,DeallocType::C_DEALLOC,distrib.size(),1);
med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
_pd=PartDefinition::New(strt,end,step);
if(!cm.isDynamic())
}
-void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int /*mdim*/, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
+void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
_m=MEDCoupling1SGTUMesh::New(mName,type);
- auto *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
+ MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New());
- mcIdType const nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
+ mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
conn->alloc(nbOfNodesPerCell*curNbOfElem,1);
MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer()));
std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind(std::plus<med_int>(),std::placeholders::_1,-1));
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
_m=MEDCoupling1SGTUMesh::New(mName,type);
- auto *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
+ MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New());
- mcIdType const nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
+ mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
if(!_pd)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : no part definition !");
- mcIdType const nbOfEltsToLoad(_pd->getNumberOfElems());
+ mcIdType nbOfEltsToLoad(_pd->getNumberOfElems());
conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1);
{
MEDFilterEntity filter;
}
-void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, int dt, int it, int /*mdim*/, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
if(!_pd)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartOfCellCommonPart : no part definition !");
- mcIdType const nbOfEltsToLoad(_pd->getNumberOfElems());
- _fam=nullptr;
+ mcIdType nbOfEltsToLoad(_pd->getNumberOfElems());
+ _fam=0;
if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
if(!mrs || mrs->isCellFamilyFieldReading())
_fam=FromMedIntArray<mcIdType>(miFam);
}
}
- _num=nullptr;
+ _num=0;
if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
if(!mrs || mrs->isCellNumFieldReading())
_num=FromMedIntArray<mcIdType>(miNum);
}
}
- _names=nullptr;
+ _names=0;
if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NAME,MED_NODAL,&changement,&transformation)>0)
{
if(!mrs || mrs->isCellNameFieldReading())
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
_pd);
if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NAME,dt,it,entity,geoElt,filter.getPtr(),_names->getPointer())!=0)
- _names=nullptr;
+ _names=0;
else
_names->reAlloc(nbOfEltsToLoad);//not a bug to avoid the memory corruption due to last \0 at the end
}
}
}
-void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int /*mdim*/, mcIdType arraySize, med_geometry_type geoElt,
+void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType arraySize, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1);
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1);
_m=MEDCoupling1DGTUMesh::New(mName,geoElt==MED_POLYGON?INTERP_KERNEL::NORM_POLYGON:INTERP_KERNEL::NORM_QPOLYG);
MCAuto<MEDCoupling1DGTUMesh> mc(DynamicCast<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New()),connI(DataArrayMedInt::New());
loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs);
}
-void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int /*mdim*/, mcIdType connFaceLgth, med_geometry_type /*geoElt*/,
+void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType connFaceLgth, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- med_int const indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation));
- mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1);
+ med_int indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation));
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1);
_m=MEDCoupling1DGTUMesh::New(mName,INTERP_KERNEL::NORM_POLYHED);
MCAuto<MEDCoupling1DGTUMesh> mc(DynamicCastSafe<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
INTERP_KERNEL::AutoPtr<med_int> index=new med_int[curNbOfElem+1];
loadCommonPart(fid,mName,dt,it,curNbOfElem,MED_POLYHEDRON,entity,mrs);
}
-void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int /*mdim*/, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names)
+void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names)
{
- mcIdType const nbOfCells=m->getNumberOfCells();
+ mcIdType nbOfCells=m->getNumberOfCells();
if(nbOfCells<1)
return ;
int dt,it;
- double const timm=m->getTime(dt,it);
- INTERP_KERNEL::NormalizedCellType const ikt=m->getTypeOfCell(0);
+ double timm=m->getTime(dt,it);
+ INTERP_KERNEL::NormalizedCellType ikt=m->getTypeOfCell(0);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(ikt);
- med_geometry_type const curMedType=typmai3[(int)ikt];
+ med_geometry_type curMedType=typmai3[(int)ikt];
if(!cm.isDynamic())
{
- const auto *m0(dynamic_cast<const MEDCoupling1SGTUMesh *>(m));
+ const MEDCoupling1SGTUMesh *m0(dynamic_cast<const MEDCoupling1SGTUMesh *>(m));
if(!m0)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !");
MCAuto<DataArrayMedInt> arr(DataArrayMedInt_Copy(m0->getNodalConnectivity()));
}
else
{
- const auto *m0(dynamic_cast<const MEDCoupling1DGTUMesh *>(m));
+ const MEDCoupling1DGTUMesh *m0(dynamic_cast<const MEDCoupling1DGTUMesh *>(m));
if(!m0)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #2 !");
if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG)
else
{
const mcIdType *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin());
- mcIdType const meshLgth=m0->getNodalConnectivityLength();
- mcIdType const nbOfFaces=ToIdType(std::count(conn,conn+meshLgth,-1)+nbOfCells);
+ mcIdType meshLgth=m0->getNodalConnectivityLength();
+ mcIdType nbOfFaces=ToIdType(std::count(conn,conn+meshLgth,-1)+nbOfCells);
INTERP_KERNEL::AutoPtr<med_int> tab1=new med_int[nbOfCells+1];
med_int *w1=tab1; *w1=1;
INTERP_KERNEL::AutoPtr<med_int> tab2=new med_int[nbOfFaces+1];
{
const mcIdType *wend=std::find(w,conn+connI[i+1],-1);
bt=std::transform(w,wend,bt,std::bind(std::plus<mcIdType>(),std::placeholders::_1,1));
- std::size_t const nbOfNode=std::distance(w,wend);
+ std::size_t nbOfNode=std::distance(w,wend);
w2[1]=w2[0]+(med_int)nbOfNode;
if(wend!=conn+connI[i+1])
w=wend+1;
#ifndef __MEDFILEMESHELT_HXX__
#define __MEDFILEMESHELT_HXX__
-#include "MCType.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingPartDefinition.hxx"
#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "NormalizedGeometricTypes"
+#include "NormalizedUnstructuredMesh.hxx"
#include "med.h"
-#include <string>
-#include <cstddef>
-#include <vector>
namespace MEDCoupling
{
std::string getClassName() const override { return std::string("MEDFileUMeshPerTypeCommon"); }
void loadCommonPart(med_idt fid, const char *mName, int dt, int it, mcIdType curNbOfElem, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
const DataArrayIdType *getFam() const { return _fam; }
const DataArrayIdType *getNum() const { return _num; }
const DataArrayAsciiChar *getNames() const { return _names; }
std::string getClassName() const override { return std::string("MEDFileUMeshPerType"); }
static bool isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity);
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
int getDim() const;
MEDCoupling1GTUMesh *getMesh() const { return const_cast<MEDCoupling1GTUMesh *>((const MEDCoupling1GTUMesh *)_m); }
const PartDefinition *getPartDef() const { return _pd; }
// Author : Anthony Geay (CEA/DEN)
#include "MEDFileMeshLL.hxx"
-#include "MEDCouplingCurveLinearMesh.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingMemArray.txx"
-#include "MEDFileBasis.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingMap.txx"
-#include "MEDCouplingPartDefinition.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCIdType.hxx"
-#include "MEDCoupling1GTUMesh.hxx"
#include "MEDFileMesh.hxx"
-#include "MEDFileMeshElt.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDFileMeshReadSelector.hxx"
#include "CellModel.hxx"
#include "MEDFilterEntity.hxx"
-#include "med.h"
-#include "NormalizedGeometricTypes"
-#include "medmesh.h"
-#include <algorithm>
-#include <cstddef>
-#include "medfamily.h"
-#include "medstructelement.h"
-#include <istream>
-#include <iterator>
-#include <map>
-#include <ostream>
#include <set>
-#include <string>
-#include <sstream>
-#include <vector>
-#include <utility>
#include <iomanip>
// From MEDLOader.cxx TU
med_int spaceDim, meshDim, nbSteps;
med_sorting_type stype;
med_axis_type axistype;
- med_int const naxis(MEDmeshnAxis(fid,getID()));
+ med_int naxis(MEDmeshnAxis(fid,getID()));
INTERP_KERNEL::AutoPtr<char> nameTmp(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE));
- INTERP_KERNEL::AutoPtr<char> const univTmp(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE));
+ INTERP_KERNEL::AutoPtr<char> univTmp(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE));
if(MEDmeshInfo(fid,getID(),nameTmp,&spaceDim,&meshDim,&type_maillage,description.getPointer(),dtunit.getPointer(),
&stype,&nbSteps,&axistype,axisname,axisunit)!=0)
throw INTERP_KERNEL::Exception("A problem has been detected when trying to get info on mesh !");
std::vector<std::string> infosOnComp(naxis);
for(int i=0;i<naxis;i++)
{
- std::string const info(MEDLoaderBase::buildUnionUnit(((char *)axisname)+i*MED_SNAME_SIZE,MED_SNAME_SIZE,((char *)axisunit)+i*MED_SNAME_SIZE,MED_SNAME_SIZE));
+ std::string info(MEDLoaderBase::buildUnionUnit(((char *)axisname)+i*MED_SNAME_SIZE,MED_SNAME_SIZE,((char *)axisunit)+i*MED_SNAME_SIZE,MED_SNAME_SIZE));
infosOnComp[i]=info;
}
return infosOnComp;
return dtt;
}
-std::vector<std::string> StructMeshCls::getAxisInfoOnMesh(med_idt fid, const std::string& /*mName*/, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& /*Mdim*/, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const
+std::vector<std::string> StructMeshCls::getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const
{
INTERP_KERNEL::AutoPtr<char> msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> zeDescription(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
med_axis_type medAxType;
- med_int const nAxis(MEDsupportMeshnAxis(fid,getID()));
+ med_int nAxis(MEDsupportMeshnAxis(fid,getID()));
INTERP_KERNEL::AutoPtr<char> axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]);
med_int spaceDim(0),meshDim(0);
MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,getID(),msn,&spaceDim,&meshDim,zeDescription,&medAxType,axisName,axisUnit));
- std::string const descriptionCpp(MEDLoaderBase::buildStringFromFortran(zeDescription,MED_COMMENT_SIZE));
+ std::string descriptionCpp(MEDLoaderBase::buildStringFromFortran(zeDescription,MED_COMMENT_SIZE));
description.set(descriptionCpp.c_str());
dtunit.clear(); univName.clear(); meshType=UNSTRUCTURED; nstep=1;
axType=MEDFileMeshL2::TraduceAxisType(medAxType);
std::vector<std::string> ret;
for(int i=0;i<nAxis;i++)
{
- std::string const info(DataArray::BuildInfoFromVarAndUnit(MEDLoaderBase::buildStringFromFortran(axisName+i*MED_SNAME_SIZE,MED_SNAME_SIZE),
+ std::string info(DataArray::BuildInfoFromVarAndUnit(MEDLoaderBase::buildStringFromFortran(axisName+i*MED_SNAME_SIZE,MED_SNAME_SIZE),
MEDLoaderBase::buildStringFromFortran(axisUnit+i*MED_SNAME_SIZE,MED_SNAME_SIZE)));
ret.push_back(info);
}
return ret;
}
-double StructMeshCls::checkMeshTimeStep(med_idt /*fid*/, const std::string& /*mName*/, int /*nstep*/, int /*dt*/, int /*it*/) const
+double StructMeshCls::checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const
{
return 0.;
}
char dtunit[MED_LNAME_SIZE+1];
med_int spaceDim,dim;
char nommaa[MED_NAME_SIZE+1];
- med_int const n=MEDnMesh(fid);
+ med_int n=MEDnMesh(fid);
char found(0);
int ret=-1;
med_sorting_type stype;
med_axis_type axistype=MED_UNDEF_AXIS_TYPE;
for(int i=0;i<n && found==0;i++)
{
- med_int const naxis(MEDmeshnAxis(fid,i+1));
+ med_int naxis(MEDmeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)),axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE));
MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&spaceDim,&dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit));
dtunit1=MEDLoaderBase::buildStringFromFortran(dtunit,sizeof(dtunit));
- std::string const cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa)));
+ std::string cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa)));
ms.push_back(cur);
if(cur==mName)
{
}
if(found==0)
{//last chance ! Is it a support mesh ?
- med_int const nbSM(MEDnSupportMesh(fid));
+ med_int nbSM(MEDnSupportMesh(fid));
for(int i=0;i<nbSM && found==0;i++)
{
- med_int const naxis(MEDsupportMeshnAxis(fid,i+1));
+ med_int naxis(MEDsupportMeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)),axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE));
MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,nommaa,&spaceDim,&dim,maillage_description,&axistype,axisname,axisunit));
- std::string const cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa)));
+ std::string cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa)));
ms.push_back(cur);
if(cur==mName)
{
return ;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
- med_int const nfam=MEDnFamily(fid,meshName.c_str());
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > > crudeFams(nfam);
for(int i=0;i<nfam;i++)
{
- med_int const ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
- med_int const natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
- std::string const famName(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE));
+ std::string famName(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE));
std::vector<std::string> grps2(ngro);
for(int j=0;j<ngro;j++)
grps2[j]=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
crudeFams[i]=std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > >(famName,std::pair<mcIdType,std::vector<std::string> >(numfam,grps2));
}
RenameFamiliesFromFileToMemInternal(crudeFams);
- for(const auto & crudeFam : crudeFams)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++)
{
- fams[crudeFam.first]=crudeFam.second.first;
- for(auto it1=crudeFam.second.second.begin();it1!=crudeFam.second.second.end();it1++)
- grps[*it1].push_back(crudeFam.first);
+ fams[(*it0).first]=(*it0).second.first;
+ for(std::vector<std::string>::const_iterator it1=(*it0).second.second.begin();it1!=(*it0).second.second.end();it1++)
+ grps[*it1].push_back((*it0).first);
}
}
{
std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > > crudeFams(fams.size());
std::size_t ii(0);
- for(auto it=fams.begin();it!=fams.end();it++,ii++)
+ for(std::map<std::string,mcIdType>::const_iterator it=fams.begin();it!=fams.end();it++,ii++)
{
std::vector<std::string> grpsOfFam;
- for(const auto & grp : grps)
+ for(std::map<std::string, std::vector<std::string> >::const_iterator it1=grps.begin();it1!=grps.end();it1++)
{
- if(std::find(grp.second.begin(),grp.second.end(),(*it).first)!=grp.second.end())
- grpsOfFam.push_back(grp.first);
+ if(std::find((*it1).second.begin(),(*it1).second.end(),(*it).first)!=(*it1).second.end())
+ grpsOfFam.push_back((*it1).first);
}
crudeFams[ii]=std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > >((*it).first,std::pair<mcIdType,std::vector<std::string> >((*it).second,grpsOfFam));
}
RenameFamiliesFromMemToFileInternal(crudeFams);
- for(const auto & crudeFam : crudeFams)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++)
{
- std::size_t const ngro(crudeFam.second.second.size());
+ std::size_t ngro((*it).second.second.size());
INTERP_KERNEL::AutoPtr<char> groName=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE*ngro);
int i=0;
- for(auto it2=crudeFam.second.second.begin();it2!=crudeFam.second.second.end();it2++,i++)
+ for(std::vector<std::string>::const_iterator it2=(*it).second.second.begin();it2!=(*it).second.second.end();it2++,i++)
MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE,groName+i*MED_LNAME_SIZE,tooLongStrPol);
INTERP_KERNEL::AutoPtr<char> famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
- MEDLoaderBase::safeStrCpy(crudeFam.first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol);
- med_int ret=MEDfamilyCr(fid,mname.c_str(),famName,ToMedInt(crudeFam.second.first),ToMedInt(ngro),groName);
+ MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol);
+ med_int ret=MEDfamilyCr(fid,mname.c_str(),famName,ToMedInt((*it).second.first),ToMedInt(ngro),groName);
ret++;
}
}
if(!func(fams))
return ;
ii=0;
- for(auto it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
(*it).first=fams[ii];
}
{
std::map<std::string,mcIdType> m;
std::set<std::string> s;
- for(const auto & famName : famNames)
+ for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++)
{
- if(s.find(famName)!=s.end())
- m[famName]=0;
- s.insert(famName);
+ if(s.find(*it)!=s.end())
+ m[*it]=0;
+ s.insert(*it);
}
if(m.empty())
return false;// the general case !
- for(auto & famName : famNames)
+ for(std::vector< std::string >::iterator it=famNames.begin();it!=famNames.end();it++)
{
- auto const it2(m.find(famName));
+ std::map<std::string,mcIdType>::iterator it2(m.find(*it));
if(it2!=m.end())
{
- std::ostringstream oss; oss << famName << ZE_SEP_FOR_FAMILY_KILLERS << std::setfill('0') << std::setw(ZE_SEP2_FOR_FAMILY_KILLERS) << (*it2).second++;
- famName=oss.str();
+ std::ostringstream oss; oss << *it << ZE_SEP_FOR_FAMILY_KILLERS << std::setfill('0') << std::setw(ZE_SEP2_FOR_FAMILY_KILLERS) << (*it2).second++;
+ *it=oss.str();
}
}
return true;
bool MEDFileMeshL2::RenameFamiliesFromMemToFile(std::vector< std::string >& famNames)
{
bool isSmthingStrange(false);
- for(const auto & famName : famNames)
+ for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++)
{
- std::size_t const found(famName.find(ZE_SEP_FOR_FAMILY_KILLERS));
+ std::size_t found((*it).find(ZE_SEP_FOR_FAMILY_KILLERS));
if(found!=std::string::npos)
isSmthingStrange=true;
}
return false;
// pattern matching
std::map< std::string, std::vector<std::string> > m;
- for(const auto & famName : famNames)
+ for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++)
{
- std::size_t const found(famName.find(ZE_SEP_FOR_FAMILY_KILLERS));
+ std::size_t found((*it).find(ZE_SEP_FOR_FAMILY_KILLERS));
if(found!=std::string::npos && found>=1)
{
- std::string const s1(famName.substr(found+sizeof(ZE_SEP_FOR_FAMILY_KILLERS)-1));
+ std::string s1((*it).substr(found+sizeof(ZE_SEP_FOR_FAMILY_KILLERS)-1));
if((int)s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS)
continue;
int k(-1);
std::istringstream iss(s1);
iss >> k;
- bool const isOK((iss.rdstate() & ( std::istream::failbit | std::istream::eofbit)) == std::istream::eofbit);
+ bool isOK((iss.rdstate() & ( std::istream::failbit | std::istream::eofbit)) == std::istream::eofbit);
if(isOK && k>=0)
{
- std::string const s0(famName.substr(0,found));
- m[s0].push_back(famName);
+ std::string s0((*it).substr(0,found));
+ m[s0].push_back(*it);
}
}
}
{
if((*it).second.size()==1)
continue;
- for(auto it1=(*it).second.begin();it1!=(*it).second.end();it1++)
+ for(std::vector<std::string>::const_iterator it1=(*it).second.begin();it1!=(*it).second.end();it1++)
zeMap[*it1]=(*it).first;
}
if(zeMap.empty())
return false;
// traduce
- for(auto & famName : famNames)
+ for(std::vector< std::string >::iterator it=famNames.begin();it!=famNames.end();it++)
{
- auto const it1(zeMap.find(famName));
+ std::map<std::string,std::string>::iterator it1(zeMap.find(*it));
if(it1!=zeMap.end())
- famName=(*it1).second;
+ *it=(*it1).second;
}
return true;
}
}
MEDFileUMeshL2::MEDFileUMeshL2()
-= default;
+{
+}
std::vector<std::string> MEDFileUMeshL2::loadCommonPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, int& Mdim)
{
void MEDFileUMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
{
int Mdim;
- std::vector<std::string> const infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim));
+ std::vector<std::string> infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim));
if(Mdim==-4)
return ;
loadConnectivity(fid,Mdim,mName,dt,it,mrs);//to improve check (dt,it) coherency
* - dealing with optimized load of coordinates (loading only points fetched by the already loaded cells)
* - update the connectivity in \a this to fit the coordinates loaded just above
*/
-void MEDFileUMeshL2::dealWithCoordsInLoadPart(med_idt fid, const MeshOrStructMeshCls * /*mId*/, const std::string& mName, const std::vector<std::string>& infosOnComp, const std::vector<INTERP_KERNEL::NormalizedCellType>& /*types*/, const std::vector<mcIdType>& /*slicPerTyp*/, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshL2::dealWithCoordsInLoadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<std::string>& infosOnComp, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- mcIdType const nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+ mcIdType nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
std::vector<bool> fetchedNodeIds(nCoords,false);
- for(const auto & it0 : _per_type_mesh)
- for(const auto & it1 : it0)
- it1->getMesh()->computeNodeIdsAlg(fetchedNodeIds);
+ for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ (*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds);
if(!mrs || mrs->getNumberOfCoordsLoadSessions()==1)
{
- mcIdType const nMin(ToIdType(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true))));
+ mcIdType nMin(ToIdType(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true))));
mcIdType nMax(ToIdType(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true))));
nMax=nCoords-nMax;
- for(const auto & it0 : _per_type_mesh)
- for(const auto & it1 : it0)
- it1->getMesh()->renumberNodesWithOffsetInConn(-nMin);
+ for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ (*it1)->getMesh()->renumberNodesWithOffsetInConn(-nMin);
this->loadPartCoords(fid,infosOnComp,mName,dt,it,nMin,nMax);
}
else
{
- mcIdType const nbOfCooLS(mrs->getNumberOfCoordsLoadSessions());
+ mcIdType nbOfCooLS(mrs->getNumberOfCoordsLoadSessions());
MCAuto<DataArrayIdType> fni(DataArrayIdType::BuildListOfSwitchedOn(fetchedNodeIds));
MCAuto< MapKeyVal<mcIdType, mcIdType> > o2n(fni->invertArrayN2O2O2NOptimized());
- for(const auto & it0 : _per_type_mesh)
- for(const auto & it1 : it0)
- it1->getMesh()->renumberNodesInConn(o2n->data());
+ for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ (*it1)->getMesh()->renumberNodesInConn(o2n->data());
this->loadPartCoordsSlice(fid,infosOnComp,mName,dt,it,fni,nbOfCooLS);
}
}
void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
int Mdim;
- std::vector<std::string> const infosOnComp(loadPartConnectivityOnly(fid,mId,mName,types,slicPerTyp,dt,it,mrs,Mdim));
+ std::vector<std::string> infosOnComp(loadPartConnectivityOnly(fid,mId,mName,types,slicPerTyp,dt,it,mrs,Mdim));
if(Mdim==-4)
return ;
loadPartOfConnectivity(fid,Mdim,mName,types,slicPerTyp,dt,it,mrs);
void MEDFileUMeshL2::loadPartFromUserDistrib(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, int dt, int it, MEDFileMeshReadSelector *mrs)
{
int Mdim;
- std::vector<std::string> const infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim));
+ std::vector<std::string> infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim));
if(Mdim==-4)
return ;
/* Second step : loading nodes */
med_bool changement,transformation;
- mcIdType const nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+ mcIdType nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
std::vector<bool> fetchedNodeIds(nCoords,false);
- for(const auto & it0 : _per_type_mesh)
- for(const auto & it1 : it0)
- it1->getMesh()->computeNodeIdsAlg(fetchedNodeIds); // for each node in the original mesh, which ones are laying on the current single geometrical type partial mesh
+ for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ (*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds); // for each node in the original mesh, which ones are laying on the current single geometrical type partial mesh
if(!mrs || mrs->getNumberOfCoordsLoadSessions()==1)
{
// thus we want each node to be renumbered so that the sequence of their numbers form a range
MCAuto<DataArrayIdType> fni(DataArrayIdType::BuildListOfSwitchedOn(fetchedNodeIds));
MCAuto< MapKeyVal<mcIdType, mcIdType> > o2n(fni->invertArrayN2O2O2NOptimized());
- for(const auto & it0 : _per_type_mesh)
- for(const auto & it1 : it0)
- it1->getMesh()->renumberNodesInConn(o2n->data());
+ for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ (*it1)->getMesh()->renumberNodesInConn(o2n->data());
// loading coordinates of fetched nodes
std::vector<mcIdType> distribNodes;
void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
- std::size_t const nbOfTypes(types.size());
+ std::size_t nbOfTypes(types.size());
if(slicPerTyp.size()!=3*nbOfTypes)
throw INTERP_KERNEL::Exception("MEDFileUMeshL2::loadPartOfConnectivity : The size of slicPerTyp array is expected to be equal to 3 times size of array types !");
- std::set<INTERP_KERNEL::NormalizedCellType> const types2(types.begin(),types.end());
+ std::set<INTERP_KERNEL::NormalizedCellType> types2(types.begin(),types.end());
if(types2.size()!=nbOfTypes)
throw INTERP_KERNEL::Exception("MEDFileUMeshL2::loadPartOfConnectivity : the geometric types in types array must appear once !");
_per_type_mesh.resize(1);
for(std::size_t ii=0;ii<nbOfTypes;ii++)
{
mcIdType strt(slicPerTyp[3*ii+0]),stp(slicPerTyp[3*ii+1]),step(slicPerTyp[3*ii+2]);
- MCAuto<MEDFileUMeshPerType> const tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs));
+ MCAuto<MEDFileUMeshPerType> tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs));
_per_type_mesh[0].push_back(tmp);
}
sortTypes();
std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>::const_iterator iter;
for (iter = distrib.begin(); iter != distrib.end(); iter++)
{
- MCAuto<MEDFileUMeshPerType> const tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,iter->first/*type*/,iter->second/*distrib over the current type*/,mrs));
+ MCAuto<MEDFileUMeshPerType> tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,iter->first/*type*/,iter->second/*distrib over the current type*/,mrs));
_per_type_mesh[0].push_back(tmp);
}
sortTypes();
void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it)
{
- int const spaceDim((int)infosOnComp.size());
+ int spaceDim((int)infosOnComp.size());
med_bool changement,transformation;
- med_int const nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+ med_int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
_coords=DataArrayDouble::New();
_coords->alloc(nCoords,spaceDim);
double *coordsPtr(_coords->getPointer());
_fam_coords=FromMedIntArray<mcIdType>(miFamCoord);
}
else
- _fam_coords=nullptr;
+ _fam_coords=0;
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
MCAuto<DataArrayMedInt> miNumCoord=DataArrayMedInt::New();
_num_coords=FromMedIntArray<mcIdType>(miNumCoord);
}
else
- _num_coords=nullptr;
+ _num_coords=0;
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0)
{
_name_coords=DataArrayAsciiChar::New();
_name_coords->reAlloc(nCoords);//not a bug to avoid the memory corruption due to last \0 at the end
}
else
- _name_coords=nullptr;
+ _name_coords=0;
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_GLOBAL_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
MCAuto<DataArrayMedInt> miNumCoord=DataArrayMedInt::New();
void MEDFileUMeshL2::LoadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, const std::vector<mcIdType>& distribNodes,
MCAuto<DataArrayDouble>& _coords, MCAuto<PartDefinition>& _part_coords, MCAuto<DataArrayIdType>& _fam_coords, MCAuto<DataArrayIdType>& _num_coords, MCAuto<DataArrayAsciiChar>& _name_coords)
{
- med_int const spaceDim((int)infosOnComp.size());
+ med_int spaceDim((int)infosOnComp.size());
allocCoordsPartCoords(spaceDim,distribNodes,_coords,_part_coords);
_coords->setInfoOnComponents(infosOnComp);
fillPartCoords(fid,spaceDim,mName,dt,it,_part_coords,_coords,_fam_coords,_num_coords,_name_coords);
void MEDFileUMeshL2::LoadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax,
MCAuto<DataArrayDouble>& _coords, MCAuto<PartDefinition>& _part_coords, MCAuto<DataArrayIdType>& _fam_coords, MCAuto<DataArrayIdType>& _num_coords, MCAuto<DataArrayAsciiChar>& _name_coords)
{
- med_int const spaceDim((int)infosOnComp.size());
+ med_int spaceDim((int)infosOnComp.size());
allocCoordsPartCoords(spaceDim,nMin,nMax,_coords,_part_coords);
_coords->setInfoOnComponents(infosOnComp);
fillPartCoords(fid,spaceDim,mName,dt,it,_part_coords,_coords,_fam_coords,_num_coords,_name_coords);
*/
void MEDFileUMeshL2::allocCoordsPartCoords(mcIdType spaceDim, const std::vector<mcIdType>& nodeIds, MCAuto<DataArrayDouble>& _coords, MCAuto<PartDefinition>& _part_coords)
{
- mcIdType const nbNodesToLoad(nodeIds.size());
+ mcIdType nbNodesToLoad(nodeIds.size());
_coords=DataArrayDouble::New();
_coords->alloc(nbNodesToLoad,spaceDim);
void MEDFileUMeshL2::allocCoordsPartCoords(mcIdType spaceDim, mcIdType nMin, mcIdType nMax, MCAuto<DataArrayDouble>& _coords, MCAuto<PartDefinition>& _part_coords)
{
_coords=DataArrayDouble::New();
- mcIdType const nbNodesToLoad(nMax-nMin);
+ mcIdType nbNodesToLoad(nMax-nMin);
_coords->alloc(nbNodesToLoad,spaceDim);
_part_coords=PartDefinition::New(nMin,nMax,1);
MCAuto<DataArrayDouble>& _coords, MCAuto<DataArrayIdType>& _fam_coords, MCAuto<DataArrayIdType>& _num_coords, MCAuto<DataArrayAsciiChar>& _name_coords)
{
med_bool changement,transformation;
- med_int const nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
- mcIdType const nbNodesToLoad = partCoords->getNumberOfElems();
+ med_int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+ mcIdType nbNodesToLoad = partCoords->getNumberOfElems();
// Based on the ids in \a partCoords, defining the appropriate med_filter (filter of block if the ids form a slice, a generic filter otherwise)
{
mcIdType partStart,partStop;
DataArray::GetSlice(nMin,nMax,1,ipart,nbOfCoordLS,partStart,partStop);
MCAuto<DataArrayIdType> idsNodeIdsToKeep(nodeIds->findIdsInRange(partStart,partStop));
- MCAuto<DataArrayIdType> const nodeIdsToKeep( nodeIds->selectByTupleIdSafe(idsNodeIdsToKeep->begin(),idsNodeIdsToKeep->end()) );
+ MCAuto<DataArrayIdType> nodeIdsToKeep( nodeIds->selectByTupleIdSafe(idsNodeIdsToKeep->begin(),idsNodeIdsToKeep->end()) );
LoadPartCoordsArray(fid,infosOnComp,mName,dt,it,nodeIdsToKeep,coords[ipart],famCoords[ipart],numCoords[ipart],nameCoords[ipart]);
}
_coords = DataArrayDouble::Aggregate(ToConstVect<DataArrayDouble>(coords));
void MEDFileUMeshL2::sortTypes()
{
std::set<int> mdims;
- std::vector< MCAuto<MEDFileUMeshPerType> > const tmp(_per_type_mesh[0]);
+ std::vector< MCAuto<MEDFileUMeshPerType> > tmp(_per_type_mesh[0]);
_per_type_mesh.clear();
- for(const auto & it : tmp)
- mdims.insert(it->getDim());
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it=tmp.begin();it!=tmp.end();it++)
+ mdims.insert((*it)->getDim());
if(mdims.empty())
return;
- int const mdim=*mdims.rbegin();
+ int mdim=*mdims.rbegin();
_per_type_mesh.resize(mdim+1);
for(int dim=mdim+1;dim!=0;dim--)
{
std::vector< MCAuto<MEDFileUMeshPerType> >& elt=_per_type_mesh[mdim+1-dim];
- for(const auto & it : tmp)
- if(it->getDim()==dim-1)
- elt.push_back(it);
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it=tmp.begin();it!=tmp.end();it++)
+ if((*it)->getDim()==dim-1)
+ elt.push_back(*it);
}
// suppression of contiguous empty levels at the end of _per_type_mesh.
int nbOfUselessLev=0;
bool isFirst=true;
- for(auto it2=_per_type_mesh.rbegin();it2!=_per_type_mesh.rend();it2++)
+ for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::reverse_iterator it2=_per_type_mesh.rbegin();it2!=_per_type_mesh.rend();it2++)
{
if((*it2).empty() && isFirst)
{
bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const
{
- for(const auto & it : _per_type_mesh[levId])
- if(it->getFam()==nullptr)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
+ if((*it)->getFam()==0)
return false;
return true;
}
bool MEDFileUMeshL2::isNumDefinedOnLev(int levId) const
{
- for(const auto & it : _per_type_mesh[levId])
- if(it->getNum()==nullptr)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
+ if((*it)->getNum()==0)
return false;
return true;
}
bool MEDFileUMeshL2::isNamesDefinedOnLev(int levId) const
{
- for(const auto & it : _per_type_mesh[levId])
- if(it->getNames()==nullptr)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
+ if((*it)->getNames()==0)
return false;
return true;
}
_cmesh=MEDCouplingCMesh::New();
for(int i=0;i<Mdim;i++)
{
- med_data_type const dataTypeReq=GetDataTypeCorrespondingToSpaceId(i);
+ med_data_type dataTypeReq=GetDataTypeCorrespondingToSpaceId(i);
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- med_int const nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf));
+ med_int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf));
MCAuto<DataArrayDouble> da=DataArrayDouble::New();
da->alloc(nbOfElt,1);
da->setInfoOnComponent(0,infosOnComp[i]);
}
MEDFileCLMeshL2::MEDFileCLMeshL2()
-= default;
+{
+}
void MEDFileCLMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it)
{
int Mdim;
MEDCoupling::MEDCouplingMeshType meshType;
MEDCoupling::MEDCouplingAxisType dummy3;
- std::vector<std::string> const infosOnComp(getAxisInfoOnMesh(fid,mId,mName,meshType,dummy3,nstep,Mdim));
+ std::vector<std::string> infosOnComp(getAxisInfoOnMesh(fid,mId,mName,meshType,dummy3,nstep,Mdim));
if(meshType!=CURVE_LINEAR)
throw INTERP_KERNEL::Exception("Invalid mesh type ! You are expected a structured one whereas in file it is not a structured !");
_time=mId->checkMeshTimeStep(fid,mName,nstep,dt,it);
MCAuto<DataArrayIdType> stGrid=FromMedIntArray<mcIdType>(miStGrid);
_clmesh->setNodeGridStructure(stGrid->begin(),stGrid->end());
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- med_int const nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf));
+ med_int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf));
MCAuto<DataArrayDouble> da=DataArrayDouble::New();
da->alloc(nbNodes,infosOnComp.size());
da->setInfoOnComponents(infosOnComp);
MEDFileUMeshPermCompute::operator MEDCouplingUMesh *() const
{
_st->_num->updateTime();
- if((MEDCouplingUMesh *)_m==nullptr)
+ if((MEDCouplingUMesh *)_m==0)
{
updateTime();
_m=static_cast<MEDCouplingUMesh *>(_st->_m_by_types.getUmesh()->deepCopy());
{
}
-MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& /*mName*/, int id):_m(this)
+MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id):_m(this)
{
const std::vector< MCAuto<MEDFileUMeshPerType> >& v=l2.getLev(id);
if(v.empty())
return;
- std::size_t const sz=v.size();
+ std::size_t sz=v.size();
std::vector<const MEDCoupling1GTUMesh *> ms(sz);
std::vector<const DataArrayIdType *> fams(sz),nums(sz);
std::vector<const DataArrayChar *> names(sz);
{
if (!_fam || _fam->getNumberOfTuples() != getSize())
throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): internal family array has an invalid size!");
- mcIdType const nbCells = getSize();
+ mcIdType nbCells = getSize();
if (_num)
{
_num->checkNbOfTuplesAndComp(nbCells,1,"MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal node numbering array!");
mcIdType pos;
- mcIdType const maxValue=_num->getMaxValue(pos);
+ mcIdType maxValue=_num->getMaxValue(pos);
if (!_rev_num || _rev_num->getNumberOfTuples() != (maxValue+1))
throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal revert node numbering array!");
}
return false;
const DataArrayIdType *d1=_fam;
const DataArrayIdType *d2=other->_fam;
- if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr))
+ if((d1==0 && d2!=0) || (d1!=0 && d2==0))
{
what="Presence of family arr in one sublevel and not in other!";
return false;
}
d1=_num;
d2=other->_num;
- if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr))
+ if((d1==0 && d2!=0) || (d1!=0 && d2==0))
{
what="Presence of cell numbering arr in one sublevel and not in other!";
return false;
}
const DataArrayAsciiChar *e1=_names;
const DataArrayAsciiChar *e2=other->_names;
- if((e1==nullptr && e2!=nullptr) || (e1!=nullptr && e2==nullptr))
+ if((e1==0 && e2!=0) || (e1!=0 && e2==0))
{
what="Presence of cell names arr in one sublevel and not in other!";
return false;
void MEDFileUMeshSplitL1::simpleRepr(std::ostream& oss) const
{
std::vector<mcIdType> code=_m_by_types.getDistributionOfTypes();
- std::size_t const nbOfTypes=code.size()/3;
+ std::size_t nbOfTypes=code.size()/3;
for(std::size_t i=0;i<nbOfTypes;i++)
{
- auto typ=(INTERP_KERNEL::NormalizedCellType) code[3*i];
+ INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType) code[3*i];
oss << " - Number of cells with type " << INTERP_KERNEL::CellModel::GetCellModel(typ).getRepr() << " : " << code[3*i+1] << std::endl;
}
}
MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const
{
MCAuto<DataArrayIdType> eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd);
- auto *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true);
+ MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true);
if(renum)
return renumIfNeeded(m,eltsToKeep->begin());
return m;
{
const DataArrayIdType *fam(_fam);
if(!fam)
- return nullptr;
+ return 0;
mcIdType start(0),stop(0);
_m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop);
return fam->selectByTupleIdSafeSlice(start,stop,1);
{
const DataArrayIdType *num(_num);
if(!num)
- return nullptr;
+ return 0;
mcIdType start(0),stop(0);
_m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop);
return num->selectByTupleIdSafeSlice(start,stop,1);
{
if((DataArrayIdType *)_fam)
return _fam;
- mcIdType const nbOfTuples=_m_by_types.getSize();
+ mcIdType nbOfTuples=_m_by_types.getSize();
_fam=DataArrayIdType::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero();
return _fam;
}
* This method ignores _m and _m_by_types.
*/
void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,mcIdType>& familyIds,
- std::map<std::string, std::vector<std::string> >& /*groups*/)
+ std::map<std::string, std::vector<std::string> >& groups)
{
std::vector< DataArrayIdType * > corr;
_m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr);
- std::vector< MCAuto<DataArrayIdType> > const corrMSafe(corr.begin(),corr.end());
+ std::vector< MCAuto<DataArrayIdType> > corrMSafe(corr.begin(),corr.end());
std::vector< std::vector<mcIdType> > fidsOfGroups;
- std::vector< const DataArrayIdType * > const corr2(corr.begin(),corr.end());
+ std::vector< const DataArrayIdType * > corr2(corr.begin(),corr.end());
_fam=DataArrayIdType::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups);
- mcIdType const nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells();
+ mcIdType nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells();
std::map<mcIdType,std::string> newfams;
std::map<mcIdType,mcIdType> famIdTrad;
TraduceFamilyNumber(fidsOfGroups,familyIds,famIdTrad,newfams);
void MEDFileUMeshSplitL1::checkCoordsConsistency(const DataArrayDouble *coords) const
{
- std::vector<MEDCoupling1GTUMesh *> const ms(_m_by_types.getParts());
+ std::vector<MEDCoupling1GTUMesh *> ms(_m_by_types.getParts());
for(auto mesh : ms)
{
if(mesh)
void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) const
{
- std::vector<MEDCoupling1GTUMesh *> const ms(_m_by_types.getParts());
+ std::vector<MEDCoupling1GTUMesh *> ms(_m_by_types.getParts());
mcIdType start=0;
- for(auto m : ms)
+ for(std::vector<MEDCoupling1GTUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++)
{
- mcIdType const nbCells=m->getNumberOfCells();
- mcIdType const end=start+nbCells;
+ mcIdType nbCells=(*it)->getNumberOfCells();
+ mcIdType end=start+nbCells;
MCAuto<DataArrayIdType> fam,num;
MCAuto<DataArrayAsciiChar> names;
if((const DataArrayIdType *)_fam)
num=_num->subArray(start,end);
if((const DataArrayAsciiChar *)_names)
names=static_cast<DataArrayAsciiChar *>(_names->subArray(start,end));
- MEDFileUMeshPerType::Write(fid,mName,mdim,m,fam,num,names);
+ MEDFileUMeshPerType::Write(fid,mName,mdim,(*it),fam,num,names);
start=end;
}
}
{
if(!famArr)
{
- _fam=nullptr;
+ _fam=0;
return ;
}
- mcIdType const sz(_m_by_types.getSize());
+ mcIdType sz(_m_by_types.getSize());
famArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setFamilyArr : Problem in size of Family arr ! ");
famArr->incrRef();
_fam=famArr;
{
if(!renumArr)
{
- _num=nullptr;
- _rev_num=nullptr;
+ _num=0;
+ _rev_num=0;
return ;
}
- mcIdType const sz(_m_by_types.getSize());
+ mcIdType sz(_m_by_types.getSize());
renumArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setRenumArr : Problem in size of numbering arr ! ");
renumArr->incrRef();
_num=renumArr;
{
if(!nameArr)
{
- _names=nullptr;
+ _names=0;
return ;
}
- mcIdType const sz(_m_by_types.getSize());
+ mcIdType sz(_m_by_types.getSize());
nameArr->checkNbOfTuplesAndComp(sz,MED_SNAME_SIZE,"MEDFileUMeshSplitL1::setNameArr : Problem in size of name arr ! ");
nameArr->incrRef();
_names=nameArr;
MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds)
{
- if(renum==nullptr)
+ if(renum==0)
return m;
- if(cellIds==nullptr)
+ if(cellIds==0)
m->renumberCells(renum->begin(),true);
else
{
DataArrayIdType *MEDFileUMeshSplitL1::Renumber(const DataArrayIdType *renum, const DataArrayIdType *da)
{
- if((const DataArrayIdType *)renum==nullptr)
+ if((const DataArrayIdType *)renum==0)
{
da->incrRef();
return const_cast<DataArrayIdType *>(da);
std::vector<mcIdType> MEDFileUMeshSplitL1::GetNewFamiliesNumber(mcIdType nb, const std::map<std::string,mcIdType>& families)
{
mcIdType id=-1;
- for(const auto & familie : families)
- id=std::max(id,familie.second);
+ for(std::map<std::string,mcIdType>::const_iterator it=families.begin();it!=families.end();it++)
+ id=std::max(id,(*it).second);
if(id==-1)
id=0;
std::vector<mcIdType> ret(nb);
return ret;
}
-void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector<mcIdType> >& /*fidsGrps*/, std::map<std::string,mcIdType>& /*familyIds*/,
- std::map<mcIdType,mcIdType>& /*famIdTrad*/, std::map<mcIdType,std::string>& /*newfams*/)
+void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector<mcIdType> >& fidsGrps, std::map<std::string,mcIdType>& familyIds,
+ std::map<mcIdType,mcIdType>& famIdTrad, std::map<mcIdType,std::string>& newfams)
{
- std::set<mcIdType> const allfids;
+ std::set<mcIdType> allfids;
//tony
}
mcIdType pos;
if(!_num->empty())
{
- mcIdType const maxValue=_num->getMaxValue(pos);
+ mcIdType maxValue=_num->getMaxValue(pos);
_rev_num=_num->invertArrayN2O2O2N(maxValue+1);
}
else
}
if(_mp_time>=_m_time)
{
- for(auto & _m_part : _m_parts)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
- MEDCoupling1GTUMesh *tmp(_m_part);
+ MEDCoupling1GTUMesh *tmp(*it);
if(tmp)
tmp->setName(name);
}
void MEDFileUMeshAggregateCompute::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts)
{
- std::size_t const sz(mParts.size());
+ std::size_t sz(mParts.size());
std::vector< MCAuto<MEDCoupling1GTUMesh> > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
_m_parts=ret;
_part_def.clear(); _part_def.resize(sz);
_mp_time=std::max(_mp_time,_m_time)+1;
- _m=nullptr;
+ _m=0;
}
void MEDFileUMeshAggregateCompute::assignDefParts(const std::vector<const PartDefinition *>& partDefs)
{
if(_mp_time<_m_time)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::assignDefParts : the parts require a computation !");
- std::size_t const sz(partDefs.size());
+ std::size_t sz(partDefs.size());
if(_part_def.size()!=partDefs.size() || _part_def.size()!=_m_parts.size())
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::assignDefParts : sizes of vectors of part definition mismatch !");
for(std::size_t i=0;i<sz;i++)
if(_mp_time<=_m_time)
return _m->getNumberOfCells();
mcIdType ret(0);
- for(const auto & _m_part : _m_parts)
- ret+=_m_part->getNumberOfCells();
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ ret+=(*it)->getNumberOfCells();
return ret;
}
{
if(_mp_time>=_m_time)
{
- std::size_t const sz(_m_parts.size());
+ std::size_t sz(_m_parts.size());
std::vector<INTERP_KERNEL::NormalizedCellType> ret(sz);
for(std::size_t i=0;i<sz;i++)
ret[i]=_m_parts[i]->getCellModelEnum();
{
if(_mp_time>=_m_time)
{
- for(const auto & _m_part : _m_parts)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
- const MEDCoupling1GTUMesh *elt(_m_part);
+ const MEDCoupling1GTUMesh *elt(*it);
if(elt && elt->getCellModelEnum()==ct)
return elt->getNumberOfCells();
}
MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const
{
std::vector<MEDCoupling1GTUMesh *> v(retrievePartsWithoutComputation());
- std::size_t const sz(v.size());
+ std::size_t sz(v.size());
for(std::size_t i=0;i<sz;i++)
{
if(v[i])
{
start=0; stop=0;
std::vector<MEDCoupling1GTUMesh *> v(retrievePartsWithoutComputation());
- std::size_t const sz(v.size());
+ std::size_t sz(v.size());
for(std::size_t i=0;i<sz;i++)
{
if(v[i])
{
if(_mp_time>_m_time)
{
- for(auto & _m_part : _m_parts)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
- MEDCoupling1GTUMesh *m(_m_part);
+ MEDCoupling1GTUMesh *m(*it);
if(m)
m->renumberNodesInConn(newNodeNumbersO2N);
}
return ;// no needs to compte parts they are already here !
}
std::vector<MEDCouplingUMesh *> ms(m->splitByType());
- std::vector< MCAuto<MEDCouplingUMesh> > const msMSafe(ms.begin(),ms.end());
- std::size_t const sz(msMSafe.size());
+ std::vector< MCAuto<MEDCouplingUMesh> > msMSafe(ms.begin(),ms.end());
+ std::size_t sz(msMSafe.size());
_m_parts.resize(sz);
for(std::size_t i=0;i<sz;i++)
_m_parts[i]=MEDCoupling1GTUMesh::New(ms[i]);
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : the parts require a computation !");
if(_m_parts.size()!=_part_def.size())
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : size of arrays are expected to be the same !");
- std::size_t const sz(_m_parts.size());
+ std::size_t sz(_m_parts.size());
for(std::size_t i=0;i<sz;i++)
{
const MEDCoupling1GTUMesh *mesh(_m_parts[i]);
{
if(_mp_time<_m_time)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : the parts require a computation !");
- std::size_t const sz(_m_parts.size());
+ std::size_t sz(_m_parts.size());
tinyInt.push_back((mcIdType)sz);
for(std::size_t i=0;i<sz;i++)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : one part is empty !");
tinyInt.push_back(mesh->getCellModelEnum());
- const auto *mesh1(dynamic_cast<const MEDCoupling1SGTUMesh *>(mesh));
- const auto *mesh2(dynamic_cast<const MEDCoupling1DGTUMesh *>(mesh));
+ const MEDCoupling1SGTUMesh *mesh1(dynamic_cast<const MEDCoupling1SGTUMesh *>(mesh));
+ const MEDCoupling1DGTUMesh *mesh2(dynamic_cast<const MEDCoupling1DGTUMesh *>(mesh));
if(mesh1)
{
DataArrayIdType *elt(mesh1->getNodalConnectivity());
if(elt)
elt->incrRef();
- MCAuto<DataArrayIdType> const elt1(elt);
+ MCAuto<DataArrayIdType> elt1(elt);
bigArraysI.push_back(elt1);
}
else if(mesh2)
void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI)
{
- mcIdType const nbParts(tinyInt.back()); tinyInt.pop_back();
+ mcIdType nbParts(tinyInt.back()); tinyInt.pop_back();
_part_def.clear(); _part_def.resize(nbParts);
_m_parts.clear(); _m_parts.resize(nbParts);
for(mcIdType i=0;i<nbParts;i++)
{
- auto tp((INTERP_KERNEL::NormalizedCellType) tinyInt.back()); tinyInt.pop_back();
+ INTERP_KERNEL::NormalizedCellType tp((INTERP_KERNEL::NormalizedCellType) tinyInt.back()); tinyInt.pop_back();
MCAuto<MEDCoupling1GTUMesh> mesh(MEDCoupling1GTUMesh::New(name,tp));
mesh->setCoords(coo);
- auto *mesh1(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *) mesh));
- auto *mesh2(dynamic_cast<MEDCoupling1DGTUMesh *>((MEDCoupling1GTUMesh *) mesh));
+ MEDCoupling1SGTUMesh *mesh1(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *) mesh));
+ MEDCoupling1DGTUMesh *mesh2(dynamic_cast<MEDCoupling1DGTUMesh *>((MEDCoupling1GTUMesh *) mesh));
if(mesh1)
{
mesh1->setNodalConnectivity(bigArraysI.back()); bigArraysI.pop_back();
else
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::unserialize : unrecognized single geo type mesh !");
_m_parts[i]=mesh;
- mcIdType const pdid(tinyInt.back()); tinyInt.pop_back();
+ mcIdType pdid(tinyInt.back()); tinyInt.pop_back();
if(pdid!=-1)
_part_def[i]=PartDefinition::Unserialize(tinyInt,bigArraysI);
_mp_time=std::max(_mp_time,_m_time)+1;
std::size_t MEDFileUMeshAggregateCompute::getTimeOfParts() const
{
std::size_t ret(0);
- for(const auto & _m_part : _m_parts)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
- const MEDCoupling1GTUMesh *elt(_m_part);
+ const MEDCoupling1GTUMesh *elt(*it);
if(!elt)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getTimeOfParts : null obj in parts !");
ret=std::max(ret,elt->getTimeOfThis());
std::size_t MEDFileUMeshAggregateCompute::getHeapMemorySizeWithoutChildren() const
{
- std::size_t const ret(_m_parts.size()*sizeof(MCAuto<MEDCoupling1GTUMesh>));
+ std::size_t ret(_m_parts.size()*sizeof(MCAuto<MEDCoupling1GTUMesh>));
return ret;
}
std::vector<const BigMemoryObject *> MEDFileUMeshAggregateCompute::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _m_part : _m_parts)
- ret.push_back((const MEDCoupling1GTUMesh *)_m_part);
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ ret.push_back((const MEDCoupling1GTUMesh *)*it);
ret.push_back((const MEDCouplingUMesh *)_m);
return ret;
}
ret._m=static_cast<MEDCoupling::MEDCouplingUMesh*>(_m->deepCopy());
ret._m->setCoords(coords);
}
- std::size_t const sz(_part_def.size());
+ std::size_t sz(_part_def.size());
ret._part_def.clear(); ret._part_def.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
void MEDFileUMeshAggregateCompute::shallowCpyMeshes()
{
- for(auto & _m_part : _m_parts)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
- const MEDCoupling1GTUMesh *elt(_m_part);
+ const MEDCoupling1GTUMesh *elt(*it);
if(elt)
{
MCAuto<MEDCouplingMesh> elt2(elt->clone(false));
- _m_part=DynamicCastSafe<MEDCouplingMesh,MEDCoupling1GTUMesh>(elt2);
+ *it=DynamicCastSafe<MEDCouplingMesh,MEDCoupling1GTUMesh>(elt2);
}
}
const MEDCouplingUMesh *m(_m);
{
const MEDCouplingUMesh *m1(getUmesh());
const MEDCouplingUMesh *m2(other.getUmesh());
- if((m1==nullptr && m2!=nullptr) || (m1!=nullptr && m2==nullptr))
+ if((m1==0 && m2!=0) || (m1!=0 && m2==0))
{
what="Presence of mesh in one sublevel and not in other!";
return false;
return false;
}
}
- std::size_t const sz(_part_def.size());
+ std::size_t sz(_part_def.size());
if(sz!=other._part_def.size())
{
what=std::string("number of subdivision per geo type for part definition is not the same !");
what=std::string("a cell part def is defined only for one among this or other !");
return false;
}
- bool const ret(pd0->isEqual(pd1,what));
+ bool ret(pd0->isEqual(pd1,what));
if(!ret)
return false;
}
void MEDFileUMeshAggregateCompute::checkConsistency() const
{
if(_mp_time >= _m_time)
- for(const auto & _m_part : _m_parts)
- _m_part->checkConsistency();
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();
+ it!=_m_parts.end(); it++)
+ (*it)->checkConsistency();
else
_m->checkConsistency();
}
void MEDFileUMeshAggregateCompute::clearNonDiscrAttributes() const
{
- for(const auto & _m_part : _m_parts)
- MEDFileUMeshSplitL1::ClearNonDiscrAttributes(_m_part);
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ MEDFileUMeshSplitL1::ClearNonDiscrAttributes(*it);
MEDFileUMeshSplitL1::ClearNonDiscrAttributes(_m);
}
void MEDFileUMeshAggregateCompute::synchronizeTinyInfo(const MEDFileMesh& master) const
{
- for(const auto & _m_part : _m_parts)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
- const MEDCoupling1GTUMesh *tmp(_m_part);
+ const MEDCoupling1GTUMesh *tmp(*it);
if(tmp)
{
(const_cast<MEDCoupling1GTUMesh *>(tmp))->setName(master.getName().c_str());
bool MEDFileUMeshAggregateCompute::empty() const
{
if(_mp_time<_m_time)
- return ((const MEDCouplingUMesh *)_m)==nullptr;
+ return ((const MEDCouplingUMesh *)_m)==0;
//else _mp_time>=_m_time)
return _m_parts.empty();
}
else
{
std::vector<mcIdType> ret;
- for(const auto & _m_part : _m_parts)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
- const MEDCoupling1GTUMesh *tmp(_m_part);
+ const MEDCoupling1GTUMesh *tmp(*it);
if(!tmp)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getDistributionOfTypes : part mesh contains null instance !");
std::vector<mcIdType> ret0(tmp->getDistributionOfTypes());
else
{
mcIdType ret=0;
- for(const auto & _m_part : _m_parts)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
- const MEDCoupling1GTUMesh *m(_m_part);
+ const MEDCoupling1GTUMesh *m(*it);
if(!m)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getSize : part mesh contains null instance !");
ret+=m->getNumberOfCells();
void MEDFileUMeshAggregateCompute::setCoords(DataArrayDouble *coords)
{
- for(auto & _m_part : _m_parts)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
- MEDCoupling1GTUMesh *tmp(_m_part);
+ MEDCoupling1GTUMesh *tmp(*it);
if(tmp)
- _m_part->setCoords(coords);
+ (*it)->setCoords(coords);
}
MEDCouplingUMesh *m(_m);
if(m)
std::vector<const MEDCoupling::BigMemoryObject*> ret;
ret.push_back(_conn);
ret.push_back(_common);
- for(const auto & _var : _vars)
- ret.push_back(_var);
+ for(std::vector< MCAuto<DataArray> >::const_iterator it=_vars.begin();it!=_vars.end();it++)
+ ret.push_back(*it);
return ret;
}
}
MCAuto<MEDFileMeshSupports> mss(MEDFileMeshSupports::New(fid));
MCAuto<MEDFileStructureElements> mse(MEDFileStructureElements::New(fid,mss));
- mcIdType const nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name));
+ mcIdType nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name));
MCAuto<DataArrayMedInt> miConn=DataArrayMedInt::New(); miConn->alloc(nCells*nbEntities);
MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,miConn->getPointer()));
_conn=FromMedIntArray<mcIdType>(miConn);
_common=MEDFileUMeshPerTypeCommon::New();
_common->loadCommonPart(fid,mName.c_str(),dt,it,nCells,geoType,MED_STRUCT_ELEMENT,mrs);
std::vector<std::string> vns(mse->getVarAttsOf(_geo_type_name));
- std::size_t const sz(vns.size());
+ std::size_t sz(vns.size());
_vars.resize(sz);
for(std::size_t i=0;i<sz;i++)
{
#ifndef __MEDFILEMESHLL_HXX__
#define __MEDFILEMESHLL_HXX__
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
#include "MEDFileBasis.hxx"
#include "MEDFileMeshElt.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "NormalizedGeometricTypes"
#include "med.h"
-#include <cstddef>
#include <map>
-#include <string>
-#include <ostream>
-#include <vector>
-#include <utility>
namespace MEDCoupling
{
protected:
MeshOrStructMeshCls(int mid):_mid(mid) { }
public:
- virtual ~MeshOrStructMeshCls() = default;
+ virtual ~MeshOrStructMeshCls() {}
int getID() const { return _mid; }
virtual std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const = 0;
virtual double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const = 0;
{
public:
MeshCls(int mid):MeshOrStructMeshCls(mid) { }
- std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const override;
- double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const override;
+ std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const;
+ double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const;
};
class StructMeshCls : public MeshOrStructMeshCls
{
public:
StructMeshCls(int mid):MeshOrStructMeshCls(mid) { }
- std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const override;
- double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const override;
+ std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const;
+ double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const;
};
class MEDFileMeshL2 : public RefCountObject
{
public:
MEDFileMeshL2();
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
const char *getName() const { return _name.getReprForWrite(); }
const char *getDescription() const { return _description.getReprForWrite(); }
const char *getUnivName() const { return _univ_name.getReprForWrite(); }
operator MEDCouplingUMesh *() const;
void operator=(MEDCouplingUMesh *m);
void updateTime() const;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- std::size_t getHeapMemorySizeWithoutChildren() const override;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
private:
const MEDFileUMeshSplitL1 *_st;
mutable std::size_t _mpt_time;
void renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N);
bool isStoredSplitByType() const;
std::size_t getTimeOfThis() const;
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDFileUMeshAggregateCompute deepCopy(DataArrayDouble *coords) const;
void shallowCpyMeshes();
bool isEqual(const MEDFileUMeshAggregateCompute& other, double eps, std::string& what) const;
MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld);
std::string getClassName() const override { return std::string("MEDFileUMeshSplitL1"); }
void setName(const std::string& name);
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDFileUMeshSplitL1 *shallowCpyUsingCoords(DataArrayDouble *coords) const;
MEDFileUMeshSplitL1 *deepCopy(DataArrayDouble *coords) const;
void checkConsistency() const;
MCAuto<MEDFileUMeshPerTypeCommon> getMeshDef() const { return _common; }
const std::vector< MCAuto<DataArray> >& getVars() const { return _vars; }
private:
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const MEDCoupling::BigMemoryObject*> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const MEDCoupling::BigMemoryObject*> getDirectChildrenWithNull() const;
private:
- ~MEDFileEltStruct4Mesh() override = default;
+ ~MEDFileEltStruct4Mesh() { }
private:
MEDFileEltStruct4Mesh(med_idt fid, const std::string& mName, int dt, int it, int iterOnStEltOfMesh, MEDFileMeshReadSelector *mrs);
private:
#include "MEDFileMeshReadSelector.hxx"
#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
-#include <ostream>
-#include <string>
+#include <sstream>
using namespace MEDCoupling;
void MEDFileMeshReadSelector::setCellFamilyFieldReading(bool b)
{
unsigned int code(_code & 0xFFFFFFFE);
- unsigned int const b2=b?1:0;
+ unsigned int b2=b?1:0;
//b2<<=0;
code+=b2;
_code=code;
#include "MCIdType.hxx"
-#include <ostream>
#include <string>
namespace MEDCoupling
// Author : Anthony Geay (EDF R&D)
#include "MEDFileMeshSupport.hxx"
-#include "MCAuto.hxx"
-#include "MEDFileUtilities.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "CellModel.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileMeshLL.hxx"
#include "MEDFileSafeCaller.txx"
#include "InterpKernelAutoPtr.hxx"
-#include <algorithm>
-#include <iterator>
-#include <string>
-#include "med.h"
-#include "medmesh.h"
-#include <cstddef>
-#include <sstream>
-#include <vector>
-#include "NormalizedGeometricTypes"
using namespace MEDCoupling;
MEDFileMeshSupports *MEDFileMeshSupports::New(const std::string& fileName)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid);
}
MEDFileMeshSupports::MEDFileMeshSupports(med_idt fid)
{
- med_int const nbSM(MEDnSupportMesh(fid));
+ med_int nbSM(MEDnSupportMesh(fid));
_supports.resize(nbSM);
for(int i=0;i<nbSM;i++)
{
INTERP_KERNEL::AutoPtr<char> msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> description(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
med_axis_type axType;
- med_int const nAxis(MEDsupportMeshnAxis(fid,i+1));
+ med_int nAxis(MEDsupportMeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]);
med_int spaceDim(0),meshDim(0);
MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,msn,&spaceDim,&meshDim,description,&axType,axisName,axisUnit));
- std::string const name(MEDLoaderBase::buildStringFromFortran(msn,MED_NAME_SIZE));
+ std::string name(MEDLoaderBase::buildStringFromFortran(msn,MED_NAME_SIZE));
_supports[i]=MEDFileUMesh::New(fid,name);
}
}
MEDFileMeshSupports::MEDFileMeshSupports()
-= default;
+{
+}
MEDFileMeshSupports::~MEDFileMeshSupports()
-= default;
+{
+}
std::vector<const BigMemoryObject *> MEDFileMeshSupports::getDirectChildrenWithNull() const
{
- std::size_t const sz(_supports.size());
+ std::size_t sz(_supports.size());
std::vector<const BigMemoryObject *> ret(sz);
for(std::size_t i=0;i<sz;i++)
ret[i]=_supports[i];
void MEDFileMeshSupports::writeLL(med_idt fid) const
{
- for(const auto & _support : _supports)
- if(_support.isNotNull())
- _support->writeLL(fid);
+ for(std::vector< MCAuto<MEDFileUMesh> >::const_iterator it=_supports.begin();it!=_supports.end();it++)
+ if((*it).isNotNull())
+ (*it)->writeLL(fid);
}
std::vector<std::string> MEDFileMeshSupports::getSupMeshNames() const
{
std::vector<std::string> ret;
- for(const auto & _support : _supports)
- if(_support.isNotNull())
- ret.push_back(_support->getName());
+ for(std::vector< MCAuto<MEDFileUMesh> >::const_iterator it=_supports.begin();it!=_supports.end();it++)
+ if((*it).isNotNull())
+ ret.push_back((*it)->getName());
return ret;
}
const MEDFileUMesh *MEDFileMeshSupports::getSupMeshWithName(const std::string& name) const
{
std::vector<std::string> mns;
- for(const auto & _support : _supports)
+ for(std::vector< MCAuto<MEDFileUMesh> >::const_iterator it=_supports.begin();it!=_supports.end();it++)
{
- if(_support.isNotNull())
+ if((*it).isNotNull())
{
- std::string const na(_support->getName());
+ std::string na((*it)->getName());
if(na==name)
- return _support;
+ return *it;
else
mns.push_back(na);
}
#ifndef __MEDFILEMESHSUPPORT_HXX__
#define __MEDFILEMESHSUPPORT_HXX__
-#include "MCAuto.hxx"
-#include "MEDFileUtilities.hxx"
-#include "MCType.hxx"
#include "MEDLoaderDefines.hxx"
+#include "MEDFileUtilities.txx"
#include "MEDFileMesh.hxx"
#include "MEDCouplingRefCountObject.hxx"
-#include <string>
-#include "med.h"
-#include <cstddef>
-#include <vector>
-#include "NormalizedGeometricTypes"
namespace MEDCoupling
{
MEDLOADER_EXPORT static MEDFileMeshSupports *New();
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileMeshSupports"); }
public:
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT std::vector<std::string> getSupMeshNames() const;
MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const;
MEDLOADER_EXPORT mcIdType getNumberOfNodesInConnOf(TypeOfField entity, INTERP_KERNEL::NormalizedCellType gt, const std::string& name) const;
private:
MEDFileMeshSupports(med_idt fid);
MEDFileMeshSupports();
- ~MEDFileMeshSupports() override;
+ ~MEDFileMeshSupports();
private:
std::vector< MCAuto<MEDFileUMesh> > _supports;
};
// Author : Anthony Geay (CEA/DEN)
#include "MEDFileParameter.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCAuto.hxx"
#include "MEDFileSafeCaller.txx"
-#include "MEDFileUtilities.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileBasis.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "med.h"
-#include "medparameter.h"
-#include "medfile.h"
-
-#include <cmath>
-#include <cstddef>
-#include <ostream>
-#include <limits>
-#include <iterator>
-#include <algorithm>
+
#include <set>
-#include <string>
-#include <sstream>
-#include <vector>
-#include <utility>
using namespace MEDCoupling;
{
if(!MEDFileParameter1TS::isEqual(other,eps,what))
return false;
- const auto *otherC=dynamic_cast<const MEDFileParameterDouble1TSWTI *>(other);
+ const MEDFileParameterDouble1TSWTI *otherC=dynamic_cast<const MEDFileParameterDouble1TSWTI *>(other);
if(!otherC)
{ what="IsEqual fails because this is double parameter other no !"; return false; }
if(fabs(_arr-otherC->_arr)>eps)
void MEDFileParameterDouble1TSWTI::simpleRepr2(int bkOffset, std::ostream& oss) const
{
- std::string const startOfLine(bkOffset,' ');
+ std::string startOfLine(bkOffset,' ');
oss << startOfLine << "ParameterDoubleItem with (iteration,order) = (" << _iteration << "," << _order << ")" << std::endl;
oss << startOfLine << "Time associacited = " << _time << std::endl;
oss << startOfLine << "The value is ***** " << _arr << " *****" << std::endl;
void MEDFileParameterTinyInfo::mainRepr(int bkOffset, std::ostream& oss) const
{
- std::string const startOfLine(bkOffset,' ');
+ std::string startOfLine(bkOffset,' ');
oss << startOfLine << "Parameter with name \"" << _name << "\"" << std::endl;
oss << startOfLine << "Parameter with description \"" << _desc_name << "\"" << std::endl;
oss << startOfLine << "Parameter with unit name \"" << _dt_unit << "\"" << std::endl;
}
MEDFileParameterDouble1TS::MEDFileParameterDouble1TS()
-= default;
+{
+}
MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- med_int const nbPar=MEDnParameter(fid);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ med_int nbPar=MEDnParameter(fid);
std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
{
med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
- std::string const paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
+ std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName && paramType==MED_FLOAT64)
{
_dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- med_int const nbPar=MEDnParameter(fid);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ med_int nbPar=MEDnParameter(fid);
std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
{
med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
- std::string const paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
+ std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName && paramType==MED_FLOAT64)
{
if(nbOfSteps>0)
MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- med_int const nbPar=MEDnParameter(fid);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ med_int nbPar=MEDnParameter(fid);
if(nbPar<1)
{
std::ostringstream oss2; oss2 << "No parameter in file \"" << fileName << "\" !";
med_parameter_type paramType;
med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps));
- std::string const paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
+ std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramType==MED_FLOAT64)
{
if(nbOfSteps>0)
{
if(!MEDFileParameterDouble1TSWTI::isEqual(other,eps,what))
return false;
- const auto *otherC=dynamic_cast<const MEDFileParameterDouble1TS *>(other);
+ const MEDFileParameterDouble1TS *otherC=dynamic_cast<const MEDFileParameterDouble1TS *>(other);
if(!otherC)
{ what="Other is not of type MEDFileParameterDouble1TS as this"; return false; }
if(!isEqualStrings(*otherC,what))
void MEDFileParameterDouble1TS::write(const std::string& fileName, int mode) const
{
- med_access_mode const medmod=MEDFileUtilities::TraduceWriteMode(mode);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),medmod);
+ med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
MEDFileParameterTinyInfo::writeLLHeader(fid,MED_FLOAT64);
MEDFileParameterDouble1TSWTI::writeAdvanced(fid,_name,*this);
}
MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid);
}
MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName, const std::string& paramName)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,paramName);
}
}
MEDFileParameterMultiTS::MEDFileParameterMultiTS()
-= default;
+{
+}
MEDFileParameterMultiTS::MEDFileParameterMultiTS(const MEDFileParameterMultiTS& other, bool deepCopy):MEDFileParameterTinyInfo(other),_param_per_ts(other._param_per_ts)
{
if(deepCopy)
- for(auto & _param_per_t : _param_per_ts)
+ for(std::size_t i=0;i<_param_per_ts.size();i++)
{
- const MEDFileParameter1TS *elt=_param_per_t;
+ const MEDFileParameter1TS *elt=_param_per_ts[i];
if(elt)
- _param_per_t=elt->deepCopy();
+ _param_per_ts[i]=elt->deepCopy();
}
}
MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid)
{
- med_int const nbPar(MEDnParameter(fid));
+ med_int nbPar(MEDnParameter(fid));
if(nbPar<1)
{
std::ostringstream oss; oss << "MEDFileParameterMultiTS : no parameter in file \"" << FileNameFromFID(fid) << "\" !" ;
med_parameter_type paramType;
med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps));
- std::string const paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE));
+ std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE));
_dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
_name=paramNameCpp;
_desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE);
MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid, const std::string& paramName)
{
- med_int const nbPar(MEDnParameter(fid));
+ med_int nbPar(MEDnParameter(fid));
std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
INTERP_KERNEL::AutoPtr<char> pName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
{
med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
- std::string const paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE));
+ std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE));
if(paramNameCpp==paramName)
{
if(nbOfSteps>0)
std::vector<const BigMemoryObject *> MEDFileParameterMultiTS::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _param_per_t : _param_per_ts)
- ret.push_back((const MEDFileParameter1TS *)_param_per_t);
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ ret.push_back((const MEDFileParameter1TS *)*it);
return ret;
}
void MEDFileParameterMultiTS::write(const std::string& fileName, int mode) const
{
- med_access_mode const medmod=MEDFileUtilities::TraduceWriteMode(mode);
- MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),medmod);
+ med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
writeAdvanced(fid,*this);
}
void MEDFileParameterMultiTS::writeAdvanced(med_idt fid, const MEDFileWritable& mw) const
{
std::set<med_parameter_type> diffType;
- for(const auto & _param_per_t : _param_per_ts)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
- const MEDFileParameter1TS *elt(_param_per_t);
+ const MEDFileParameter1TS *elt(*it);
if(dynamic_cast<const MEDFileParameterDouble1TSWTI *>(elt))
diffType.insert(MED_FLOAT64);
}
throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::writeAdvanced : impossible to mix type of data in parameters in MED file ! Only float64 or only int32 ...");
if(diffType.empty())
return;
- med_parameter_type const typ(*diffType.begin());
+ med_parameter_type typ(*diffType.begin());
MEDFileParameterTinyInfo::writeLLHeader(fid,typ);
- for(const auto & _param_per_t : _param_per_ts)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
- const MEDFileParameter1TS *elt(_param_per_t);
+ const MEDFileParameter1TS *elt(*it);
if(elt)
elt->writeAdvanced(fid,_name,mw);
}
void MEDFileParameterMultiTS::simpleRepr2(int bkOffset, std::ostream& oss) const
{
MEDFileParameterTinyInfo::mainRepr(bkOffset,oss);
- for(const auto & _param_per_t : _param_per_ts)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
- const MEDFileParameter1TS *elt(_param_per_t);
+ const MEDFileParameter1TS *elt(*it);
if(elt)
elt->simpleRepr2(bkOffset+2,oss);
}
double MEDFileParameterMultiTS::getDoubleValue(int iteration, int order) const
{
- int const pos=getPosOfTimeStep(iteration,order);
+ int pos=getPosOfTimeStep(iteration,order);
const MEDFileParameter1TS *elt=_param_per_ts[pos];
if(!elt)
{
oss << " exists but elt is empty !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- const auto *eltC=dynamic_cast<const MEDFileParameterDouble1TSWTI *>(elt);
+ const MEDFileParameterDouble1TSWTI *eltC=dynamic_cast<const MEDFileParameterDouble1TSWTI *>(elt);
if(!eltC)
{
std::ostringstream oss; oss << "MEDFileParameterMultiTS::getDoubleValue : time iteration it=" << iteration << " order=" << order;
{
int ret=0;
std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosOfTimeStep : no such iteration=" << iteration << " order=" << order << " ! Possibilities are :";
- for(auto it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
{
int ret=0;
std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosGivenTime : no such time=" << time << " ! Possibilities are :";
- for(auto it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
void MEDFileParameterMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds)
{
std::vector<bool> b(_param_per_ts.size(),true);
- int const len=(int)_param_per_ts.size();
+ int len=(int)_param_per_ts.size();
for(const int *w=startIds;w!=endIds;w++)
if(*w>=0 && *w<len)
b[*w]=false;
{
std::ostringstream oss; oss << "MEDFileParameterMultiTS::eraseTimeStepIds : At pos #" << std::distance(startIds,w) << " value is " << *w << " should be in [0," << len << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::size_t const newNb=std::count(b.begin(),b.end(),true);
+ std::size_t newNb=std::count(b.begin(),b.end(),true);
std::vector< MCAuto<MEDFileParameter1TS> > paramPerTs(newNb);
std::size_t j=0;
for(std::size_t i=0;i<_param_per_ts.size();i++)
std::vector< std::pair<int,int> > MEDFileParameterMultiTS::getIterations() const
{
std::vector< std::pair<int,int> > ret;
- for(const auto & _param_per_t : _param_per_ts)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
- const MEDFileParameter1TS *elt(_param_per_t);
+ const MEDFileParameter1TS *elt(*it);
if(elt)
ret.push_back(std::pair<int,int>(elt->getIteration(),elt->getOrder()));
}
{
std::vector< std::pair<int,int> > ret0;
ret1.clear();
- for(const auto & _param_per_t : _param_per_ts)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
- const MEDFileParameter1TS *elt(_param_per_t);
+ const MEDFileParameter1TS *elt(*it);
if(elt)
{
ret0.push_back(std::pair<int,int>(elt->getIteration(),elt->getOrder()));
MEDFileParameters *MEDFileParameters::New(const std::string& fileName)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid);
}
MEDFileParameters::MEDFileParameters(med_idt fid)
{
- med_int const nbPar=MEDnParameter(fid);
+ med_int nbPar=MEDnParameter(fid);
_params.resize(nbPar);
INTERP_KERNEL::AutoPtr<char> pName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
{
med_int nbOfSteps;
MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
- std::string const paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE));
+ std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE));
_params[i]=MEDFileParameterMultiTS::New(fid,paramNameCpp);
}
}
MEDFileParameters::MEDFileParameters()
-= default;
+{
+}
std::size_t MEDFileParameters::getHeapMemorySizeWithoutChildren() const
{
std::vector<const BigMemoryObject *> MEDFileParameters::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _param : _params)
- ret.push_back((const MEDFileParameterMultiTS *)_param);
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
+ ret.push_back((const MEDFileParameterMultiTS *)*it);
return ret;
}
MEDFileParameters::MEDFileParameters(const MEDFileParameters& other, bool deepCopy):MEDFileWritableStandAlone(other),_params(other._params)
{
if(deepCopy)
- for(auto & _param : _params)
+ for(std::size_t i=0;i<_params.size();i++)
{
- const MEDFileParameterMultiTS *elt=_param;
+ const MEDFileParameterMultiTS *elt=_params[i];
if(elt)
- _param=elt->deepCopy();
+ _params[i]=elt->deepCopy();
}
}
void MEDFileParameters::writeLL(med_idt fid) const
{
- for(const auto & _param : _params)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
{
- const MEDFileParameterMultiTS *elt(_param);
+ const MEDFileParameterMultiTS *elt(*it);
if(elt)
elt->writeAdvanced(fid,*this);
}
{
std::vector<std::string> ret(_params.size());
int i=0;
- for(auto it=_params.begin();it!=_params.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,i++)
{
const MEDFileParameterMultiTS *p=(*it);
if(p)
void MEDFileParameters::simpleReprWithoutHeader(std::ostream& oss) const
{
- for(const auto & _param : _params)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
{
- const MEDFileParameterMultiTS *elt(_param);
+ const MEDFileParameterMultiTS *elt(*it);
if(elt)
elt->simpleRepr2(2,oss);
}
{
if(param)
param->incrRef();
- MCAuto<MEDFileParameterMultiTS> const elt(param);
+ MCAuto<MEDFileParameterMultiTS> elt(param);
_params.push_back(elt);
}
_params.resize(i+1);
if(param)
param->incrRef();
- MCAuto<MEDFileParameterMultiTS> const elt(param);
+ MCAuto<MEDFileParameterMultiTS> elt(param);
_params[i]=elt;
}
*/
MEDFileParameterMultiTS *MEDFileParameters::getParamWithName(const std::string& paramName) const
{
- int const pos=getPosFromParamName(paramName);
+ int pos=getPosFromParamName(paramName);
return getParamAtPos(pos);
}
std::ostringstream oss; oss << "MEDFileParameters::destroyParamAtPos : should be in [0," << _params.size() << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- _params[i]=MCAuto<MEDFileParameterMultiTS>(nullptr);
+ _params[i]=MCAuto<MEDFileParameterMultiTS>(0);
}
int MEDFileParameters::getPosFromParamName(const std::string& paramName) const
{
std::ostringstream oss; oss << "MEDFileParameters::getPosFromParamName : no such name=" << paramName << " ! Possibilities are :";
int ret=0;
- for(auto it=_params.begin();it!=_params.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,ret++)
{
const MEDFileParameterMultiTS *elt(*it);
if(elt)
#ifndef __MEDFILEPARAMETER_HXX__
#define __MEDFILEPARAMETER_HXX__
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDFileUtilities.txx"
#include "MEDLoaderDefines.hxx"
+#include "MEDFileUtilities.txx"
#include "MEDCouplingMemArray.hxx"
#include "MCAuto.hxx"
-#include <string>
-#include <ostream>
-#include "med.h"
-#include <cstddef>
-#include <vector>
-#include <utility>
namespace MEDCoupling
{
public:
MEDLOADER_EXPORT static MEDFileParameterDouble1TSWTI *New(int iteration, int order, double time);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileParameterDouble1TSWTI"); }
- MEDLOADER_EXPORT MEDFileParameter1TS *deepCopy() const override;
+ MEDLOADER_EXPORT MEDFileParameter1TS *deepCopy() const;
MEDLOADER_EXPORT void setValue(double val) { _arr=val; }
MEDLOADER_EXPORT double getValue() const { return _arr; }
- MEDLOADER_EXPORT bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const override;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- MEDLOADER_EXPORT void readValue(med_idt fid, const std::string& name) override;
+ MEDLOADER_EXPORT bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT void readValue(med_idt fid, const std::string& name);
MEDLOADER_EXPORT std::string simpleRepr() const;
protected:
MEDFileParameterDouble1TSWTI();
MEDFileParameterDouble1TSWTI(int iteration, int order, double time);
- void simpleRepr2(int bkOffset, std::ostream& oss) const override;
+ void simpleRepr2(int bkOffset, std::ostream& oss) const;
void finishLoading(med_idt fid, const std::string& name, int dt, int it, int nbOfSteps);
void finishLoading(med_idt fid, const std::string& name, int timeStepId);
- void writeAdvanced(med_idt fid, const std::string& name, const MEDFileWritable& mw) const override;
+ void writeAdvanced(med_idt fid, const std::string& name, const MEDFileWritable& mw) const;
protected:
double _arr;
};
MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileParameterDouble1TS"); }
- MEDLOADER_EXPORT MEDFileParameter1TS *deepCopy() const override;
- MEDLOADER_EXPORT bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const override;
+ MEDLOADER_EXPORT virtual MEDFileParameter1TS *deepCopy() const;
+ MEDLOADER_EXPORT virtual bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const;
MEDLOADER_EXPORT virtual std::string simpleRepr() const;
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; }
MEDLOADER_EXPORT std::string getName() const { return _name; }
MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileParameterMultiTS"); }
MEDLOADER_EXPORT std::string getName() const { return _name; }
MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT MEDFileParameterMultiTS *deepCopy() const;
MEDLOADER_EXPORT bool isEqual(const MEDFileParameterMultiTS *other, double eps, std::string& what) const;
MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
MEDLOADER_EXPORT static MEDFileParameters *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileParameters>(db); }
MEDLOADER_EXPORT static MEDFileParameters *New(const std::string& fileName);
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileParameters"); }
- MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override;
- MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT MEDFileParameters *deepCopy() const;
MEDLOADER_EXPORT bool isEqual(const MEDFileParameters *other, double eps, std::string& what) const;
- MEDLOADER_EXPORT void writeLL(med_idt fid) const override;
+ MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT std::vector<std::string> getParamsNames() const;
MEDLOADER_EXPORT std::string simpleRepr() const;
MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const;
#ifndef __MEDFILESAFECALLER_TXX__
#define __MEDFILESAFECALLER_TXX__
+#include "med.h"
+#include "InterpKernelException.hxx"
+#include <sstream>
// TXX extension to avoid to be installed.
// Author : Anthony Geay (EDF R&D)
#include "MEDFileStructureElement.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCIdType.hxx"
-#include "MEDFileBasis.hxx"
#include "MEDFileMeshSupport.hxx"
-#include "MEDFileUtilities.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileMeshLL.hxx"
#include "MEDFileSafeCaller.txx"
#include "InterpKernelAutoPtr.hxx"
-#include <string>
-#include <cstddef>
-#include "NormalizedGeometricTypes"
-#include "med.h"
-#include "medstructelement.h"
-#include <sstream>
-#include <vector>
using namespace MEDCoupling;
MEDFileSEConstAtt::MEDFileSEConstAtt(med_idt fid, MEDFileStructureElement *father, int idCstAtt, const MEDFileUMesh *mesh):MEDFileSEHolder(father)
{
- std::string const modelName(getModelName());
+ std::string modelName(getModelName());
INTERP_KERNEL::AutoPtr<char> constattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
med_attribute_type constatttype;
med_int nbCompo;
med_entity_type met;
med_int miPflSz;
MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&miPflSz));
- std::string const name(MEDLoaderBase::buildStringFromFortran(constattname,MED_NAME_SIZE));
+ std::string name(MEDLoaderBase::buildStringFromFortran(constattname,MED_NAME_SIZE));
setName(name);
setProfile(MEDLoaderBase::buildStringFromFortran(profilename,MED_NAME_SIZE));
_tof=MEDFileMesh::ConvertFromMEDFileEntity(met);
MEDFileSEVarAtt::MEDFileSEVarAtt(med_idt fid, MEDFileStructureElement *father, int idVarAtt):MEDFileSEHolder(father)
{
- std::string const modelName(getModelName());
+ std::string modelName(getModelName());
INTERP_KERNEL::AutoPtr<char> varattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
med_attribute_type varatttype;
{
std::vector<const BigMemoryObject *> MEDFileStructureElement::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & it : _cst_att)
- ret.push_back(it);
- for(const auto & it : _var_att)
- ret.push_back(it);
+ for(std::vector< MCAuto<MEDFileSEConstAtt> >::const_iterator it=_cst_att.begin();it!=_cst_att.end();it++)
+ ret.push_back(*it);
+ for(std::vector< MCAuto<MEDFileSEVarAtt> >::const_iterator it=_var_att.begin();it!=_var_att.end();it++)
+ ret.push_back(*it);
return ret;
}
std::vector<std::string> MEDFileStructureElement::getVarAtts() const
{
std::vector<std::string> ret;
- for(const auto & it : _var_att)
- if(it.isNotNull())
- ret.push_back(it->getName());
+ for(std::vector< MCAuto<MEDFileSEVarAtt> >::const_iterator it=_var_att.begin();it!=_var_att.end();it++)
+ if((*it).isNotNull())
+ ret.push_back((*it)->getName());
return ret;
}
const MEDFileSEVarAtt *MEDFileStructureElement::getVarAtt(const std::string& varName) const
{
- for(const auto & it : _var_att)
- if(it.isNotNull())
- if(it->getName()==varName)
- return it;
+ for(std::vector< MCAuto<MEDFileSEVarAtt> >::const_iterator it=_var_att.begin();it!=_var_att.end();it++)
+ if((*it).isNotNull())
+ if((*it)->getName()==varName)
+ return *it;
std::ostringstream oss; oss << "MEDFileStructureElement::getVarAtt : no var att with name \"" << varName << "\" !";
throw INTERP_KERNEL::Exception(oss.str());
}
MEDFileStructureElements *MEDFileStructureElements::New(const std::string& fileName, const MEDFileMeshSupports *ms)
{
- MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
return New(fid,ms);
}
std::vector<const BigMemoryObject *> MEDFileStructureElements::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(const auto & _elem : _elems)
- ret.push_back(_elem);
+ for(std::vector< MCAuto<MEDFileStructureElement> >::const_iterator it=_elems.begin();it!=_elems.end();it++)
+ ret.push_back(*it);
return ret;
}
MEDFileStructureElements::MEDFileStructureElements(med_idt fid, const MEDFileMeshSupports *ms)
{
- med_int const nbSE(MEDnStructElement(fid));
+ med_int nbSE(MEDnStructElement(fid));
_elems.resize(nbSE);
for(int i=0;i<nbSE;i++)
_elems[i]=MEDFileStructureElement::New(fid,i,ms);
}
MEDFileStructureElements::MEDFileStructureElements()
-= default;
+{
+}
MEDFileStructureElements::~MEDFileStructureElements()
-= default;
+{
+}
int MEDFileStructureElements::getNumberOf() const
{
std::vector<int> MEDFileStructureElements::getDynGTAvail() const
{
std::vector<int> ret;
- for(const auto & _elem : _elems)
+ for(std::vector< MCAuto<MEDFileStructureElement> >::const_iterator it=_elems.begin();it!=_elems.end();it++)
{
- const MEDFileStructureElement *elt(_elem);
+ const MEDFileStructureElement *elt(*it);
if(elt)
ret.push_back(elt->getDynGT());
}
const MEDFileStructureElement *MEDFileStructureElements::getWithGT(int idGT) const
{
- for(const auto & _elem : _elems)
- if(_elem.isNotNull())
+ for(std::vector< MCAuto<MEDFileStructureElement> >::const_iterator it=_elems.begin();it!=_elems.end();it++)
+ if((*it).isNotNull())
{
- if(_elem->getDynGT()==idGT)
- return _elem;
+ if((*it)->getDynGT()==idGT)
+ return *it;
}
std::ostringstream oss; oss << "MEDFileStructureElements::getWithGT : no such geo type " << idGT << " !";
throw INTERP_KERNEL::Exception(oss.str());
if(seName=="MED_PARTICLE")
return 1;
const MEDFileStructureElement *se(getSEWithName(seName));
- std::string const meshName(se->getMeshName());
+ std::string meshName(se->getMeshName());
return _sup->getNumberOfNodesInConnOf(se->getEntity(),se->getGeoType(),meshName);
}
const MEDFileStructureElement *MEDFileStructureElements::getSEWithName(const std::string& seName) const
{
- for(const auto & _elem : _elems)
+ for(std::vector< MCAuto<MEDFileStructureElement> >::const_iterator it=_elems.begin();it!=_elems.end();it++)
{
- if(_elem.isNotNull())
- if(_elem->getName()==seName)
- return _elem;
+ if((*it).isNotNull())
+ if((*it)->getName()==seName)
+ return *it;
}
std::ostringstream oss; oss << "MEDFileStructureElements::getSEWithName : no such structure element with name " << seName << " !";
throw INTERP_KERNEL::Exception(oss.str());
#ifndef __MEDFILESTRUCTUREELEMENT_HXX__
#define __MEDFILESTRUCTUREELEMENT_HXX__
-#include "MEDFileUtilities.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCType.hxx"
#include "MEDLoaderDefines.hxx"
+#include "MEDFileUtilities.txx"
#include "MEDFileMesh.hxx"
#include "MEDCouplingRefCountObject.hxx"
-#include <string>
-#include <cstddef>
-#include <vector>
-#include "med.h"
-#include "NormalizedGeometricTypes"
namespace MEDCoupling
{
static MEDFileSEConstAtt *New(med_idt fid, MEDFileStructureElement *father, int idCstAtt, const MEDFileUMesh *mesh);
public:
std::string getClassName() const override { return std::string("MEDFileSEConstAtt"); }
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- void writeLL(med_idt fid) const override;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ void writeLL(med_idt fid) const;
void setProfile(const std::string& name);
std::string getProfile() const;
private:
static MEDFileSEVarAtt *New(med_idt fid, MEDFileStructureElement *father, int idVarAtt);
public:
std::string getClassName() const override { return std::string("MEDFileSEVarAtt"); }
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- void writeLL(med_idt fid) const override;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ void writeLL(med_idt fid) const;
int getNbOfComponents() const { return _nb_compo; }
MCAuto<DataArray> getGenerator() const { return _gen; }
private:
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileStructureElement"); }
MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _geo_type; }
public:
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- void writeLL(med_idt fid) const override;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ void writeLL(med_idt fid) const;
public:
static MCAuto<DataArray> BuildFrom(med_attribute_type mat);
static int EffectiveNbCompo(med_attribute_type mat, int nbCompo);
MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAttOf(const std::string &seName, const std::string& varName) const;
MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const;
public:
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- void writeLL(med_idt fid) const override;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ void writeLL(med_idt fid) const;
private:
MEDFileStructureElements(med_idt fid, const MEDFileMeshSupports *ms);
MEDFileStructureElements();
- ~MEDFileStructureElements() override;
+ ~MEDFileStructureElements();
private:
std::vector< MCAuto<MEDFileStructureElement> > _elems;
MCConstAuto<MEDFileMeshSupports> _sup;
// Author : Anthony Geay (CEA/DEN)
#include "MEDFileUtilities.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDLoaderBase.hxx"
#include "MEDLoader.hxx"
+#include "MEDFileBasis.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "med.h"
-#include "medfile.h"
#include <sstream>
-#include <string>
+#include <fstream>
const char MEDCoupling::MEDFileWritableStandAlone::DFT_FILENAME_IN_MEM[]="DftFileNameInMemory";
}
}
-void MEDFileUtilities::CheckMEDCode(int code, med_idt /*fid*/, const std::string& msg)
+void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const std::string& msg)
{
if(code<0)
{
void MEDFileUtilities::CheckFileForRead(const std::string& fileName)
{
- int const status=MEDLoaderBase::getStatusOfFile(fileName);
+ int status=MEDLoaderBase::getStatusOfFile(fileName);
std::ostringstream oss;
oss << " File : \"" << fileName << "\"";
switch(status)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- AutoFid const fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
if(fid<0)
{
oss << " has been detected as unreadable by MED file : impossible to read anything !";
std::string MEDCoupling::MEDFileWritable::FileNameFromFID(med_idt fid)
{
- med_int const lgth(MEDfileName(fid,nullptr,0));
+ med_int lgth(MEDfileName(fid,0,0));
if(lgth<=0)
return std::string();
INTERP_KERNEL::AutoPtr<char> tmp(new char[lgth+1]);
*/
void MEDCoupling::MEDFileWritableStandAlone::write(const std::string& fileName, int mode) const
{
- med_access_mode const medmod(MEDFileUtilities::TraduceWriteMode(mode));
- MEDFileUtilities::AutoFid const fid(MEDfileOpen(fileName.c_str(),medmod));
+ med_access_mode medmod(MEDFileUtilities::TraduceWriteMode(mode));
+ MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),medmod));
std::ostringstream oss; oss << "MEDFileWritableStandAlone : error on attempt to write in file : \"" << fileName << "\"";
MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str());
writeLL(fid);
void MEDCoupling::MEDFileWritableStandAlone::writeXX(const std::string& fileName, int mode, med_int maj, med_int min, med_int rel) const
{
#if ( MED_NUM_MAJEUR>4 || ( MED_NUM_MAJEUR==4 && MED_NUM_MINEUR>=1 ) )
- med_access_mode const medmod(MEDFileUtilities::TraduceWriteMode(mode));
- MEDFileUtilities::AutoFid const fid(MEDfileVersionOpen(fileName.c_str(),medmod,maj,min,rel));
+ med_access_mode medmod(MEDFileUtilities::TraduceWriteMode(mode));
+ MEDFileUtilities::AutoFid fid(MEDfileVersionOpen(fileName.c_str(),medmod,maj,min,rel));
writeLL(fid);
#else
std::ostringstream oss; oss << "MEDFileWritableStandAlone::write" << maj << min << " : the MED version used to compile medcoupling is " << MEDFileVersionStr() << " ! If you need this feature please use version >= 4.1.";
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> MEDCoupling::MEDFileWritableStandAlone::serialize() const
{
med_memfile memfile=MED_MEMFILE_INIT;
- memfile.app_image_ptr=nullptr;
+ memfile.app_image_ptr=0;
memfile.app_image_size=0;
//
- std::string const dftFileName(GenerateUniqueDftFileNameInMem());
+ std::string dftFileName(GenerateUniqueDftFileNameInMem());
{// very important to let this braces ! The AutoFid destructor must be called, to have a "clean" memfile.app_image_ptr pointer embedded in the returned object.
- MEDFileUtilities::AutoFid const fid(MEDmemFileOpen(dftFileName.c_str(),&memfile,MED_FALSE,MED_ACC_CREAT));
+ MEDFileUtilities::AutoFid fid(MEDmemFileOpen(dftFileName.c_str(),&memfile,MED_FALSE,MED_ACC_CREAT));
writeLL(fid);
}
//
#ifndef __MEDFILEUTILITIES_HXX__
#define __MEDFILEUTILITIES_HXX__
+#include "InterpKernelException.hxx"
#include "MEDLoaderDefines.hxx"
#include "MCAuto.hxx"
#include "MEDCouplingMemArray.hxx"
#include "med.h"
-#include <string>
namespace MEDFileUtilities
{
{
public:
MEDFileWritable();
- virtual ~MEDFileWritable() = default;
+ virtual ~MEDFileWritable() {}
void copyOptionsFrom(const MEDFileWritable& other) const;
int getTooLongStrPolicy() const;
void setTooLongStrPolicy(int newVal);
#ifndef __MEDFILEUTILITIES_TXX__
#define __MEDFILEUTILITIES_TXX__
-#include "MEDCouplingMemArray.hxx"
#include "MEDFileUtilities.hxx"
-#include "med.h"
-#include <string>
-#include "medfile.h"
template<class T>
T *MEDCoupling::MEDFileWritableStandAlone::BuildFromMemoryChunk(MEDCoupling::DataArrayByte *db)
med_memfile memfile=MED_MEMFILE_INIT;
memfile.app_image_ptr=db->getPointer();
memfile.app_image_size=db->getNbOfElems();
- std::string const dftFileName(MEDCoupling::MEDFileWritableStandAlone::GenerateUniqueDftFileNameInMem());
+ std::string dftFileName(MEDCoupling::MEDFileWritableStandAlone::GenerateUniqueDftFileNameInMem());
MEDFileUtilities::AutoFid fid(MEDmemFileOpen(dftFileName.c_str(),&memfile,MED_FALSE,MED_ACC_RDWR));
return T::New(fid);
}
#ifndef __MEDFILTERENTITY_HXX__
#define __MEDFILTERENTITY_HXX__
-#include "MCType.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingPartDefinition.hxx"
-#include "InterpKernelException.hxx"
-#include "MEDFileBasis.hxx"
#include "med.h"
-#include "medfilter.h"
-#include <algorithm>
-#include <iterator>
#include <memory>
-#include <vector>
namespace MEDCoupling
{
const med_int constituentSelect, const med_switch_mode switchMode, const med_storage_mode storageMode, const char * const profileName,
const PartDefinition* pd)
{
- const auto *spd(dynamic_cast<const SlicePartDefinition *>(pd));
+ const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(pd));
if(spd)
{
//Here, pd contains a slice, so it's more efficient to define a filter of block
//(which will load contiguous values)
- mcIdType const nbOfEltsToLoad = spd->getNumberOfElems();
+ mcIdType nbOfEltsToLoad = spd->getNumberOfElems();
mcIdType strt,end,step;
spd->getSlice(strt,end,step);
if(strt<0)
/*lastblocksize=useless because count=1*/0,_filter.get());
return;
}
- const auto *dpd(dynamic_cast<const DataArrayPartDefinition *>(pd));
+ const DataArrayPartDefinition *dpd(dynamic_cast<const DataArrayPartDefinition *>(pd));
if(dpd)
{
- mcIdType const nbOfEltsToLoad = dpd->getNumberOfElems();
+ mcIdType nbOfEltsToLoad = dpd->getNumberOfElems();
//convert to fortran indexing
std::vector<mcIdType> dpdPlus1;
// Author : Anthony Geay (CEA/DEN)
#include "MEDLoader.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "MEDFileBasis.hxx"
-#include "MEDFileFieldMultiTS.hxx"
-#include "MEDFileField1TS.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingCurveLinearMesh.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileUtilities.hxx"
#include "MEDLoaderNS.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "NormalizedGeometricTypes"
-#include "MEDLoaderTraits.hxx"
#include "med.h"
-#include "medmesh.h"
-#include "medlibrary.h"
-#include "medfile.h"
-#include "medfield.h"
-#include "medfamily.h"
-#include <set>
-#include <iterator>
-#include <ostream>
-#include <map>
-#include <memory>
#include <string>
#include <limits>
#include <cstring>
#include <sstream>
+#include <fstream>
+#include <numeric>
+#include <iterator>
#include <algorithm>
-#include <vector>
-#include <utility>
+#include <memory>
extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO];
extern med_geometry_type typmainoeud[1];
int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector<int>& possibilities)
{
possibilities.clear();
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
int ret;
std::set<int> poss;
char nommaa[MED_NAME_SIZE+1];
med_mesh_type type_maillage;
med_int Sdim,Mdim;
std::string trueMeshName;
- int const meshId=FromMedInt<int>(getIdFromMeshName(fid,meshName,trueMeshName));
+ int meshId=FromMedInt<int>(getIdFromMeshName(fid,meshName,trueMeshName));
INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
med_sorting_type sortingType;
med_int nstep;
med_axis_type axisType;
- med_int const naxis(MEDmeshnAxis(fid,meshId));
+ med_int naxis(MEDmeshnAxis(fid,meshId));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
// endlimitation
for(int i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
{
- med_geometry_type const curMedType=typmai[i];
+ med_geometry_type curMedType=typmai[i];
med_bool changement,transformation;
- med_int const curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
- med_int const curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation
+ med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ med_int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation
med_int curNbOfElem;
med_entity_type whichEntity;
MEDLoaderNS::dispatchElems(curNbOfElemM,curNbOfElemF,curNbOfElem,whichEntity);
if(curNbOfElem>0)
{
- INTERP_KERNEL::NormalizedCellType const type=typmai2[i];
- int const curDim=(int)INTERP_KERNEL::CellModel::GetCellModel(type).getDimension();
+ INTERP_KERNEL::NormalizedCellType type=typmai2[i];
+ int curDim=(int)INTERP_KERNEL::CellModel::GetCellModel(type).getDimension();
poss.insert(curDim);
}
}
if(!poss.empty())
{
ret=*poss.rbegin();
- for(auto it=poss.rbegin();it!=poss.rend();it++)
+ for(std::set<int>::const_reverse_iterator it=poss.rbegin();it!=poss.rend();it++)
possibilities.push_back(*it-ret);
}
else
trueMeshName=meshes[0];
return 1;
}
- std::string const meshNameStr(meshName);
+ std::string meshNameStr(meshName);
std::vector<std::string> meshes=getMeshNamesFid(fid);
if(meshes.empty())
throw INTERP_KERNEL::Exception("No mesh in file");
- auto const iter=std::find(meshes.begin(),meshes.end(),meshNameStr);
+ std::vector<std::string>::iterator iter=std::find(meshes.begin(),meshes.end(),meshNameStr);
if(iter==meshes.end())
{
std::ostringstream os2;
char nommaa[MED_NAME_SIZE+1];
med_axis_type axistype;
med_sorting_type stype;
- med_int const n=MEDnMesh(fid);
+ med_int n=MEDnMesh(fid);
std::vector<std::string> ret(n);
for(int i=0;i<n;i++)
{
- med_int const naxis(MEDmeshnAxis(fid,i+1));
+ med_int naxis(MEDmeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
med_int nstep;
MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&space_dim,&mesh_dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit));
- std::string const cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa));
+ std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa));
ret[i]=cur;
}
return ret;
char buf[SZ];
std::fill(buf,buf+SZ,'\0');
const char START_EXPECTED[]="MED-";
- med_err const ret(MEDlibraryStrVersion(buf));
+ med_err ret(MEDlibraryStrVersion(buf));
if(ret!=0)
throw INTERP_KERNEL::Exception("MEDFileVersionStr : fail to find version of MED file ! It looks very bad !");
- std::string const zeRet(buf);
- std::size_t const pos(zeRet.find(START_EXPECTED,0));
+ std::string zeRet(buf);
+ std::size_t pos(zeRet.find(START_EXPECTED,0));
if(pos!=0)
{
std::ostringstream oss; oss << "MEDFileVersionStr : internal error ! The MEDFile returned version (\"" << zeRet << "\") has not the right pattern !";
std::string MEDCoupling::MEDFileVersionOfFileStr(const std::string& fileName)
{
#if MED_NUM_MAJEUR>3 || ( MED_NUM_MAJEUR==3 && ( (MED_NUM_MINEUR==2 && MED_NUM_RELEASE>=1) || MED_NUM_MINEUR>=3) )
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
const int SZ=20;
const char START_EXPECTED[]="MED-";
char buf[SZ];
std::fill(buf,buf+SZ,'\0');
MEDFILESAFECALLERRD0(MEDfileStrVersionRd,(fid,buf));
- std::string const ret(buf);
- std::size_t const pos(ret.find(START_EXPECTED,0));
+ std::string ret(buf);
+ std::size_t pos(ret.find(START_EXPECTED,0));
if(pos!=0)
{
std::ostringstream oss; oss << "MEDFileVersionOfFileStr : internal error ! The MEDFile returned version (\"" << ret << "\") has not the right pattern !";
void MEDCoupling::MEDFileVersion(int& major, int& minor, int& release)
{
med_int majj,minn,rell;
- med_err const ret(MEDlibraryNumVersion(&majj,&minn,&rell));
+ med_err ret(MEDlibraryNumVersion(&majj,&minn,&rell));
if(ret!=0)
throw INTERP_KERNEL::Exception("MEDFileVersion : fail to call MEDlibraryNumVersion ! It looks very bad !");
major=FromMedInt<int>(majj);
*/
std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes)
{
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- std::set<int> const poss;
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ std::set<int> poss;
char nommaa[MED_NAME_SIZE+1];
char maillage_description[MED_COMMENT_SIZE+1];
med_mesh_type type_maillage;
std::string trueMeshName;
- int const meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName);
+ int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName);
INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
med_sorting_type sortingType;
med_int nstep, mDim, sDim;
med_axis_type axisType;
- med_int const naxis(MEDmeshnAxis(fid,meshId));
+ med_int naxis(MEDmeshnAxis(fid,meshId));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&sDim,&mDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
med_bool changement,transformation;
for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
{
- med_geometry_type const curMedType=typmai[i];
- med_int const curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ med_geometry_type curMedType=typmai[i];
+ med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
if(curNbOfElemM>0)
{
- INTERP_KERNEL::NormalizedCellType const typp=typmai2[i];
- int const mdimCell=INTERP_KERNEL::CellModel::GetCellModel(typp).getDimension();
+ INTERP_KERNEL::NormalizedCellType typp=typmai2[i];
+ int mdimCell=INTERP_KERNEL::CellModel::GetCellModel(typp).getDimension();
dims.push_back(mdimCell);
geoTypes.push_back(std::pair<INTERP_KERNEL::NormalizedCellType,int>(typp,curNbOfElemM));
}
}
- int const maxLev=*std::max_element(dims.begin(),dims.end());
- int const lowLev=*std::min_element(dims.begin(),dims.end());
- int const nbOfLevels=maxLev-lowLev+1;
+ int maxLev=*std::max_element(dims.begin(),dims.end());
+ int lowLev=*std::min_element(dims.begin(),dims.end());
+ int nbOfLevels=maxLev-lowLev+1;
std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > ret(nbOfLevels);
for(std::size_t i=0;i<dims.size();i++)
{
std::vector<std::string> MEDCoupling::GetMeshNames(const std::string& fileName)
{
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
return MEDLoaderNS::getMeshNamesFid(fid);
}
std::vector< std::pair<std::string,std::string> > MEDCoupling::GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName)
{
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields(MEDnField(fid));
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields(MEDnField(fid));
std::vector<std::string> fields(nbFields);
med_field_type typcha;
for(int i=0;i<nbFields;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
- std::string const meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE);
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
std::vector< std::pair<std::string,std::string> > ret(ncomp);
void MEDCoupling::GetFamiliesGroupsInfo(const std::string& fileName, const std::string& meshName, std::map<std::string,mcIdType>& families, std::map<std::string,std::vector<std::string>>& groupsOnFam)
{
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFams(MEDnFamily(fid,meshName.c_str()));
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFams(MEDnFamily(fid,meshName.c_str()));
char nomfam[MED_NAME_SIZE+1];
for(med_int i=0;i<nbFams;++i)
{
med_int nbGrps(MEDnFamilyGroup(fid,meshName.c_str(),FromMedInt<int>(i+1))),famId;
- std::unique_ptr<char[]> const gro{new char[MED_LNAME_SIZE*nbGrps+1]};
+ std::unique_ptr<char[]> gro{new char[MED_LNAME_SIZE*nbGrps+1]};
MEDFILESAFECALLERRD0(MEDfamilyInfo,(fid,meshName.c_str(),FromMedInt<int>(i+1),nomfam,&famId,gro.get()));
- std::string const fam(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE));
+ std::string fam(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE));
families[fam] = FromMedInt<mcIdType>(famId);
std::vector<std::string> v(nbGrps);
std::copy(MEDVectorStringIterator(0,gro.get()),MEDVectorStringIterator(nbGrps,gro.get()),v.begin());
{
std::vector<std::string> ret;
//
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields=MEDnField(fid);
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
//
for(int i=0;i<nbFields;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
- std::string const meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE);
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
ret.push_back(meshName);
}
std::vector<std::string> MEDCoupling::GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName)
{
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nfam=MEDnFamily(fid,meshName.c_str());
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
std::vector<std::string> ret(nfam);
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- med_int const ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
- med_int const natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
- std::string const cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
+ std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
ret[i]=cur;
}
return ret;
std::vector<std::string> MEDCoupling::GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName)
{
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nfam=MEDnFamily(fid,meshName.c_str());
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
std::vector<std::string> ret;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- med_int const ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
- med_int const natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
- std::string const cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
+ std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
for(int j=0;j<ngro;j++)
{
- std::string const cur2=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ std::string cur2=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
if(cur2==grpName)
ret.push_back(cur);
}
std::vector<std::string> MEDCoupling::GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName)
{
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nfam(MEDnFamily(fid,meshName.c_str()));
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nfam(MEDnFamily(fid,meshName.c_str()));
std::vector<std::string> ret;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
bool found=false;
for(int i=0;i<nfam && !found;i++)
{
- med_int const ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
- med_int const natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
- std::string const cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
+ std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
found=(cur==famName);
if(found)
for(int j=0;j<ngro;j++)
{
- std::string const cur2=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ std::string cur2=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
ret.push_back(cur2);
}
}
std::vector<std::string> MEDCoupling::GetMeshGroupsNames(const std::string& fileName, const std::string& meshName)
{
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nfam=MEDnFamily(fid,meshName.c_str());
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
std::vector<std::string> ret;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- med_int const ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
- med_int const natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
for(int j=0;j<ngro;j++)
{
- std::string const cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ std::string cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
if(std::find(ret.begin(),ret.end(),cur)==ret.end())
ret.push_back(cur);
}
oss << " The name of the mesh in file is \"" << fs->getMeshName() << "\"!";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int const nbTS(fs->getNumberOfTS());
+ int nbTS(fs->getNumberOfTS());
if(nbTS==0)
return ret;
for(int i=0;i<nbTS;i++)
{
MCAuto<MEDFileAnyTypeField1TS> f1ts(fs->getTimeStepAtPos(i));
- std::vector<MEDCoupling::TypeOfField> const tof(f1ts->getTypesOfFieldAvailable());
- for(auto it : tof)
- if(std::find(ret.begin(),ret.end(),it)==ret.end())
- ret.push_back(it);
+ std::vector<MEDCoupling::TypeOfField> tof(f1ts->getTypesOfFieldAvailable());
+ for(std::vector<MEDCoupling::TypeOfField>::const_iterator it=tof.begin();it!=tof.end();it++)
+ if(std::find(ret.begin(),ret.end(),*it)==ret.end())
+ ret.push_back(*it);
}
// sort ret to put before ON_NODES then ON_CELLS then the remaining.
std::vector<MEDCoupling::TypeOfField> ret2;
ret2.push_back(ON_NODES);
if(std::find(ret.begin(),ret.end(),ON_CELLS)!=ret.end())
ret2.push_back(ON_CELLS);
- for(auto it : ret)
- if(it!=ON_NODES && it!=ON_CELLS)
- ret2.push_back(it);
+ for(std::vector<MEDCoupling::TypeOfField>::const_iterator it=ret.begin();it!=ret.end();it++)
+ if(*it!=ON_NODES && *it!=ON_CELLS)
+ ret2.push_back(*it);
return ret2;
}
std::vector<std::string> MEDCoupling::GetAllFieldNames(const std::string& fileName)
{
std::vector<std::string> ret;
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields=MEDnField(fid);
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields=MEDnField(fid);
med_field_type typcha;
for(int i=0;i<nbFields;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
std::vector<std::string> MEDCoupling::GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
std::vector<std::string> ret;
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields=MEDnField(fid);
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
char *maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
//
for(int i=0;i<nbFields;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1];
med_int nbPdt;
med_bool localmesh;
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
- std::string const curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
//
if(curMeshName==meshName)
ret.push_back(curFieldName);
std::vector<std::string> MEDCoupling::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
std::vector<std::string> ret;
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields=MEDnField(fid);
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
//med_int nbpdtnor=0,pflsize,*pflval,lnsize;
//
for(int i=0;i<nbFields;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
- std::string const curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
med_int profilesize,nbi;
if(curMeshName==meshName)
{
if(nbPdt>0)
{
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt));
- med_int const nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
+ med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
if(nbOfVal>0)
{
std::vector<std::string> MEDCoupling::GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
std::vector<std::string> ret;
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields=MEDnField(fid);
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields=MEDnField(fid);
char pflname[MED_NAME_SIZE+1]="";
char locname[MED_NAME_SIZE+1]="";
//
//
for(int i=0;i<nbFields;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
- std::string const curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
if(nbPdt>0)
{
med_int profilesize,nbi;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt));
- med_int const nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
+ med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
if(curMeshName==meshName && nbOfVal>0)
{
std::vector< std::pair< std::pair<int,int>, double> > MEDCoupling::GetAllFieldIterations(const std::string& fileName, const std::string& fieldName)
{
std::vector< std::pair< std::pair<int,int>, double > > ret;
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields=MEDnField(fid);
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
med_int numdt=0,numo=0;
std::ostringstream oss; oss << "GetAllFieldIterations : No field with name \"" << fieldName<< "\" in file \"" << fileName << "\" ! Possible fields are : ";
for(int i=0;i<nbFields;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
for(int k=0;k<nbPdt;k++)
double MEDCoupling::GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order)
{
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields=MEDnField(fid);
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
med_int numdt=0,numo=0;
double ret=std::numeric_limits<double>::max();
for(int i=0;i<nbFields && !found;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&local,&typcha,comp,unit,dt_unit,&nbPdt));
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
found=true;
std::vector< std::pair<int,int> > MEDCoupling::GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
- std::string const meshNameCpp(meshName);
+ std::string meshNameCpp(meshName);
std::vector< std::pair<int,int> > ret;
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields=MEDnField(fid);
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
med_int numdt=0,numo=0;
std::set<std::string> s2;
for(int i=0;i<nbFields;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
bool found=false;
{
med_int profilesize,nbi;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
- med_int const nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
+ med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
- std::string const maa_ass_cpp(maa_ass);
+ std::string maa_ass_cpp(maa_ass);
if(nbOfVal>0)
{
if(meshNameCpp==maa_ass_cpp)
std::vector< std::pair<int,int> > MEDCoupling::GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
- std::string const meshNameCpp(meshName);
+ std::string meshNameCpp(meshName);
std::vector< std::pair<int,int> > ret;
- MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName));
- med_int const nbFields=MEDnField(fid);
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
med_int numdt=0,numo=0;
std::set<std::string> s2;
for(int i=0;i<nbFields;i++)
{
- med_int const ncomp(MEDfieldnComponent(fid,i+1));
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
for(int k=0;k<nbPdt;k++)
{
med_int profilesize,nbi;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
- med_int const nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
+ med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
- std::string const maa_ass_cpp(maa_ass);
+ std::string maa_ass_cpp(maa_ass);
if(nbOfVal>0)
{
if(meshNameCpp==maa_ass_cpp)
MEDCoupling::CheckFileForRead(fileName);
MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
- auto *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
+ MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(mmuPtr)
return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
- auto *mmcPtr=dynamic_cast<MEDFileCMesh *>(mmPtr);
+ MEDFileCMesh *mmcPtr=dynamic_cast<MEDFileCMesh *>(mmPtr);
if(mmcPtr)
{
const MEDCouplingCMesh *ret(mmcPtr->getMesh()); ret->incrRef();
return const_cast<MEDCouplingCMesh *>(ret);
}
- auto *mmc2Ptr=dynamic_cast<MEDFileCurveLinearMesh *>(mmPtr);
+ MEDFileCurveLinearMesh *mmc2Ptr=dynamic_cast<MEDFileCurveLinearMesh *>(mmPtr);
if(mmc2Ptr)
{
const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef();
MEDCoupling::CheckFileForRead(fileName);
MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName));
MEDFileMesh *mmPtr(mm);
- auto *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
+ MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(mmuPtr)
return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
- auto *mmcPtr=dynamic_cast<MEDFileCMesh *>(mmPtr);
+ MEDFileCMesh *mmcPtr=dynamic_cast<MEDFileCMesh *>(mmPtr);
if(mmcPtr)
{
const MEDCouplingCMesh *ret(mmcPtr->getMesh()); ret->incrRef();
return const_cast<MEDCouplingCMesh *>(ret);
}
- auto *mmc2Ptr=dynamic_cast<MEDFileCurveLinearMesh *>(mmPtr);
+ MEDFileCurveLinearMesh *mmc2Ptr=dynamic_cast<MEDFileCurveLinearMesh *>(mmPtr);
if(mmc2Ptr)
{
const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef();
MEDCoupling::CheckFileForRead(fileName);
MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
- auto *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
+ MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
{
std::ostringstream oss; oss << "ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName=\""<< meshName << "\" exists but it is not an unstructured mesh !";
MEDCoupling::CheckFileForRead(fileName);
MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName));
MEDFileMesh *mmPtr(mm);
- auto *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
+ MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
{
std::ostringstream oss; oss << "ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !";
MEDCoupling::CheckFileForRead(fileName);
MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
- auto *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
+ MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
{
std::ostringstream oss; oss << "ReadUMeshFromFamilies : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !";
MEDCoupling::CheckFileForRead(fileName);
MCAuto<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
MEDFileMesh *mmPtr(mm);
- auto *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
+ MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
{
std::ostringstream oss; oss << "ReadUMeshFromGroups : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !";
MCAuto<MEDCoupling::MEDCouplingField> MEDCoupling::ReadField(const std::string& fileName)
{
std::vector<std::string> fieldNames(GetAllFieldNames(fileName));
- std::size_t const sz(fieldNames.size());
+ std::size_t sz(fieldNames.size());
if(sz==0)
{
std::ostringstream oss;
oss << "In file \"" << fileName << "\" there are more than one field !" << std::endl;
oss << "You are invited to use ReadField(fileName, fieldName) instead to avoid misleading concerning field you want to read !" << std::endl;
oss << "For information, fields available are :" << std::endl;
- for(const auto & fieldName : fieldNames)
- oss << " - \"" << fieldName << "\"" << std::endl;
+ for(std::vector<std::string>::const_iterator it=fieldNames.begin();it!=fieldNames.end();it++)
+ oss << " - \"" << *it << "\"" << std::endl;
throw INTERP_KERNEL::Exception(oss.str());
}
return ReadField(fileName,fieldNames[0]);
MCAuto<MEDCoupling::MEDCouplingField> MEDCoupling::ReadField(const std::string& fileName, const std::string& fieldName)
{
std::vector< std::pair< std::pair<int,int>, double> > iterations(GetAllFieldIterations(fileName,fieldName));
- std::size_t const sz(iterations.size());
+ std::size_t sz(iterations.size());
if(sz==0)
{
std::ostringstream oss;
oss << "In file \"" << fileName << "\" field \"" << fieldName << "\" exists but with more than one time steps !" << std::endl;
oss << "You are invited to use ReadField(fileName, fieldName, iteration, order) instead to avoid misleading concerning time steps." << std::endl;
oss << "For information, time steps available for field \"" << fieldName << "\" are :" << std::endl;
- for(const auto & iteration : iterations)
- oss << " - " << iteration.first.first << ", " << iteration.first.second << " (" << iteration.second << ")" << std::endl;
+ for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator it=iterations.begin();it!=iterations.end();it++)
+ oss << " - " << (*it).first.first << ", " << (*it).first.second << " (" << (*it).second << ")" << std::endl;
throw INTERP_KERNEL::Exception(oss.str());
}
return ReadField(fileName,fieldName,iterations[0].first.first,iterations[0].first.second);
//Retrieving mesh of rank 0 and field on rank 0 too.
MCAuto<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
MEDFileMesh *mmPtr(mm);
- auto *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
+ MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !");
MCAuto<MEDCouplingUMesh> m=mmuPtr->getMeshAtLevel(meshDimRelToMax);
if(o2n)
m2->renumberCells(o2n->begin(),true);
int i=0;
- for(auto it=its.begin();it!=its.end();it++,i++)
+ for(std::vector<std::pair<int,int> >::const_iterator it=its.begin();it!=its.end();it++,i++)
{
MCAuto<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,(*it).first,(*it).second);
MCAuto<MEDCouplingFieldDouble> retElt=ff->getFieldOnMeshAtLevel(type,m);
retSafe[i]=retElt;
}
i=0;
- for(auto it=its.begin();it!=its.end();it++,i++)
+ for(std::vector<std::pair<int,int> >::const_iterator it=its.begin();it!=its.end();it++,i++)
ret[i]=retSafe[i].retn();
return ret;
}
namespace MEDCoupling
{
template<class T>
- MCAuto<typename Traits<T>::FieldType> ReadFieldCellLikeT(typename MLFieldTraits<T>::F1TSType *ff, MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& /*fieldName*/, int /*iteration*/, int /*order*/)
+ MCAuto<typename Traits<T>::FieldType> ReadFieldCellLikeT(typename MLFieldTraits<T>::F1TSType *ff, MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MCAuto<MEDFileUMesh> muPtr(MEDCoupling::DynamicCast<MEDFileMesh,MEDFileUMesh>(mm));
}
template<class T>
- MCAuto<typename Traits<T>::FieldType> ReadFieldNodeT(typename MLFieldTraits<T>::F1TSType *ff, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& /*fieldName*/, int /*iteration*/, int /*order*/)
+ MCAuto<typename Traits<T>::FieldType> ReadFieldNodeT(typename MLFieldTraits<T>::F1TSType *ff, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MCAuto<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
MCAuto<DataArrayIdType> pflSafe(pfl);
MCAuto<DataArrayIdType> mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end()));
MCAuto<MEDCouplingUMesh> mzip(static_cast<MEDCouplingUMesh *>(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2)));
- MCAuto<DataArrayIdType> const arr2Safe(arr2);
+ MCAuto<DataArrayIdType> arr2Safe(arr2);
MCAuto<DataArrayIdType> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
MCAuto<DataArrayIdType> pflSorted(pflSafe->deepCopy()); pflSorted->sort(true);
if(!arr3->isEqualWithoutConsideringStr(*pflSorted))
{
if(!mesh)
throw INTERP_KERNEL::Exception("WriteMesh : input mesh is null !");
- const auto *um(dynamic_cast<const MEDCouplingUMesh *>(mesh));
+ const MEDCouplingUMesh *um(dynamic_cast<const MEDCouplingUMesh *>(mesh));
if(um)
{
WriteUMesh(fileName,um,writeFromScratch);
return ;
}
- int const mod=writeFromScratch?2:0;
- const auto *um2(dynamic_cast<const MEDCoupling1GTUMesh *>(mesh));
+ int mod=writeFromScratch?2:0;
+ const MEDCoupling1GTUMesh *um2(dynamic_cast<const MEDCoupling1GTUMesh *>(mesh));
if(um2)
{
MCAuto<MEDFileUMesh> mmu(MEDFileUMesh::New());
mmu->write(fileName,mod);
return ;
}
- const auto *um3(dynamic_cast<const MEDCouplingCMesh *>(mesh));
+ const MEDCouplingCMesh *um3(dynamic_cast<const MEDCouplingCMesh *>(mesh));
if(um3)
{
MCAuto<MEDFileCMesh> mmc(MEDFileCMesh::New());
mmc->write(fileName,mod);
return ;
}
- const auto *um4(dynamic_cast<const MEDCouplingCurveLinearMesh *>(mesh));
+ const MEDCouplingCurveLinearMesh *um4(dynamic_cast<const MEDCouplingCurveLinearMesh *>(mesh));
if(um4)
{
MCAuto<MEDFileCurveLinearMesh> mmc(MEDFileCurveLinearMesh::New());
{
if(!mesh)
throw INTERP_KERNEL::Exception("WriteUMesh : input mesh is null !");
- int const mod=writeFromScratch?2:0;
+ int mod=writeFromScratch?2:0;
MCAuto<MEDFileUMesh> m(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*m);
MCAuto<MEDCouplingUMesh> mcpy(static_cast<MEDCouplingUMesh *>(mesh->deepCopy()));
void MEDCoupling::WriteUMeshesPartition(const std::string& fileName, const std::string& meshNameC, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
{
- std::string const meshName(meshNameC);
+ std::string meshName(meshNameC);
if(meshName.empty())
throw INTERP_KERNEL::Exception("Trying to write a unstructured mesh with no name ! MED file format needs a not empty mesh name : change 2nd parameter !");
- int const status=MEDLoaderBase::getStatusOfFile(fileName);
+ int status=MEDLoaderBase::getStatusOfFile(fileName);
if(status!=MEDLoaderBase::EXIST_RW && status!=MEDLoaderBase::NOT_EXIST)
{
std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions !";
AssignStaticWritePropertiesTo(*m);
m->setGroupsFromScratch(0,meshes,true);
m->setName(meshNameC);
- int const mod=writeFromScratch?2:0;
+ int mod=writeFromScratch?2:0;
m->write(fileName,mod);
}
void MEDCoupling::WriteUMeshes(const std::string& fileName, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
{
- int const mod(writeFromScratch?2:0);
+ int mod(writeFromScratch?2:0);
MCAuto<MEDFileUMesh> m(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*m);
m->setMeshes(meshes,true);
AssignStaticWritePropertiesTo(*ff);
MCAuto<typename MEDCoupling::Traits<T>::FieldType> f2(f->deepCopy());
const MEDCouplingMesh *m(f2->getMesh());
- const auto *um(dynamic_cast<const MEDCouplingUMesh *>(m));
- const auto *um2(dynamic_cast<const MEDCoupling1GTUMesh *>(m));
- const auto *um3(dynamic_cast<const MEDCouplingCMesh *>(m));
- const auto *um4(dynamic_cast<const MEDCouplingCurveLinearMesh *>(m));
- MCAuto<MEDFileMesh> const mm;
- int const mod(writeFromScratch?2:0);
+ const MEDCouplingUMesh *um(dynamic_cast<const MEDCouplingUMesh *>(m));
+ const MEDCoupling1GTUMesh *um2(dynamic_cast<const MEDCoupling1GTUMesh *>(m));
+ const MEDCouplingCMesh *um3(dynamic_cast<const MEDCouplingCMesh *>(m));
+ const MEDCouplingCurveLinearMesh *um4(dynamic_cast<const MEDCouplingCurveLinearMesh *>(m));
+ MCAuto<MEDFileMesh> mm;
+ int mod(writeFromScratch?2:0);
if(um)
{
MCAuto<MEDFileUMesh> mmu(MEDFileUMesh::New());
if(!f)
throw INTERP_KERNEL::Exception("WriteField : input field is NULL !");
f->checkConsistencyLight();
- int const status(MEDLoaderBase::getStatusOfFile(fileName));
+ int status(MEDLoaderBase::getStatusOfFile(fileName));
if(status!=MEDLoaderBase::EXIST_RW && status!=MEDLoaderBase::NOT_EXIST)
{
std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions !";
std::vector<std::string> meshNames(GetMeshNames(fileName));
if(!f->getMesh())
throw INTERP_KERNEL::Exception("WriteField : trying to write a field with no mesh !");
- std::string const fileNameCpp(f->getMesh()->getName());
+ std::string fileNameCpp(f->getMesh()->getName());
if(std::find(meshNames.begin(),meshNames.end(),fileNameCpp)==meshNames.end())
MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile<T>(fileName,f,false);
else
MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,f->getMesh()->getName().c_str()));
AssignStaticWritePropertiesTo(*mm);
const MEDFileMesh *mmPtr(mm);
- const auto *mmuPtr(dynamic_cast<const MEDFileUMesh *>(mmPtr));
+ const MEDFileUMesh *mmuPtr(dynamic_cast<const MEDFileUMesh *>(mmPtr));
if(!mmuPtr)
throw INTERP_KERNEL::Exception("WriteField : only umeshes are supported now !");
MCAuto< typename MEDCoupling::Traits<T>::FieldType > f2(f->deepCopy());
- auto *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh())));
+ MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh())));
if(!m)
throw INTERP_KERNEL::Exception("WriteField : only umesh in input field supported !");
MCAuto<DataArrayIdType> o2n(m->getRenumArrForMEDFileFrmt());
m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP);
else
mread->setCoords(m->getCoords());
- DataArrayIdType *part(nullptr);
- bool const b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part));
- MCAuto<DataArrayIdType> const partSafe(part);
+ DataArrayIdType *part(NULL);
+ bool b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part));
+ MCAuto<DataArrayIdType> partSafe(part);
if(!b)
{
std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !";
}
else
{
- DataArrayIdType *part(nullptr);
- bool const b(mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part));
- MCAuto<DataArrayIdType> const partSafe(part);
+ DataArrayIdType *part(NULL);
+ bool b(mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part));
+ MCAuto<DataArrayIdType> partSafe(part);
if(!b)
{
std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !";
if(!f)
throw INTERP_KERNEL::Exception("WriteField : input field is null !");
{
- const auto *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldDouble *>(f));
+ const MEDCoupling::MEDCouplingFieldDouble *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldDouble *>(f));
if(f1)
{
WriteFieldT<double>(fileName,f1,writeFromScratch);
}
}
{
- const auto *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt32 *>(f));
+ const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt32 *>(f));
if(f1)
{
WriteFieldT<int>(fileName,f1,writeFromScratch);
}
}
{
- const auto *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt64 *>(f));
+ const MEDCoupling::MEDCouplingFieldInt64 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt64 *>(f));
if(f1)
{
WriteFieldT<Int64>(fileName,f1,writeFromScratch);
}
{
- const auto *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldFloat *>(f));
+ const MEDCoupling::MEDCouplingFieldFloat *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldFloat *>(f));
if(f1)
{
WriteFieldT<float>(fileName,f1,writeFromScratch);
if(!f)
throw INTERP_KERNEL::Exception("WriteFieldUsingAlreadyWrittenMeshT : input field is null !");
f->checkConsistencyLight();
- int const status(MEDLoaderBase::getStatusOfFile(fileName));
+ int status(MEDLoaderBase::getStatusOfFile(fileName));
if(status!=MEDLoaderBase::EXIST_RW)
{
std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions or not exists !";
}
MCAuto< typename MLFieldTraits<T>::F1TSType > f1ts(MLFieldTraits<T>::F1TSType::New());
AssignStaticWritePropertiesTo(*f1ts);
- auto *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh())));
+ MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh())));
if(m)
{
MCAuto<DataArrayIdType> o2n(m->getRenumArrForMEDFileFrmt());
if(!f)
throw INTERP_KERNEL::Exception("WriteFieldUsingAlreadyWrittenMesh : input field is null !");
{
- const auto *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldDouble *>(f));
+ const MEDCoupling::MEDCouplingFieldDouble *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldDouble *>(f));
if(f1)
{
WriteFieldUsingAlreadyWrittenMeshT<double>(fileName,f1);
}
}
{
- const auto *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt32 *>(f));
+ const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt32 *>(f));
if(f1)
{
WriteFieldUsingAlreadyWrittenMeshT<int>(fileName,f1);
}
}
{
- const auto *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt64 *>(f));
+ const MEDCoupling::MEDCouplingFieldInt64 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt64 *>(f));
if(f1)
{
WriteFieldUsingAlreadyWrittenMeshT<Int64>(fileName,f1);
}
}
{
- const auto *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldFloat *>(f));
+ const MEDCoupling::MEDCouplingFieldFloat *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldFloat *>(f));
if(f1)
{
WriteFieldUsingAlreadyWrittenMeshT<float>(fileName,f1);
#pragma once
#include "MEDLoaderDefines.hxx"
+#include "InterpKernelException.hxx"
#include "MEDCouplingRefCountObject.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "MCAuto.hxx"
#include "MCIdType.hxx"
-#include "NormalizedGeometricTypes"
-#include <string>
-#include <utility>
-#include <map>
+#include <list>
#include <vector>
namespace MEDCoupling
#include "MEDLoaderBase.hxx"
#include "InterpKernelException.hxx"
-#include <algorithm>
#include <sstream>
#include <fstream>
#include <cstring>
#include <iostream>
-#include <string>
const char MEDLoaderBase::WHITE_SPACES[]=" \n";
ifs.close();
return NOT_EXIST;
}
- std::ofstream const ofs(fileName.c_str(),std::ios_base::app);
+ std::ofstream ofs(fileName.c_str(),std::ios_base::app);
if((ofs.rdstate() & std::ofstream::failbit)!=0)
{
return EXIST_RDONLY;
void MEDLoaderBase::getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName)
{
- std::size_t const pos=fullName.find_last_of(getPathSep());
+ std::size_t pos=fullName.find_last_of(getPathSep());
if(pos!=std::string::npos)
{
dirName=fullName.substr(0,pos);
void MEDLoaderBase::splitIntoNameAndUnit(const std::string& s, std::string& name, std::string& unit)
{
- std::string::size_type const f1=s.find_first_of('[');
- std::string::size_type const f2=s.find_last_of(']');
+ std::string::size_type f1=s.find_first_of('[');
+ std::string::size_type f2=s.find_last_of(']');
if(f1!=std::string::npos && f2!=std::string::npos)
{
if(f1<f2)
void MEDLoaderBase::strip(std::string& s)
{
- std::string::size_type const f1=s.find_first_not_of(' ');
+ std::string::size_type f1=s.find_first_not_of(' ');
if(f1==std::string::npos)
{
s="";
return ;
}
- std::string::size_type const f2=s.find_last_not_of(' ');
+ std::string::size_type f2=s.find_last_not_of(' ');
s=s.substr(f1,f2-f1+1);
}
}
else if(behaviour==1)
{
- std::string const s=zipString(src,maxLgth);
+ std::string s=zipString(src,maxLgth);
std::cerr << "A string : \"" << src << "\" has been detected to be too long for MED File ( > " << maxLgth << ") : ";
std::cerr << "zipping to : " << s << "\n";
strcpy(dest,s.c_str());
}
else if(behaviour==1)
{
- std::string const s=zipString(src,maxLgth);
+ std::string s=zipString(src,maxLgth);
std::cerr << "A string : \"" << src << "\" has been detected to be too long for MED File ( > " << maxLgth << ") : ";
std::cerr << "zipping to : " << s << "\n";
strcpy(dest,s.c_str());
return ;
}
}
- std::size_t const n(strlen(src));
+ std::size_t n(strlen(src));
std::fill(dest,dest+maxLgth,' ');
strncpy(dest,src,n);
}
std::string MEDLoaderBase::buildStringFromFortran(const char *expr, int lgth)
{
- std::string const ret(expr,lgth);
- std::string const whiteSpaces(WHITE_SPACES);
- std::size_t const lgthReal=strlen(ret.c_str());
+ std::string ret(expr,lgth);
+ std::string whiteSpaces(WHITE_SPACES);
+ std::size_t lgthReal=strlen(ret.c_str());
std::string ret2=ret.substr(0,lgthReal);
- std::size_t const found=ret2.find_last_not_of(whiteSpaces);
+ std::size_t found=ret2.find_last_not_of(whiteSpaces);
if (found!=std::string::npos)
ret2.erase(found+1);
else
{
for(std::string::iterator it=s.begin();it!=s.end();it++)
{
- char const tmp=*it;
+ char tmp=*it;
int sz=1;
for(std::string::iterator it2=it+1;it2!=s.end() && *it2==tmp;it2++)
sz++;
#define __MEDLOADERBASE_HXX__
#include "MEDLoaderDefines.hxx"
+#include "InterpKernelException.hxx"
-#include <cstddef>
#include <string>
class MEDLOADER_EXPORT MEDLoaderBase
#ifndef __MEDLOADERNS_HXX__
#define __MEDLOADERNS_HXX__
-#include "MEDCouplingTraits.hxx"
#include <vector>
#include <string>
template<class T>
struct MEDLOADER_EXPORT MLFieldTraits
{
- using EltType = T;
+ typedef T EltType;
};
class MEDFileFieldMultiTS;
template<>
struct MEDLOADER_EXPORT MLFieldTraits<double>
{
- using FMTSWSDAType = MEDFileFieldMultiTSWithoutSDA;
- using FMTSType = MEDFileFieldMultiTS;
- using F1TSType = MEDFileField1TS;
- using F1TSWSDAType = MEDFileField1TSWithoutSDA;
+ typedef MEDFileFieldMultiTSWithoutSDA FMTSWSDAType;
+ typedef MEDFileFieldMultiTS FMTSType;
+ typedef MEDFileField1TS F1TSType;
+ typedef MEDFileField1TSWithoutSDA F1TSWSDAType;
};
template<>
struct MEDLOADER_EXPORT MLFieldTraits<float>
{
- using FMTSWSDAType = MEDFileFloatFieldMultiTSWithoutSDA;
- using FMTSType = MEDFileFloatFieldMultiTS;
- using F1TSType = MEDFileFloatField1TS;
- using F1TSWSDAType = MEDFileFloatField1TSWithoutSDA;
+ typedef MEDFileFloatFieldMultiTSWithoutSDA FMTSWSDAType;
+ typedef MEDFileFloatFieldMultiTS FMTSType;
+ typedef MEDFileFloatField1TS F1TSType;
+ typedef MEDFileFloatField1TSWithoutSDA F1TSWSDAType;
};
template<>
struct MEDLOADER_EXPORT MLFieldTraits<Int32>
{
- using FMTSWSDAType = MEDFileInt32FieldMultiTSWithoutSDA;
- using FMTSType = MEDFileInt32FieldMultiTS;
- using F1TSType = MEDFileInt32Field1TS;
- using F1TSWSDAType = MEDFileInt32Field1TSWithoutSDA;
+ typedef MEDFileInt32FieldMultiTSWithoutSDA FMTSWSDAType;
+ typedef MEDFileInt32FieldMultiTS FMTSType;
+ typedef MEDFileInt32Field1TS F1TSType;
+ typedef MEDFileInt32Field1TSWithoutSDA F1TSWSDAType;
};
template<>
struct MEDLOADER_EXPORT MLFieldTraits<Int64>
{
- using FMTSWSDAType = MEDFileInt64FieldMultiTSWithoutSDA;
- using FMTSType = MEDFileInt64FieldMultiTS;
- using F1TSType = MEDFileInt64Field1TS;
- using F1TSWSDAType = MEDFileInt64Field1TSWithoutSDA;
+ typedef MEDFileInt64FieldMultiTSWithoutSDA FMTSWSDAType;
+ typedef MEDFileInt64FieldMultiTS FMTSType;
+ typedef MEDFileInt64Field1TS F1TSType;
+ typedef MEDFileInt64Field1TSWithoutSDA F1TSWSDAType;
};
template<class T>
#include "MEDMESHConverterUtilities.hxx"
-#include <string>
-#include <clocale>
+#include "libmesh5.hxx"
namespace MeshFormat
{
Localizer::Localizer()
{
- _locale = setlocale(LC_NUMERIC, nullptr);
+ _locale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C");
}
# include <string>
# include <sstream>
#include <iostream>
+# include <vector>
#include <cstring>
namespace MeshFormat
#include "MeshFormatReader.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
#include "MEDFileMesh.hxx"
#include "MEDFileField.hxx"
#include "MEDFileData.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "NormalizedGeometricTypes"
#include "libmesh5.hxx"
#include "MEDMESHConverterUtilities.hxx"
-#include <algorithm>
#include <cstring>
-#include <map>
-#include <string>
-#include <vector>
-#include <utility>
+#include <fstream>
namespace MEDCoupling {
MeshFormatReader::MeshFormatReader():_myMeshName("MESH")
{}
MeshFormatReader::~MeshFormatReader()
-= default;
+{}
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> MeshFormatReader::loadInMedFileDS()
{
_myStatus = perform();
- if(_myStatus != MeshFormat::DRS_OK) return nullptr;
+ if(_myStatus != MeshFormat::DRS_OK) return 0;
if ( !_uMesh->getName().c_str() || strlen( _uMesh->getName().c_str() ) == 0 )
_uMesh->setName( _myMeshName );
MeshFormat::Status MeshFormatReader::perform()
{
- MeshFormat::Localizer const loc;
+ MeshFormat::Localizer loc;
- MeshFormat::Status const status = MeshFormat::DRS_OK;
+ MeshFormat::Status status = MeshFormat::DRS_OK;
// open the file
setNodes(coordArray);
- int const nbEdges = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfEdges);
- int const nbTria = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfTriangles);
- int const nbQuad = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals);
- int const nbTet = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfTetrahedra );
- int const nbPyr = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfPyramids);
- int const nbHex = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfHexahedra);
- int const nbPrism = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfPrisms);
+ int nbEdges = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfEdges);
+ int nbTria = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfTriangles);
+ int nbQuad = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals);
+ int nbTet = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfTetrahedra );
+ int nbPyr = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfPyramids);
+ int nbHex = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfHexahedra);
+ int nbPrism = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfPrisms);
_dim1NbEl = nbEdges;
_dim2NbEl = nbTria + nbQuad;
MeshFormat::Status MeshFormatReader::performFields()
{
- MeshFormat::Status const status = MeshFormat::DRS_OK;
+ MeshFormat::Status status = MeshFormat::DRS_OK;
_fields = MEDCoupling::MEDFileFields::New();
}
- MeshFormat::GmfKwdCod const kwd = meshFormatSol[0];
+ MeshFormat::GmfKwdCod kwd = meshFormatSol[0];
int NmbSol, NmbTypes, NmbReals, TypesTab[ GmfMaxTyp ];
NmbSol = _reader.GmfStatKwd( _myCurrentFileId, kwd, &NmbTypes, &NmbReals, TypesTab );
if(NmbSol)
double* values = fieldValues->getPointer();
int ref;
- auto *val = new double[nbComp];
+ double *val = new double[nbComp];
- bool const isOnAll = (_uMesh->getNumberOfNodes()== nmbSol);
+ bool isOnAll = (_uMesh->getNumberOfNodes()== nmbSol);
for(int i = 1; i<= nmbSol; i++)
timeStamp->setMesh( dimMesh );
- std::string const name = "Field_on_Vertex";
+ std::string name = "Field_on_Vertex";
timeStamp->setName(name);
timeStamp->setArray(fieldValues);
// set an order
MeshFormat::Status MeshFormatReader::setNodes( MEDCoupling::DataArrayDouble* coordArray)
{
- MeshFormat::Status const status = MeshFormat::DRS_OK;
- int const nbNodes = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfVertices);
+ MeshFormat::Status status = MeshFormat::DRS_OK;
+ int nbNodes = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfVertices);
if ( nbNodes < 1 )
return addMessage( "No nodes in the mesh", /*fatal=*/true );
nCoords[1] = y;
nCoords[2] = z;
std::copy(coordPointer, coordPointer+_dim, coordPrt);
- MeshFormatElement const e(MeshFormat::GmfVertices, i-1);
+ MeshFormatElement e(MeshFormat::GmfVertices, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 1);
coordPrt += _dim;
nCoords[1] = y;
nCoords[2] = z;
std::copy(coordPointer, coordPointer+_dim, coordPrt);
- MeshFormatElement const e(MeshFormat::GmfVertices, i-1);
+ MeshFormatElement e(MeshFormat::GmfVertices, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 1);
coordPrt += _dim;
}
int ref;
// read extra vertices for quadratic edges
std::vector<int> quadNodesAtEdges( nbEdges + 1, -1 );
- if ( int const nbQuadEdges = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges))
+ if ( int nbQuadEdges = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges))
{
_reader.GmfGotoKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges);
for ( int i = 1; i <= nbQuadEdges; ++i )
mcIdType nodalConnPerCell[3] = {iN[0], iN[1], midN};
backward_shift(nodalConnPerCell, 3);
dimMesh1->insertNextCell(INTERP_KERNEL::NORM_SEG3, 3,nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfEdges, i-1);
+ MeshFormatElement e(MeshFormat::GmfEdges, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 1 -_dim);
}
else
mcIdType nodalConnPerCell[2] = {iN[0], iN[1]};
backward_shift(nodalConnPerCell, 2);
dimMesh1->insertNextCell(INTERP_KERNEL::NORM_SEG2, 2,nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfEdges, i-1);
+ MeshFormatElement e(MeshFormat::GmfEdges, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 1 -_dim);
}
}
int ref;
// read extra vertices for quadratic triangles
std::vector< std::vector<int> > quadNodesAtTriangles( nbTria + 1 );
- if ( int const nbQuadTria = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles ))
+ if ( int nbQuadTria = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles ))
{
_reader.GmfGotoKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles );
for ( int i = 1; i <= nbQuadTria; ++i )
mcIdType nodalConnPerCell[6] = {iN[0], iN[1], iN[2], midN[0], midN[1], midN[2]};
backward_shift(nodalConnPerCell, 6);
dimMesh2->insertNextCell(INTERP_KERNEL::NORM_TRI6, 6, nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfTriangles, i-1);
+ MeshFormatElement e(MeshFormat::GmfTriangles, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 2 -_dim);
}
else
mcIdType nodalConnPerCell[3] = {iN[0], iN[1], iN[2]};
backward_shift(nodalConnPerCell, 3);
dimMesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfTriangles, i-1);
+ MeshFormatElement e(MeshFormat::GmfTriangles, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 2 -_dim);
}
if ( !midN.empty() ) MeshFormat::FreeVector( midN );
int ref;
// read extra vertices for quadratic quadrangles
std::vector< std::vector<int> > quadNodesAtQuadrilaterals( nbQuad + 1 );
- if ( int const nbQuadQuad = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals ))
+ if ( int nbQuadQuad = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals ))
{
_reader.GmfGotoKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals);
for ( int i = 1; i <= nbQuadQuad; ++i )
};
backward_shift(nodalConnPerCell, 8);
dimMesh2->insertNextCell(INTERP_KERNEL::NORM_QUAD8,8, nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfQuadrilaterals, i-1);
+ MeshFormatElement e(MeshFormat::GmfQuadrilaterals, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 2 -_dim);
}
else if ( midN.size() > 8-4 ) // QUAD9
};
backward_shift(nodalConnPerCell, 9);
dimMesh2->insertNextCell(INTERP_KERNEL::NORM_QUAD9,9, nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfQuadrilaterals, i-1);
+ MeshFormatElement e(MeshFormat::GmfQuadrilaterals, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 2 -_dim);
}
else // QUAD4
mcIdType nodalConnPerCell[4] = {iN[0], iN[1], iN[2], iN[3]};
backward_shift(nodalConnPerCell, 4);
dimMesh2->insertNextCell(INTERP_KERNEL::NORM_QUAD4, 4, nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfQuadrilaterals, i-1);
+ MeshFormatElement e(MeshFormat::GmfQuadrilaterals, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 2 -_dim);
}
if ( !midN.empty() ) MeshFormat::FreeVector( midN );
int ref;
// read extra vertices for quadratic tetrahedra
std::vector< std::vector<int> > quadNodesAtTetrahedra( nbTet + 1 );
- if ( int const nbQuadTetra = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra ))
+ if ( int nbQuadTetra = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra ))
{
_reader.GmfGotoKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra);
for ( int i = 1; i <= nbQuadTetra; ++i )
};
backward_shift(nodalConnPerCell, 10);
dimMesh3->insertNextCell(INTERP_KERNEL::NORM_TETRA10, 10,nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfTetrahedra, i-1);
+ MeshFormatElement e(MeshFormat::GmfTetrahedra, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 3 -_dim);
}
else // TETRA4
mcIdType nodalConnPerCell[4] = {iN[0], iN[2], iN[1], iN[3]};
backward_shift(nodalConnPerCell, 4);
dimMesh3->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4, nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfTetrahedra, i-1);
+ MeshFormatElement e(MeshFormat::GmfTetrahedra, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 3 -_dim);
}
if ( !midN.empty() ) MeshFormat::FreeVector( midN );
mcIdType nodalConnPerCell[5] = {iN[3], iN[2], iN[1], iN[0], iN[4]};
backward_shift(nodalConnPerCell, 5);
dimMesh3->insertNextCell(INTERP_KERNEL::NORM_PYRA5, 5,nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfPyramids, i-1);
+ MeshFormatElement e(MeshFormat::GmfPyramids, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 3 -_dim);
}
int ref;
// read extra vertices for quadratic hexahedra
std::vector< std::vector<int> > quadNodesAtHexahedra( nbHex + 1 );
- if ( int const nbQuadHexa = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra ))
+ if ( int nbQuadHexa = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra ))
{
_reader.GmfGotoKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra);
for ( int i = 1; i <= nbQuadHexa; ++i )
};
backward_shift(nodalConnPerCell, 20);
dimMesh3->insertNextCell(INTERP_KERNEL::NORM_HEXA20,20, nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfHexahedra, i-1);
+ MeshFormatElement e(MeshFormat::GmfHexahedra, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 3 -_dim);
};
backward_shift(nodalConnPerCell, 27);
dimMesh3->insertNextCell(INTERP_KERNEL::NORM_HEXA27,27, nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfHexahedra, i-1);
+ MeshFormatElement e(MeshFormat::GmfHexahedra, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 3 -_dim);
}
};
backward_shift(nodalConnPerCell, 8);
dimMesh3->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8, nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfHexahedra, i-1);
+ MeshFormatElement e(MeshFormat::GmfHexahedra, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 3 -_dim);
}
mcIdType nodalConnPerCell[8] = {iN[0], iN[2], iN[1], iN[3], iN[5], iN[4]};
backward_shift(nodalConnPerCell, 8);
dimMesh3->insertNextCell(INTERP_KERNEL::NORM_PENTA6, 6,nodalConnPerCell);
- MeshFormatElement const e(MeshFormat::GmfPrisms, i-1);
+ MeshFormatElement e(MeshFormat::GmfPrisms, i-1);
_fams.insert(std::pair <int, MeshFormatElement> (ref, e), 3 -_dim);
}
}
-INTERP_KERNEL::NormalizedCellType MeshFormatReader::toMedType(MeshFormat::GmfKwdCod /*kwd*/)
+INTERP_KERNEL::NormalizedCellType MeshFormatReader::toMedType(MeshFormat::GmfKwdCod kwd)
{
INTERP_KERNEL::NormalizedCellType type;
//~switch (kwd)
void MeshFormatReader::buildCellsFamilies()
{
- std::vector<int> const levs = _uMesh->getNonEmptyLevels();
- for (int const dimRelMax : levs)
+ std::vector<int> levs = _uMesh->getNonEmptyLevels();
+ for (size_t iDim = 0; iDim<levs.size(); iDim++ )
{
+ int dimRelMax = levs[iDim];
std::map <int, std::vector<MeshFormatElement>* > famDim = _fams.getMapAtLevel(dimRelMax);
std::map <int, std::vector<MeshFormatElement>* >::const_iterator _meshFormatFamsIt = famDim.begin();
- std::vector< const MEDCoupling::DataArrayIdType* > const fams;
+ std::vector< const MEDCoupling::DataArrayIdType* > fams;
MEDCoupling::DataArrayIdType* cellIds = MEDCoupling::DataArrayIdType::New();
cellIds->alloc(_uMesh->getSizeAtLevel(dimRelMax), 1);
cellIds->fillWithZero();
for(; _meshFormatFamsIt!= famDim.end(); ++_meshFormatFamsIt)
{
const int famId = _meshFormatFamsIt->first;
- std::string const famName ="FromMeshGemsFormatAttributFamily_"+std::to_string(famId);
+ std::string famName ="FromMeshGemsFormatAttributFamily_"+std::to_string(famId);
std::vector <MeshFormatElement>* cellsInFam = _meshFormatFamsIt->second;
if (!famId) continue;
- auto cellsInFamIt = cellsInFam->begin();
+ std::vector <MeshFormatElement>::iterator cellsInFamIt = cellsInFam->begin();
_uMesh->addFamily(famName, famId);
for ( ; cellsInFamIt !=cellsInFam->end(); ++cellsInFamIt)
void MeshFormatReader::buildNodesFamilies()
{
- std::vector<int> const levs = _uMesh->getNonEmptyLevels();
- int const dimRelMax = 1;
+ std::vector<int> levs = _uMesh->getNonEmptyLevels();
+ int dimRelMax = 1;
std::map <int, std::vector<MeshFormatElement>* > famDim = _fams.getMapAtLevel(dimRelMax);
std::map <int, std::vector<MeshFormatElement>* >::const_iterator _meshFormatFamsIt = famDim.begin();
- std::vector< const MEDCoupling::DataArrayIdType* > const fams;
+ std::vector< const MEDCoupling::DataArrayIdType* > fams;
MEDCoupling::DataArrayIdType* cellIds = MEDCoupling::DataArrayIdType::New();
cellIds->alloc(_uMesh->getSizeAtLevel(dimRelMax), 1);
cellIds->fillWithZero();
if (!famId) continue;
bool thisIsACellFamily = false;
- for (int const dimMesh : levs)
+ for (size_t iDim = 0; iDim<levs.size(); iDim++ )
{
+ int dimMesh = levs[iDim];
std::map <int, std::vector<MeshFormatElement>* > famDimAtLevel = _fams.getMapAtLevel(dimMesh);
- auto const famDimAtLevelId = famDimAtLevel.find(famId);
+ std::map <int, std::vector<MeshFormatElement>* >::iterator famDimAtLevelId = famDimAtLevel.find(famId);
if (famDimAtLevelId != famDimAtLevel.end())
{
thisIsACellFamily = true;
}
if (thisIsACellFamily) continue;
- std::string const famName ="FromMeshGemsFormatAttributFamily_"+std::to_string(famId);
+ std::string famName ="FromMeshGemsFormatAttributFamily_"+std::to_string(famId);
std::vector <MeshFormatElement>* cellsInFam = _meshFormatFamsIt->second;
- auto cellsInFamIt = cellsInFam->begin();
+ std::vector <MeshFormatElement>::iterator cellsInFamIt = cellsInFam->begin();
_uMesh->addFamily(famName, famId);
for ( ; cellsInFamIt !=cellsInFam->end(); ++cellsInFamIt)
#include <map>
#include <algorithm>
#include <utility>
+#include <iterator>
#include "MCAuto.hxx"
#include "InterpKernelException.hxx"
-#include "MEDLoaderDefines.hxx"
-#include "MEDCouplingRefCountObject.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "MCType.hxx"
#include "MEDMESHConverterUtilities.hxx"
#include "libmesh5.hxx"
-#include "NormalizedGeometricTypes"
+#include <fstream>
#if !defined(WIN32) && !defined(__APPLE__)
+#include <features.h>
#endif
namespace MEDCoupling
private:
void insertPairInMap(std::map<int, std::vector<MeshFormatElement> *> &aMap, std::pair<int, MeshFormatElement> addToFamily)
{
- auto const it = aMap.find(addToFamily.first);
+ std::map<int, std::vector<MeshFormatElement> *>::iterator it = aMap.find(addToFamily.first);
if (it != aMap.end())
{
aMap[addToFamily.first]->push_back(addToFamily.second);
}
else
{
- auto *tmpVec = new std::vector<MeshFormatElement>;
+ std::vector<MeshFormatElement> *tmpVec = new std::vector<MeshFormatElement>;
tmpVec->push_back(addToFamily.second);
aMap.insert(std::pair<int, std::vector<MeshFormatElement> *>(addToFamily.first, tmpVec));
}
if (!aMap.size())
return;
- auto const itTmp = aMap.find(removeFromFamily.first);
+ std::map<int, std::vector<MeshFormatElement> *>::iterator itTmp = aMap.find(removeFromFamily.first);
if (itTmp == aMap.end())
return;
else
private:
void freeMap(std::map<int, std::vector<MeshFormatElement> *> &aMap)
{
- auto it = aMap.begin();
+ std::map<int, std::vector<MeshFormatElement> *>::iterator it = aMap.begin();
for (; it != aMap.end(); ++it)
delete it->second;
}
//
#include "MeshFormatWriter.hxx"
-#include "MEDFileFieldMultiTS.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDFileMesh.hxx"
#include "MEDFileField.hxx"
#include "MEDFileData.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "NormalizedGeometricTypes"
#include "libmesh5.hxx"
#include "MEDMESHConverterUtilities.hxx"
#include <cstring>
#include <algorithm>
-#include <cstdlib>
#include <map>
-#include <string>
-#include <utility>
-#include <vector>
+#include <cstdlib>
+#include <fstream>
namespace MEDCoupling {
MeshFormatWriter::MeshFormatWriter()
-= default;
+{}
MeshFormatWriter::MeshFormatWriter(const std::string& meshFileName,
const std::vector<std::string>& fieldFileNames):_meshFileName(meshFileName),
_fieldFileNames(fieldFileNames)
{}
MeshFormatWriter::~MeshFormatWriter()
-= default;
+{}
void MeshFormatWriter::setMeshFileName(const std::string& meshFileName)
{
_meshFileName = meshFileName;
void MeshFormatWriter::write()
{
- MeshFormat::Localizer const loc;
+ MeshFormat::Localizer loc;
MEDCoupling::MCAuto<MEDCoupling::MEDCouplingMesh > mesh = _mesh->getMeshAtLevel( 1 );
MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh = mesh->buildUnstructured();
MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3;
std::vector<int> dims = _mesh->getNonEmptyLevelsExt();
- int const dim = _mesh->getMeshDimension();
+ int dim = _mesh->getMeshDimension();
bool threeDElements = false;
bool twoDElements = false;
bool OneDElements = false;
if (dims.size() != 0)
{
- bool const maxLevelDimElments = ( std::find(dims.begin(), dims.end(), 0) != dims.end() );
- bool const nextToMaxLevelDimElments = ( std::find(dims.begin(), dims.end(), -1) != dims.end() );
- bool const nextToNextToMaxLevelDimElments = (std::find(dims.begin(), dims.end(), -2) != dims.end() );
+ bool maxLevelDimElments = ( std::find(dims.begin(), dims.end(), 0) != dims.end() );
+ bool nextToMaxLevelDimElments = ( std::find(dims.begin(), dims.end(), -1) != dims.end() );
+ bool nextToNextToMaxLevelDimElments = (std::find(dims.begin(), dims.end(), -2) != dims.end() );
threeDElements = (dim == 3) ? maxLevelDimElments : false ;
twoDElements = (dim == 3) ? nextToMaxLevelDimElments : maxLevelDimElments ;
OneDElements = (dim == 3) ? nextToNextToMaxLevelDimElments : nextToMaxLevelDimElments;
MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh0 = _mesh->getMeshAtLevel(1);
- MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > const umesh0 = mesh0->buildUnstructured();
+ MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0 = mesh0->buildUnstructured();
// nodes
getNodes(umesh0);
}
- int const dim = _mesh->getMeshDimension(); // dim mesh field lying to
+ int dim = _mesh->getMeshDimension(); // dim mesh field lying to
std::vector<std::string>::const_iterator fieldFileIt = _fieldFileNames.begin();
int iField = 0;
- std::vector<int> const levs {0} ;
+ std::vector<int> levs {0} ;
for (; fieldFileIt !=_fieldFileNames.end(); ++fieldFileIt)
{
// Open files
std::vector< std::vector<MEDCoupling::TypeOfField> > fTypes = f->getTypesOfFieldAvailable();
std::vector< std::pair<int,int> > iters = f->getIterations();
const std::vector<std::string>& compInfo = f->getInfo();
- std::pair<int,int> const it = iters[0];
+ std::pair<int,int> it = iters[0];
//~// Open File for writing
_myCurrentFileId = _writer.GmfOpenMesh( fieldFileIt->c_str(), GmfWrite, _version, _dim );
const MEDCoupling::DataArrayDouble* valsArray = f->getUndergroundDataArray(iteration, order);
int typTab[] = { getGmfSolKwd((int)compSize, _dim) };
_writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfSolAtVertices, (int)valsVec[0][0].second, 1, typTab);
- auto* valTab0 = new double[compSize];
+ double* valTab0 = new double[compSize];
double* valTab;
for ( size_t i = valsVec[0][0].first; i < (std::size_t)valsVec[0][0].second; ++i )
{
MeshFormat::Status MeshFormatWriter::setFieldOnCells(MEDCoupling::MEDFileFieldMultiTS * f, int iteration, int order, std::vector<int> levs )
{
- int const dim = _mesh->getMeshDimension(); // dim mesh field lying to
- int const absDim = f->getNonEmptyLevels(iteration, order, f->getMeshName(), levs);
+ int dim = _mesh->getMeshDimension(); // dim mesh field lying to
+ int absDim = f->getNonEmptyLevels(iteration, order, f->getMeshName(), levs);
- auto** cellToNodeFldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ;
- auto** fldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ;
+ MEDCoupling::MEDCouplingFieldDouble** cellToNodeFldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ;
+ MEDCoupling::MEDCouplingFieldDouble** fldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ;
for (size_t k = 0; k<levs.size(); k++) fldb[k] = f->field( iteration, order,_mesh );
MEDCoupling::DataArrayDouble* timeStamp = cellToNodeFldb[j]->getArray();
double* values = timeStamp->getPointer();
- int const typ = getGmfSolKwd((int)nbComp, _dim) ;
+ int typ = getGmfSolKwd((int)nbComp, _dim) ;
if(typ == -1)
{
addMessage( MeshFormat::Comment(" error with Number of Component ") << nbComp, /*fatal=*/true );
for (int ii =0; ii<_dim; ii++)
for (int jj =ii; jj<_dim; jj++)
{
- int const kk = _dim*(_dim-1)/2- (_dim-ii)*(_dim-ii-1)/2+jj;
+ int kk = _dim*(_dim-1)/2- (_dim-ii)*(_dim-ii-1)/2+jj;
symTensor[kk] = fullTensor[ii+jj*_dim];
}
}
}
bool MeshFormatWriter::checkFileName()
{
- bool const ret = true;
+ bool ret = true;
return ret;
}
bool MeshFormatWriter::checkFieldFileName()
{
- bool const ret = true;
+ bool ret = true;
return ret;
}
void MeshFormatWriter::forward_shift(std::vector<MEDCoupling::mcIdType> &conn)
{
- auto it = conn.begin();
+ std::vector<MEDCoupling::mcIdType>::iterator it = conn.begin();
for (; it != conn.end(); ++it) *it = *it+1;
}
std::copy(coordPrt, coordPrt+_dim, xyz);
- MeshFormatNode const e(xyz[0], xyz[1], xyz[2], idNode);
+ MeshFormatNode e(xyz[0], xyz[1], xyz[2], idNode);
_idNodeToNode.insert(std::pair <int, MeshFormatNode> (idNode, e));
coordPrt+= _dim;
idNode++;
}
linkFamilyToNodes();
- auto itNode = _idNodeToNode.begin();
+ std::map <int, MeshFormatNode>::iterator itNode = _idNodeToNode.begin();
for (; itNode!= _idNodeToNode.end(); ++itNode)
_dim == 3? _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfVertices, itNode->second.xyz[0],
itNode->second.xyz[1], itNode->second.xyz[2], std::abs(itNode->second._famId) ) :
}
-void MeshFormatWriter::getNSEG2(MEDCoupling::mcIdType /*nbEdgesNSEG2*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
+void MeshFormatWriter::getNSEG2(MEDCoupling::mcIdType nbEdgesNSEG2, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG2);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh1->getNodeIdsOfCell(it, conn) ;
+ umesh1->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_SEG2, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_SEG2, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_SEG2, idCellToCell) );
}
-void MeshFormatWriter::getNSEG3( MEDCoupling::mcIdType /*nbEdgesNSEG3*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
+void MeshFormatWriter::getNSEG3( MEDCoupling::mcIdType nbEdgesNSEG3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG3);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh1->getNodeIdsOfCell(it, conn) ;
+ umesh1->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_SEG3, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_SEG3, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_SEG3, idCellToCell) );
}
-void MeshFormatWriter::getTRI3( MEDCoupling::mcIdType /*nbTRI3*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
+void MeshFormatWriter::getTRI3( MEDCoupling::mcIdType nbTRI3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI3);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh2->getNodeIdsOfCell(it, conn) ;
+ umesh2->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_TRI3, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_TRI3, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TRI3, idCellToCell) );
}
-void MeshFormatWriter::getTRI6( MEDCoupling::mcIdType /*nbTRI6*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
+void MeshFormatWriter::getTRI6( MEDCoupling::mcIdType nbTRI6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI6);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh2->getNodeIdsOfCell(it, conn) ;
+ umesh2->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_TRI6, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_TRI6, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TRI6, idCellToCell) );
}
-void MeshFormatWriter::getQUAD4( MEDCoupling::mcIdType /*nbQUAD4*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
+void MeshFormatWriter::getQUAD4( MEDCoupling::mcIdType nbQUAD4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD4);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh2->getNodeIdsOfCell(it, conn) ;
+ umesh2->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_QUAD4, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_QUAD4, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD4, idCellToCell) );
}
-void MeshFormatWriter::getQUAD8(MEDCoupling::mcIdType /*nbQUAD8*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
+void MeshFormatWriter::getQUAD8(MEDCoupling::mcIdType nbQUAD8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD8);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh2->getNodeIdsOfCell(it, conn) ;
+ umesh2->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_QUAD8, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_QUAD8, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD8, idCellToCell) );
}
-void MeshFormatWriter::getQUAD9(MEDCoupling::mcIdType /*nbQUAD9*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
+void MeshFormatWriter::getQUAD9(MEDCoupling::mcIdType nbQUAD9, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD9);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh2->getNodeIdsOfCell(it, conn) ;
+ umesh2->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_QUAD9, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_QUAD9, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD9, idCellToCell) );
}
-void MeshFormatWriter::getTETRA4(MEDCoupling::mcIdType /*nbTETRA4*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
+void MeshFormatWriter::getTETRA4(MEDCoupling::mcIdType nbTETRA4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA4);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh3->getNodeIdsOfCell(it, conn) ;
+ umesh3->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_TETRA4, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_TETRA4, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TETRA4, idCellToCell) );
}
-void MeshFormatWriter::getTETRA10(MEDCoupling::mcIdType /*nbTETRA10*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
+void MeshFormatWriter::getTETRA10(MEDCoupling::mcIdType nbTETRA10, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA10);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh3->getNodeIdsOfCell(it, conn) ;
+ umesh3->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_TETRA10, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_TETRA10, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TETRA10, idCellToCell) );
}
-void MeshFormatWriter::getPYRA5(MEDCoupling::mcIdType /*nbPYRA5*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
+void MeshFormatWriter::getPYRA5(MEDCoupling::mcIdType nbPYRA5, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PYRA5);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh3->getNodeIdsOfCell(it, conn) ;
+ umesh3->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_PYRA5, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_PYRA5, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_PYRA5, idCellToCell) );
}
-void MeshFormatWriter::getHEXA8(MEDCoupling::mcIdType /*nbHEXA8*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
+void MeshFormatWriter::getHEXA8(MEDCoupling::mcIdType nbHEXA8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA8);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh3->getNodeIdsOfCell(it, conn) ;
+ umesh3->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_HEXA8, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_HEXA8, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA8, idCellToCell) );
}
-void MeshFormatWriter::getHEXA20(MEDCoupling::mcIdType /*nbHEXA20*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
+void MeshFormatWriter::getHEXA20(MEDCoupling::mcIdType nbHEXA20, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA20);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh3->getNodeIdsOfCell(it, conn) ;
+ umesh3->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_HEXA20, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_HEXA20, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA20, idCellToCell) );
}
-void MeshFormatWriter::getHEXA27(MEDCoupling::mcIdType /*nbHEXA27*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
+void MeshFormatWriter::getHEXA27(MEDCoupling::mcIdType nbHEXA27, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA27);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh3->getNodeIdsOfCell(it, conn) ;
+ umesh3->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_HEXA27, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_HEXA27, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA27, idCellToCell) );
}
-void MeshFormatWriter::getPENTA6(MEDCoupling::mcIdType /*nbPENTA6*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
+void MeshFormatWriter::getPENTA6(MEDCoupling::mcIdType nbPENTA6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PENTA6);
std::map<int, MeshFormatCell> idCellToCell;
- for (long const it : *elementId)
+ for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
{
std::vector<MEDCoupling::mcIdType> conn;
- umesh3->getNodeIdsOfCell(it, conn) ;
+ umesh3->getNodeIdsOfCell(*it, conn) ;
forward_shift(conn);
- MeshFormatCell e(INTERP_KERNEL::NORM_PENTA6, (int)it);
+ MeshFormatCell e(INTERP_KERNEL::NORM_PENTA6, (int)*it);
e.setConn(conn);
- idCellToCell.insert(std::pair <int, MeshFormatCell> (it, e));
+ idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
}
_typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_PENTA6, idCellToCell) );
}
const MEDCoupling::mcIdType * nodeIdsIt = nodeIds->begin(), * famIDEnd = nodeIds->end();
for(; nodeIdsIt< famIDEnd; ++nodeIdsIt) {
- auto const itNode = _idNodeToNode.find((int)*nodeIdsIt);
+ std::map <int, MeshFormatNode>::iterator itNode = _idNodeToNode.find((int)*nodeIdsIt);
if (itNode == _idNodeToNode.end()) continue;
else itNode->second._famId =(int) famIt->second;
void MeshFormatWriter::linkFamilyToCells()
{
- std::vector<int> const levs = _mesh->getNonEmptyLevels();
- for (int const meshDimRelToMax : levs)
+ std::vector<int> levs = _mesh->getNonEmptyLevels();
+ for (size_t iDim = 0; iDim < levs.size(); iDim++ )
{
+ int meshDimRelToMax = levs[iDim];
MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh = _mesh->getMeshAtLevel( meshDimRelToMax);
MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0 = mesh->buildUnstructured();
const MEDCoupling::DataArrayIdType * famIdsField = _mesh->getFamilyFieldAtLevel(meshDimRelToMax);
for (; famID < famIDEnd; ++famID)
{
if (!(*famID)) continue; // "FAMILLE_ZERO"
- std::string const famName = _mesh->getFamilyNameGivenId(*famID);
+ std::string famName = _mesh->getFamilyNameGivenId(*famID);
MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> cellIds = _mesh->getFamilyArr( meshDimRelToMax, famName);
const MEDCoupling::mcIdType * cellIdsIt = cellIds->begin(), *cellIDEnd = cellIds->end();
for(; cellIdsIt< cellIDEnd; ++cellIdsIt)
{
- INTERP_KERNEL::NormalizedCellType const type = umesh0->getTypeOfCell(*cellIdsIt); //TODO
- auto const itCellMap = _typeToIdCellToCell.find(type);
+ INTERP_KERNEL::NormalizedCellType type = umesh0->getTypeOfCell(*cellIdsIt); //TODO
+ std::map<INTERP_KERNEL::NormalizedCellType, std::map <int, MeshFormatCell> >::iterator itCellMap = _typeToIdCellToCell.find(type);
if (itCellMap == _typeToIdCellToCell.end()) continue;
else
{
- auto const itCell = itCellMap->second.find((int)*cellIdsIt);
+ std::map <int, MeshFormatCell>::iterator itCell = itCellMap->second.find((int)*cellIdsIt);
if (itCell == itCellMap->second.end()) continue;
else itCell->second._famId = (int)*famID;
}
void MeshFormatWriter::writeCells()
{
- auto typeCellMapIt = _typeToIdCellToCell.begin();
+ std::map < INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >::iterator typeCellMapIt = _typeToIdCellToCell.begin();
for (; typeCellMapIt!= _typeToIdCellToCell.end(); ++typeCellMapIt)
{
- auto cellMapIt = typeCellMapIt->second.begin();
+ std::map<int, MeshFormatCell>::iterator cellMapIt = typeCellMapIt->second.begin();
switch (typeCellMapIt->first)
{
case INTERP_KERNEL::NORM_SEG2 :
#ifndef MESHFORMATWRITER_HXX
#define MESHFORMATWRITER_HXX
-#include <algorithm>
-#include <cstddef>
-#include <iterator>
-#include <map>
+#include <vector>
#include <string>
#include <string>
-#include <vector>
#include "MCAuto.hxx"
-#include "NormalizedGeometricTypes"
-#include "MEDLoaderDefines.hxx"
-#include "MEDCouplingUMesh.hxx"
+#include "InterpKernelException.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "MCType.hxx"
#include "MEDMESHConverterUtilities.hxx"
#include "libmesh5.hxx"
#include "MEDFileMesh.hxx"
+#include <fstream>
namespace MEDCoupling
{
#include "SauvMedConvertor.hxx"
#include "CellModel.hxx"
-#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDFileMesh.hxx"
#include "MEDFileField.hxx"
#include "MEDFileData.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "NormalizedGeometricTypes"
-#include "SauvUtilities.hxx"
-#include <algorithm>
-#include <cstdio>
#include <iostream>
#include <cassert>
#include <cmath>
-#include <map>
-#include <list>
#include <queue>
#include <limits>
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
-#include <vector>
-#include <utility>
-#include <set>
-#include <sstream>
#ifdef WIN32
#include <io.h>
#endif
#ifdef HAS_XDR
+#include <rpc/types.h>
#include <rpc/xdr.h>
#endif
inline void reverse(const Cell & aCell, const std::vector<std::pair<int,int> > & swapVec )
{
Cell* ma = const_cast<Cell*>(&aCell);
- for (const auto & i : swapVec)
- std::swap( ma->_nodes[ i.first ],
- ma->_nodes[ i.second ]);
+ for ( unsigned i = 0; i < swapVec.size(); ++i )
+ std::swap( ma->_nodes[ swapVec[i].first ],
+ ma->_nodes[ swapVec[i].second ]);
if ( swapVec.empty() )
ma->_reverse = true;
else
return i1->_number < i2->_number;
}
};
- using TCellToOrderMap = std::map<const Cell *, unsigned int, TCellByIDCompare>;
+ typedef std::map< const Cell*, unsigned, TCellByIDCompare > TCellToOrderMap;
//================================================================================
/*!
// check if relocation table is necessary
bool isRelocated = false;
unsigned newOrder = 0;
- auto c2oIt = cell2order.begin(), c2oEnd = cell2order.end();
+ TCellToOrderMap::iterator c2oIt = cell2order.begin(), c2oEnd = cell2order.end();
for ( ; !isRelocated && c2oIt != c2oEnd; ++c2oIt, ++newOrder )
isRelocated = ( c2oIt->second != newOrder );
namespace // define default GAUSS points
{
- using TDoubleVector = std::vector<double>;
- using TCoordSlice = double *;
- using TInt = int;
+ typedef std::vector<double> TDoubleVector;
+ typedef double* TCoordSlice;
+ typedef int TInt;
//---------------------------------------------------------------
//! Shape function definitions
//---------------------------------------------------------------
//---------------------------------------------------------------
TSeg2a::TSeg2a():TShapeFun(1,2)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
//---------------------------------------------------------------
TSeg3a::TSeg3a():TShapeFun(1,3)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TTria3a::TTria3a():
TShapeFun(2,3)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
//---------------------------------------------------------------
TTria6a::TTria6a():TShapeFun(2,6)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TTria3b::TTria3b():
TShapeFun(2,3)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TTria6b::TTria6b():
TShapeFun(2,6)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TQuad4a::TQuad4a():
TShapeFun(2,4)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TQuad8a::TQuad8a():
TShapeFun(2,8)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TQuad4b::TQuad4b():
TShapeFun(2,4)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TQuad8b::TQuad8b():
TShapeFun(2,8)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TTetra4a::TTetra4a():
TShapeFun(3,4)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TTetra10a::TTetra10a():
TShapeFun(3,10)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TTetra4b::TTetra4b():
TShapeFun(3,4)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TTetra10b::TTetra10b():
TShapeFun(3,10)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
THexa8a::THexa8a():
TShapeFun(3,8)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
THexa20a::THexa20a(TInt theDim, TInt theNbRef):
TShapeFun(theDim,theNbRef)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
THexa27a::THexa27a():
THexa20a(3,27)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
THexa8b::THexa8b():
TShapeFun(3,8)
{
- TInt const aNbRef = GetNbRef();
+ TInt aNbRef = GetNbRef();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
THexa20b::THexa20b(TInt theDim, TInt theNbRef):
TShapeFun(theDim,theNbRef)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TPenta6a::TPenta6a():
TShapeFun(3,6)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TPenta6b::TPenta6b():
TShapeFun(3,6)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TPenta15a::TPenta15a():
TShapeFun(3,15)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TPenta15b::TPenta15b():
TShapeFun(3,15)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TPyra5a::TPyra5a():
TShapeFun(3,5)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TPyra5b::TPyra5b():
TShapeFun(3,5)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TPyra13a::TPyra13a():
TShapeFun(3,13)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
TPyra13b::TPyra13b():
TShapeFun(3,13)
{
- std::size_t const aNbRef = myRefCoord.size();
+ std::size_t aNbRef = myRefCoord.size();
for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
static const int seg3 [] = {0,2,1};
if ( conn.empty() )
{
- conn.resize( MaxMedCellType + 1, nullptr );
+ conn.resize( MaxMedCellType + 1, 0 );
conn[ NORM_HEXA20 ] = hexa20;
conn[ NORM_PENTA15] = penta15;
conn[ NORM_PYRA13 ] = pyra13;
//================================================================================
Cell::Cell(const Cell& ma)
- : _nodes(ma._nodes), _reverse(ma._reverse), _number(ma._number)
+ : _nodes(ma._nodes), _reverse(ma._reverse), _sortedNodeIDs(0), _number(ma._number)
{
if ( ma._sortedNodeIDs )
{
SauvUtilities::Link Cell::link(int i) const
{
- std::size_t const i2 = ( i + 1 ) % _nodes.size();
+ std::size_t i2 = ( i + 1 ) % _nodes.size();
if ( _reverse )
return std::make_pair( _nodes[i2]->_number, _nodes[i]->_number );
else
{
if ( !_sortedNodeIDs )
{
- size_t const l=_nodes.size();
+ size_t l=_nodes.size();
_sortedNodeIDs = new TID[ l ];
for (size_t i=0; i!=l; ++i)
else if ( !_cells.empty() )
sizze = _cells.size();
else
- for (auto _group : _groups)
- sizze += _group->size();
+ for ( size_t i = 0; i < _groups.size(); ++i )
+ sizze += _groups[i]->size();
return ToIdType( sizze );
}
if (_file >= 0)
{
::close (_file);
- if (_start != nullptr)
+ if (_start != 0L)
{
delete [] _start;
//delete [] _tmpBuf;
- _start = nullptr;
+ _start = 0;
}
_file = -1;
}
}
else
{
- _curPos = nullptr;
+ _curPos = 0;
}
}
}
else
{
- _curPos = nullptr;
+ _curPos = 0;
}
}
// 53619906 | SCALAIRE
// 53619907 | -63312600499 1 0 0 0 -2 0 2
// where -63312600499 is actually -633 and 12600499
- char const hold=_curPos[_width];
+ char hold=_curPos[_width];
_curPos[_width] = '\0';
- int const result = atoi( _curPos );
+ int result = atoi( _curPos );
_curPos[_width] = hold;
return result;
//return atoi(str());
*/
//================================================================================
-XDRReader::XDRReader(const char* fileName) :FileReader(fileName), _xdrs_file(nullptr)
+XDRReader::XDRReader(const char* fileName) :FileReader(fileName), _xdrs_file(NULL)
{
}
xdr_destroy((XDR*)_xdrs);
free((XDR*)_xdrs);
::fclose(_xdrs_file);
- _xdrs_file = nullptr;
+ _xdrs_file = NULL;
}
#endif
}
xdr_destroy((XDR*)_xdrs);
free((XDR*)_xdrs);
fclose(_xdrs_file);
- _xdrs_file = nullptr;
+ _xdrs_file = NULL;
}
}
#endif
_xdr_kind = _xdr_kind_char;
if(nbValues*width)
{
- unsigned int const nels = nbValues*width;
+ unsigned int nels = nbValues*width;
_xdr_cvals = (char*)malloc((nels+1)*sizeof(char));
#ifdef HAS_XDR
xdr_string((XDR*)_xdrs, &_xdr_cvals, nels);
if(nbValues)
{
#ifdef HAS_XDR
- unsigned int const nels = nbValues;
+ unsigned int nels = nbValues;
unsigned int actual_nels;
_xdr_ivals = (int*)malloc(nels*sizeof(int));
xdr_array((XDR*)_xdrs, (char **)&_xdr_ivals, &actual_nels, nels, sizeof(int), (xdrproc_t)xdr_int);
if(nbValues)
{
#ifdef HAS_XDR
- unsigned int const nels = nbValues;
+ unsigned int nels = nbValues;
unsigned int actual_nels;
_xdr_dvals = (double*)malloc(nels*sizeof(double));
xdr_array((XDR*)_xdrs, (char **)&_xdr_dvals, &actual_nels, nels, sizeof(double), (xdrproc_t)xdr_double);
// correct pointers to sub-groups
for ( size_t j = 0; j < _groups[i]._groups.size(); ++j )
{
- std::size_t const iG = _groups[i]._groups[j] - &_groups[0];
+ std::size_t iG = _groups[i]._groups[j] - &_groups[0];
newGroups[i]._groups[j] = & newGroups[ iG ];
}
}
// fix given groups
if ( groupsToFix )
- for (auto & i : *groupsToFix)
- if ( i )
+ for ( size_t i = 0; i < groupsToFix->size(); ++i )
+ if ( (*groupsToFix)[i] )
{
- std::size_t const iG = i - &_groups[0];
- i = & newGroups[ iG ];
+ std::size_t iG = (*groupsToFix)[i] - &_groups[0];
+ (*groupsToFix)[i] = & newGroups[ iG ];
}
// fix field supports
for ( int isNode = 0; isNode < 2; ++isNode )
{
- std::vector<DoubleField* > const& fields = isNode ? _nodeFields : _cellFields;
- for (auto & field : fields)
+ std::vector<DoubleField* >& fields = isNode ? _nodeFields : _cellFields;
+ for ( size_t i = 0; i < fields.size(); ++i )
{
- if ( !field ) continue;
- for (auto & j : field->_sub)
- if ( j._support )
+ if ( !fields[i] ) continue;
+ for ( size_t j = 0; j < fields[i]->_sub.size(); ++j )
+ if ( fields[i]->_sub[j]._support )
{
- std::size_t const iG = j._support - &_groups[0];
- j._support = & newGroups[ iG ];
+ std::size_t iG = fields[i]->_sub[j]._support - &_groups[0];
+ fields[i]->_sub[j]._support = & newGroups[ iG ];
}
- if ( field->_group )
+ if ( fields[i]->_group )
{
- std::size_t const iG = field->_group - &_groups[0];
- field->_group = & newGroups[ iG ];
+ std::size_t iG = fields[i]->_group - &_groups[0];
+ fields[i]->_group = & newGroups[ iG ];
}
}
}
// IMP 0023285: only keep the meshes named in the table MED_MAIL
// clear all group names
- for (auto & _group : _groups)
- if ( !_group._isProfile )
- _group._name.clear();
+ for ( size_t i = 0; i < _groups.size(); ++i )
+ if ( !_groups[i]._isProfile )
+ _groups[i]._name.clear();
// IMP 0020434: mapping GIBI names to MED names
std::set<int> treatedGroups;
- auto itGIBItoMED = _listGIBItoMED_mail.begin();
+ std::list<nameGIBItoMED>::iterator itGIBItoMED = _listGIBItoMED_mail.begin();
for (; itGIBItoMED != _listGIBItoMED_mail.end(); itGIBItoMED++)
{
if ( (int)_groups.size() < itGIBItoMED->gibi_id ) continue;
}
else if ( !grp._refNames.empty() && grp._refNames.back().empty() )
{
- for (auto & _refName : grp._refNames)
- if ( _refName.empty() )
- _refName = _mapStrings[ (*itGIBItoMED).med_id ];
+ for ( unsigned i = 0; i < grp._refNames.size(); ++i )
+ if ( grp._refNames[i].empty() )
+ grp._refNames[i] = _mapStrings[ (*itGIBItoMED).med_id ];
}
else
{
// remove all cells belonging to non-named groups only
// use Cell::_reverse to mark cells to keep
- for (auto & grp : _groups)
+ for ( size_t i = 0; i < _groups.size(); ++i )
{
+ SauvUtilities::Group & grp = _groups[i];
if ( grp._isProfile || !grp._name.empty() )
{
- for (auto & _cell : grp._cells)
- _cell->_reverse = true;
+ for ( size_t iC = 0; iC < grp._cells.size(); ++iC )
+ grp._cells[iC]->_reverse = true;
- for (auto & _group : grp._groups)
- for (auto & _cell : _group->_cells)
- _cell->_reverse = true;
+ for (size_t j = 0; j < grp._groups.size(); ++j )
+ for ( size_t iC = 0; iC < grp._groups[j]->_cells.size(); ++iC )
+ grp._groups[j]->_cells[iC]->_reverse = true;
}
}
// remove non-marked cells (with _reverse == false)
while ( cellsIt.nextType() )
{
std::set<Cell> & cells = _cellsByType[ cellsIt.type() ];
- auto cIt = cells.begin();
+ std::set<Cell>::iterator cIt = cells.begin();
while ( cIt != cells.end() )
if ( cIt->_reverse )
{
void IntermediateMED::setFieldLongNames(std::set< std::string >& usedNames)
{
- auto itGIBItoMED = _listGIBItoMED_cham.begin();
+ std::list<nameGIBItoMED>::iterator itGIBItoMED = _listGIBItoMED_cham.begin();
for (; itGIBItoMED != _listGIBItoMED_cham.end(); itGIBItoMED++)
{
if (itGIBItoMED->gibi_pile == PILE_FIELD)
for (itGIBItoMED =_listGIBItoMED_comp.begin(); itGIBItoMED != _listGIBItoMED_comp.end(); itGIBItoMED++)
{
- std::string const medName = _mapStrings[itGIBItoMED->med_id];
- std::string const gibiName = _mapStrings[itGIBItoMED->gibi_id];
+ std::string medName = _mapStrings[itGIBItoMED->med_id];
+ std::string gibiName = _mapStrings[itGIBItoMED->gibi_id];
- bool const name_found = false;
+ bool name_found = false;
for ( int isNodal = 0; isNodal < 2 && !name_found; ++isNodal )
{
std::vector<DoubleField* > & fields = isNodal ? _nodeFields : _cellFields;
if (medName.find( fields[ifi]->_name + "." ) == 0 )
{
std::vector<DoubleField::_Sub_data>& aSubDs = fields[ifi]->_sub;
- std::size_t const nbSub = aSubDs.size();
+ std::size_t nbSub = aSubDs.size();
for (std::size_t isu = 0; isu < nbSub; isu++)
for (int ico = 0; ico < aSubDs[isu].nbComponents(); ico++)
{
if (aSubDs[isu].compName(ico) == gibiName)
{
- std::string const medNameCompo = medName.substr( fields[ifi]->_name.size() + 1 );
+ std::string medNameCompo = medName.substr( fields[ifi]->_name.size() + 1 );
fields[ifi]->_sub[isu].compName(ico) = medNameCompo;
}
}
}
} // iterate on _listGIBItoMED_comp
- for (auto & _nodeField : _nodeFields)
- usedNames.insert( _nodeField->_name );
- for (auto & _cellField : _cellFields)
- usedNames.insert( _cellField->_name );
+ for ( size_t i = 0; i < _nodeFields.size() ; i++)
+ usedNames.insert( _nodeFields[i]->_name );
+ for ( size_t i = 0; i < _cellFields.size() ; i++)
+ usedNames.insert( _cellFields[i]->_name );
}
//================================================================================
void IntermediateMED::decreaseHierarchicalDepthOfSubgroups()
{
- for (auto & grp : _groups)
+ for (size_t i=0; i!=_groups.size(); ++i)
{
+ Group& grp = _groups[i];
for (size_t j = 0; j < grp._groups.size(); ++j )
{
Group & sub_grp = *grp._groups[j];
// remove empty sub-_groups
std::vector< Group* > newSubGroups;
newSubGroups.reserve( grp._groups.size() );
- for (auto & _group : grp._groups)
- if ( !_group->empty() )
- newSubGroups.push_back( _group );
+ for (size_t j = 0; j < grp._groups.size(); ++j )
+ if ( !grp._groups[j]->empty() )
+ newSubGroups.push_back( grp._groups[j] );
if ( newSubGroups.size() < grp._groups.size() )
grp._groups.swap( newSubGroups );
}
// }
std::set<Group*> groups2convert;
// keep not named sub-groups of field supports
- for (auto & grp : _groups)
+ for (size_t i=0; i!=_groups.size(); ++i)
{
+ Group& grp = _groups[i];
if ( grp._isProfile && !grp._groups.empty() )
groups2convert.insert( grp._groups.begin(), grp._groups.end() );
}
// keep named groups and their subgroups
- for (auto & grp : _groups)
+ for (size_t i=0; i!=_groups.size(); ++i)
{
+ Group& grp = _groups[i];
if ( !grp._name.empty() && !grp.empty() )
{
groups2convert.insert( &grp );
}
}
// erase groups that are not in groups2convert and not _isProfile
- for (auto & _group : _groups)
+ for (size_t i=0; i!=_groups.size(); ++i)
{
- Group* grp = &_group;
+ Group* grp = &_groups[i];
if ( !grp->_isProfile && !groups2convert.count( grp ) )
{
grp->_cells.clear();
void IntermediateMED::detectMixDimGroups()
{
//hasMixedCells = false;
- for (auto & grp : _groups)
+ for ( size_t i=0; i < _groups.size(); ++i )
{
+ Group& grp = _groups[i];
if ( grp._groups.size() < 2 )
continue;
// check if sub-groups have different dimension
- unsigned const dim1 = getDim( &grp );
+ unsigned dim1 = getDim( &grp );
for ( size_t j = 1; j < grp._groups.size(); ++j )
{
- unsigned const dim2 = getDim( grp._groups[j] );
+ unsigned dim2 = getDim( grp._groups[j] );
if ( dim1 != dim2 )
{
grp._cells.clear();
// ------------------------------------
// fix connectivity of quadratic edges
// ------------------------------------
- std::set<Cell> const& quadEdges = _cellsByType[ INTERP_KERNEL::NORM_SEG3 ];
+ std::set<Cell>& quadEdges = _cellsByType[ INTERP_KERNEL::NORM_SEG3 ];
if ( !quadEdges.empty() )
{
elemIt = quadEdges.begin(), elemEnd = quadEdges.end();
std::map<Link, std::list<const Cell*> > linkFacesMap;
std::map<Link, std::list<const Cell*> >::iterator lfIt, lfIt2;
- for (auto & grp : _groups)
+ for (size_t i=0; i!=_groups.size(); ++i)
{
+ Group& grp = _groups[i];
if ( !grp._cells.empty() && getDimension( grp._cellType ) == 2 )
for ( size_t j = 0; j < grp._cells.size(); ++j )
if ( faces.insert( grp._cells[j] ).second )
// loop on links of <face>
for ( int i = 0; i < (int)face->_nodes.size(); ++i )
{
- Link const link = face->link( i );
+ Link link = face->link( i );
// find the neighbor faces
lfIt = linkFacesMap.find( link );
int nbFaceByLink = 0;
if ( lfIt != linkFacesMap.end() )
{
std::list<const Cell*> & fList = lfIt->second;
- auto fIt = fList.begin();
+ std::list<const Cell*>::iterator fIt = fList.begin();
assert( fIt != fList.end() );
for ( ; fIt != fList.end(); fIt++, nbFaceByLink++ )
{
// reverse and remove badFace from linkFacesMap
for ( int j = 0; j < (int)badFace->_nodes.size(); ++j )
{
- Link const badlink = badFace->link( j );
+ Link badlink = badFace->link( j );
if ( badlink == link ) continue;
lfIt2 = linkFacesMap.find( badlink );
if ( lfIt2 != linkFacesMap.end() )
{
std::list<const Cell*> & ff = lfIt2->second;
- auto const lfIt3 = find( ff.begin(), ff.end(), badFace );
+ std::list<const Cell*>::iterator lfIt3 = find( ff.begin(), ff.end(), badFace );
// check if badFace has been found,
// else we can't erase it
// case of degenerated face in edge
linkFacesMap.erase( lfIt );
}
// add good neighbors to the queue
- Link const revLink( link.second, link.first );
+ Link revLink( link.second, link.first );
lfIt = linkFacesMap.find( revLink );
if ( lfIt != linkFacesMap.end() )
{
std::list<const Cell*> & fList = lfIt->second;
- auto fIt = fList.begin();
+ std::list<const Cell*>::iterator fIt = fList.begin();
for ( ; fIt != fList.end(); fIt++, nbFaceByLink++ )
{
ml.push_back( *fIt );
{
if ( manifold )
{
- auto ii = ml.begin();
+ std::list<const Cell*>::iterator ii = ml.begin();
std::cout << nbFaceByLink << " faces by 1 link:" << std::endl;
for( ; ii!= ml.end(); ii++ )
std::cout << "in sub-mesh <" << fgm[ *ii ]->_name << "> " << **ii << std::endl;
vec[0] = normal[1] * vec01[2] - normal[2] * vec01[1];
vec[1] = normal[2] * vec01[0] - normal[0] * vec01[2];
vec[2] = normal[0] * vec01[1] - normal[1] * vec01[0];
- double const dot2 = vec[0]*vec03[0] + vec[1]*vec03[1] + vec[2]*vec03[2]; // vec*vec03
+ double dot2 = vec[0]*vec03[0] + vec[1]*vec03[1] + vec[2]*vec03[2]; // vec*vec03
if ( dot2 < 0 ) // concave -> reverse normal
{
normal[0] *= -1;
tbDir[2] = n[0][2] - n[3][2];
// compare 2 directions: normal and top-bottom
- double const dot = normal[0]*tbDir[0] + normal[1]*tbDir[1] + normal[2]*tbDir[2];
+ double dot = normal[0]*tbDir[0] + normal[1]*tbDir[1] + normal[2]*tbDir[2];
if ( dot < 0. ) // need reverse
reverse( *elemIt, swapVec );
int NodeContainer::numberNodes()
{
int id = 1;
- for (auto & _node : _nodes)
- for (auto & j : _node)
- if ( j.isUsed() )
- j._number = id++;
+ for ( size_t i = 0; i < _nodes.size(); ++i )
+ for ( size_t j = 0; j < _nodes[i].size(); ++j )
+ if ( _nodes[i][j].isUsed() )
+ _nodes[i][j]._number = id++;
return id-1;
}
if ( elemIt->_number < minNumber ) minNumber = elemIt->_number;
if ( elemIt->_number > maxNumber ) maxNumber = elemIt->_number;
}
- mcIdType const typeSize = ToIdType( typeCells->size() );
+ mcIdType typeSize = ToIdType( typeCells->size() );
if ( typeSize != maxNumber - minNumber + 1 )
ok = false;
if ( prevNbElems+1 != (int)minNumber )
prevNbCells += ToIdType( cells->size() );
// fill dimMesh
- TCellType const cellType = dimCells.type();
+ TCellType cellType = dimCells.type();
nodalConnOfCell = &connectivity[0];
for ( size_t i = 0; i < cells->size(); ++i, nodalConnOfCell += nbCellNodes )
dimMesh->insertNextCell( cellType, nbCellNodes, nodalConnOfCell );
std::vector< Group* > groupVec;
if ( grp._groups.empty() ) groupVec.push_back( & grp );
else groupVec = grp._groups;
- for (auto aG : groupVec)
+ for ( size_t iG = 0; iG < groupVec.size(); ++iG )
{
+ Group* aG = groupVec[ iG ];
if ( (int)getDim( aG ) != dim )
continue;
- for (auto & _cell : aG->_cells)
- cell2order.insert( cell2order.end(), std::make_pair( _cell, orderInGroup++ ));
+ for ( size_t iC = 0; iC < aG->_cells.size(); ++iC )
+ cell2order.insert( cell2order.end(), std::make_pair( aG->_cells[iC], orderInGroup++ ));
}
if ( cell2order.empty() )
continue;
- bool const isSelfIntersect = ( orderInGroup != cell2order.size() );
+ bool isSelfIntersect = ( orderInGroup != cell2order.size() );
if ( isSelfIntersect ) // self intersecting group
{
std::ostringstream msg;
bool IntermediateMED::isOnAll( const Group* grp, int & dimRel ) const
{
- int const dim = getDim( grp );
+ int dim = getDim( grp );
mcIdType nbElems = 0;
if ( dim == 0 )
dimRel = dim - meshDim;
}
- bool const onAll = ( nbElems == grp->size() );
+ bool onAll = ( nbElems == grp->size() );
return onAll;
}
MEDCoupling::MEDFileFields * IntermediateMED::makeMEDFileFields(MEDCoupling::MEDFileUMesh* mesh)
{
- if ( _nodeFields.empty() && _cellFields.empty() ) return nullptr;
+ if ( _nodeFields.empty() && _cellFields.empty() ) return 0;
// set long names
std::set< std::string > usedFieldNames;
double * valPtr = values->getPointer();
if ( uniteSubs )
{
- mcIdType const nbElems = fld->_group->size();
+ mcIdType nbElems = fld->_group->size();
for ( mcIdType elemShift = 0; elemShift < nbElems && iSub < fld->_sub.size(); )
elemShift += fld->setValues( valPtr, iSub++, elemShift );
setTS( fld, values, medFields, mesh );
// set gauss points
if ( timeStamp->getTypeOfField() == MEDCoupling::ON_GAUSS_PT )
{
- TGaussDef const gaussDef( fld->_sub[iSub]._support->_cellType,
+ TGaussDef gaussDef( fld->_sub[iSub]._support->_cellType,
fld->_sub[iSub].nbGauss() );
timeStamp->setGaussLocalizationOnType( fld->_sub[iSub]._support->_cellType,
gaussDef.myRefCoords,
}
else
{
- std::string::size_type const pos = base.rfind('_');
+ std::string::size_type pos = base.rfind('_');
if ( pos != std::string::npos )
base = base.substr( 0, pos+1 );
else
bool DoubleField::hasSameComponentsBySupport() const
{
- auto sub_data = _sub.begin();
+ std::vector< _Sub_data >::const_iterator sub_data = _sub.begin();
const _Sub_data& first_sub_data = *sub_data;
for ( ++sub_data ; sub_data != _sub.end(); ++sub_data )
{
mcIdType valsShift = 0;
for ( mcIdType iS = iSub-1, shift = elemShift; shift > 0; --iS)
{
- mcIdType const nbE = _sub[iS]._support->size();
+ mcIdType nbE = _sub[iS]._support->size();
shift -= nbE;
valsShift += nbE * _sub[iS].nbComponents() * _sub[iS].nbGauss();
}
if ( isConstField )
for ( mcIdType iE = 0; iE < nbElems; ++iE )
{
- mcIdType const iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
+ mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
for ( iComp = 0; iComp < nbComponents; ++iComp )
valPtr[ iMed + iComp ] = compValues[iComp][ 0 ];
}
else
for ( mcIdType iE = 0; iE < nbElems; ++iE )
{
- mcIdType const iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
+ mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
for ( iComp = 0; iComp < nbComponents; ++iComp )
for ( int iG = 0; iG < nbGauss; ++iG )
valPtr[ iMed + iG * nbComponents + iComp ] = compValues[iComp][ iE * nbGauss + iG ];
IntermediateMED::~IntermediateMED()
{
- for (auto & _nodeField : _nodeFields)
- if ( _nodeField )
- delete _nodeField;
+ for ( size_t i = 0; i < _nodeFields.size(); ++i )
+ if ( _nodeFields[i] )
+ delete _nodeFields[i];
_nodeFields.clear();
- for (auto & _cellField : _cellFields)
- if ( _cellField )
- delete _cellField;
+ for ( size_t i = 0; i < _cellFields.size(); ++i )
+ if ( _cellFields[i] )
+ delete _cellFields[i];
_cellFields.clear();
- for (auto & _group : _groups)
- if ( _group._medGroup )
- _group._medGroup->decrRef();
+ for ( size_t i = 0; i < _groups.size(); ++i )
+ if ( _groups[i]._medGroup )
+ _groups[i]._medGroup->decrRef();
}
//================================================================================
while ( ++myCurType < myTypeEnd )
if ( !myImed->_cellsByType[myCurType].empty() && ( myDim < 0 || dim(false) == myDim ))
return & myImed->_cellsByType[myCurType];
- return nullptr;
+ return 0;
}
/*!
* \brief return dimension of cells returned by the last or further next()
#ifndef __SauvMedConvertor_HXX__
#define __SauvMedConvertor_HXX__
-#include "MCIdType.hxx"
+#include "InterpKernelException.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "SauvUtilities.hxx"
#include "MCType.hxx"
-#include "NormalizedGeometricTypes"
-#include <utility>
-#include <cstddef>
-#include <ostream>
-#include <string>
-#include <cstdio>
#include <vector>
#include <set>
#include <map>
struct IntermediateMED;
// ==============================================================================
- using TID = mcIdType; // an ID countered from 1
- using Link = std::pair<TID, TID>; // a pair of node numbers
+ typedef mcIdType TID; // an ID countered from 1
+ typedef std::pair<TID,TID> Link; // a pair of node numbers
typedef INTERP_KERNEL::NormalizedCellType TCellType;
// ==============================================================================
struct Node
{
- TID _number{0};
+ TID _number;
size_t _coordID;
- Node()= default;
+ Node():_number(0){}
bool isUsed() const { return _number != 0; }
};
struct Cell
{
std::vector< Node* > _nodes;
- mutable bool _reverse{false}; // to reverse orientation of a face only
- mutable TID* _sortedNodeIDs{nullptr}; // for comparison
- mutable TID _number{0};
+ mutable bool _reverse; // to reverse orientation of a face only
+ mutable TID* _sortedNodeIDs; // for comparison
+ mutable TID _number;
- Cell(size_t nnNodes=0) : _nodes(nnNodes) {}
+ Cell(size_t nnNodes=0) : _nodes(nnNodes),_reverse(false),_sortedNodeIDs(0),_number(0) {}
Cell(const Cell& ma);
- void init() const { if ( _sortedNodeIDs ) delete [] _sortedNodeIDs; _sortedNodeIDs = nullptr; }
+ void init() const { if ( _sortedNodeIDs ) delete [] _sortedNodeIDs; _sortedNodeIDs = 0; }
~Cell() { init(); }
const TID* getSortedNodes() const; // creates if needed and return _sortedNodeIDs
// ==============================================================================
struct Group
{
- TCellType _cellType{INTERP_KERNEL::NORM_ERROR};
+ TCellType _cellType;
std::string _name;
std::vector<const Cell*> _cells;
std::vector< Group* > _groups; // des sous-groupes composant le Group
- bool _isProfile{false}; // is a field support or not
+ bool _isProfile; // is a field support or not
std::vector<std::string> _refNames; /* names of groups referring this one;
_refNames is resized according to nb of references
while reading a group (pile 1) and it is filled with
reference is converted into a copy of the medGroup
(issue 0021311)
*/
- MEDCoupling::DataArrayIdType* _medGroup{nullptr}; // result of conversion
+ MEDCoupling::DataArrayIdType* _medGroup; // result of conversion
std::vector< mcIdType > _relocTable; // for _cells[i] gives its index in _medGroup
bool empty() const { return _cells.empty() && _groups.empty(); }
mcIdType size() const;
- Group() {}
+ Group():_cellType(INTERP_KERNEL::NORM_ERROR), _isProfile(false), _medGroup(NULL) {}
};
// ==============================================================================
std::string _name;
std::string _description; // field description
std::vector< _Sub_data > _sub;
- Group* _group{nullptr}; /* if _group == NULL then each subcomponent makes a
+ Group* _group; /* if _group == NULL then each subcomponent makes a
separate med field, else all subcomponents
are converted into timestamps of one med field.
The latter is possible only if nb of components in all subs
is the same and supports of subcomponents do not overlap
*/
std::vector< std::vector< double > > _comp_values;
- MEDCoupling::MEDFileFieldMultiTS* _curMedField{nullptr};
+ MEDCoupling::MEDFileFieldMultiTS* _curMedField;
DoubleField( int nb_sub, int total_nb_comp )
- : _sub(nb_sub) { _comp_values.reserve( total_nb_comp ); }
+ : _sub(nb_sub), _group(NULL), _curMedField(NULL) { _comp_values.reserve( total_nb_comp ); }
~DoubleField();
std::vector< double >& addComponent( int nb_values ); // return a vector ready to fill in
bool hasCommonSupport() const { return _group; } // true if there is one support for all subs
*/
struct IntermediateMED
{
- unsigned _spaceDim{0};
- unsigned _nbNodes{0};
+ unsigned _spaceDim;
+ unsigned _nbNodes;
NodeContainer _points;
std::vector<double> _coords;
std::vector<Group> _groups;
std::list<nameGIBItoMED> _listGIBItoMED_comp; // to read from table "MED_COMP" of PILE_TABLES
std::map<int,std::string> _mapStrings; // to read from PILE_STRINGS
- IntermediateMED() = default;
+ IntermediateMED(): _spaceDim(0), _nbNodes(0) {}
~IntermediateMED();
Node* getNode( TID nID ) { return _points.getNode( nID ); }
mcIdType getNbCellsOfType( TCellType type ) const { return ToIdType(_cellsByType[type].size()); }
const Cell* insert(TCellType type, const Cell& ma) { return &( *_cellsByType[type].insert( ma ).first ); }
- Group* addNewGroup(std::vector<SauvUtilities::Group*>* groupsToFix=nullptr);
+ Group* addNewGroup(std::vector<SauvUtilities::Group*>* groupsToFix=0);
MEDCoupling::MEDFileData* convertInMEDFileDS();
private:
{
public:
ASCIIReader(const char* fileName);
- ~ASCIIReader() override;
- bool isASCII() const override;
- bool open() override;
- bool getNextLine (char* & line, bool raiseOEF = true ) override;
- void initNameReading(int nbValues, int width = 8) override;
- void initIntReading(int nbValues) override;
- void initDoubleReading(int nbValues) override;
- bool more() const override;
- void next() override;
- int getInt() const override;
- float getFloat() const override;
- double getDouble() const override;
- std::string getName() const override;
+ virtual ~ASCIIReader();
+ virtual bool isASCII() const;
+ virtual bool open();
+ virtual bool getNextLine (char* & line, bool raiseOEF = true );
+ virtual void initNameReading(int nbValues, int width = 8);
+ virtual void initIntReading(int nbValues);
+ virtual void initDoubleReading(int nbValues);
+ virtual bool more() const;
+ virtual void next();
+ virtual int getInt() const;
+ virtual float getFloat() const;
+ virtual double getDouble() const;
+ virtual std::string getName() const;
int lineNb() const { return _lineNb; }
std::string getClassName() const override { return std::string("ASCIIReader"); }
private:
{
public:
XDRReader(const char* fileName);
- ~XDRReader() override;
- bool isASCII() const override;
- bool open() override;
- bool getNextLine (char* & line, bool raiseOEF = true ) override;
- void initNameReading(int nbValues, int width = 8) override;
- void initIntReading(int nbValues) override;
- void initDoubleReading(int nbValues) override;
- bool more() const override;
- void next() override;
- int getInt() const override;
- float getFloat() const override;
- double getDouble() const override;
- std::string getName() const override;
+ virtual ~XDRReader();
+ virtual bool isASCII() const;
+ virtual bool open();
+ virtual bool getNextLine (char* & line, bool raiseOEF = true );
+ virtual void initNameReading(int nbValues, int width = 8);
+ virtual void initIntReading(int nbValues);
+ virtual void initDoubleReading(int nbValues);
+ virtual bool more() const;
+ virtual void next();
+ virtual int getInt() const;
+ virtual float getFloat() const;
+ virtual double getDouble() const;
+ virtual std::string getName() const;
std::string getClassName() const override { return std::string("XDRReader"); }
private:
#include "SauvReader.hxx"
-#include "InterpKernelException.hxx"
#include "SauvMedConvertor.hxx"
#include "MCAuto.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "MEDCouplingRefCountObject.hxx"
-#include "SauvUtilities.hxx"
-#include "NormalizedGeometricTypes"
-#include <clocale>
-#include <cstdlib>
#include <cstring>
-#include <map>
-#include <set>
+#include <sstream>
#include <iostream>
-#include <string>
-#include <vector>
-#include <utility>
using namespace MEDCoupling;
using namespace SauvUtilities;
public:
Localizer()
{
- _locale = setlocale(LC_NUMERIC, nullptr);
+ _locale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C");
}
~Localizer()
parser = new XDRReader( fileName.c_str() );
if ( parser->open() )
{
- auto* reader = new SauvReader;
+ SauvReader* reader = new SauvReader;
reader->_fileReader = parser.retn();
return reader;
}
parser = new ASCIIReader( fileName.c_str() );
if ( parser->open() )
{
- auto* reader = new SauvReader;
+ SauvReader* reader = new SauvReader;
reader->_fileReader = parser.retn();
return reader;
}
MEDCoupling::MEDFileData * SauvReader::loadInMEDFileDS()
{
- Localizer const loc; // localization, to read numbers in "C" locale
+ Localizer loc; // localization, to read numbers in "C" locale
SauvUtilities::IntermediateMED iMed; // intermadiate DS
_iMed = &iMed;
for (int object=0; object!=nbObjects; ++object) // loop on sub-groups
{
initIntReading( 5 );
- int const castemCellType = getIntNext();
- int const nbSubGroups = getIntNext();
- int const nbReferences = getIntNext();
- int const nbNodesPerElem = getIntNext();
- int const nbElements = getIntNext();
+ int castemCellType = getIntNext();
+ int nbSubGroups = getIntNext();
+ int nbReferences = getIntNext();
+ int nbNodesPerElem = getIntNext();
+ int nbElements = getIntNext();
_iMed->_groups.push_back(Group());
SauvUtilities::Group & group = _iMed->_groups.back();
ma.init();
for ( int n = 0; n < nbNodesPerElem; ++n )
{
- int const nodeID = getIntNext();
+ int nodeID = getIntNext();
pNode = _iMed->getNode( nodeID );
ma._nodes[n] = pNode;
_iMed->_nbNodes += ( !pNode->isUsed() );
// set group names
for (i=0; i!=(int)objectNames.size(); ++i)
{
- int const grpID = nameIndices[i];
+ int grpID = nameIndices[i];
SauvUtilities::Group & grp = _iMed->_groups[ grpID-1 ];
if ( !grp._name.empty() ) // a group has several names
{ // create a group with subgroup grp and named grp.name
for (int object=0; object!=nbObjects; ++object) // pour chaque Group
{
initIntReading(1);
- int const nb_vals = getIntNext();
+ int nb_vals = getIntNext();
initDoubleReading(nb_vals);
for(int i=0; i<nb_vals; i++) next();
}
if ( isXRD() )
{
initIntReading(1);
- int const nb_vals = getIntNext();
+ int nb_vals = getIntNext();
initIntReading(nb_vals);
for(int i=0; i<nb_vals; i++) next();
}
if ( isXRD() )
{
initIntReading(1);
- int const nb_vals = getIntNext();
+ int nb_vals = getIntNext();
initDoubleReading(nb_vals);
for(int i=0; i<nb_vals; i++) next();
}
if ( isXRD() )
{
initIntReading(1);
- int const nb_vals = getIntNext();
+ int nb_vals = getIntNext();
initIntReading(nb_vals);
for(int i=0; i<nb_vals; i++) next();
}
for (int object=0; object!=nbObjects; ++object) // pour chaque Group
{
initIntReading(2);
- int const len = getIntNext();
- int const nb_vals = getIntNext();
- int const nb_char = len*nb_vals;
+ int len = getIntNext();
+ int nb_vals = getIntNext();
+ int nb_char = len*nb_vals;
int nb_char_tmp = 0;
- int const fixed_length = 71;
+ int fixed_length = 71;
while (nb_char_tmp < nb_char)
{
- int const remain_len = nb_char - nb_char_tmp;
+ int remain_len = nb_char - nb_char_tmp;
int width;
if ( remain_len > fixed_length )
{
{
// see wrmodl.eso
initIntReading(10);
- int const n1 = getIntNext();
- int const nm2 = getIntNext();
- int const nm3 = getIntNext();
- int const nm4 = getIntNext();
- int const nm5 = getIntNext();
- int const n45 = getIntNext();
+ int n1 = getIntNext();
+ int nm2 = getIntNext();
+ int nm3 = getIntNext();
+ int nm4 = getIntNext();
+ int nm5 = getIntNext();
+ int n45 = getIntNext();
/*int nm6 =*/ getIntNext();
/*int nm7 =*/ getIntNext();
next();
next();
- int const nm1 = n1 * n45;
- int const nm9 = n1 * 16;
+ int nm1 = n1 * n45;
+ int nm9 = n1 * 16;
for (initIntReading(nm1); more(); next());
for (initIntReading(nm9); more(); next());
for (initNameReading(nm5, 8); more(); next());
void SauvReader::read_PILE_NOEUDS (const int nbObjects, std::vector<std::string>&, std::vector<int>&)
{
initIntReading(1);
- int const nb_indices = getIntNext();
+ int nb_indices = getIntNext();
if (nb_indices != nbObjects)
THROW_IK_EXCEPTION("Error of reading PILE NUMERO " << PILE_NOEUDS << lineNb() );
for ( initIntReading( nbObjects ); more(); next() )
{
- int const coordID = getInt();
+ int coordID = getInt();
_iMed->getNode( index()+1 )->_coordID = coordID;
}
}
*/
//================================================================================
-void SauvReader::read_PILE_COORDONNEES (const int /*nbObjects*/, std::vector<std::string>&, std::vector<int>&)
+void SauvReader::read_PILE_COORDONNEES (const int nbObjects, std::vector<std::string>&, std::vector<int>&)
{
initIntReading(1);
- int const nbReals = getIntNext();
+ int nbReals = getIntNext();
if ( nbReals < (int)(_iMed->_nbNodes*(_iMed->_spaceDim+1)) )
THROW_IK_EXCEPTION("Error of reading PILE NUMERO " << PILE_COORDONNEES << lineNb() );
void SauvReader::setFieldSupport(const vector<SauvUtilities::Group*>& supports,
SauvUtilities::DoubleField* field)
{
- SauvUtilities::Group* group = nullptr;
- set<SauvUtilities::Group*> const sup_set( supports.begin(), supports.end() );
+ SauvUtilities::Group* group = NULL;
+ set<SauvUtilities::Group*> sup_set( supports.begin(), supports.end() );
if ( sup_set.size() == 1 ) // one or equal supports
{
group = supports[0];
map<int,int> nbGaussByCellType;
for ( size_t i = 0; i < supports.size(); ++i )
{
- auto const ct2ng = nbGaussByCellType.find( supports[i]->_cellType );
+ map<int,int>::iterator ct2ng = nbGaussByCellType.find( supports[i]->_cellType );
if ( ct2ng == nbGaussByCellType.end() )
nbGaussByCellType[ supports[i]->_cellType ] = field->_sub[i].nbGauss();
else if ( ct2ng->second != field->_sub[i].nbGauss() )
return;
}
- bool const isSameCellType = ( nbGaussByCellType.size() == 1 );
+ bool isSameCellType = ( nbGaussByCellType.size() == 1 );
// try to find an existing composite group with the same sub-groups
if ( isSameCellType )
for ( size_t i = 0; i < _iMed->_groups.size() && !group; ++i )
isSwapped = false;
for ( std::size_t i = 1; i < groups.size(); ++i )
{
- std::size_t const nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size();
- std::size_t const nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size();
+ std::size_t nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size();
+ std::size_t nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size();
if ( nbN1 > nbN2 )
{
isSwapped = isModified = true;
size_t iFromSub = 0, iNewSub = 0, iNewComp = 0;
for ( ; iFromSub < field->_sub.size(); iFromSub += groups.size() )
{
- size_t const iFromComp = iNewComp;
- for (auto & group : groups)
+ size_t iFromComp = iNewComp;
+ for ( size_t iG = 0; iG < groups.size(); ++iG )
{
size_t iComp = iFromComp;
for ( size_t iSub = iFromSub; iSub < field->_sub.size(); ++iSub )
- if ( field->_sub[ iSub ]._support == group )
+ if ( field->_sub[ iSub ]._support == groups[ iG ] )
{
newSub[ iNewSub++ ] = field->_sub[ iSub ];
int iC = 0, nbC = field->_sub[ iSub ].nbComponents();
unsigned i;
for ( i = 0; i < indices_objets_nommes.size(); ++i )
{
- int const fieldIndex = indices_objets_nommes[ i ];
+ int fieldIndex = indices_objets_nommes[ i ];
if ( fields[ fieldIndex - 1 ] )
fields[ fieldIndex - 1 ]->_name = objets_nommes[ i ];
}
std::vector<std::string>& objectNames,
std::vector<int>& nameIndices)
{
- _iMed->_nodeFields.resize( nbObjects, (SauvUtilities::DoubleField*) nullptr );
+ _iMed->_nodeFields.resize( nbObjects, (SauvUtilities::DoubleField*) 0 );
for (int object=0; object!=nbObjects; ++object) // loop on fields
{
// EXAMPLE ( with no values )
initIntReading( nb_sub * 3 );
for ( i_sub = 0; i_sub < nb_sub; ++i_sub )
{
- int const supId = -getIntNext(); // (a) reference to support
+ int supId = -getIntNext(); // (a) reference to support
if ( supId < 1 || supId > (int)_iMed->_groups.size() )
THROW_IK_EXCEPTION("Wrong mesh reference: "<< supId << lineNb() );
supports[ i_sub ] = &_iMed->_groups[ supId-1 ]; // (a) reference to support
}
// create a field if there are values
- SauvUtilities::DoubleField* fdouble = nullptr;
+ SauvUtilities::DoubleField* fdouble = 0;
if ( total_nb_values > 0 )
fdouble = new DoubleField( nb_sub, total_nb_comp );
_iMed->_nodeFields[ object ] = fdouble;
for ( i_comp = 0; i_comp < nb_comps[ i_sub ]; ++i_comp, next() )
{
// store component name
- string const compName = getName();
+ string compName = getName();
if ( fdouble )
fdouble->_sub[ i_sub ].compName( i_comp ) = compName;
}
// (17) 1.00000000000000E+02 1.00000000000000E+02 1.00000000000000E+02
// (18) ...
- _iMed->_cellFields.resize( nbObjects, (SauvUtilities::DoubleField*) nullptr );
+ _iMed->_cellFields.resize( nbObjects, (SauvUtilities::DoubleField*) 0 );
for (int object=0; object!=nbObjects; ++object) // pour chaque field
{
initIntReading( 4 );
int i_sub, nb_sub = getIntNext(); // (1) <nb_sub> 2 6 <title length>
next(); // skip "2"
next(); // skip "6"
- int const title_length = getIntNext(); // <title length>
+ int title_length = getIntNext(); // <title length>
if ( nb_sub < 1 )
THROW_IK_EXCEPTION("Error of field reading: wrong nb of subcomponents " << nb_sub << lineNb() );
vector<int> nb_comp( nb_sub );
for ( i_sub = 0; i_sub < nb_sub; ++i_sub )
{ // (3)
- int const supportId = -getIntNext(); // <reference to support>
+ int supportId = -getIntNext(); // <reference to support>
next(); // ignore <address>
nb_comp [ i_sub ] = getIntNext(); // <nb of components in the sub>
for ( int i = 0; i < 6; ++i ) next(); // ignore 6 ints, in example "0 0 0 -2 0 3"
// loop on subcomponents of a field, each of which refers to
// a certain support and has its own number of components;
// read component values
- SauvUtilities::DoubleField* fdouble = nullptr;
+ SauvUtilities::DoubleField* fdouble = 0;
for ( i_sub = 0; i_sub < nb_sub; ++ i_sub )
{
vector<string> comp_names( nb_comp[ i_sub ]), comp_type( nb_comp[ i_sub ]);
<< ">" << lineNb() );
}
// now type is known, create a field, one for all subs
- bool const isReal = (nb_comp[i_sub] > 0) ? (comp_type[0] == "REAL*8") : true;
+ bool isReal = (nb_comp[i_sub] > 0) ? (comp_type[0] == "REAL*8") : true;
if ( !fdouble && total_nb_comp )
{
if ( !isReal )
{
// (9) nb of values
initIntReading( 4 );
- int const nb_val_by_elem = getIntNext();
+ int nb_val_by_elem = getIntNext();
int nb_values = getIntNext();
next();
next();
{
// IMP 0020434: mapping GIBI names to MED names
- string const table_med_mail = "MED_MAIL";
- string const table_med_cham = "MED_CHAM";
- string const table_med_comp = "MED_COMP";
+ string table_med_mail = "MED_MAIL";
+ string table_med_cham = "MED_CHAM";
+ string table_med_comp = "MED_COMP";
int table_med_mail_id = -1;
int table_med_cham_id = -1;
int table_med_comp_id = -1;
// read tables "MED_MAIL", "MED_CHAM" and "MED_COMP", that keeps correspondence
// between GIBI names (8 symbols if any) and MED names (possibly longer)
initIntReading(1);
- int const nb_table_vals = getIntNext();
+ int nb_table_vals = getIntNext();
if (nb_table_vals < 0)
THROW_IK_EXCEPTION("Error of reading PILE NUMERO 10" << lineNb() );
//================================================================================
void SauvReader::read_PILE_STRINGS (const int nbObjects,
- std::vector<std::string>& /*objectNames*/,
- std::vector<int>& /*nameIndices*/)
+ std::vector<std::string>& objectNames,
+ std::vector<int>& nameIndices)
{
// IMP 0020434: mapping GIBI names to MED names
initIntReading(2);
- int const stringLen = getIntNext();
- int const nbSubStrings = getIntNext();
+ int stringLen = getIntNext();
+ int nbSubStrings = getIntNext();
if (nbSubStrings != nbObjects)
THROW_IK_EXCEPTION("Error of reading PILE NUMERO 27" << lineNb() );
const int fixedLength = 71;
while ((int)aWholeString.length() < stringLen)
{
- int const remainLen = (int)(stringLen - aWholeString.length());
+ int remainLen = (int)(stringLen - aWholeString.length());
int len;
if ( remainLen > fixedLength )
{
while ((int)aWholeString.length() < stringLen)
{
getNextLine( line );
- int const remainLen = (int)(stringLen - aWholeString.length());
+ int remainLen = (int)(stringLen - aWholeString.length());
if ( remainLen > fixedLength )
{
aWholeString += line + 1;
#define __SAUVREADER_HXX__
#include "MEDLoaderDefines.hxx"
+#include "InterpKernelException.hxx"
#include "SauvUtilities.hxx"
#include "MEDCouplingRefCountObject.hxx"
-#include <cstddef>
#include <vector>
#include <string>
#include <set>
public:
MEDLOADER_EXPORT static SauvReader* New(const std::string& fileName);
MEDLOADER_EXPORT MEDCoupling::MEDFileData * loadInMEDFileDS();
- MEDLOADER_EXPORT ~SauvReader() override;
+ MEDLOADER_EXPORT ~SauvReader();
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("SauvReader"); }
private:
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
void readRecord2();
void readRecord4();
void readRecord7();
void next() { _fileReader->next(); }
int index() const { return _fileReader->index(); }
int getInt() const { return _fileReader->getInt(); }
- int getIntNext() { int const i = getInt(); next(); return i; }
+ int getIntNext() { int i = getInt(); next(); return i; }
float getFloat() const { return _fileReader->getFloat(); }
double getDouble() const { return _fileReader->getDouble(); }
std::string getName() const { return _fileReader->getName(); }
#include "MEDLoaderDefines.hxx"
#include "MEDCouplingRefCountObject.hxx"
-#include "NormalizedGeometricTypes"
+#include "NormalizedUnstructuredMesh.hxx"
-#include <cstddef>
#include <string>
#include <sstream>
-#include <vector>
namespace SauvUtilities
{
{
public:
FileReader(const char* fileName);
- ~FileReader() override = default;
+ virtual ~FileReader() {}
virtual bool isASCII() const = 0;
virtual bool open() = 0;
virtual double getDouble() const = 0;
virtual std::string getName() const = 0;
protected:
- std::size_t getHeapMemorySizeWithoutChildren() const override { return 0; }
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override { return std::vector<const BigMemoryObject *>(); }
+ std::size_t getHeapMemorySizeWithoutChildren() const { return 0; }
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const { return std::vector<const BigMemoryObject *>(); }
protected:
std::string _fileName;
int _iRead, _nbToRead;
#include "SauvWriter.hxx"
#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
-#include "MEDFileFieldMultiTS.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "MEDFileMesh.hxx"
#include "MEDFileField.hxx"
#include "MEDFileData.hxx"
#include "CellModel.hxx"
-#include "NormalizedGeometricTypes"
-#include "SauvUtilities.hxx"
-#include <cctype>
#include <fstream>
+#include <sstream>
#include <iostream>
#include <cstdlib>
#include <iomanip>
-#include <map>
-#include <set>
-#include <string>
-#include <utility>
-#include <vector>
using namespace MEDCoupling;
using namespace SauvUtilities;
if ( !name.empty() )
{
// cut off leading white spaces
- string::size_type const firstChar = name.find_first_not_of(" \t");
+ string::size_type firstChar = name.find_first_not_of(" \t");
if (firstChar < name.length())
{
name = name.substr(firstChar);
name = ""; // only whitespaces there - remove them
}
// cut off trailing white spaces
- string::size_type const lastChar = name.find_last_not_of(" \t");
+ string::size_type lastChar = name.find_last_not_of(" \t");
if (lastChar < name.length())
name = name.substr(0, lastChar + 1);
}
if (!healedName.empty())
{
string name = healedName;
- std::size_t const len = name.length();
+ std::size_t len = name.length();
for (std::size_t i = 0; i < len; ++i)
name[i] = (char)toupper(name[i]);
{
INFOS_MED("Save <" << theName << "> as <" << name << ">");
- auto const it = nameMap.find(name);
+ map<string,int>::iterator it = nameMap.find(name);
if (it != nameMap.end())
{
// There is already such name in the map.
// a. Replace in the map the old pair by the current one
- int const old_ind = nameMap[name];
+ int old_ind = nameMap[name];
nameMap[name] = ind;
// b. Rebuild the old pair (which was in the map,
// it seems to be built automatically by step II)
if (new_loc_index > 0)
{
// prefix
- string const str = name.substr(0,5);
+ string str = name.substr(0,5);
if (namePrefixesMap.find(str) != namePrefixesMap.end())
{
- int const old_loc_index = namePrefixesMap[str];
+ int old_loc_index = namePrefixesMap[str];
if (new_loc_index < old_loc_index) new_loc_index = old_loc_index;
}
namePrefixesMap[str] = new_loc_index;
if (len > 5) name = name.substr(0,5);
// numeric suffix
- auto const name2ind = namePrefixesMap.insert( make_pair( name, 0 )).first;
+ map<string,int>::iterator name2ind = namePrefixesMap.insert( make_pair( name, 0 )).first;
string numSuffix = SauvUtilities::toString( ++(name2ind->second) );
if ( numSuffix.size() + name.size() > 8 )
for ( int i = 0; i < fields->getNumberOfFields(); ++i )
{
MEDFileAnyTypeFieldMultiTS * fB = fields->getFieldAtPos(i);
- auto * f = dynamic_cast<MEDFileFieldMultiTS *>(fB);
+ MEDFileFieldMultiTS * f = dynamic_cast<MEDFileFieldMultiTS *>(fB);
if(!f)
continue;// fields on int32 not managed
if ( f->getMeshName() == _fileMesh->getName() )
// fill names of SubMesh'es and count nb of sauv sub-meshes they will be stored into
nbSauvObjects = 0;
map<string,int> namePrefixMap;
- for (auto & sm : _subs)
+ for ( size_t i = 0; i < _subs.size(); ++i )
{
+ SubMesh& sm = _subs[i];
+
sm._nbSauvObjects = 0;
if ( sm._subs.empty() )
{
void SauvWriter::fillFamilySubMeshes()
{
- auto* nilSm = (SubMesh*) nullptr;
- std::vector<int> const dims = _fileMesh->getNonEmptyLevelsExt();
- for (int const dimRelExt : dims)
+ SubMesh* nilSm = (SubMesh*) 0;
+ std::vector<int> dims = _fileMesh->getNonEmptyLevelsExt();
+ for ( size_t iDim = 0; iDim < dims.size(); ++iDim )
{
+ int dimRelExt = dims[ iDim ];
MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(dimRelExt);
const DataArrayIdType * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt);
if ( !famIds ) continue;
if ( *famID != curFamID )
{
curFamID = *famID;
- auto const f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first;
+ map< mcIdType, SubMesh* >::iterator f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first;
if ( !f2s->second )
f2s->second = addSubMesh( "", dimRelExt ); // no names for families
curSubMesh = f2s->second;
}
- INTERP_KERNEL::NormalizedCellType const cellType =
+ INTERP_KERNEL::NormalizedCellType cellType =
dimRelExt == 1 ? INTERP_KERNEL::NORM_POINT1 : mesh->getTypeOfCell( cellID );
curSubMesh->_cellIDsByType[ cellType ].push_back( cellID );
}
void SauvWriter::fillGroupSubMeshes()
{
const map<string, vector<string> >& grpFams = _fileMesh->getGroupInfo();
- auto g2ff = grpFams.begin();
+ map<string, vector<string> >::const_iterator g2ff = grpFams.begin();
for ( ; g2ff != grpFams.end(); ++g2ff )
{
const string& groupName = g2ff->first;
if ( famNames.empty() ) continue;
std::vector<SubMesh*> famSubMeshes( famNames.size() );
std::size_t k = 0;
- for (const auto & famName : famNames)
+ for ( size_t i = 0; i < famNames.size(); ++i )
{
- mcIdType const famID = _fileMesh->getFamilyId( famName.c_str() );
- auto const i2f = _famIDs2Sub.find( famID );
+ mcIdType famID = _fileMesh->getFamilyId( famNames[i].c_str() );
+ map< mcIdType, SubMesh* >::iterator i2f = _famIDs2Sub.find( famID );
if ( i2f != _famIDs2Sub.end() )
{
famSubMeshes[ k ] = i2f->second;
void SauvWriter::fillProfileSubMeshes()
{
_profile2Sub.clear();
- auto* nilSm = (SubMesh*) nullptr;
+ SubMesh* nilSm = (SubMesh*) 0;
for ( int isOnNodes = 0; isOnNodes < 2; ++isOnNodes )
{
vector< MCAuto< MEDFileFieldMultiTS > >
fields = isOnNodes ? _nodeFields : _cellFields;
- for (auto & field : fields)
+ for ( size_t i = 0; i < fields.size(); ++i )
{
- vector< pair<int,int> > iters = field->getIterations();
+ vector< pair<int,int> > iters = fields[i]->getIterations();
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- field->getFieldSplitedByType( iters[0].first, iters[0].second,
+ fields[i]->getFieldSplitedByType( iters[0].first, iters[0].second,
_fileMesh->getName().c_str(), types, typesF, pfls, locs);
int dimRelExt;
for ( size_t iType = 0; iType < types.size(); ++iType )
dimRelExt = getDimension( types[iType] ) - _fileMesh->getMeshDimension();
for ( size_t iPfl = 0; iPfl < pfls[iType].size(); ++iPfl )
{
- bool const isOnAll = pfls[iType][iPfl].empty();
+ bool isOnAll = pfls[iType][iPfl].empty();
if ( isOnAll ) pfls[iType][iPfl] = noProfileName( types[iType] );
- auto const pfl2sm =
+ map< string, SubMesh* >::iterator pfl2sm =
_profile2Sub.insert( make_pair( pfls[iType][iPfl], nilSm )).first;
if ( !pfl2sm->second )
{
SubMesh* sm = pfl2sm->second = addSubMesh( "", dimRelExt ); // no names for profiles
- const DataArrayIdType * pfl = isOnAll ? nullptr : field->getProfile( pfls[iType][iPfl].c_str() );
+ const DataArrayIdType * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() );
makeProfileIDs( sm, types[iType], pfl );
}
}
int SauvWriter::evaluateNbProfileSubMeshes() const
{
std::size_t nb = 0;
- for (const auto & _nodeField : _nodeFields)
- nb += 1 + _nodeField->getPflsReallyUsed().size();
+ for ( std::size_t i = 0; i < _nodeFields.size(); ++i )
+ nb += 1 + _nodeFields[i]->getPflsReallyUsed().size();
- for (const auto & _cellField : _cellFields)
+ for ( std::size_t i = 0; i < _cellFields.size(); ++i )
{
- nb += _cellField->getPflsReallyUsed().size();
+ nb += _cellFields[i]->getPflsReallyUsed().size();
- vector< pair<int,int> > iters = _cellField->getIterations();
+ vector< pair<int,int> > iters = _cellFields[i]->getIterations();
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- _cellField->getFieldSplitedByType( iters[0].first, iters[0].second,
+ _cellFields[i]->getFieldSplitedByType( iters[0].first, iters[0].second,
_fileMesh->getName().c_str(), types, typesF, pfls, locs);
nb += 2 * types.size(); // x 2 - a type can be on nodes and on cells at the same time
}
{
MCAuto< MEDCouplingMesh >
mesh = _fileMesh->getMeshAtLevel(sm->_dimRelExt);
- const auto* uMesh = dynamic_cast< const MEDCouplingUMesh* > ((const MEDCouplingMesh*) mesh );
+ const MEDCouplingUMesh* uMesh = dynamic_cast< const MEDCouplingUMesh* > ((const MEDCouplingMesh*) mesh );
if ( sm->_dimRelExt == 1 ) type = INTERP_KERNEL::NORM_POINT1;
vector< mcIdType >& ids = sm->_cellIDsByType[ type ];
code[1] = mesh->getNumberOfCellsWithType( type );
code[2] = -1;
}
- vector<const DataArrayIdType *> const idsPerType( 1, profile );
+ vector<const DataArrayIdType *> idsPerType( 1, profile );
MCAuto<DataArrayIdType>
resIDs = uMesh->checkTypeConsistencyAndContig( code, idsPerType );
if (( const DataArrayIdType *) resIDs )
// * 8001 FORMAT(8(1X,A8))
TFieldCounter fcount( *_sauvFile, 8 );
*_sauvFile << left;
- auto nameNbIt = nameNbMap.begin();
+ map<string,int>::const_iterator nameNbIt = nameNbMap.begin();
for ( ; nameNbIt != nameNbMap.end(); nameNbIt++, fcount++ )
*_sauvFile << " " << setw(8) << nameNbIt->first;
fcount.stop();
for ( unsigned int iSub = 0; iSub < _subs.size(); ++iSub )
{
- SubMesh const& sm = _subs[iSub];
+ SubMesh& sm = _subs[iSub];
if ( sm._nbSauvObjects < 1 ) continue;
// The first record of each sub-mesh writes
const vector<mcIdType>& cellIDs = sm._cellIDsByType[iType];
if ( cellIDs.empty() ) continue;
- auto
+ INTERP_KERNEL::NormalizedCellType
cellType = INTERP_KERNEL::NormalizedCellType( iType );
const INTERP_KERNEL::CellModel &
cell = INTERP_KERNEL::CellModel::GetCellModel( cellType );
- int const castemType = SauvUtilities::med2gibiGeom( cellType );
- unsigned const nbElemNodes = cell.getNumberOfNodes();
- std::size_t const nbElems = cellIDs.size();
+ int castemType = SauvUtilities::med2gibiGeom( cellType );
+ unsigned nbElemNodes = cell.getNumberOfNodes();
+ std::size_t nbElems = cellIDs.size();
*_sauvFile << setw(8) << castemType
<< zeroI8
void SauvWriter::writeCompoundSubMesh(int iSub)
{
- SubMesh const& sm = _subs[iSub];
+ SubMesh& sm = _subs[iSub];
if ( sm._nbSauvObjects < 1 || sm._subs.empty()) return;
vector< int > subIDs;
- for (auto & _sub : sm._subs) // loop on sub-meshes of families
- for ( int j = 0; j < _sub->_nbSauvObjects; ++j )
- subIDs.push_back( _sub->_id + j );
+ for ( size_t i = 0; i < sm._subs.size(); ++i ) // loop on sub-meshes of families
+ for ( int j = 0; j < sm._subs[i]->_nbSauvObjects; ++j )
+ subIDs.push_back( sm._subs[i]->_id + j );
*_sauvFile << zeroI8
<< setw(8) << subIDs.size()
{
for ( int j = 0; j < dim; ++j, fcount++ )
{
- double const coo = coordArray->getIJ( i, j );
- bool const zero = ( -precision < coo && coo < precision );
+ double coo = coordArray->getIJ( i, j );
+ bool zero = ( -precision < coo && coo < precision );
*_sauvFile << setw(22) << ( zero ? 0.0 : coo );
}
*_sauvFile << density;
void SauvWriter::writeLongNames()
{
- int const nbTables =
+ int nbTables =
3 - _longNames[ LN_MAIL ].empty() - _longNames[ LN_CHAM ].empty() - _longNames[ LN_COMP ].empty();
if (nbTables == 0) return;
*_sauvFile << setw(8) << longNames.size()*4 << endl; // Nb of table values
- auto itGIBItoMED = longNames.begin();
+ vector<nameGIBItoMED>::iterator itGIBItoMED = longNames.begin();
for (; itGIBItoMED != longNames.end(); itGIBItoMED++, iStr++)
{
// PILE of i-th key (med name)
for ( unsigned int iF = 0; iF < flds.size(); ++iF )
{
- string const name = addName( nameNbMap, fldNamePrefixMap, flds[iF]->getName(), iF+1 );
+ string name = addName( nameNbMap, fldNamePrefixMap, flds[iF]->getName(), iF+1 );
nameGIBItoMED aMEDName;
aMEDName.gibi_pile = isNodal ? PILE_NODES_FIELD : PILE_FIELD;
aMEDName.gibi_id = iF+1;
const vector<string>& compInfo,
map<string, string>& mapMedToGibi)
{
- for (const auto & i : compInfo)
- mapMedToGibi[i] = cleanName( i );
+ for ( size_t i = 0; i < compInfo.size(); ++i )
+ mapMedToGibi[compInfo[i]] = cleanName( compInfo[i] );
int compIndex = 1;
- auto namesIt = mapMedToGibi.begin();
+ map<string, string>::iterator namesIt = mapMedToGibi.begin();
for (; namesIt != mapMedToGibi.end(); namesIt++)
{
string & compGibiName = (*namesIt).second;
while (mapMedToGibi.count(compGibiName) > 0); // real component name could be CXXX
}
- string const compMedName = fieldName + "." + namesIt->first;
+ string compMedName = fieldName + "." + namesIt->first;
nameGIBItoMED aMEDName;
aMEDName.med_name = compMedName;
aMEDName.gibi_pile = PILE_STRINGS;
// (5) cree par muc pri
// (6)
// (7) 2
- for (auto & _nodeField : _nodeFields)
+ for ( size_t iF = 0; iF < _nodeFields.size(); ++iF )
{
// (1) write nb subcomponents, nb components(total)
- vector< pair<int,int> > const iters = _nodeField->getIterations();
- const vector<string>& compInfo = _nodeField->getInfo();
+ vector< pair<int,int> > iters = _nodeFields[iF]->getIterations();
+ const vector<string>& compInfo = _nodeFields[iF]->getInfo();
const std::size_t nbSub = iters.size();
const std::size_t nbComp = compInfo.size();
const std::size_t totalNbComp = nbSub * nbComp;
// write support, number of values and number of components
fcount.init(10);
vector< mcIdType > vals(3);
- for (auto it : iters)
+ for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
+ pair<int,int> it = iters[iIt];
+
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
- valsVec=_nodeField->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
+ valsVec=_nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
// believe that there can be only one type in a nodal field,
// so do not use a loop on types
if ( pfls[0][0].empty() ) pfls[0][0] = noProfileName( types[0] );
- auto const pfl2Sub = _profile2Sub.find( pfls[0][0] );
+ map< string, SubMesh* >::iterator pfl2Sub = _profile2Sub.find( pfls[0][0] );
if ( pfl2Sub == _profile2Sub.end() )
THROW_IK_EXCEPTION( "SauvWriter::writeNodalFields(): no sub-mesh for profile |"
<< pfls[0][0] << "|");
// (3) Write names of components
map<string, string> mapMedToGibi;
- makeCompNames( _nodeField->getName(), compInfo, mapMedToGibi );
+ makeCompNames( _nodeFields[iF]->getName(), compInfo, mapMedToGibi );
fcount.init(8);
*_sauvFile << left;
for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
*_sauvFile << " " << setw(8) << 0;
fcount.stop();
- string const description = _nodeField->getName();
+ string description = _nodeFields[iF]->getName();
*_sauvFile << endl; // (5) TYPE
*_sauvFile << setw(72) << description.substr(0,71) << endl; // (6) TITRE
//*_sauvFile << endl; // (7) 0 attributes
// write values of each component
fcount.init( 3 ); // 3 values per a line
- for (auto it : iters)
+ for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
+ pair<int,int> it = iters[iIt];
+
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
- valsVec = _nodeField->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
+ valsVec = _nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
// believe that there can be only one type in a nodal field,
// so do not perform a loop on types
- const DataArrayDouble* valsArray = _nodeField->getUndergroundDataArray(it.first, it.second);
+ const DataArrayDouble* valsArray = _nodeFields[iF]->getUndergroundDataArray(it.first, it.second);
for ( size_t j = 0; j < compInfo.size(); ++j )
{
for ( size_t i = valsVec[0][0].first; i < (std::size_t)valsVec[0][0].second; ++i, fcount++ )
{
// count nb of sub-components
std::size_t iSub, nbSub = 0;
- vector< pair<int,int> > const iters = _cellFields[iF]->getIterations();
- for (auto it : iters)
+ vector< pair<int,int> > iters = _cellFields[iF]->getIterations();
+ for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
+ pair<int,int> it = iters[iIt];
+
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
- for (const auto & i : valsVec)
- nbSub += i.size();
+ for ( size_t i = 0; i < valsVec.size(); ++i )
+ nbSub += valsVec[i].size();
}
// (1) write nb sub-components, title length
*_sauvFile << setw(8) << nbSub
<< setw(8) << 6 // whatever
<< setw(8) << 72 << endl; // title length
// (2) title
- string const title = _cellFields[iF]->getName();
+ string title = _cellFields[iF]->getName();
*_sauvFile << setw(72) << title.substr(0,71) << endl;
*_sauvFile << setw(72) << " " << endl;
const vector<string>& compInfo = _cellFields[iF]->getInfo();
vals[2] = ToIdType( compInfo.size() );
fcount.init(10);
- for (auto it : iters)
+ for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
+ pair<int,int> it = iters[iIt];
+
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
for ( size_t iP = 0; iP < pfls[iType].size(); ++iP )
{
if ( pfls[iType][iP].empty() ) pfls[iType][iP] = noProfileName( types[iType] );
- auto const pfl2Sub = _profile2Sub.find( pfls[iType][iP] );
+ map< string, SubMesh* >::iterator pfl2Sub = _profile2Sub.find( pfls[iType][iP] );
if ( pfl2Sub == _profile2Sub.end() )
THROW_IK_EXCEPTION( "SauvWriter::writeElemFields(): no sub-mesh for profile |"
<< pfls[iType][iP] << "|");
// loop on sub-components of a field, each of which refers to
// a certain support and has its own number of components
- for (auto it : iters)
+ for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
+ pair<int,int> it = iters[iIt];
writeElemTimeStamp( iF, it.first, it.second );
}
} // loop on cell fields
*/
//================================================================================
-void SauvWriter::writeElemTimeStamp(int iF, int iter, int order)
+void SauvWriter::writeElemTimeStamp(int iF, int iter, int order)
{
// (6) 317767 317761 317755 317815
// (7) YOUN NU H SIGY
int nbPntPerCell = 1;
if ( !locs[iType][iP].empty() )
{
- int const locID = _cellFields[iF]->getLocalizationId( locs[iType][iP].c_str() );
+ int locID = _cellFields[iF]->getLocalizationId( locs[iType][iP].c_str() );
nbPntPerCell = _cellFields[iF]->getNbOfGaussPtPerCell( locID );
}
else if ( typesF[iType][iP] == ON_GAUSS_NE )
#include "MEDLoaderDefines.hxx"
#include "MEDCouplingRefCountObject.hxx"
-#include "NormalizedGeometricTypes"
+#include "NormalizedUnstructuredMesh.hxx"
#include "SauvUtilities.hxx"
#include "MCAuto.hxx"
#include "MCType.hxx"
-#include <cstddef>
-#include <fstream>
#include <vector>
#include <string>
#include <map>
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("SauvWriter"); }
private:
SauvWriter();
- std::size_t getHeapMemorySizeWithoutChildren() const override;
- std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override;
+ std::size_t getHeapMemorySizeWithoutChildren() const;
+ std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
/*!
* \brief Class representing a GIBI sub-mesh (described in the pile 1 of the SAUVE file).
* It stands for a named med sub-mesh (family, etc) and contains either cell IDs or other sub-meshes.
// Author : Anthony Geay (CEA/DEN)
#include "MEDLoaderTest.hxx"
-#include "InterpKernelException.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingFieldInt.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCAuto.hxx"
+#include "MEDCouplingCMesh.hxx"
#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "NormalizedGeometricTypes"
#include "TestInterpKernelUtils.hxx" // getResourceFile()
#include "MEDFileMesh.hxx"
#include <algorithm>
-#include <cmath>
-#include <cppunit/TestAssert.h>
-#include <functional>
-#include <math.h>
-#include <cstdint>
#include <numeric>
-#include <vector>
-#include <utility>
-#include <set>
using namespace MEDCoupling;
{
MEDCouplingFieldDouble *f1=buildVecFieldOnCells_1();
WriteField("file6.med",f1,true);
- auto *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell("file6.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1));
+ MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell("file6.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1));
CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
f1->decrRef();
f2->decrRef();
WriteFieldUsingAlreadyWrittenMesh(fileName,f1_int64);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1_fl);
//retrieving time steps...
- auto *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),8,9));
+ MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),8,9));
f1->setTime(10.,8,9);
tmp[0]=VAL1;
CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
CPPUNIT_ASSERT(f1_int->isEqual(f2_int,1e-12,0)); // exact equality for int values
f2_int->decrRef();
f1_int->decrRef();
- auto *f2_int64=dynamic_cast<MEDCouplingFieldInt64 *>(ReadFieldCell(fileName,f1_int64->getMesh()->getName().c_str(),0,f1_int64->getName().c_str(),8,9));
+ MEDCouplingFieldInt64 *f2_int64=dynamic_cast<MEDCouplingFieldInt64 *>(ReadFieldCell(fileName,f1_int64->getMesh()->getName().c_str(),0,f1_int64->getName().c_str(),8,9));
CPPUNIT_ASSERT(f1_int64->isEqual(f2_int64,1e-12,0)); // exact equality for int values
f2_int64->decrRef();
f1_int64->decrRef();
- auto *f2_fl=dynamic_cast<MEDCouplingFieldFloat *>(ReadFieldCell(fileName,f1_fl->getMesh()->getName().c_str(),0,f1_fl->getName().c_str(),8,9));
+ MEDCouplingFieldFloat *f2_fl=dynamic_cast<MEDCouplingFieldFloat *>(ReadFieldCell(fileName,f1_fl->getMesh()->getName().c_str(),0,f1_fl->getName().c_str(),8,9));
CPPUNIT_ASSERT(f1_fl->isEqual(f2_fl,1e-12,1e-07f)); // float comparison
f2_fl->decrRef();
f1_fl->decrRef();
const char fileName[]="file10.med";
MEDCouplingUMesh *mesh1=build3DMesh_1();
const mcIdType part1[5]={1,2,4,13,15};
- auto *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true);
+ MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true);
mesh2->setName("mesh2");
const mcIdType part2[4]={3,4,13,14};
- auto *mesh3=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part2,part2+4,true);
+ MEDCouplingUMesh *mesh3=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part2,part2+4,true);
mesh3->setName("mesh3");
MEDCouplingUMesh *mesh4=MEDCouplingUMesh::New();
mesh4->setName("mesh4");
MEDCouplingUMesh *mesh5=ReadUMeshFromFile(fileName,mnane);
mesh1->setName(mnane);
const mcIdType part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
- auto *mesh6=(MEDCouplingUMesh *)mesh5->buildPartOfMySelf(part3,part3+18,true);
+ MEDCouplingUMesh *mesh6=(MEDCouplingUMesh *)mesh5->buildPartOfMySelf(part3,part3+18,true);
mesh6->setName(mnane);
mesh5->decrRef();
CPPUNIT_ASSERT(mesh6->isEqual(mesh1,1e-12));
mesh2_2->decrRef();
//
std::vector<std::string> ret(GetMeshFamiliesNamesOnGroup(fileName,"3DToto","3DMesh_1"));
- std::set<std::string> const s(ret.begin(),ret.end());
+ std::set<std::string> s(ret.begin(),ret.end());
std::set<std::string> ref_s;
ref_s.insert("Family_-2");
ref_s.insert("Family_-3");
da->decrRef();
WriteUMesh(fileName,mesh1,true);
const mcIdType part1[5]={1,2,4,13,15};
- auto *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true);
+ MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true);
mesh2->setName(mesh1->getName().c_str());// <- important for the test
//
- mcIdType const nbOfCells=mesh2->getNumberOfCells();
+ mcIdType nbOfCells=mesh2->getNumberOfCells();
CPPUNIT_ASSERT_EQUAL(ToIdType(5),nbOfCells);
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
//
WriteField(fileName,f1,false);// <- false important for the test
//
- auto *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7));
+ MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7));
std::vector<MEDCoupling::TypeOfField> types=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str());
CPPUNIT_ASSERT_EQUAL(1,(int)types.size());
CPPUNIT_ASSERT(types[0]==ON_CELLS);
const char fileName[]="file19.med";
const char fileName2[]="file20.med";
MEDCouplingUMesh *m=build2DMesh_1();
- mcIdType const nbOfNodes=m->getNumberOfNodes();
+ mcIdType nbOfNodes=m->getNumberOfNodes();
WriteUMesh(fileName,m,true);
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VFieldOnNodes");
(const_cast<MEDCouplingMesh *>(f2->getMesh()))->setName(f1->getMesh()->getName().c_str());
WriteField(fileName,f2,false);// <- false important for the test
//
- auto *f3=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldNode(fileName,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7));
+ MEDCouplingFieldDouble *f3=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldNode(fileName,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7));
f3->checkConsistencyLight();
CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12));
f3->decrRef();
f1->renumberNodes(renumArr);
f1->checkConsistencyLight();
WriteField(fileName,f1,false);// <- false important for the test
- auto *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7));
+ MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7));
CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12));
//
f2->decrRef();
const mcIdType renumber1[6]={2,1,5,0,3,4};
f1->renumberCells(renumber1,false);
WriteField(fileName,f1,true);
- auto *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7));
+ MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7));
CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12));
f2->decrRef();
//
CPPUNIT_ASSERT(fs[2]->isEqual(f_3,1e-12,1e-12));
CPPUNIT_ASSERT(mm==fs[1]->getMesh());// <- important for the test
CPPUNIT_ASSERT(mm==fs[2]->getMesh());// <- important for the test
- for(auto & f : fs)
- f->decrRef();
+ for(std::vector<MEDCouplingFieldDouble *>::iterator iter=fs.begin();iter!=fs.end();iter++)
+ (*iter)->decrRef();
//
f_1->decrRef();
f_2->decrRef();
const double vec[3]={0.,0.,1.};
std::vector<mcIdType> nodes;
m3d->findNodesOnPlane(pt,vec,1e-12,nodes);
- auto *m2d=(MEDCouplingUMesh *)m3d->buildFacePartOfMySelfNode(&nodes[0],&nodes[0]+nodes.size(),true);
+ MEDCouplingUMesh *m2d=(MEDCouplingUMesh *)m3d->buildFacePartOfMySelfNode(&nodes[0],&nodes[0]+nodes.size(),true);
const mcIdType renumber[5]={1,2,0,4,3};
m2d->renumberCells(renumber,false);
m2d->setName("ExampleOfMultiDimW");
f1->setTime(3.14,2,7);
f1->checkConsistencyLight();
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
- auto *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),-1,f1->getName().c_str(),2,7));
+ MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),-1,f1->getName().c_str(),2,7));
CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12));
f1->decrRef();
f2->decrRef();
CPPUNIT_ASSERT_EQUAL(ON_NODES,ts[0]);
CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[1]);
//
- auto *f3=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7));
+ MEDCouplingFieldDouble *f3=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7));
CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12));
f3->decrRef();
f3=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7));
using namespace std;
using namespace INTERP_KERNEL;
- string const fileName= INTERP_TEST::getResourceFile("pointe.med", 3);
+ string fileName= INTERP_TEST::getResourceFile("pointe.med", 3);
vector<string> meshNames=GetMeshNames(fileName.c_str());
CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size());
MEDCouplingUMesh *mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0);
CPPUNIT_ASSERT_EQUAL(-1,its1[0].first);
CPPUNIT_ASSERT_EQUAL(-1,its1[0].second);
//
- auto *field0=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second));
+ MEDCouplingFieldDouble *field0=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second));
field0->checkConsistencyLight();
CPPUNIT_ASSERT(field0->getName()==fieldsName[0]);
CPPUNIT_ASSERT_EQUAL(1,(int)field0->getNumberOfComponents());
std::transform(field0->getArray()->getPointer(),field0->getArray()->getPointer()+16,expectedValues,diffValue,std::minus<double>());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue,diffValue+16),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue,diffValue+16),1e-12);
- const auto *constMesh=dynamic_cast<const MEDCouplingUMesh *>(field0->getMesh());
+ const MEDCouplingUMesh *constMesh=dynamic_cast<const MEDCouplingUMesh *>(field0->getMesh());
CPPUNIT_ASSERT(constMesh);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
field0->decrRef();
//
- auto *field1=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[1].c_str(),its1[0].first,its1[0].second));
+ MEDCouplingFieldDouble *field1=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[1].c_str(),its1[0].first,its1[0].second));
field1->checkConsistencyLight();
CPPUNIT_ASSERT(field1->getName()==fieldsName[1]);
CPPUNIT_ASSERT_EQUAL(3,(int)field1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(-1,its0Node[1].second);
CPPUNIT_ASSERT_EQUAL(2,its0Node[2].first);
CPPUNIT_ASSERT_EQUAL(-1,its0Node[2].second);
- auto *field0Nodes=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second));
+ MEDCouplingFieldDouble *field0Nodes=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second));
field0Nodes->checkConsistencyLight();
CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]);
CPPUNIT_ASSERT_EQUAL(1,(int)field0Nodes->getNumberOfComponents());
using namespace std;
using namespace INTERP_KERNEL;
- string const fileName=INTERP_TEST::getResourceFile("polygones.med", 3);
+ string fileName=INTERP_TEST::getResourceFile("polygones.med", 3);
vector<string> meshNames=GetMeshNames(fileName.c_str());
CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size());
CPPUNIT_ASSERT(meshNames[0]=="Bord");
CPPUNIT_ASSERT(fieldsName[2]=="bord_:_non-ortho");
std::vector<std::pair<int,int> > its0=GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str());
CPPUNIT_ASSERT_EQUAL(1,(int)its0.size());
- auto *field=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second));
+ MEDCouplingFieldDouble *field=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second));
field->checkConsistencyLight();
CPPUNIT_ASSERT(field->getName()==fieldsName[0]);
CPPUNIT_ASSERT_EQUAL(1,(int)field->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(538,(int)field->getNumberOfTuples());
- const auto *constMesh=dynamic_cast<const MEDCouplingUMesh *>(field->getMesh());
+ const MEDCouplingUMesh *constMesh=dynamic_cast<const MEDCouplingUMesh *>(field->getMesh());
CPPUNIT_ASSERT(constMesh);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,constMesh->getMeshDimension());
using namespace std;
using namespace INTERP_KERNEL;
- string const fileName=INTERP_TEST::getResourceFile("poly3D.med", 3);
+ string fileName=INTERP_TEST::getResourceFile("poly3D.med", 3);
vector<string> meshNames=GetMeshNames(fileName.c_str());
CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size());
CPPUNIT_ASSERT(meshNames[0]=="poly3D");
{
MEDCouplingUMesh *m3dsurfBase=build3DSurfMesh_1();
mcIdType numbers[5]={0,1,2,3,5};
- auto *m3dsurf=(MEDCouplingUMesh *)m3dsurfBase->buildPartOfMySelf(numbers,numbers+5,false);
+ MEDCouplingUMesh *m3dsurf=(MEDCouplingUMesh *)m3dsurfBase->buildPartOfMySelf(numbers,numbers+5,false);
m3dsurfBase->decrRef();
MEDCouplingUMesh *m1dBase=build1DMesh_1();
mcIdType numbers2[4]={0,1,2,3};
- auto *m1d=(MEDCouplingUMesh *)m1dBase->buildPartOfMySelf(numbers2,numbers2+4,false);
+ MEDCouplingUMesh *m1d=(MEDCouplingUMesh *)m1dBase->buildPartOfMySelf(numbers2,numbers2+4,false);
m1dBase->decrRef();
m1d->changeSpaceDimension(3);
const double vec[3]={0.,1.,0.};
MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- mcIdType const nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
f1->setMesh(mesh);
MEDCouplingFieldInt *MEDLoaderTest::buildIntVecFieldOnCells_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- mcIdType const nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldInt *f1=MEDCouplingFieldInt::New(ON_CELLS,ONE_TIME);
f1->setName("IntVectorFieldOnCells");
f1->setMesh(mesh);
MEDCouplingFieldInt64 *MEDLoaderTest::buildInt64VecFieldOnCells_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- mcIdType const nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldInt64 *f1=MEDCouplingFieldInt64::New(ON_CELLS,ONE_TIME);
f1->setName("Int64VectorFieldOnCells");
f1->setMesh(mesh);
MEDCouplingFieldFloat *MEDLoaderTest::buildFloatVecFieldOnCells_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- mcIdType const nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldFloat *f1=MEDCouplingFieldFloat::New(ON_CELLS,ONE_TIME);
f1->setName("FloatVectorFieldOnCells");
f1->setMesh(mesh);
MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnNodes_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- mcIdType const nbOfNodes=mesh->getNumberOfNodes();
+ mcIdType nbOfNodes=mesh->getNumberOfNodes();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VectorFieldOnNodes");
f1->setMesh(mesh);
const double gsCoo1[12]={ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b,
2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 };
const double wg1[6]={ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 };
- std::vector<double> const _refCoo1(refCoo1,refCoo1+6);
+ std::vector<double> _refCoo1(refCoo1,refCoo1+6);
std::vector<double> _gsCoo1(gsCoo1,gsCoo1+12);
std::vector<double> _wg1(wg1,wg1+6);
MEDCouplingUMesh *m=build2DMesh_2();
f->setMesh(m);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1);
const double refCoo2[12]={-1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 };
- std::vector<double> const _refCoo2(refCoo2,refCoo2+12);
+ std::vector<double> _refCoo2(refCoo2,refCoo2+12);
std::vector<double> _gsCoo2(_gsCoo1);
std::vector<double> _wg2(_wg1);
_gsCoo2.resize(6); _wg2.resize(3);
const double refCoo3[8]={ 0.,0., 1.,0., 1.,1., 0.,1. };
- std::vector<double> const _refCoo3(refCoo3,refCoo3+8);
+ std::vector<double> _refCoo3(refCoo3,refCoo3+8);
_gsCoo1.resize(4); _wg1.resize(2);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo3,_gsCoo1,_wg1);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI6,_refCoo2,_gsCoo2,_wg2);
#define __MEDLOADERTEST_HXX__
#include "MEDCouplingFieldInt.hxx" // this one can not use a class forward
-#include <cppunit/TestFixture.h>
-#include "MEDCouplingTraits.hxx"
#include <cppunit/extensions/HelperMacros.h>
namespace MEDCoupling
#include "SauvLoaderTest.hxx"
-#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "NormalizedGeometricTypes"
-#include "MEDFileMesh.hxx"
-#include "MEDFileField.hxx"
-#include "MEDFileFieldMultiTS.hxx"
-#include "MEDCouplingMesh.hxx"
#include "SauvReader.hxx"
#include "SauvWriter.hxx"
#include "MEDFileData.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "TestInterpKernelUtils.hxx" // getResourceFile()
-#include <algorithm>
-#include <cppunit/TestAssert.h>
-#include <iostream>
-#include <cstddef>
-#include <map>
-#include <stdio.h>
-#include <vector>
-#include <utility>
#ifdef WIN32
#include <windows.h>
# include <unistd.h>
#endif
+#include <vector>
#include <string>
using namespace MEDCoupling;
void SauvLoaderTest::testSauv2Med()
{
// read a file containing all types of readable piles
- std::string const file = INTERP_TEST::getResourceFile("allPillesTest.sauv", 3);
+ std::string file = INTERP_TEST::getResourceFile("allPillesTest.sauv", 3);
MCAuto<SauvReader> sr=SauvReader::New(file.c_str());
MCAuto<MEDFileData> d2=sr->loadInMEDFileDS();
// write MED
// read SAUV and check groups
MCAuto<SauvReader> sr=SauvReader::New(sauvFile);
MCAuto<MEDFileData> d2=sr->loadInMEDFileDS();
- auto* m2 = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) );
+ MEDFileUMesh* m2 = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) );
MCAuto<MEDCouplingUMesh> group1 = m2->getGroup(0, "Group1");
CPPUNIT_ASSERT_EQUAL(1,(int)group1->getNumberOfCells());
MCAuto<MEDCouplingUMesh> group2 = m2->getGroup(0, "Group2");
void SauvLoaderTest::testSauv2MedOnA3SubsField()
{
// read SAUV
- std::string const sauvFile = INTERP_TEST::getResourceFile("portico_3subs.sauv", 3);
+ std::string sauvFile = INTERP_TEST::getResourceFile("portico_3subs.sauv", 3);
MCAuto<SauvReader> sr=SauvReader::New(sauvFile.c_str());
MCAuto<MEDFileData> d2=sr->loadInMEDFileDS();
// check mesh
- auto* m2 = static_cast<MEDFileUMesh*>(d2->getMeshes()->getMeshAtPos(0));
+ MEDFileUMesh* m2 = static_cast<MEDFileUMesh*>(d2->getMeshes()->getMeshAtPos(0));
MCAuto<MEDCouplingUMesh> mesh1d = m2->getMeshAtLevel(0);
- MCAuto<MEDCouplingFieldDouble> length1dField = mesh1d->getMeasureField(false);
+ MCAuto<MEDCouplingFieldDouble> length1dField = mesh1d->getMeasureField(0);
std::cout << "Length of 1d elements: " << length1dField->accumulate(0) << std::endl;
CPPUNIT_ASSERT_DOUBLES_EQUAL(3, length1dField->accumulate(0), 1e-12);
// check field
// Check first component of the field
// 2 gauss points per element => 12 values
- double const values[12] = {
+ double values[12] = {
-7.687500000000e-03,
-7.687500000000e-03,
-4.562500000000e-03,
void SauvLoaderTest::testMed2Sauv()
{
// read pointe.med
- std::string const file = INTERP_TEST::getResourceFile("pointe.med", 3);
+ std::string file = INTERP_TEST::getResourceFile("pointe.med", 3);
MCAuto<MEDFileData> pointeMed=MEDFileData::New(file.c_str());
// add 3 faces to pointeMed
- auto* pointeMedMesh = static_cast<MEDFileUMesh*>(pointeMed->getMeshes()->getMeshAtPos(0));
+ MEDFileUMesh* pointeMedMesh = static_cast<MEDFileUMesh*>(pointeMed->getMeshes()->getMeshAtPos(0));
MCAuto<MEDCouplingUMesh> pointeM1D = MEDCouplingUMesh::New();
DataArrayDouble *coords = pointeMedMesh->getCoords();
pointeM1D->setCoords( coords );
MCAuto<MEDFileData> d2=sr->loadInMEDFileDS();
CPPUNIT_ASSERT_EQUAL(1,d2->getNumberOfMeshes());
CPPUNIT_ASSERT_EQUAL(4,d2->getNumberOfFields());
- auto * m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) );
+ MEDFileUMesh * m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) );
CPPUNIT_ASSERT_EQUAL(std::string("maa1"),std::string(m->getName() ));
CPPUNIT_ASSERT_EQUAL(3,m->getMeshDimension());
std::vector<std::string > groups = m->getGroupsNames();
DataArrayDouble *coo = m->getCoords();
DataArrayDouble *pointeCoo = pointeMedMesh->getCoords();
CPPUNIT_ASSERT(coo->isEqualWithoutConsideringStr(*pointeCoo,1e-12));
- MCAuto<MEDCouplingFieldDouble> vol = um0->getMeasureField(false);
- MCAuto<MEDCouplingFieldDouble> pointeVol = pointeUM0->getMeasureField(false);
+ MCAuto<MEDCouplingFieldDouble> vol = um0->getMeasureField(0);
+ MCAuto<MEDCouplingFieldDouble> pointeVol = pointeUM0->getMeasureField(0);
CPPUNIT_ASSERT_DOUBLES_EQUAL( vol->accumulate(0), pointeVol->accumulate(0),1e-12);
// check fields
// fieldnodedouble
void SauvLoaderTest::testCellsWithLingNames()
{
// test IMP 3285: [CEA 1778] SauvReader: only keep the meshes named in the table MED_MAIL
- std::string const file = INTERP_TEST::getResourceFile("test_MED_MAIL.sauv", 3);
+ std::string file = INTERP_TEST::getResourceFile("test_MED_MAIL.sauv", 3);
MCAuto<SauvReader> sr=SauvReader::New(file.c_str());
MCAuto<MEDFileData> d2=sr->loadInMEDFileDS();
// check that the mesh contains
// - Nombre de mailles de type MED_QUAD4 : 43
// - Nombre de mailles de type MED_HEXA8 : 24
// - Nombre de mailles de type MED_PENTA6 : 3
- auto* m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0));
+ MEDFileUMesh* m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0));
CPPUNIT_ASSERT_EQUAL(ToIdType(6), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 ));
CPPUNIT_ASSERT_EQUAL(ToIdType(43), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_QUAD4 ));
CPPUNIT_ASSERT_EQUAL(ToIdType(24), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 ));
#else
const char* fileToRemove[nbFilesToRemove] = { "allPillesTest.med", "pointe.sauv", "mesh_with_void_family.sauv" };
#endif
- for (auto & i : fileToRemove)
+ for ( int i = 0; i < nbFilesToRemove; ++i )
{
#ifdef WIN32
if (GetFileAttributes(fileToRemove[i]) != INVALID_FILE_ATTRIBUTES)
#else
- if (access(i, F_OK) == 0)
+ if (access(fileToRemove[i], F_OK) == 0)
#endif
#if defined(WIN32) && defined(UNICODE)
_wremove(fileToRemove[i]);
#else
- remove(i);
+ remove(fileToRemove[i]);
#endif
}
}
#ifndef __SauvLoaderTest_HXX__
#define __SauvLoaderTest_HXX__
-#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
+#include "MEDLoaderTest.hxx"
namespace MEDCoupling
{
void testCellsWithLingNames();
public:
- void tearDown() override;
+ void tearDown();
};
}
//
// Author : Anthony Geay (CEA/DEN)
+#include "CppUnitTest.hxx"
#include "MEDLoaderTest.hxx"
#include "CrackAlgoTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::MEDLoaderTest );
CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::CrackAlgoTest );
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#include "CppUnitTest.hxx"
#include "SauvLoaderTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::SauvLoaderTest );
+#include "BasicMainTest.hxx"
// see MeshGems/Docs/meshgems_formats_description.pdf
extern const char* GmfKwdFmt[ GmfMaxKwd + 1 ][4];
// occ/24009
-#include <cstdio>
#include "MEDLoaderDefines.hxx"
/*----------------------------------------------------------*/
/* Structures */
#include "MEDPARTITIONER_ConnectZone.hxx"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
#include "MEDCouplingSkyLineArray.hxx"
#include <map>
-#include <utility>
-#include <vector>
using namespace MEDCoupling;
,_description("")
,_local_domain_number(0)
,_distant_domain_number(0)
- ,_local_mesh(nullptr)
- ,_distant_mesh(nullptr)
- ,_node_corresp(nullptr)
- ,_face_corresp(nullptr)
+ ,_local_mesh(0)
+ ,_distant_mesh(0)
+ ,_node_corresp(0)
+ ,_face_corresp(0)
{
}
MEDPARTITIONER::ConnectZone::~ConnectZone()
{
- for(auto & iter : _entity_corresp)
+ for(std::map < std::pair <mcIdType, mcIdType>,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++)
{
- iter.second->decrRef();
+ iter->second->decrRef();
}
}
,_description(myConnectZone._description)
,_local_domain_number(myConnectZone._local_domain_number)
,_distant_domain_number(myConnectZone._distant_domain_number)
- ,_local_mesh(nullptr)
- ,_distant_mesh(nullptr)
+ ,_local_mesh(0)
+ ,_distant_mesh(0)
,_node_corresp(myConnectZone._node_corresp)
,_face_corresp(myConnectZone._face_corresp)
,_entity_corresp(myConnectZone._entity_corresp)
bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(mcIdType localEntity, mcIdType distantEntity) const
{
typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
- for(const auto & iter : _entity_corresp)
+ for(map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++)
{
- if ((iter.first).first==localEntity && (iter.first).second==distantEntity)
+ if ((iter->first).first==localEntity && (iter->first).second==distantEntity)
return true;
}
return false;
{
typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
- for(const auto & iter : _entity_corresp)
+ for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
- if ((iter.first).first==localEntity && (iter.first).second==distantEntity)
- return iter.second->getIndex();
+ if ((iter->first).first==localEntity && (iter->first).second==distantEntity)
+ return iter->second->getIndex();
}
- return nullptr;
+ return 0;
}
const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(mcIdType localEntity,
{
typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
- for (const auto & iter : _entity_corresp)
+ for (map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
- if ((iter.first).first==localEntity && (iter.first).second==distantEntity)
- return iter.second->getValues();
+ if ((iter->first).first==localEntity && (iter->first).second==distantEntity)
+ return iter->second->getValues();
}
- return nullptr;
+ return 0;
}
mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(mcIdType localEntity,
{
typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
- for(const auto & iter : _entity_corresp)
+ for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
- if((iter.first).first==localEntity && (iter.first).second==distantEntity)
- return iter.second->getNumberOf();
+ if((iter->first).first==localEntity && (iter->first).second==distantEntity)
+ return iter->second->getNumberOf();
}
return 0;
}
{
typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
- for (const auto & iter : _entity_corresp)
+ for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++)
{
- if ((iter.first).first==localEntity && (iter.first).second==distantEntity)
- return iter.second->getLength();
+ if ((iter->first).first==localEntity && (iter->first).second==distantEntity)
+ return iter->second->getLength();
}
return 0;
}
{
typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
- for (const auto & iter : _entity_corresp)
+ for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++)
{
- if ((iter.first).first==localEntity && (iter.first).second==distantEntity)
- return iter.second;
+ if ((iter->first).first==localEntity && (iter->first).second==distantEntity)
+ return iter->second;
}
- return nullptr;
+ return 0;
}
std::vector< std::pair< mcIdType,mcIdType > > MEDPARTITIONER::ConnectZone::getEntities() const
{
std::vector< std::pair< mcIdType,mcIdType > > types;
- auto
+ std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator
iter = _entity_corresp.begin();
for ( ; iter != _entity_corresp.end(); iter++)
{
void MEDPARTITIONER::ConnectZone::setNodeCorresp(MEDCouplingSkyLineArray* array)
{
- MCAuto<MEDCouplingSkyLineArray> const arr(array);
+ MCAuto<MEDCouplingSkyLineArray> arr(array);
_node_corresp = arr;
}
void MEDPARTITIONER::ConnectZone::setFaceCorresp(MEDCouplingSkyLineArray* array)
{
- MCAuto<MEDCouplingSkyLineArray> const arr (array);
+ MCAuto<MEDCouplingSkyLineArray> arr (array);
_face_corresp = arr;
}
void MEDPARTITIONER::ConnectZone::setEntityCorresp(mcIdType localEntity, mcIdType distantEntity,
MEDCouplingSkyLineArray *array)
{
- MEDCouplingSkyLineArray * nullArray = nullptr;
+ MEDCouplingSkyLineArray * nullArray = 0;
std::map < std::pair <mcIdType,mcIdType>, MEDCouplingSkyLineArray * >::iterator it;
it = _entity_corresp.insert
( std::make_pair( std::make_pair(localEntity,distantEntity), nullArray )).first;
#ifndef __MEDPARTITIONER_CONNECTZONE_HXX__
#define __MEDPARTITIONER_CONNECTZONE_HXX__
-#include "MCIdType.hxx"
#include "MEDPARTITIONER.hxx"
#include "MCAuto.hxx"
-#include <utility>
+#include "MCType.hxx"
namespace MEDCoupling
{
#include "MEDPARTITIONER_Graph.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MEDCouplingSkyLineArray.hxx"
#include <set>
namespace MEDPARTITIONER
{
Graph::Graph():
- _graph(nullptr),_partition(nullptr),
- _edge_weight(nullptr),_cell_weight(nullptr)
+ _graph(0),_partition(0),
+ _edge_weight(0),_cell_weight(0)
{
}
Graph::Graph(MEDCoupling::MEDCouplingSkyLineArray *array, int *edgeweight):
- _graph(array),_partition(nullptr),
- _edge_weight(edgeweight),_cell_weight(nullptr)
+ _graph(array),_partition(0),
+ _edge_weight(edgeweight),_cell_weight(0)
{
}
Graph::~Graph()
- = default;
+ {
+ }
int Graph::nbDomains() const
{
if ( _partition.isNotNull() )
if ( MEDCoupling::DataArrayIdType* array = _partition->getValuesArray() )
{
- for (long const dom : *array)
- domains.insert( dom );
+ for ( const mcIdType * dom = array->begin(); dom != array->end(); ++dom )
+ domains.insert( *dom );
}
return (int)domains.size();
}
#ifndef __MEDPARTITIONER_GRAPH_HXX__
#define __MEDPARTITIONER_GRAPH_HXX__
-#include "MCIdType.hxx"
#include "MEDPARTITIONER.hxx"
#include "MCAuto.hxx"
+#include "MCType.hxx"
#include <string>
class MEDPARTITIONER_EXPORT Graph
{
public:
- using splitter_type = enum {METIS,SCOTCH,PTSCOTCH};
+ typedef enum {METIS,SCOTCH,PTSCOTCH} splitter_type;
Graph();
//creates a graph from a SKYLINEARRAY- WARNING!! Graph takes ownership of the array.
- Graph(MEDCouplingSkyLineArray* graph, int* edgeweight=nullptr);
+ Graph(MEDCouplingSkyLineArray* graph, int* edgeweight=0);
virtual ~Graph();
void setEdgesWeights(int *edgeweight) { _edge_weight=edgeweight; }
void setVerticesWeights(int *cellweight) { _cell_weight=cellweight; }
//computes partitioning of the graph
- virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=nullptr) = 0;
+ virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) = 0;
//returns the partitioning
const mcIdType *getPart() const;
//
#include "MEDPARTITIONER_JointFinder.hxx"
-
-#include <algorithm>
-#include <cstddef>
-#include <iostream>
-#include <utility>
-#include <map>
-#include <vector>
-
-#include "MCType.hxx"
-#include "MCIdType.hxx"
#include "MEDPARTITIONER_MeshCollection.hxx"
#include "MEDPARTITIONER_Topology.hxx"
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_Utils.hxx"
#include "MEDCouplingUMesh.hxx"
+#include "BBTree.txx"
/*!
* Method contributing to the distant cell graph
}
MEDPARTITIONER::JointFinder::~JointFinder()
-= default;
+{
+}
void MEDPARTITIONER::JointFinder::findCommonDistantNodes()
{
- int const nbdomain=_topology->nbDomain();
+ int nbdomain=_topology->nbDomain();
_distant_node_cell.resize(nbdomain);
_node_node.resize(nbdomain);
for (int i=0; i<nbdomain; i++)
_distant_node_cell[i].resize(nbdomain);
_node_node[i].resize(nbdomain);
}
- int const nbproc=_domain_selector->nbProcs();
- std::vector<BBTreeOfDim* > bbtree(nbdomain,(BBTreeOfDim*) nullptr);
- std::vector<double* > bbxi(nbdomain,(double*) nullptr);
- std::vector<MEDCoupling::DataArrayIdType*> rev(nbdomain,(MEDCoupling::DataArrayIdType*) nullptr);
- std::vector<MEDCoupling::DataArrayIdType*> revIndx(nbdomain,(MEDCoupling::DataArrayIdType*) nullptr);
+ int nbproc=_domain_selector->nbProcs();
+ std::vector<BBTreeOfDim* > bbtree(nbdomain,(BBTreeOfDim*) 0);
+ std::vector<double* > bbxi(nbdomain,(double*) 0);
+ std::vector<MEDCoupling::DataArrayIdType*> rev(nbdomain,(MEDCoupling::DataArrayIdType*) 0);
+ std::vector<MEDCoupling::DataArrayIdType*> revIndx(nbdomain,(MEDCoupling::DataArrayIdType*) 0);
//int meshDim=-1;
int spaceDim=-1;
rev[mydomain] = MEDCoupling::DataArrayIdType::New();
revIndx[mydomain] = MEDCoupling::DataArrayIdType::New();
myMesh->getReverseNodalConnectivity(rev[mydomain],revIndx[mydomain]);
- auto* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()];
+ double* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()];
for (int i=0; i<myMesh->getNumberOfNodes()*spaceDim; i++)
{
const double* coords=myMesh->getCoords()->getConstPointer();
bbx[2*i]=(coords[i])-1e-12;
bbx[2*i+1]=bbx[2*i]+2e-12;
}
- bbtree[mydomain]=new BBTreeOfDim( spaceDim, bbx,nullptr,0,myMesh->getNumberOfNodes(),-1e-12);
+ bbtree[mydomain]=new BBTreeOfDim( spaceDim, bbx,0,0,myMesh->getNumberOfNodes(),-1e-12);
//keep bbx because need it in getIntersectingElems
//no delete [] bbx yet
bbxi[mydomain]=bbx;
if (_domain_selector->isMyDomain(isource))
{
//preparing data for treatment on target proc
- int const targetProc = _domain_selector->getProcessorID(itarget);
+ int targetProc = _domain_selector->getProcessorID(itarget);
std::vector<double> vec(spaceDim*sourceMesh->getNumberOfNodes());
std::copy(sourceMesh->getCoords()->getConstPointer(),sourceMesh->getCoords()->getConstPointer()+sourceMesh->getNumberOfNodes()*spaceDim,&vec[0]);
if (_domain_selector->isMyDomain(itarget))
{
//receiving data from source proc
- int const sourceProc = isource%nbproc;
+ int sourceProc = isource%nbproc;
std::vector<double> recvVec;
RecvDoubleVec(recvVec,sourceProc);
std::map<mcIdType,mcIdType> commonNodes; // (local nodes, distant nodes) list
for (mcIdType inode=0; inode<ToIdType(recvVec.size()/spaceDim); inode++)
{
- auto* bbox=new double[2*spaceDim];
+ double* bbox=new double[2*spaceDim];
for (int i=0; i<spaceDim; i++)
{
bbox[2*i]=recvVec[inode*spaceDim+i]-1e-12;
}
std::vector<mcIdType> nodeCellCorrespondency;
- for (auto & commonNode : commonNodes)
+ for (std::map<mcIdType,mcIdType>::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++)
{
- _node_node[itarget][isource].push_back(std::make_pair(commonNode.first, commonNode.second));//storing node pairs in a vector
+ _node_node[itarget][isource].push_back(std::make_pair(iter->first, iter->second));//storing node pairs in a vector
const mcIdType* revIndxPtr=revIndx[itarget]->getConstPointer();
const mcIdType* revPtr=rev[itarget]->getConstPointer();
- for (mcIdType icell=revIndxPtr[commonNode.first]; icell<revIndxPtr[commonNode.first+1]; icell++)
+ for (mcIdType icell=revIndxPtr[iter->first]; icell<revIndxPtr[iter->first+1]; icell++)
{
- nodeCellCorrespondency.push_back(commonNode.second); //
- mcIdType const globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]);
+ nodeCellCorrespondency.push_back(iter->second); //
+ mcIdType globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]);
nodeCellCorrespondency.push_back(globalCell);
}
}
//free rev(nbdomain) revIndx(nbdomain) bbtree(nbdomain) bbxi(nbdomain)
for (int i=0; i<nbdomain; i++)
{
- if (rev[i]!=nullptr)
+ if (rev[i]!=0)
rev[i]->decrRef();
- if (revIndx[i]!=nullptr)
+ if (revIndx[i]!=0)
revIndx[i]->decrRef();
- if (bbtree[i]!=nullptr)
+ if (bbtree[i]!=0)
delete bbtree[i];
- if (bbxi[i]!=nullptr)
+ if (bbxi[i]!=0)
delete [] bbxi[i];
}
void MEDPARTITIONER::JointFinder::print()
//it is for debug on small arrays under mpi 2,3 cpus
{
- int const nbdomain=_topology->nbDomain();
+ int nbdomain=_topology->nbDomain();
//MPI_Barrier(MPI_COMM_WORLD);
if (MyGlobals::_Is0verbose>0)
std::cout << "\nJointFinder print node-node (nn)iproc|itarget|isource|i|inodefirst-inodesecond\n\n" <<
#ifndef __MEDPARTITIONER_JOINTFINDER_HXX__
#define __MEDPARTITIONER_JOINTFINDER_HXX__
-#include "MCIdType.hxx"
#include "MEDPARTITIONER.hxx"
+#include "MCType.hxx"
#include <map>
-#include <utility>
#include <vector>
namespace MEDPARTITIONER
//
#include "MEDPARTITIONER_MEDPartitioner.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
#include "MEDPARTITIONER_MeshCollection.hxx"
#include "MEDPARTITIONER_Topology.hxx"
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_ParallelTopology.hxx"
#include "MEDPARTITIONER_Utils.hxx"
#include "MEDPARTITIONER_Graph.hxx"
-#include <string>
#ifdef MED_ENABLE_METIS
# include "MEDPARTITIONER_MetisGraph.hxx"
#endif
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingSkyLineArray.hxx"
+#include <iostream>
#include <vector>
const char MEDPARTITIONER::MEDPartitioner::METIS_PART_ALG[]="Metis";
const char MEDPARTITIONER::MEDPartitioner::PTSCOTCH_PART_ALG[]="PTScotch";
MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const std::string& filename, int ndomains, const std::string& library,bool create_boundary_faces, bool create_joints, bool mesure_memory):
- _input_collection( nullptr ), _output_collection( nullptr ), _new_topology( nullptr )
+ _input_collection( 0 ), _output_collection( 0 ), _new_topology( 0 )
{
MyGlobals::_World_Size = 1;
MyGlobals::_Rank = 0;
_input_collection=new MeshCollection(filename,parallelizer);
_input_collection->setParaDomainSelector( ¶llelizer );
- auto* aPT =
+ MEDPARTITIONER::ParallelTopology* aPT =
(MEDPARTITIONER::ParallelTopology*) _input_collection->getTopology();
aPT->setGlobalNumerotationDefault( _input_collection->getParaDomainSelector() );
_input_collection->prepareFieldDescriptions();
}
MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const MEDCoupling::MEDFileData* filedata, int ndomains, const std::string& library,bool create_boundary_faces, bool create_joints, bool mesure_memory):
- _input_collection( nullptr ), _output_collection( nullptr ), _new_topology( nullptr )
+ _input_collection( 0 ), _output_collection( 0 ), _new_topology( 0 )
{
MyGlobals::_World_Size = 1;
MyGlobals::_Rank = 0;
_input_collection->setParaDomainSelector( ¶llelizer );
_input_collection->retrieveDriver()->readMEDFileData(filedata);
- auto* aPT =
+ MEDPARTITIONER::ParallelTopology* aPT =
(MEDPARTITIONER::ParallelTopology*) _input_collection->getTopology();
aPT->setGlobalNumerotationDefault( _input_collection->getParaDomainSelector() );
_input_collection->prepareFieldDescriptions();
}
MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const MEDCoupling::MEDFileData* filedata, MEDPARTITIONER ::Graph* graph, bool create_boundary_faces, bool create_joints, bool mesure_memory):
- _input_collection( nullptr ), _output_collection( nullptr ), _new_topology( nullptr )
+ _input_collection( 0 ), _output_collection( 0 ), _new_topology( 0 )
{
MyGlobals::_World_Size = 1;
MyGlobals::_Rank = 0;
_input_collection->setParaDomainSelector( ¶llelizer );
_input_collection->retrieveDriver()->readMEDFileData(filedata);
- auto* aPT =
+ MEDPARTITIONER::ParallelTopology* aPT =
(MEDPARTITIONER::ParallelTopology*) _input_collection->getTopology();
aPT->setGlobalNumerotationDefault( _input_collection->getParaDomainSelector() );
_input_collection->prepareFieldDescriptions();
MEDPARTITIONER::MEDPartitioner::~MEDPartitioner()
{
- delete _input_collection; _input_collection = nullptr;
- delete _output_collection; _output_collection = nullptr;
- delete _new_topology; _new_topology = nullptr;
+ delete _input_collection; _input_collection = 0;
+ delete _output_collection; _output_collection = 0;
+ delete _new_topology; _new_topology = 0;
}
-void MEDPARTITIONER::MEDPartitioner::createPartitionCollection(int ndomains, const std::string& library,bool /*create_boundary_faces*/, bool /*create_joints*/, bool /*mesure_memory*/)
+void MEDPARTITIONER::MEDPartitioner::createPartitionCollection(int ndomains, const std::string& library,bool create_boundary_faces, bool create_joints, bool mesure_memory)
{
//ParallelTopology* aPT = (ParallelTopology*) _input_collection->getTopology();
if (library == "metis")
MEDPARTITIONER::Graph* MEDPARTITIONER::MEDPartitioner::Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split, int* edgeweight, DataArrayIdType *vlbloctab)
{
- MEDPARTITIONER::Graph* cellGraph=nullptr;
+ MEDPARTITIONER::Graph* cellGraph=0;
// will be destroyed by XXXGraph class:
MEDCoupling::MCAuto<MEDCoupling::MEDCouplingSkyLineArray> arr(MEDCoupling::MEDCouplingSkyLineArray::New(graph->getIndexArray(), graph->getValuesArray()));
switch (split)
#include "MEDPARTITIONER_Graph.hxx"
#include "MCType.hxx"
-#include <string>
+#include <map>
#include <vector>
namespace MEDCoupling
MEDPartitioner(const std::string& filename, int ndomains=1, const std::string& library="metis",bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false);
MEDPartitioner(const MEDCoupling::MEDFileData* fileData, int ndomains=1, const std::string& library="metis",bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false);
MEDPartitioner(const MEDCoupling::MEDFileData* fileData, Graph* graph, bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false);
- static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=nullptr, DataArrayIdType* vlbloctab=nullptr);
+ static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=0, DataArrayIdType* vlbloctab=0);
static std::vector<std::string> AvailableAlgorithms();
static std::vector<std::string> AllAlgorithms();
static bool HasMetisAlg();
#include "MEDPARTITIONER_MeshCollection.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
#include "MEDPARTITIONER_ConnectZone.hxx"
#include "MEDPARTITIONER_Graph.hxx"
#include "MEDPARTITIONER_MeshCollectionDriver.hxx"
#include "MEDPARTITIONER_Topology.hxx"
#include "MEDPARTITIONER_UserGraph.hxx"
#include "MEDPARTITIONER_Utils.hxx"
-#include <cstddef>
-#include "NormalizedGeometricTypes"
-#include <sstream>
#ifdef HAVE_MPI
#include "MEDPARTITIONER_JointFinder.hxx"
#include "MCAuto.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingNormalizedUnstructuredMesh.hxx"
#include "MEDCouplingSkyLineArray.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDLoader.hxx"
#include "MEDPARTITIONER_ScotchGraph.hxx"
#endif
+#include <set>
#include <vector>
#include <string>
+#include <limits>
#include <iostream>
#include <fstream>
MEDPARTITIONER::MeshCollection::MeshCollection()
- : _topology(nullptr),
+ : _topology(0),
_owns_topology(false),
- _driver(nullptr),
- _domain_selector( nullptr ),
+ _driver(0),
+ _domain_selector( 0 ),
_i_non_empty_mesh(-1),
_driver_type(MEDPARTITIONER::MedXml),
_subdomain_boundary_creates( MyGlobals::_Create_Boundary_Faces ),
_family_splitting(false),
_create_empty_groups(false),
- _joint_finder(nullptr)
+ _joint_finder(0)
{
}
bool create_empty_groups)
: _topology(topology),
_owns_topology(false),
- _driver(nullptr),
+ _driver(0),
_domain_selector( initialCollection._domain_selector ),
_i_non_empty_mesh(-1),
_name(initialCollection._name),
_subdomain_boundary_creates(MyGlobals::_Create_Boundary_Faces),
_family_splitting(family_splitting),
_create_empty_groups(create_empty_groups),
- _joint_finder(nullptr)
+ _joint_finder(0)
{
std::vector<std::vector<std::vector<mcIdType> > > new2oldIds(initialCollection.getTopology()->nbDomain());
std::vector<MEDCoupling::DataArrayIdType*> o2nRenumber;
{
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : castCellMeshes" << std::endl;
- if (_topology==nullptr)
+ if (_topology==0)
throw INTERP_KERNEL::Exception("Topology has not been defined on call to castCellMeshes");
int nbNewDomain=_topology->nbDomain();
_mesh.resize(nbNewDomain);
o2nRenumber.resize(nbNewDomain,0);
- int const rank=MyGlobals::_Rank;
+ int rank=MyGlobals::_Rank;
//splitting the initial domains into smaller bits
std::vector<std::vector<MEDCoupling::MEDCouplingUMesh*> > splitMeshes;
splitMeshes.resize(nbNewDomain);
for (int inew=0; inew<nbNewDomain; inew++)
{
- splitMeshes[inew].resize(nbOldDomain, (MEDCoupling::MEDCouplingUMesh*)nullptr);
+ splitMeshes[inew].resize(nbOldDomain, (MEDCoupling::MEDCouplingUMesh*)0);
}
for (int iold=0; iold<nbOldDomain; iold++)
{
if (!isParallelMode() || initialCollection._domain_selector->isMyDomain(iold))
{
- mcIdType const size=(initialCollection._mesh)[iold]->getNumberOfCells();
+ mcIdType size=(initialCollection._mesh)[iold]->getNumberOfCells();
std::vector<mcIdType> globalids(size);
initialCollection.getTopology()->getCellList(iold, &globalids[0]);
std::vector<mcIdType> ilocalnew(size); //local
{
double* bbox;
- BBTreeOfDim* tree = nullptr;
+ BBTreeOfDim* tree = 0;
int dim = 3;
if (!isParallelMode() || (_domain_selector->isMyDomain(iold)))
{
MEDCoupling::DataArrayDouble* coords = initialCollection.getMesh(iold)->getCoords();
double* coordsPtr=coords->getPointer();
dim = (int)coords->getNumberOfComponents();
- mcIdType const nvertices=initialCollection.getMesh(iold)->getNumberOfNodes();
+ mcIdType nvertices=initialCollection.getMesh(iold)->getNumberOfNodes();
bbox=new double[nvertices*2*dim];
for (int i=0; i<nvertices*dim;i++)
bbox[i*2]=coordsPtr[i]-1e-8;
bbox[i*2+1]=coordsPtr[i]+1e-8;
}
- tree=new BBTreeOfDim( dim, bbox,nullptr,0,nvertices,1e-9);
+ tree=new BBTreeOfDim( dim, bbox,0,0,nvertices,1e-9);
}
for (int inew=0; inew<_topology->nbDomain(); inew++)
using MEDPARTITIONER::BBTreeOfDim;
//if (!&meshOne || !&meshTwo) return; //empty or not existing
double* bbox;
- BBTreeOfDim* tree = nullptr;
- mcIdType const nv1=meshOne.getNumberOfNodes();
+ BBTreeOfDim* tree = 0;
+ mcIdType nv1=meshOne.getNumberOfNodes();
MEDCoupling::DataArrayDouble* coords=meshOne.getCoords();
- int const dim = (int)coords->getNumberOfComponents();
+ int dim = (int)coords->getNumberOfComponents();
bbox=new double[nv1*2*dim];
double* coordsPtr=coords->getPointer();
bbox[i*2]=coordsPtr[i]-1e-8;
bbox[i*2+1]=coordsPtr[i]+1e-8;
}
- tree=new BBTreeOfDim( dim, bbox,nullptr,0,nv1,1e-9);
+ tree=new BBTreeOfDim( dim, bbox,0,0,nv1,1e-9);
mcIdType nv2=meshTwo.getNumberOfNodes();
nodeIds.resize(nv2,-1);
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : castFaceMeshes" << std::endl;
- if (_topology==nullptr)
+ if (_topology==0)
throw INTERP_KERNEL::Exception("Topology has not been defined on call to castFaceMeshes");
int nbNewDomain=_topology->nbDomain();
splitMeshes.resize(nbNewDomain);
for (int inew=0; inew<nbNewDomain; inew++)
{
- splitMeshes[inew].resize(nbOldDomain, (MEDCoupling::MEDCouplingUMesh*)nullptr);
+ splitMeshes[inew].resize(nbOldDomain, (MEDCoupling::MEDCouplingUMesh*)0);
}
new2oldIds.resize(nbOldDomain);
for (int iold=0; iold<nbOldDomain; iold++) new2oldIds[iold].resize(nbNewDomain);
for (int iold=0; iold<nbOldDomain; iold++)
{
MEDCoupling::MEDCouplingUMesh *umesh=splitMeshes[inew][iold];
- if (umesh!=nullptr)
+ if (umesh!=0)
if (umesh->getNumberOfCells()>0)
myMeshes.push_back(umesh);
}
- MEDCoupling::MEDCouplingUMesh *bndMesh = nullptr;
+ MEDCoupling::MEDCouplingUMesh *bndMesh = 0;
if ( _subdomain_boundary_creates &&
_mesh[inew] &&
_mesh[inew]->getNumberOfCells()>0 )
MEDCoupling::DataArrayDouble* targetCoords=targetMesh.computeCellCenterOfMass();
const double* tc=targetCoords->getConstPointer();
mcIdType targetSize=targetMesh.getNumberOfCells();
- mcIdType const sourceSize=sourceMesh.getNumberOfCells();
+ mcIdType sourceSize=sourceMesh.getNumberOfCells();
if (MyGlobals::_Verbose>200)
std::cout<<"remap vers target de taille "<<targetSize<<std::endl;
std::vector<mcIdType> ccI;
const BBTreeOfDim* tree;
bool cleantree=false;
- MEDCoupling::DataArrayDouble* sourceBBox=nullptr;
- int const dim = (int)targetCoords->getNumberOfComponents();
- if (myTree==nullptr)
+ MEDCoupling::DataArrayDouble* sourceBBox=0;
+ int dim = (int)targetCoords->getNumberOfComponents();
+ if (myTree==0)
{
sourceBBox=sourceMesh.computeCellCenterOfMass()->computeBBoxPerTuple(1e-8);
- tree=new BBTreeOfDim( dim, sourceBBox->getConstPointer(),nullptr,0, sourceBBox->getNumberOfTuples(),1e-10);
+ tree=new BBTreeOfDim( dim, sourceBBox->getConstPointer(),0,0, sourceBBox->getNumberOfTuples(),1e-10);
cleantree=true;
}
else tree=myTree;
targetCoords->decrRef();
if (cleantree) delete tree;
- if (sourceBBox !=nullptr) sourceBBox->decrRef();
+ if (sourceBBox !=0) sourceBBox->decrRef();
}
void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollection, std::string nameArrayTo)
if (nameArrayTo!="cellFieldDouble")
throw INTERP_KERNEL::Exception("Error castAllField only on cellFieldDouble");
- std::string const nameTo="typeData=6"; //resume the type of field casted
+ std::string nameTo="typeData=6"; //resume the type of field casted
// send-recv operations
- std::size_t const ioldMax=initialCollection.getMesh().size();
- std::size_t const inewMax=this->getMesh().size();
- std::size_t const iFieldMax=initialCollection.getFieldDescriptions().size();
+ std::size_t ioldMax=initialCollection.getMesh().size();
+ std::size_t inewMax=this->getMesh().size();
+ std::size_t iFieldMax=initialCollection.getFieldDescriptions().size();
if (MyGlobals::_Verbose>10)
std::cout << "castAllFields with:\n" << ReprVectorOfString(initialCollection.getFieldDescriptions()) << std::endl;
//see collection.prepareFieldDescriptions()
for (std::size_t ifield=0; ifield<iFieldMax; ifield++)
{
- std::string const descriptionField=initialCollection.getFieldDescriptions()[ifield];
+ std::string descriptionField=initialCollection.getFieldDescriptions()[ifield];
if (descriptionField.find(nameTo)==std::string::npos)
continue; //only nameTo accepted in Fields name description
#ifdef HAVE_MPI
//sending arrays for distant domains
if (isParallelMode() && _domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew))
{
- int const target=_domain_selector->getProcessorID(inew);
+ int target=_domain_selector->getProcessorID(inew);
MEDCoupling::DataArrayDouble* field=initialCollection.getField(descriptionField,iold);
if (MyGlobals::_Verbose>10)
std::cout << "proc " << _domain_selector->rank() << " : castAllFields sendDouble" << std::endl;
//receiving arrays from distant domains
if (isParallelMode() && !_domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew))
{
- int const source=_domain_selector->getProcessorID(iold);
+ int source=_domain_selector->getProcessorID(iold);
//receive vector
if (MyGlobals::_Verbose>10)
std::cout << "proc " << _domain_selector->rank() << " : castAllFields recvDouble" << std::endl;
if (MyGlobals::_Verbose>300)
std::cout << "proc " << MyGlobals::_Rank << " : remapDoubleField " << key << " size " << ccI->getNbOfElems() << std::endl;
- mcIdType const nbcell=this->getMesh()[inew]->getNumberOfCells();
- std::size_t const nbcomp=fromArray->getNumberOfComponents();
- int const nbPtGauss=StrToInt(ExtractFromDescription(descriptionField, "nbPtGauss="));
+ mcIdType nbcell=this->getMesh()[inew]->getNumberOfCells();
+ std::size_t nbcomp=fromArray->getNumberOfComponents();
+ int nbPtGauss=StrToInt(ExtractFromDescription(descriptionField, "nbPtGauss="));
std::string tag="inewFieldDouble="+IntToStr(inew);
key=descriptionField+SerializeFromString(tag);
- mcIdType const fromArrayNbOfElem=fromArray->getNbOfElems();
+ mcIdType fromArrayNbOfElem=fromArray->getNbOfElems();
mcIdType fromArrayNbOfComp=ToIdType(fromArray->getNumberOfComponents());
- mcIdType const fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss;
+ mcIdType fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss;
if (MyGlobals::_Verbose>1000)
{
" nbComponents " << fromArray->getNumberOfComponents() << std::endl;
}
- MEDCoupling::DataArrayDouble* field=nullptr;
+ MEDCoupling::DataArrayDouble* field=0;
std::map<std::string,MEDCoupling::DataArrayDouble*>::iterator it2;
it2=_map_dataarray_double.find(key);
if (it2==_map_dataarray_double.end())
else
{
//replaced by setPartOfValuesAdv if nbPtGauss==1
- mcIdType const iMax=ccI->getNbOfElems();
+ mcIdType iMax=ccI->getNbOfElems();
mcIdType* pccI=ccI->getPointer();
double* pField=field->getPointer();
double* pFrom=fromArray->getPointer();
isource=pccI[i+1];
if ((itarget<0) || (itarget>=nbcell) || (isource<0) || (isource>=fromArrayNbOfCell))
throw INTERP_KERNEL::Exception("Error field override");
- mcIdType const ita=itarget*delta;
- mcIdType const iso=isource*delta;
+ mcIdType ita=itarget*delta;
+ mcIdType iso=isource*delta;
for (mcIdType k=0; k<delta; k++) pField[ita+k]=pFrom[iso+k]; //components and gausspoints
}
}
if ( corresp.empty() )
continue;
- MEDPARTITIONER::ConnectZone* cz = nullptr;
+ MEDPARTITIONER::ConnectZone* cz = 0;
for ( size_t i = 0; i < czVec.size() && !cz; ++i )
if ( czVec[i] &&
czVec[i]->getLocalDomainNumber () == idomain &&
if ( types1.size() < 1 || types2.size() < 1 )
continue; // parallel mode?
- MEDPARTITIONER::ConnectZone* cz21 = nullptr; // zone 2 -> 1
+ MEDPARTITIONER::ConnectZone* cz21 = 0; // zone 2 -> 1
for ( size_t j = 0; j < czVec.size() && !cz21; ++j )
if ( czVec[j] &&
czVec[j]->getLocalDomainNumber () == cz->getDistantDomainNumber() &&
}
}// split and sort
- cz->setEntityCorresp( 0, 0, nullptr, 0 ); // erase ids computed by _topology
+ cz->setEntityCorresp( 0, 0, 0, 0 ); // erase ids computed by _topology
if ( cz21 )
- cz21->setEntityCorresp( 0, 0, nullptr, 0 );
+ cz21->setEntityCorresp( 0, 0, 0, 0 );
} // loop on czVec
if ( cz->getDistantDomainNumber() < cz->getLocalDomainNumber() )
continue; // treat a pair of domains once
- MEDPARTITIONER::ConnectZone* cz21 = nullptr; // zone 2 -> 1
+ MEDPARTITIONER::ConnectZone* cz21 = 0; // zone 2 -> 1
for ( size_t j = 0; j < czVec.size() && !cz21; ++j )
if ( czVec[j] &&
czVec[j]->getLocalDomainNumber () == cz->getDistantDomainNumber() &&
{
for (unsigned int inew2 = inew1+1; inew2 < nbMeshes; inew2++ )
{
- MEDCouplingUMesh* mesh1 = nullptr;
- MEDCouplingUMesh* mesh2 = nullptr;
+ MEDCouplingUMesh* mesh1 = 0;
+ MEDCouplingUMesh* mesh2 = 0;
//MEDCouplingUMesh* recvMesh = 0;
bool mesh1Here = true, mesh2Here = true;
if (isParallelMode())
_group_info.erase( groupName );
// get family IDs array
- mcIdType* famIDs = nullptr;
- int const inew = (is2nd ? inew2 : inew1 );
+ mcIdType* famIDs = 0;
+ int inew = (is2nd ? inew2 : inew1 );
mcIdType totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0;
- std::string const cle = Cle1ToStr( "faceFamily_toArray", inew );
+ std::string cle = Cle1ToStr( "faceFamily_toArray", inew );
if ( !_map_dataarray_int.count(cle) )
{
if ( totalNbFaces > 0 )
* \param filename name of the master file containing the list of all the MED files
*/
MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename)
- : _topology(nullptr),
+ : _topology(0),
_owns_topology(true),
- _driver(nullptr),
- _domain_selector( nullptr ),
+ _driver(0),
+ _domain_selector( 0 ),
_i_non_empty_mesh(-1),
_driver_type(MEDPARTITIONER::Undefined),
_subdomain_boundary_creates(MyGlobals::_Create_Boundary_Faces),
_family_splitting(false),
_create_empty_groups(false),
- _joint_finder(nullptr)
+ _joint_finder(0)
{
try
{
}
catch(...)
{ // Handle all exceptions
- if ( _driver ) delete _driver; _driver=nullptr;
+ if ( _driver ) delete _driver; _driver=0;
try
{
_driver=new MeshCollectionMedAsciiDriver(this);
catch(...)
{
delete _driver;
- _driver=nullptr;
+ _driver=0;
throw INTERP_KERNEL::Exception("file does not comply with any recognized format");
}
}
* \param domainSelector - selector of domains to load
*/
MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, ParaDomainSelector& domainSelector)
- : _topology(nullptr),
+ : _topology(0),
_owns_topology(true),
- _driver(nullptr),
+ _driver(0),
_domain_selector( &domainSelector ),
_i_non_empty_mesh(-1),
_driver_type(MEDPARTITIONER::Undefined),
_subdomain_boundary_creates(MyGlobals::_Create_Boundary_Faces),
_family_splitting(false),
_create_empty_groups(false),
- _joint_finder(nullptr)
+ _joint_finder(0)
{
- std::string const myfile=filename;
+ std::string myfile=filename;
std::size_t found=myfile.find(".xml");
if (found!=std::string::npos) //file .xml
{
}
catch(...)
{ // Handle all exceptions
- delete _driver; _driver=nullptr;
+ delete _driver; _driver=0;
throw INTERP_KERNEL::Exception("file medpartitioner_xxx.xml does not comply with any recognized format");
}
}
catch(...)
{
delete _driver;
- _driver=nullptr;
+ _driver=0;
throw INTERP_KERNEL::Exception("file name with no extension does not comply with any recognized format");
}
}
* \param meshname name of the mesh that is to be read
*/
MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, const std::string& meshname)
- : _topology(nullptr),
+ : _topology(0),
_owns_topology(true),
- _driver(nullptr),
- _domain_selector( nullptr ),
+ _driver(0),
+ _domain_selector( 0 ),
_i_non_empty_mesh(-1),
_name(meshname),
_driver_type(MEDPARTITIONER::MedXml),
_subdomain_boundary_creates(MyGlobals::_Create_Boundary_Faces),
_family_splitting(false),
_create_empty_groups(false),
- _joint_finder(nullptr)
+ _joint_finder(0)
{
try // avoid memory leak in case of inexistent filename
{
catch (...)
{
delete _driver;
- _driver=nullptr;
+ _driver=0;
throw INTERP_KERNEL::Exception("problem reading .med files");
}
if ( _mesh[0] && _mesh[0]->getNumberOfNodes() > 0 )
MEDPARTITIONER::MeshCollection::~MeshCollection()
{
- for (auto & i : _mesh)
- if (i!=nullptr) i->decrRef();
+ for (std::size_t i=0; i<_mesh.size();i++)
+ if (_mesh[i]!=0) _mesh[i]->decrRef();
- for (auto & _cell_family_id : _cell_family_ids)
- if (_cell_family_id!=nullptr)
- _cell_family_id->decrRef();
+ for (std::size_t i=0; i<_cell_family_ids.size();i++)
+ if (_cell_family_ids[i]!=0)
+ _cell_family_ids[i]->decrRef();
- for (auto & i : _face_mesh)
- if (i!=nullptr)
- i->decrRef();
+ for (std::size_t i=0; i<_face_mesh.size();i++)
+ if (_face_mesh[i]!=0)
+ _face_mesh[i]->decrRef();
- for (auto & _face_family_id : _face_family_ids)
- if (_face_family_id!=nullptr)
- _face_family_id->decrRef();
+ for (std::size_t i=0; i<_face_family_ids.size();i++)
+ if (_face_family_ids[i]!=0)
+ _face_family_ids[i]->decrRef();
for (std::map<std::string, MEDCoupling::DataArrayIdType*>::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ )
if ((*it).second!=0)
(*it).second->decrRef();
delete _driver;
- if (_topology!=nullptr && _owns_topology)
+ if (_topology!=0 && _owns_topology)
delete _topology;
#ifdef HAVE_MPI
delete _joint_finder;
{
//suppresses link with driver so that it can be changed for writing
delete _driver;
- _driver=nullptr;
+ _driver=0;
retrieveDriver()->write (filename.c_str(), _domain_selector);
}
*/
MEDPARTITIONER::MeshCollectionDriver* MEDPARTITIONER::MeshCollection::retrieveDriver()
{
- if (_driver==nullptr)
+ if (_driver==0)
{
switch(_driver_type)
{
int MEDPARTITIONER::MeshCollection::getNbOfLocalMeshes() const
{
int nb=0;
- for (auto i : _mesh)
+ for (size_t i=0; i<_mesh.size(); i++)
{
- if (i) nb++;
+ if (_mesh[i]) nb++;
}
return nb;
}
mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const
{
mcIdType nb=0;
- for (auto i : _mesh)
+ for (size_t i=0; i<_mesh.size(); i++)
{
- if (i) nb=nb+i->getNumberOfCells();
+ if (_mesh[i]) nb=nb+_mesh[i]->getNumberOfCells();
}
return nb;
}
mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const
{
mcIdType nb=0;
- for (auto i : _face_mesh)
+ for (size_t i=0; i<_face_mesh.size(); i++)
{
- if (i) nb=nb+i->getNumberOfCells();
+ if (_face_mesh[i]) nb=nb+_face_mesh[i]->getNumberOfCells();
}
return nb;
}
void MEDPARTITIONER::MeshCollection::setTopology(Topology* topo, bool takeOwneship)
{
- if (_topology!=nullptr)
+ if (_topology!=0)
{
throw INTERP_KERNEL::Exception("topology is already set");
}
* \param edgeweight returns the pointer to the table that contains the edgeweights
* (only used if indivisible regions are required)
*/
-void MEDPARTITIONER::MeshCollection::buildCellGraph(MEDCoupling::MEDCouplingSkyLineArray* & array, int *& /*edgeweights*/ )
+void MEDPARTITIONER::MeshCollection::buildCellGraph(MEDCoupling::MEDCouplingSkyLineArray* & array, int *& edgeweights )
{
using std::map;
* \param edgeweight returns the pointer to the table that contains the edgeweights
* (only used if indivisible regions are required)
*/
-void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCouplingSkyLineArray* & array, int *& /*edgeweights*/ )
+void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCouplingSkyLineArray* & array, int *& edgeweights )
{
using std::multimap;
using std::vector;
std::multimap<mcIdType,mcIdType> cell2cell;
std::vector<std::vector<std::multimap<mcIdType,mcIdType> > > commonDistantNodes;
- int const nbdomain=_topology->nbDomain();
+ int nbdomain=_topology->nbDomain();
#ifdef HAVE_MPI
if (isParallelMode())
{
MEDCoupling::DataArrayIdType* index=MEDCoupling::DataArrayIdType::New();
MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New();
- mcIdType const nbNodes=_mesh[idomain]->getNumberOfNodes();
+ mcIdType nbNodes=_mesh[idomain]->getNumberOfNodes();
_mesh[idomain]->getReverseNodalConnectivity(revConn,index);
//problem saturation over 1 000 000 nodes for 1 proc
if (MyGlobals::_Verbose>100)
{
for (mcIdType icell=index_ptr[i]; icell<index_ptr[i+1]; icell++)
{
- mcIdType const globalNode=_topology->convertNodeToGlobal(idomain,i);
- mcIdType const globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]);
+ mcIdType globalNode=_topology->convertNodeToGlobal(idomain,i);
+ mcIdType globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]);
node2cell.insert(make_pair(globalNode, globalCell));
}
}
for (int iother=0; iother<nbdomain; iother++)
{
std::multimap<mcIdType,mcIdType>::iterator it;
- int const isource=idomain;
- int const itarget=iother;
+ int isource=idomain;
+ int itarget=iother;
for (it=_joint_finder->getDistantNodeCell()[isource][itarget].begin();
it!=_joint_finder->getDistantNodeCell()[isource][itarget].end(); it++)
{
for (int idomain=0; idomain<nbdomain; idomain++)
{
if (isParallelMode() && !_domain_selector->isMyDomain(idomain)) continue;
- mcIdType const nbCells=_mesh[idomain]->getNumberOfCells();
+ mcIdType nbCells=_mesh[idomain]->getNumberOfCells();
for (mcIdType icell=0; icell<nbCells; icell++)
{
mcIdType size=0;
- mcIdType const globalCell=_topology->convertCellToGlobal(idomain,icell);
+ mcIdType globalCell=_topology->convertCellToGlobal(idomain,icell);
multimap<mcIdType,mcIdType>::iterator it;
pair<multimap<mcIdType,mcIdType>::iterator,multimap<mcIdType,mcIdType>::iterator> ret;
ret=cell2cell.equal_range(globalCell);
if (nbdomain <1)
throw INTERP_KERNEL::Exception("Number of subdomains must be > 0");
- MEDCoupling::MEDCouplingSkyLineArray* array=nullptr;
- int* edgeweights=nullptr;
+ MEDCoupling::MEDCouplingSkyLineArray* array=0;
+ int* edgeweights=0;
if (_topology->nbDomain()>1 || isParallelMode())
buildParallelCellGraph(array,edgeweights);
else
buildCellGraph(array,edgeweights);
- Graph* cellGraph = nullptr;
+ Graph* cellGraph = 0;
switch (split)
{
case Graph::METIS:
}
//!user-defined weights
- if (user_edge_weights!=nullptr)
+ if (user_edge_weights!=0)
cellGraph->setEdgesWeights(user_edge_weights);
- if (user_vertices_weights!=nullptr)
+ if (user_vertices_weights!=0)
cellGraph->setVerticesWeights(user_vertices_weights);
if (MyGlobals::_Is0verbose>10)
if (MyGlobals::_Is0verbose>10)
std::cout << "building new topology" << std::endl;
//cellGraph is a shared pointer
- Topology *topology=nullptr;
+ Topology *topology=0;
topology=new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension());
//cleaning
delete [] edgeweights;
*/
MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const int* partition)
{
- MEDCoupling::MEDCouplingSkyLineArray* array=nullptr;
- int* edgeweights=nullptr;
+ MEDCoupling::MEDCouplingSkyLineArray* array=0;
+ int* edgeweights=0;
if ( _topology->nbDomain()>1)
buildParallelCellGraph(array,edgeweights);
cellGraph=new UserGraph(array, partition, _topology->nbCells());
//cellGraph is a shared pointer
- Topology *topology=nullptr;
+ Topology *topology=0;
int nbdomain=(int)domains.size();
topology=new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension());
// if (array!=0) delete array;
//getField look for and read it if not done, and assume decrRef() in ~MeshCollection;
//something like MCAuto<MEDCouplingFieldDouble> f2=ReadFieldCell(name,f1->getMesh()->getName(),0,f1->getName(),0,1);
{
- int const rank=MyGlobals::_Rank;
+ int rank=MyGlobals::_Rank;
std::string tag="ioldFieldDouble="+IntToStr(iold);
std::string descriptionIold=descriptionField+SerializeFromString(tag);
if (_map_dataarray_double.find(descriptionIold)!=_map_dataarray_double.end())
}
//here vector(procs*fields) of serialised vector(description) data
_field_descriptions=r2;
- std::size_t const nbfields=_field_descriptions.size(); //on all domains
+ std::size_t nbfields=_field_descriptions.size(); //on all domains
if ((nbfields%nbfiles)!=0)
{
if (MyGlobals::_Rank==0)
throw INTERP_KERNEL::Exception("incoherent number of fields references in all files .med\n");
}
_field_descriptions.resize(nbfields/nbfiles);
- for (auto & _field_description : _field_descriptions)
+ for (std::size_t i=0; i<_field_descriptions.size(); i++)
{
- std::string str=_field_description;
+ std::string str=_field_descriptions[i];
str=EraseTagSerialized(str,"idomain=");
str=EraseTagSerialized(str,"fileName=");
- _field_description=str;
+ _field_descriptions[i]=str;
}
}
std::vector< mcIdType > faceOnCell;
std::vector< mcIdType > faceNotOnCell;
- mcIdType const nbface=mfac->getNumberOfCells();
+ mcIdType nbface=mfac->getNumberOfCells();
for (mcIdType iface=0; iface<nbface; iface++)
{
bool ok;
std::cout << "filterFaceOnCell problem 1" << std::endl;
continue;
}
- mcIdType const nbcell=revIndxC[inod+1]-revIndxC[inod];
+ mcIdType nbcell=revIndxC[inod+1]-revIndxC[inod];
for (mcIdType j=0; j<nbcell; j++) //look for each cell with inod
{
- mcIdType const icel=revC[revIndxC[inod]+j];
+ mcIdType icel=revC[revIndxC[inod]+j];
std::vector< mcIdType > inodesCell;
mcel->getNodeIdsOfCell(icel, inodesCell);
ok=isFaceOncell(inodesFace, inodesCell);
mfac->decrRef();
// filter the face families
- std::string const key = Cle1ToStr("faceFamily_toArray",inew);
+ std::string key = Cle1ToStr("faceFamily_toArray",inew);
if ( getMapDataArrayInt().count( key ))
{
MEDCoupling::DataArrayIdType * & fam = getMapDataArrayInt()[ key ];
#ifndef __MEDPARTITIONER_MESHCOLLECTION_HXX__
#define __MEDPARTITIONER_MESHCOLLECTION_HXX__
-#include "MCType.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "MEDPARTITIONER.hxx"
#include "MEDPARTITIONER_Graph.hxx"
#include "MEDPARTITIONER_Utils.hxx"
#include "MEDCouplingSkyLineArray.hxx"
#include <map>
-#include <utility>
#include <vector>
#include <string>
+#include "BBTree.txx"
namespace MEDCoupling
{
//creation and partition of the associated graph
Topology* createPartition(int nbdomain, Graph::splitter_type type = Graph::METIS,
- const std::string& ="", int* edgeweights=nullptr, int* verticesweights=nullptr);
+ const std::string& ="", int* edgeweights=0, int* verticesweights=0);
//creation of a user specified partition
Topology* createPartition(const int* partition);
#include "MEDPARTITIONER_MeshCollectionDriver.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
-#include "MCAuto.hxx"
-#include "MEDFileFieldMultiTS.hxx"
-#include "MEDFileField1TS.hxx"
#include "MEDPARTITIONER_ConnectZone.hxx"
#include "MEDPARTITIONER_MeshCollection.hxx"
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDFileMesh.hxx"
#include "MEDLoader.hxx"
-#include <cstddef>
#include <map>
-#include <sstream>
-#include <utility>
+#include <set>
#include <vector>
#include <string>
+#include <fstream>
#include <iostream>
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
-#include "NormalizedGeometricTypes"
+#include "med.h"
using namespace MEDPARTITIONER;
(_collection->getCZ()).clear();
- auto* aPT = new ParallelTopology((_collection->getMesh()));
+ ParallelTopology* aPT = new ParallelTopology((_collection->getMesh()));
_collection->setTopology(aPT, true);
_collection->setName(meshname);
_collection->setDomainNames(meshname);
void MeshCollectionDriver::readMEDFileData(const MEDCoupling::MEDFileData* filedata)
{
const int nbDomains = filedata->getMeshes()->getNumberOfMeshes();
- _collection->getMesh() .resize( nbDomains, nullptr );
- _collection->getFaceMesh() .resize( nbDomains, nullptr );
- _collection->getCellFamilyIds().resize( nbDomains, nullptr );
- _collection->getFaceFamilyIds().resize( nbDomains, nullptr );
+ _collection->getMesh() .resize( nbDomains, 0 );
+ _collection->getFaceMesh() .resize( nbDomains, 0 );
+ _collection->getCellFamilyIds().resize( nbDomains, 0 );
+ _collection->getFaceFamilyIds().resize( nbDomains, 0 );
for (int i=0; i<nbDomains; i++)
{
- auto *mfm = dynamic_cast<MEDCoupling::MEDFileUMesh *>(filedata->getMeshes()->getMeshAtPos(i));
+ MEDCoupling::MEDFileUMesh *mfm = dynamic_cast<MEDCoupling::MEDFileUMesh *>(filedata->getMeshes()->getMeshAtPos(i));
readData(mfm,i);
if ( mfm && mfm->getMeshDimension() > 0 )
_collection->setNonEmptyMesh( i );
}
- auto* aPT = new ParallelTopology(_collection->getMesh());
+ ParallelTopology* aPT = new ParallelTopology(_collection->getMesh());
_collection->setTopology(aPT, true);
if ( nbDomains > 0 )
{
void MeshCollectionDriver::readSubdomain(int idomain)
{
- std::string const meshname=MyGlobals::_Mesh_Names[idomain];
- std::string const file=MyGlobals::_File_Names[idomain];
+ std::string meshname=MyGlobals::_Mesh_Names[idomain];
+ std::string file=MyGlobals::_File_Names[idomain];
readFileData(file,meshname,idomain);
std::vector<std::string> localInformation;
- std::string const str;
+ std::string str;
localInformation.push_back(str+"ioldDomain="+IntToStr(idomain));
localInformation.push_back(str+"meshName="+meshname);
MyGlobals::_General_Informations.push_back(SerializeFromVectorOfString(localInformation));
- std::vector<std::string> const localFields=BrowseAllFieldsOnMesh(file, meshname, idomain);
+ std::vector<std::string> localFields=BrowseAllFieldsOnMesh(file, meshname, idomain);
if (localFields.size()>0)
MyGlobals::_Field_Descriptions.push_back(SerializeFromVectorOfString(localFields));
}
std::string finalMeshName="";
if (MyGlobals::_General_Informations.size()!=0)
{
- std::size_t const found=MyGlobals::_General_Informations[0].find("finalMeshName=");
+ std::size_t found=MyGlobals::_General_Informations[0].find("finalMeshName=");
if ((found!=std::string::npos) && (found>0))
{
finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName=");
j1st->pushCorrespondence( corr );
}
- std::vector< std::pair< mcIdType,mcIdType > > const types = cz->getEntities();
+ std::vector< std::pair< mcIdType,mcIdType > > types = cz->getEntities();
INTERP_KERNEL::NormalizedCellType t1, t2;
- for (auto & type : types)
+ for ( size_t it = 0; it < types.size(); ++it )
{
const MEDCouplingSkyLineArray * cellCorr =
- cz->getEntityCorresp( type.first, type.second );
+ cz->getEntityCorresp( types[it].first, types[it].second );
if ( cellCorr && cellCorr->getNumberOf() > 0 )
{
- t1 = INTERP_KERNEL::NormalizedCellType( type.first );
- t2 = INTERP_KERNEL::NormalizedCellType( type.second );
+ t1 = INTERP_KERNEL::NormalizedCellType( types[it].first );
+ t2 = INTERP_KERNEL::NormalizedCellType( types[it].second );
MCAuto< MEDFileJointCorrespondence>
corr = MEDFileJointCorrespondence::New( cellCorr->getValuesArray(), t1, t2 );
j1st->pushCorrespondence( corr );
return mfm;
}
-MEDCoupling::MEDCouplingFieldDouble* MeshCollectionDriver::getField(std::string /*key*/, std::string description, MEDCoupling::DataArrayDouble* data, MEDCoupling::MEDFileMesh* mfm, int /*idomain*/) const
+MEDCoupling::MEDCouplingFieldDouble* MeshCollectionDriver::getField(std::string key, std::string description, MEDCoupling::DataArrayDouble* data, MEDCoupling::MEDFileMesh* mfm, int idomain) const
{
- std::string const desc=description;
+ std::string desc=description;
if (MyGlobals::_Verbose>20)
std::cout << "proc " << MyGlobals::_Rank << " : write field " << desc << std::endl;
std::string meshName, fieldName;
int typeField, DT, IT, entity;
FieldShortDescriptionToData(desc, fieldName, typeField, entity, DT, IT);
- double const time=StrToDouble(ExtractFromDescription(desc, "time="));
- int const typeData=StrToInt(ExtractFromDescription(desc, "typeData="));
- std::string const entityName=ExtractFromDescription(desc, "entityName=");
- MEDCoupling::MEDCouplingFieldDouble* field=nullptr;
+ double time=StrToDouble(ExtractFromDescription(desc, "time="));
+ int typeData=StrToInt(ExtractFromDescription(desc, "typeData="));
+ std::string entityName=ExtractFromDescription(desc, "entityName=");
+ MEDCoupling::MEDCouplingFieldDouble* field=0;
if (typeData!=6)
{
std::cout << "WARNING : writeMedFile : typeData " << typeData << " not implemented for fields\n";
r1=SelectTagsInVectorOfString(r1,"DT="+IntToStr(DT));
r1=SelectTagsInVectorOfString(r1,"IT="+IntToStr(IT));
//not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription="));
- std::size_t const nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents="));
+ std::size_t nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents="));
if (nbc==da->getNumberOfComponents())
{
for (unsigned int i=0; i<nbc; i++)
MEDCoupling::MEDFileMesh* mfm = getMesh( idomain );
mfm->write(distfilename,2);
- std::string const key="/inewFieldDouble="+IntToStr(idomain)+"/";
+ std::string key="/inewFieldDouble="+IntToStr(idomain)+"/";
std::map<std::string,MEDCoupling::DataArrayDouble*>::iterator it;
int nbfFieldFound=0;
for (it=_collection->getMapDataArrayDouble().begin() ; it!=_collection->getMapDataArrayDouble().end(); it++)
{
- size_t const found=(*it).first.find(key);
+ size_t found=(*it).first.find(key);
if (found==std::string::npos)
continue;
- MEDCoupling::MEDCouplingFieldDouble* field=nullptr;
+ MEDCoupling::MEDCouplingFieldDouble* field=0;
field = getField(key, (*it).first, (*it).second, mfm, idomain);
nbfFieldFound++;
try
MEDCoupling::MEDFileMesh* mfm = getMesh( i );
meshes->pushMesh(mfm);
- std::string const key="/inewFieldDouble="+IntToStr(i)+"/";
+ std::string key="/inewFieldDouble="+IntToStr(i)+"/";
std::map<std::string,MEDCoupling::DataArrayDouble*>::iterator it;
MEDCoupling::MEDFileFieldMultiTS* fieldsMTS = MEDCoupling::MEDFileFieldMultiTS::New();
for (it=_collection->getMapDataArrayDouble().begin() ; it!=_collection->getMapDataArrayDouble().end(); it++)
{
- size_t const found=(*it).first.find(key);
+ size_t found=(*it).first.find(key);
if (found==std::string::npos)
continue;
- MEDCoupling::MEDCouplingFieldDouble* field=nullptr;
+ MEDCoupling::MEDCouplingFieldDouble* field=0;
field=getField(key, (*it).first, (*it).second, mfm, i);
MEDCoupling::MEDFileField1TS* f1ts = MEDCoupling::MEDFileField1TS::New();
f1ts->setFieldNoProfileSBT(field);
#include "MEDPARTITIONER.hxx"
+#include <vector>
#include <string>
namespace MEDCoupling
{
public:
MeshCollectionDriver(MeshCollection*);
- virtual ~MeshCollectionDriver() = default;
- virtual int read(const char*, ParaDomainSelector* sel=nullptr) = 0;
+ virtual ~MeshCollectionDriver() { }
+ virtual int read(const char*, ParaDomainSelector* sel=0) = 0;
int readSeq(const char*,const char*);
MEDCoupling::MEDFileData *getMEDFileData();
- virtual void write(const char*, ParaDomainSelector* sel=nullptr) const = 0;
+ virtual void write(const char*, ParaDomainSelector* sel=0) const = 0;
void readMEDFileData(const MEDCoupling::MEDFileData* filedata);
protected:
void readSubdomain(int idomain);
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MCIdType.hxx"
#include "MEDPARTITIONER_ParallelTopology.hxx"
#include "MEDPARTITIONER_MeshCollectionDriver.hxx"
#include "MEDPARTITIONER_MeshCollection.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDLoader.hxx"
-#include <cstddef>
-#include <cstdlib>
+#include <map>
+#include <set>
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
using namespace MEDPARTITIONER;
{
readMEDFileData(filedata);
- std::vector<MEDPARTITIONER::ConnectZone*> const cz; // to fill from filedata
+ std::vector<MEDPARTITIONER::ConnectZone*> cz; // to fill from filedata
std::vector<mcIdType*> cellglobal;
std::vector<mcIdType*> nodeglobal;
std::vector<mcIdType*> faceglobal;
- std::size_t const size = _collection->getMesh().size();
+ std::size_t size = _collection->getMesh().size();
cellglobal.resize(size);
nodeglobal.resize(size);
faceglobal.resize(size);
for ( unsigned int idomain = 0; idomain < size; ++idomain )
{
- cellglobal[idomain]=nullptr;
- faceglobal[idomain]=nullptr;
- nodeglobal[idomain]=nullptr;
+ cellglobal[idomain]=0;
+ faceglobal[idomain]=0;
+ nodeglobal[idomain]=0;
if ( (_collection->getMesh())[idomain] && (_collection->getMesh())[idomain]->getNumberOfNodes() > 0 )
_collection->setNonEmptyMesh(idomain);
}
//creation of topology from mesh and connect zones
- auto* aPT = new ParallelTopology((_collection->getMesh()), cz, cellglobal, nodeglobal, faceglobal);
+ ParallelTopology* aPT = new ParallelTopology((_collection->getMesh()), cz, cellglobal, nodeglobal, faceglobal);
_collection->setTopology(aPT,true);
return 0;
//reading information about the domain
std::string mesh,host;
int idomain;
- cellglobal[i]=nullptr;
- faceglobal[i]=nullptr;
- nodeglobal[i]=nullptr;
+ cellglobal[i]=0;
+ faceglobal[i]=0;
+ nodeglobal[i]=0;
asciiinput >> mesh >> idomain >> MyGlobals::_Mesh_Names[i] >> host >> MyGlobals::_File_Names[i];
}
//creation of topology from mesh and connect zones
- auto* aPT = new ParallelTopology((_collection->getMesh()), (_collection->getCZ()), cellglobal, nodeglobal, faceglobal);
+ ParallelTopology* aPT = new ParallelTopology((_collection->getMesh()), (_collection->getCZ()), cellglobal, nodeglobal, faceglobal);
_collection->setTopology(aPT, true);
for (int i=0; i<nbdomain; i++)
*/
void MeshCollectionMedAsciiDriver::write(const char* filename, ParaDomainSelector* domainSelector) const
{
- std::size_t const nbdomains=_collection->getMesh().size();
+ std::size_t nbdomains=_collection->getMesh().size();
std::vector<std::string> filenames;
filenames.resize(nbdomains);
#include "MEDPARTITIONER.hxx"
#include "MEDPARTITIONER_MeshCollectionDriver.hxx"
-#include <string>
namespace MEDPARTITIONER
{
{
public:
MeshCollectionMedAsciiDriver(MeshCollection*);
- ~MeshCollectionMedAsciiDriver() override = default;
- int read(const char*, ParaDomainSelector* sel=nullptr) override;
+ virtual ~MeshCollectionMedAsciiDriver() { }
+ int read(const char*, ParaDomainSelector* sel=0);
int read(MEDCoupling::MEDFileData*);
- void write(const char*, ParaDomainSelector* sel=nullptr) const override;
+ void write(const char*, ParaDomainSelector* sel=0) const;
private:
std::string _master_filename;
};
#include "MEDCouplingUMesh.hxx"
#include "MEDLoader.hxx"
-#include "libxml/xmlstring.h"
+#include "MEDFileMesh.hxx"
-#include <cstdio>
-#include <ctime>
+#include <map>
+#include <set>
#include <vector>
#include <string>
#include <cstring>
+#include <fstream>
#include <sstream>
#include <iostream>
#ifdef WIN32
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
using namespace MEDPARTITIONER;
//number of domains
xmlXPathContextPtr xpathCtx = xmlXPathNewContext(master_doc);
xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression(BAD_CAST "//splitting/subdomain", xpathCtx);
- if (xpathObj==nullptr || xpathObj->nodesetval->nodeNr ==0)
+ if (xpathObj==0 || xpathObj->nodesetval->nodeNr ==0)
throw INTERP_KERNEL::Exception("Xml Master File does not contain /MED/splitting/subdomain node");
//as subdomain has only one property which is "number"
//mesh name
xmlXPathFreeObject(xpathObj);
xpathObj = xmlXPathEvalExpression(BAD_CAST "//content/mesh", xpathCtx);
- if (xpathObj==nullptr || xpathObj->nodesetval->nodeNr ==0)
+ if (xpathObj==0 || xpathObj->nodesetval->nodeNr ==0)
throw INTERP_KERNEL::Exception("Xml Master File does not contain /MED/content/mesh node");
_collection->setName( (const char*)xpathObj->nodesetval->nodeTab[0]->properties->children->content);
const char filechar[]="//files/subfile";
xmlXPathFreeObject(xpathObj);
xpathObj = xmlXPathEvalExpression(BAD_CAST filechar, xpathCtx);
- if (xpathObj==nullptr || xpathObj->nodesetval->nodeNr ==0)
+ if (xpathObj==0 || xpathObj->nodesetval->nodeNr ==0)
throw INTERP_KERNEL::Exception("Xml Master File does not contain /MED/files/subfile nodes");
- int const nbfiles = xpathObj->nodesetval ->nodeNr;
+ int nbfiles = xpathObj->nodesetval ->nodeNr;
for (int i=0; i<nbfiles;i++)
{
//reading information about the domain
- std::string const host;
+ std::string host;
//reading file names
std::ostringstream name_search_string;
name_search_string<<"//files/subfile[@id=\""<<i+1<<"\"]/name";
xmlXPathObjectPtr xpathObjfilename =
xmlXPathEvalExpression(BAD_CAST name_search_string.str().c_str(),xpathCtx);
- if (xpathObjfilename->nodesetval ==nullptr)
+ if (xpathObjfilename->nodesetval ==0)
throw INTERP_KERNEL::Exception("Error retrieving a file name from subfile of Xml Master File");
MyGlobals::_File_Names[i]=(const char*)xpathObjfilename->nodesetval->nodeTab[0]->children->content;
mesh_search_string<<"//mapping/mesh/chunk[@subdomain=\""<<i+1<<"\"]/name";
xmlXPathObjectPtr xpathMeshObj = xmlXPathEvalExpression(BAD_CAST mesh_search_string.str().c_str(),xpathCtx);
- if (xpathMeshObj->nodesetval ==nullptr)
+ if (xpathMeshObj->nodesetval ==0)
throw INTERP_KERNEL::Exception("Error retrieving mesh name from chunk of Xml Master File");
MyGlobals::_Mesh_Names[i]=(const char*)xpathMeshObj->nodesetval->nodeTab[0]->children->content;
throw INTERP_KERNEL::Exception("I/O error reading parallel MED file");
}
- auto* aPT = new ParallelTopology(_collection->getMesh());
+ ParallelTopology* aPT = new ParallelTopology(_collection->getMesh());
//creation of topology from mesh and connect zones
if ( _collection->isParallelMode() )
{
*/
void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* domainSelector) const
{
- xmlDocPtr master_doc = nullptr;
- xmlNodePtr root_node = nullptr, node, node2;
+ xmlDocPtr master_doc = 0;
+ xmlNodePtr root_node = 0, node, node2;
char buff[256];
//Creating the Xml document
master_doc = xmlNewDoc(BAD_CAST "1.0");
- root_node = xmlNewNode(nullptr, BAD_CAST "root");
+ root_node = xmlNewNode(0, BAD_CAST "root");
xmlDocSetRootElement(master_doc,root_node);
//Creating child nodes
// Version tag
- node = xmlNewChild(root_node, nullptr, BAD_CAST "version",nullptr);
+ node = xmlNewChild(root_node, 0, BAD_CAST "version",0);
xmlNewProp(node, BAD_CAST "maj", BAD_CAST "2");
xmlNewProp(node, BAD_CAST "min", BAD_CAST "3");
xmlNewProp(node, BAD_CAST "ver", BAD_CAST "1");
,st.wDay);
#endif
- node = xmlNewChild(root_node,nullptr, BAD_CAST "description",nullptr);
+ node = xmlNewChild(root_node,0, BAD_CAST "description",0);
xmlNewProp(node, BAD_CAST "what", BAD_CAST _collection->getDescription().c_str());
xmlNewProp(node, BAD_CAST "when", BAD_CAST date);
//Content tag
- node =xmlNewChild(root_node,nullptr, BAD_CAST "content",nullptr);
- node2 = xmlNewChild(node, nullptr, BAD_CAST "mesh",nullptr);
+ node =xmlNewChild(root_node,0, BAD_CAST "content",0);
+ node2 = xmlNewChild(node, 0, BAD_CAST "mesh",0);
xmlNewProp(node2, BAD_CAST "name", BAD_CAST _collection->getName().c_str());
//Splitting tag
- node=xmlNewChild(root_node,nullptr,BAD_CAST "splitting",nullptr);
- node2=xmlNewChild(node,nullptr,BAD_CAST "subdomain",nullptr);
+ node=xmlNewChild(root_node,0,BAD_CAST "splitting",0);
+ node2=xmlNewChild(node,0,BAD_CAST "subdomain",0);
sprintf(buff, "%d", (int)_collection->getMesh().size());
xmlNewProp(node2, BAD_CAST "number", BAD_CAST buff);
- node2=xmlNewChild(node,nullptr,BAD_CAST "global_numbering",nullptr);
+ node2=xmlNewChild(node,0,BAD_CAST "global_numbering",0);
xmlNewProp(node2, BAD_CAST "present", BAD_CAST "yes");
//Files tag
- xmlNodePtr file_node=xmlNewChild(root_node,nullptr,BAD_CAST "files",nullptr);
+ xmlNodePtr file_node=xmlNewChild(root_node,0,BAD_CAST "files",0);
//Mapping tag
- node = xmlNewChild(root_node,nullptr,BAD_CAST "mapping",nullptr);
- xmlNodePtr mesh_node = xmlNewChild(node, nullptr, BAD_CAST "mesh",nullptr);
+ node = xmlNewChild(root_node,0,BAD_CAST "mapping",0);
+ xmlNodePtr mesh_node = xmlNewChild(node, 0, BAD_CAST "mesh",0);
xmlNewProp(mesh_node, BAD_CAST "name", BAD_CAST _collection->getName().c_str());
- int const nbdomains= _collection->getNbOfGlobalMeshes();
+ int nbdomains= _collection->getNbOfGlobalMeshes();
//loop on the domains
std::string finalMeshName="";
if (MyGlobals::_General_Informations.size()!=0)
{
- std::size_t const found=MyGlobals::_General_Informations[0].find("finalMeshName=");
+ std::size_t found=MyGlobals::_General_Informations[0].find("finalMeshName=");
if ((found!=std::string::npos) && (found>0))
{
finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName=");
if (domainSelector->rank()==0)
{
//updating the ascii description file
- node = xmlNewChild(file_node, nullptr, BAD_CAST "subfile",nullptr);
+ node = xmlNewChild(file_node, 0, BAD_CAST "subfile",0);
sprintf (buff,"%d",idomain+1);
xmlNewProp(node, BAD_CAST "id", BAD_CAST buff);
- xmlNewChild(node,nullptr,BAD_CAST "name",BAD_CAST distfilename.c_str());
- xmlNewChild(node,nullptr,BAD_CAST "machine",BAD_CAST "localhost");
+ xmlNewChild(node,0,BAD_CAST "name",BAD_CAST distfilename.c_str());
+ xmlNewChild(node,0,BAD_CAST "machine",BAD_CAST "localhost");
- node = xmlNewChild(mesh_node,nullptr, BAD_CAST "chunk",nullptr);
+ node = xmlNewChild(mesh_node,0, BAD_CAST "chunk",0);
xmlNewProp(node, BAD_CAST "subdomain", BAD_CAST buff);
- xmlNewChild(node,nullptr,BAD_CAST "name", BAD_CAST finalMeshName.c_str());
+ xmlNewChild(node,0,BAD_CAST "name", BAD_CAST finalMeshName.c_str());
//xmlNewChild(node,0,BAD_CAST "name", BAD_CAST ((_collection->getMesh())[idomain]->getName()).c_str());
}
}
#include "MEDPARTITIONER.hxx"
#include "MEDPARTITIONER_MeshCollectionDriver.hxx"
-#include <string>
namespace MEDPARTITIONER
{
{
public:
MeshCollectionMedXmlDriver(MeshCollection*);
- ~MeshCollectionMedXmlDriver() override = default;
- int read(const char*, ParaDomainSelector* sel=nullptr) override;
- void write(const char*, ParaDomainSelector* sel=nullptr) const override;
+ virtual ~MeshCollectionMedXmlDriver() { }
+ int read(const char*, ParaDomainSelector* sel=0);
+ void write(const char*, ParaDomainSelector* sel=0) const;
private :
std::string _master_filename;
};
//
#include "MEDPARTITIONER_MetisGraph.hxx"
-#include "MCIdType.hxx"
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_Utils.hxx"
#include "MEDCouplingSkyLineArray.hxx"
+#include "InterpKernelException.hxx"
#include <iostream>
-#include <string>
-#include <vector>
extern "C"
{
}
METISGraph::~METISGraph()
-= default;
+{
+}
void METISGraph::partGraph(int ndomain,
const std::string& options_string,
- ParaDomainSelector * /*parallelizer*/)
+ ParaDomainSelector *parallelizer)
{
using std::vector;
if (MyGlobals::_Verbose>10)
//constraints
int * vwgt=_cell_weight;
int * adjwgt=_edge_weight;
- int wgtflag=(_edge_weight!=nullptr)?1:0+(_cell_weight!=nullptr)?2:0;
+ int wgtflag=(_edge_weight!=0)?1:0+(_cell_weight!=0)?2:0;
//base 0 or 1
int base=0;
//ndomain
{
public:
METISGraph();
- METISGraph(MEDCoupling::MEDCouplingSkyLineArray*, int *edgeweight=nullptr);
- ~METISGraph() override;
- void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=nullptr) override;
+ METISGraph(MEDCoupling::MEDCouplingSkyLineArray*, int *edgeweight=0);
+ virtual ~METISGraph();
+ void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0);
};
}
//
#include "MEDPARTITIONER_PTScotchGraph.hxx"
-#include "MEDPARTITIONER_Graph.hxx"
#include "MEDPARTITIONER_Utils.hxx"
-#include "MCIdType.hxx"
#include "MEDCouplingSkyLineArray.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MCType.hxx"
-#include "scotch.h"
#include <cstdio>
+#include <memory>
#include <mpi.h>
-#include <string>
#ifdef MED_ENABLE_PTSCOTCH
extern "C"
}
PTSCOTCHGraph::~PTSCOTCHGraph()
-= default;
+{
+}
-void PTSCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* /*sel*/)
+void PTSCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* sel)
{
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : PTSCOTCHGraph::partGraph" << std::endl;
//number of graph vertices
int n = FromIdType<int>(_graph->getNumberOf());
//graph
- auto * xadj=const_cast<mcIdType*>(_graph->getIndex());
- auto * adjncy=const_cast<mcIdType*>(_graph->getValues());
+ mcIdType * xadj=const_cast<mcIdType*>(_graph->getIndex());
+ mcIdType * adjncy=const_cast<mcIdType*>(_graph->getValues());
//ndomain
- int const nparts=ndomain;
+ int nparts=ndomain;
#if !defined(MED_ENABLE_PTSCOTCH)
throw INTERP_KERNEL::Exception("PTSCOTCHGraph::partGraph : PTSCOTCH is not available. Check your products, please.");
n, // vertlocnbr , nb of local graph nodes
n, // vertlocmax , should be set to vertlocnbr for graphs without holes
xadj, // vertloctab[vertnbr+1] , index vertex table
- nullptr, // vendloctab , index end vertex table if disjoint, set to zero
+ 0, // vendloctab , index end vertex table if disjoint, set to zero
cellWeightPtr, // veloloctab , graph vertices loads, set to zero
vlbloctab, // vlblocltab , vertex label array : global vertex index
xadj[n], // edgelocnbr , number of edges
xadj[n], // edgelocsiz , same as edgelocnbr if edgeloctab is compact
adjncy, // edgeloctab[edgelocnbr], global indexes of edges
- nullptr, // edgegsttab , optional, should be computed internally, set to zero
+ 0, // edgegsttab , optional, should be computed internally, set to zero
edgeWeightPtr); // edloloctab , graph edges loads, set to zero
SCOTCH_Strat scotch_strategy;
class MEDPARTITIONER_EXPORT PTSCOTCHGraph : public Graph
{
public:
- PTSCOTCHGraph() = default;
- PTSCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray* , int *edgeweight=nullptr, DataArrayIdType *vlbloctab=nullptr);
- ~PTSCOTCHGraph() override;
- void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=nullptr) override;
+ PTSCOTCHGraph() { }
+ PTSCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray* , int *edgeweight=0, DataArrayIdType *vlbloctab=0);
+ virtual ~PTSCOTCHGraph();
+ void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=0);
protected:
MEDCoupling::DataArrayIdType *_vlbloctab;
};
//
#include "MEDPARTITIONER_ParMetisGraph.hxx"
-#include "MCIdType.hxx"
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_Utils.hxx"
#include "InterpKernelException.hxx"
#include <iostream>
-#include <string>
-#include <vector>
#ifdef MED_ENABLE_PARMETIS
#include <parmetis.h>
}
ParMETISGraph::~ParMETISGraph()
-= default;
+{
+}
void ParMETISGraph::partGraph(int ndomain,
- const std::string& /*options_string*/,
- ParaDomainSelector * /*parallelizer*/)
+ const std::string& options_string,
+ ParaDomainSelector *parallelizer)
{
using std::vector;
vector<int> ran,vx,va; //for randomize
std::cout << "proc " << MyGlobals::_Rank << " : ParMETISGraph::partGraph" << std::endl;
// number of graph vertices
- int const n=FromIdType<int>(_graph->getNumberOf());
+ int n=FromIdType<int>(_graph->getNumberOf());
//graph
#ifdef MEDCOUPLING_USE_64BIT_IDS
std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
//constraints
int * vwgt=_cell_weight;
int * adjwgt=_edge_weight;
- int const wgtflag=(_edge_weight!=nullptr)?1:0+(_cell_weight!=nullptr)?2:0;
+ int wgtflag=(_edge_weight!=0)?1:0+(_cell_weight!=0)?2:0;
//base 0 or 1
- int const base=0;
+ int base=0;
//ndomain
- int const nparts=ndomain;
+ int nparts=ndomain;
//options
/*
(0=default_option,option,random_seed) see defs.h
#define PMV3_OPTION_PSR 3
seems no changes int options[4]={1,0,33,0}; //test for a random seed of 33
*/
- int const options[4]={0,0,0,0};
+ int options[4]={0,0,0,0};
// output parameters
int edgecut;
#if !defined(MED_ENABLE_PARMETIS)
{
public:
ParMETISGraph();
- ParMETISGraph(MEDCoupling::MEDCouplingSkyLineArray*, int *edgeweight=nullptr);
- ~ParMETISGraph() override;
- void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=nullptr) override;
+ ParMETISGraph(MEDCoupling::MEDCouplingSkyLineArray*, int *edgeweight=0);
+ virtual ~ParMETISGraph();
+ void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0);
};
}
//
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
-#include "MEDPARTITIONER_Graph.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingPointSet.hxx"
-#include "MEDCouplingMesh.hxx"
+#include "MEDPARTITIONER_UserGraph.hxx"
#include "MEDPARTITIONER_Utils.hxx"
#include "MEDPARTITIONER_Utils.hxx"
#include "MEDCouplingSkyLineArray.hxx"
#include "MCIdType.hxx"
-#include <cstddef>
#include <iostream>
-#include <linux/sysinfo.h>
+#include <numeric>
#ifdef HAVE_MPI
}
MEDPARTITIONER::ParaDomainSelector::~ParaDomainSelector()
-= default;
+{
+}
/*!
* \brief Return true if is running on different hosts
int size;
MPI_Get_processor_name( name_here, &size);
- int const next_proc = (rank() + 1) % nbProcs();
- int const prev_proc = (rank() - 1 + nbProcs()) % nbProcs();
- int const tag = 1111111;
+ int next_proc = (rank() + 1) % nbProcs();
+ int prev_proc = (rank() - 1 + nbProcs()) % nbProcs();
+ int tag = 1111111;
MPI_Status status;
MPI_Sendrecv((void*)&name_here[0], MPI_MAX_PROCESSOR_NAME, MPI_CHAR, next_proc, tag,
_nb_vert_of_procs[0] = 0; // base = 0
for (int i=0; i<nb_domains; ++i)
{
- int const rankk = getProcessorID(i);
+ int rankk = getProcessorID(i);
_nb_vert_of_procs[rankk+1] += all_nb_elems[i*2];
}
for (std::size_t i=1; i<_nb_vert_of_procs.size(); ++i)
*/
std::unique_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gatherGraph(const Graph* graph) const
{
- Graph* glob_graph = nullptr;
+ Graph* glob_graph = 0;
evaluateMemory();
#ifdef HAVE_MPI
for ( std::size_t i = 1; i < _nb_vert_of_procs.size(); ++i )
index_size_of_proc[i-1] = FromIdType<int>(_nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ]);
- mcIdType const index_size = 1 + _cell_shift_by_domain.back();
- auto *graph_index = new mcIdType[ index_size ];
+ mcIdType index_size = 1 + _cell_shift_by_domain.back();
+ mcIdType *graph_index = new mcIdType[ index_size ];
const mcIdType *index = graph->getGraph()->getIndex();
MCAuto< DataArrayInt > nb_vert_of_procs = FromIdTypeVec( _nb_vert_of_procs );
int *proc_index_displacement = nb_vert_of_procs->getPointer();
// update graph_index
for ( int i = 1; i < nbProcs(); ++i )
{
- mcIdType const shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0];
+ mcIdType shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0];
for ( int j = proc_index_displacement[i]; j < proc_index_displacement[i+1]; ++j )
graph_index[ j ] += shift;
}
// Gather values
// --------------
- mcIdType const value_size = graph_index[ index_size-1 ] - graph_index[ 0 ];
- auto *graph_value = new mcIdType[ value_size ];
+ mcIdType value_size = graph_index[ index_size-1 ] - graph_index[ 0 ];
+ mcIdType *graph_value = new mcIdType[ value_size ];
const mcIdType *value = graph->getGraph()->getValues();
MPI_Allgatherv((void*) value, // send local value
// Gather partition
// -----------------
- auto * partition = new mcIdType[ _cell_shift_by_domain.back() ];
+ mcIdType * partition = new mcIdType[ _cell_shift_by_domain.back() ];
const mcIdType* part = graph->getPart();
MPI_Allgatherv((void*) part, // send local partition
if ( _nb_cell_pairs_by_joint.empty() )
_nb_cell_pairs_by_joint.resize( _nb_result_domains*(_nb_result_domains+1), 0);
- int const joint_id = jointId( loc_domain, dist_domain );
+ int joint_id = jointId( loc_domain, dist_domain );
_nb_cell_pairs_by_joint[ joint_id ] = nb_cell_pairs;
}
evaluateMemory();
{
evaluateMemory();
- int const joint_id = jointId( loc_domain, dist_domain );
+ int joint_id = jointId( loc_domain, dist_domain );
return _nb_cell_pairs_by_joint[ joint_id ];
}
// (got in gatherNbOf( MED_FACE )).
evaluateMemory();
- mcIdType const total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back();
+ mcIdType total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back();
mcIdType id = total_nb_faces + 1;
if ( _nb_cell_pairs_by_joint.empty() )
throw INTERP_KERNEL::Exception("gatherNbCellPairs() must be called before");
- int const joint_id = jointId( loc_domain, dist_domain );
+ int joint_id = jointId( loc_domain, dist_domain );
for ( int j = 0; j < joint_id; ++j )
id += _nb_cell_pairs_by_joint[ j ];
{
int* loc_ids_dist = new int[ loc_ids_here.size()];
#ifdef HAVE_MPI
- int const dest = getProcessorID( dist_domain );
- int const tag = 2002 + jointId( loc_domain, dist_domain );
+ int dest = getProcessorID( dist_domain );
+ int tag = 2002 + jointId( loc_domain, dist_domain );
MPI_Status status;
MPI_Sendrecv((void*)&loc_ids_here[0], (int)loc_ids_here.size(), MPI_INT, dest, tag,
(void*) loc_ids_dist, (int)loc_ids_here.size(), MPI_INT, dest, tag,
if (mesh.getNumberOfCells()>0) //no sends if empty
{
- MEDCoupling::DataArrayIdType *v1Local=nullptr;
- MEDCoupling::DataArrayDouble *v2Local=nullptr;
+ MEDCoupling::DataArrayIdType *v1Local=0;
+ MEDCoupling::DataArrayDouble *v2Local=0;
//serialization of local mesh to send data to distant proc.
mesh.serialize(v1Local,v2Local);
int nbLocalElems=0;
- mcIdType* ptLocal=nullptr;
+ mcIdType* ptLocal=0;
if(v1Local) //if empty getNbOfElems() is 1!
{
nbLocalElems=FromIdType<int>(v1Local->getNbOfElems()); // if empty be 1!
}
MPI_Send(ptLocal, nbLocalElems, MPI_ID_TYPE, target, 1111, MPI_COMM_WORLD);
int nbLocalElems2=0;
- double *ptLocal2=nullptr;
+ double *ptLocal2=0;
if(v2Local) //if empty be 0!
{
nbLocalElems2=FromIdType<int>(v2Local->getNbOfElems());
mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
int nbDistElem=0;
- mcIdType *ptDist=nullptr;
+ mcIdType *ptDist=0;
if(v1Distant)
{
nbDistElem=FromIdType<int>(v1Distant->getNbOfElems());
ptDist=v1Distant->getPointer();
}
MPI_Recv(ptDist, nbDistElem, MPI_ID_TYPE, source,1111, MPI_COMM_WORLD, &status);
- double *ptDist2=nullptr;
+ double *ptDist2=0;
nbDistElem=0;
if(v2Distant)
{
int used_memory = 0;
#if !defined WIN32 && !defined __APPLE__
struct sysinfo si;
- int const err = sysinfo( &si );
+ int err = sysinfo( &si );
if ( !err )
used_memory = (int)(( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024;
#endif
#ifndef __MEDPARTITIONER_PARADOMAINSELECTOR_HXX__
#define __MEDPARTITIONER_PARADOMAINSELECTOR_HXX__
-#include "MCIdType.hxx"
#include "MEDPARTITIONER.hxx"
+#include "MCType.hxx"
#include <memory>
#include <vector>
#include "InterpKernelHashMap.hxx"
#include "MCIdType.hxx"
-#include <cstddef>
-#include <utility>
+#include <set>
+#include <map>
#include <vector>
#include <iostream>
for (int idomain=0; idomain<_nb_domain; idomain++)
{
_loc_to_glob[idomain].resize(_nb_cells[idomain]);
- mcIdType const domainCellShift=domainSelector->getDomainCellShift(idomain);
+ mcIdType domainCellShift=domainSelector->getDomainCellShift(idomain);
for (mcIdType i=0; i<_nb_cells[idomain]; i++)
{
mcIdType global=domainCellShift+i ;
for (int idomain=0; idomain<_nb_domain; idomain++)
{
_node_loc_to_glob[idomain].resize(_nb_nodes[idomain]);
- mcIdType const domainNodeShift=domainSelector->getDomainNodeShift(idomain);
+ mcIdType domainNodeShift=domainSelector->getDomainNodeShift(idomain);
for (mcIdType i=0; i<_nb_nodes[idomain]; i++)
{
mcIdType global=domainNodeShift+i ;
_nb_domain=(int)meshes.size();
mcIdType index_global=0;
mcIdType index_node_global=0;
- mcIdType const index_face_global=0;
+ mcIdType index_face_global=0;
_nb_cells.resize(_nb_domain);
_nb_nodes.resize(_nb_domain);
for (mcIdType i=0; i< nb_node; i++)
{
mcIdType local= node_corresp[i*2];
- mcIdType const distant = node_corresp[i*2+1];
+ mcIdType distant = node_corresp[i*2+1];
local2distant.insert(std::make_pair(local, std::make_pair(distant_ip,distant)));
}
}
int icellProc=0; //all cells of my domains are concatenated in part
for (int iold=0; iold<oldTopology->nbDomain(); iold++)
{
- mcIdType const ioldNbCell=oldTopology->getCellNumber(iold);
+ mcIdType ioldNbCell=oldTopology->getCellNumber(iold);
//std::cout<<"proc "<<MyGlobals::_Rank<<" : cell number old domain "<<iold<<" : "<<ioldNbCell<<std::endl;
//if not my old domains getCellNumber is 0
std::vector<mcIdType> globalids(ioldNbCell);
int iGlobDom = FromIdType<int>(part[ iGlob ]);
for ( mcIdType i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ )
{
- mcIdType const iGlobNear = value[ i ];
+ mcIdType iGlobNear = value[ i ];
if ( iGlob > iGlobNear )
continue; // treat ( iGlob, iGlobNear ) pair once
int iGlobNearDom = FromIdType<int>(part[ iGlobNear ]);
std::vector< mcIdType > & corresp = cellCorresp[ idomain ][ idomainNear ];
if ( corresp.empty() )
continue;
- auto* cz = new MEDPARTITIONER::ConnectZone();
+ MEDPARTITIONER::ConnectZone* cz = new MEDPARTITIONER::ConnectZone();
cz->setName( "Connect Zone defined by MEDPARTITIONER" );
cz->setDistantDomainNumber( idomainNear );
cz->setLocalDomainNumber ( idomain );
ParallelTopology::~ParallelTopology()
{
- for (auto & _connect_zone : _connect_zones)
+ for ( size_t i = 0; i < _connect_zones.size(); ++i )
{
- delete _connect_zone;
- _connect_zone = nullptr;
+ delete _connect_zones[i];
+ _connect_zones[i] = 0;
}
_connect_zones.clear();
}
for (mcIdType inode=0; inode<nbnodes; inode++)
{
// cout <<" inode :"<<inode<< " global = "<<type_connectivity[type][inode];
- mcIdType const global = nodes[inode];
+ mcIdType global = nodes[inode];
typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(global);
for (mmiter it=range.first; it !=range.second; it++)
#ifndef __MEDPARTITIONER_PARALLELTOPOLOGY_HXX__
#define __MEDPARTITIONER_PARALLELTOPOLOGY_HXX__
-#include "MCIdType.hxx"
#include "MEDPARTITIONER.hxx"
#include "MEDPARTITIONER_Topology.hxx"
#include "InterpKernelHashMap.hxx"
#include <set>
-#include <utility>
#include <vector>
namespace MEDPARTITIONER
std::vector<mcIdType*>&,
std::vector<mcIdType*>&);
ParallelTopology(Graph* graph, Topology* oldTopology, int nbdomain, int mesh_dimension);
- ~ParallelTopology() override;
+ ~ParallelTopology();
void setGlobalNumerotationDefault(ParaDomainSelector* domainSelector);
/*! converts a list of global cell numbers
* to a distributed array with local cell numbers
*/
- void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int*) override;
- void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int) override;
- void convertGlobalNodeListWithTwins(const mcIdType* face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) override;
+ void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int*);
+ void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int);
+ void convertGlobalNodeListWithTwins(const mcIdType* face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size);
/*! converts a list of global node numbers
* to a distributed array with local cell numbers
*/
- void convertGlobalCellList(const mcIdType*, mcIdType , mcIdType*, int *) override;
+ void convertGlobalCellList(const mcIdType*, mcIdType , mcIdType*, int *);
/*! converts a list of global face numbers
* to a distributed array with local face numbers
*/
- void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int *) override;
- void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int) override;
- void convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size) override;
+ void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int *);
+ void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int);
+ void convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size);
/*! converting node global numberings to local numberings */
- void convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain) override;
+ void convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain);
/*! converting node local numbering to global */
- mcIdType convertNodeToGlobal(int ip, mcIdType icell) const override { return _node_loc_to_glob[ip][icell]; }
+ mcIdType convertNodeToGlobal(int ip, mcIdType icell) const { return _node_loc_to_glob[ip][icell]; }
/*! converting face local numbering to global */
- mcIdType convertFaceToGlobal(int ip, mcIdType iface) const override { return _face_loc_to_glob[ip][iface]; }
+ mcIdType convertFaceToGlobal(int ip, mcIdType iface) const { return _face_loc_to_glob[ip][iface]; }
/*! converting cell global numbering to local */
- mcIdType convertCellToGlobal(int ip, mcIdType icell) const override { return _loc_to_glob[ip][icell]; }
+ mcIdType convertCellToGlobal(int ip, mcIdType icell) const { return _loc_to_glob[ip][icell]; }
- void convertNodeToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const override
+ void convertNodeToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const
{
for (mcIdType i=0; i<n; i++)
global[i]=_node_loc_to_glob[ip][local[i]];
}
- void convertCellToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const override
+ void convertCellToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const
{
for (mcIdType i=0; i<n; i++)
global[i]=_loc_to_glob[ip][local[i]];
}
- void convertFaceToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const override
+ void convertFaceToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const
{
for (mcIdType i=0; i<n; i++)
global[i]=_face_loc_to_glob[ip][local[i]];
}
- int nbDomain() const override { return _nb_domain; }
+ int nbDomain() const { return _nb_domain; }
- mcIdType nbCells() const override { return _nb_total_cells; }
+ mcIdType nbCells() const { return _nb_total_cells; }
- mcIdType nbNodes() const override { return _nb_total_nodes; }
+ mcIdType nbNodes() const { return _nb_total_nodes; }
- mcIdType nbCells( int idomain) const override { return _nb_cells[idomain]; }
+ mcIdType nbCells( int idomain) const { return _nb_cells[idomain]; }
/*! retrieving number of nodes */
- mcIdType getNodeNumber(int idomain) const override { return _nb_nodes[idomain]; }
+ mcIdType getNodeNumber(int idomain) const { return _nb_nodes[idomain]; }
- mcIdType getNodeNumber() const override;
+ mcIdType getNodeNumber() const;
- void getNodeList(int idomain, mcIdType* list) const override;
+ void getNodeList(int idomain, mcIdType* list) const;
/*! retrieving cell numbers after merging in parallel mode */
- std::vector<mcIdType> & getFusedCellNumbers(int idomain) override { return _cell_loc_to_glob_fuse[idomain]; }
+ std::vector<mcIdType> & getFusedCellNumbers(int idomain) { return _cell_loc_to_glob_fuse[idomain]; }
- const std::vector<mcIdType>& getFusedCellNumbers(int idomain) const override { return _cell_loc_to_glob_fuse[idomain]; }
+ const std::vector<mcIdType>& getFusedCellNumbers(int idomain) const { return _cell_loc_to_glob_fuse[idomain]; }
/*! retrieving face numbers after merging in parallel mode */
- std::vector<mcIdType> & getFusedFaceNumbers(int idomain) override { return _face_loc_to_glob_fuse[idomain]; }
+ std::vector<mcIdType> & getFusedFaceNumbers(int idomain) { return _face_loc_to_glob_fuse[idomain]; }
- const std::vector<mcIdType>& getFusedFaceNumbers(int idomain) const override { return _face_loc_to_glob_fuse[idomain]; }
+ const std::vector<mcIdType>& getFusedFaceNumbers(int idomain) const { return _face_loc_to_glob_fuse[idomain]; }
/*! retrieving number of nodes */
- mcIdType getCellNumber(int idomain) const override { return _nb_cells[idomain]; }
+ mcIdType getCellNumber(int idomain) const { return _nb_cells[idomain]; }
mcIdType getCellDomainNumber(int global) const { return (_glob_to_loc.find(global)->second).first; }
- void getCellList(int idomain, mcIdType* list) const override;
+ void getCellList(int idomain, mcIdType* list) const;
- mcIdType getFaceNumber(int idomain) const override { return _nb_faces[idomain]; }
+ mcIdType getFaceNumber(int idomain) const { return _nb_faces[idomain]; }
- mcIdType getFaceNumber() const override;
+ mcIdType getFaceNumber() const;
- void getFaceList(int idomain, mcIdType* list) const override;
+ void getFaceList(int idomain, mcIdType* list) const;
/*! converting a global cell number to a local representation (domain + local number) */
- std::pair<int,mcIdType> convertGlobalCell(mcIdType iglobal) const override { return _glob_to_loc.find(iglobal)->second; }
+ std::pair<int,mcIdType> convertGlobalCell(mcIdType iglobal) const { return _glob_to_loc.find(iglobal)->second; }
- mcIdType convertGlobalFace(mcIdType iglobal, int idomain) override;
+ mcIdType convertGlobalFace(mcIdType iglobal, int idomain);
- mcIdType convertGlobalNode(mcIdType iglobal, int idomain) override;
+ mcIdType convertGlobalNode(mcIdType iglobal, int idomain);
- std::vector<MEDPARTITIONER::ConnectZone*>& getCZ() override;
+ std::vector<MEDPARTITIONER::ConnectZone*>& getCZ();
//adding a face to the topology
- void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal) override;
+ void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal);
//return max global face number
- mcIdType getMaxGlobalFace() const override;
+ mcIdType getMaxGlobalFace() const;
private:
bool hasCellWithNodes( const MeshCollection&, int dom, const std::set<mcIdType>& nodes );
private:
//mapping global -> local
- using TGlob2DomainLoc = INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int, mcIdType>>;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> > TGlob2DomainLoc;
TGlob2DomainLoc _glob_to_loc;
TGlob2DomainLoc _node_glob_to_loc;
std::vector<std::vector <mcIdType> > _face_loc_to_glob_fuse; // glob nums after merging
//mapping global -> local
- using TGlob2LocsMap = INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int, mcIdType>>;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> > TGlob2LocsMap;
TGlob2LocsMap _face_glob_to_loc;
//mapping local -> global
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MCIdType.hxx"
#include "MEDPARTITIONER_Graph.hxx"
#include "MEDPARTITIONER_ScotchGraph.hxx"
#include "MEDPARTITIONER_Utils.hxx"
#include "MEDCouplingSkyLineArray.hxx"
-#include <iostream>
#include <cstdio>
-#include <string>
-#include <vector>
#ifdef MED_ENABLE_SCOTCH
extern "C"
}
SCOTCHGraph::~SCOTCHGraph()
-= default;
+{
+}
-void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* /*sel*/)
+void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* sel)
{
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : SCOTCHGraph::partGraph" << std::endl;
//number of graph vertices
- int const n = FromIdType<int>(_graph->getNumberOf());
+ int n = FromIdType<int>(_graph->getNumberOf());
//graph
#ifdef MEDCOUPLING_USE_64BIT_IDS
std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
int * adjncy=const_cast<int*>(_graph->getValues());
#endif
//ndomain
- int const nparts=ndomain;
+ int nparts=ndomain;
#if !defined(MED_ENABLE_SCOTCH)
throw INTERP_KERNEL::Exception("SCOTCHGraph::partGraph : SCOTCH is not available. Check your products, please.");
{
public:
SCOTCHGraph();
- SCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray*, int* edgeweight=nullptr);
- ~SCOTCHGraph() override;
- void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=nullptr) override;
+ SCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray*, int* edgeweight=0);
+ virtual ~SCOTCHGraph();
+ void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=0);
};
}
#ifndef __MEDPARTITIONER_TOPOLOGY_HXX__
#define __MEDPARTITIONER_TOPOLOGY_HXX__
-#include "MCIdType.hxx"
#include "MEDPARTITIONER.hxx"
+#include "MCType.hxx"
-#include <utility>
+#include <map>
#include <vector>
namespace MEDCoupling
class MEDPARTITIONER_EXPORT Topology
{
public:
- Topology() = default;
+ Topology() { }
Topology(std::vector<MEDCoupling::MEDCouplingUMesh*>, std::vector<MEDPARTITIONER::ConnectZone*>) { }
- virtual ~Topology() = default;
+ virtual ~Topology() { }
/*! converts a list of global cell numbers
* to a distributed array with local cell numbers
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MCIdType.hxx"
#include "MEDPARTITIONER_Graph.hxx"
#include "MEDPARTITIONER_UserGraph.hxx"
#include "MEDCouplingSkyLineArray.hxx"
#include <iostream>
-#include <string>
#include <vector>
using namespace MEDPARTITIONER;
* (domain numbers range from 0 to ndomain-1
* \param n number of cells in the mesh
*/
-UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, mcIdType n):Graph(array,nullptr)
+UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, mcIdType n):Graph(array,0)
{
std::vector<mcIdType> index(n+1),value(n);
}
UserGraph::~UserGraph()
-= default;
+{
+}
-void UserGraph::partGraph(int /*ndomain*/, const std::string& /*options*/, ParaDomainSelector* /*sel*/)
+void UserGraph::partGraph(int ndomain, const std::string& options, ParaDomainSelector* sel)
{
std::cerr << "MEDPARTITIONER::UserGraph::partGraph() should not have to be used" << std::endl;
}
#ifndef __MEDPARTITIONER_USERGRAPH_HXX__
#define __MEDPARTITIONER_USERGRAPH_HXX__
-#include "MCIdType.hxx"
#include "MEDPARTITIONER.hxx"
#include "MEDPARTITIONER_Graph.hxx"
{
public:
UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const int*, mcIdType);
- ~UserGraph() override;
- void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector *sel=nullptr) override;
+ virtual ~UserGraph();
+ void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector *sel=0);
};
}
#endif
#include "MEDPARTITIONER_Utils.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "BBTree.txx"
#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
+#include "MEDFileUtilities.hxx"
+#include "CellModel.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "InterpKernelException.hxx"
#include "MCAuto.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "med.h"
-#include "medfile.h"
-#include "medfield.h"
-#include <cstdlib>
-#include <algorithm>
+#include <fstream>
#include <iostream>
#include <iomanip>
-#include <map>
#include <sstream>
#include <string>
#include <cstring>
-#include <vector>
-#include <utility>
using namespace MEDPARTITIONER;
srand( MyGlobals::_Randomize );
for (int i=0; i<size; i++)
{
- int const ii=rand()%size;
- int const tmp=res[ii];
+ int ii=rand()%size;
+ int tmp=res[ii];
res[ii]=res[i];
res[i]=tmp;
}
std::cerr << "MEDPARTITIONER::RandomizeAdj only works on one proc!" << std::endl;
return;
}
- std::size_t const size=ran.size();
+ std::size_t size=ran.size();
std::vector<int> invran(size);
for (unsigned int i=0; i<size; i++)
invran[ran[i]]=i;
vx.resize(size+1);
- int const lga=xadj[size];
+ int lga=xadj[size];
va.resize(lga);
int jj=0;
vx[0]=0;
for (std::size_t i=0; i<size; i++)
{
- int const ir=ran[i];
+ int ir=ran[i];
int ii=xadj[ir];
- int const lgj=xadj[ir+1]-ii;
+ int lgj=xadj[ir+1]-ii;
for (int j=0; j<lgj; j++)
{
va[jj]=invran[adjncy[ii]];
//int adjncy[13]={1,4,0,2,4,1,3,4,2,4,4,3,4};
int xadj[6]={0,2,5,9,12,13};
int adjncy[13]={0,0,1,1,1,2,2,2,2,3,3,3,4};
- int const size=5;
+ int size=5;
std::vector<int> r=CreateRandomSize(size);
std::vector<int> vx,va;
RandomizeAdj(&xadj[0],&adjncy[0],r,vx,va);
if (vec.size()==0)
return std::string(" NONE\n");
std::ostringstream oss;
- for (const auto & i : vec)
- oss << " -> '" << i << "'" << std::endl;
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ oss << " -> '" << *i << "'" << std::endl;
return oss.str();
}
if (vec.size()==0)
return std::string(" NONE\n");
std::ostringstream oss;
- for (const auto & i : vec)
- oss << separator << i;
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ oss << separator << *i;
return oss.str();
}
if (mymap.size()==0)
return std::string(" NONE\n");
std::ostringstream oss;
- for (const auto & i : mymap)
- oss << " -> [" << i.first << "]=" << i.second << std::endl;
+ for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ oss << " -> [" << (*i).first << "]=" << (*i).second << std::endl;
return oss.str();
}
if (mymap.size()==0)
return std::string(" NONE\n");
std::ostringstream oss;
- for (const auto & i : mymap)
- oss << " -> [" << i.first << "]=" << std::endl << ReprVectorOfString(i.second) << std::endl;
+ for (std::map< std::string,std::vector<std::string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ oss << " -> [" << (*i).first << "]=" << std::endl << ReprVectorOfString((*i).second) << std::endl;
return oss.str();
}
if (vec.size()==0)
return std::string(" NONE\n");
std::ostringstream oss;
- for (const auto & i : vec)
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
oss << " ->";
- oss << ReprVectorOfString(DeserializeToVectorOfString(i), separator) << std::endl;
+ oss << ReprVectorOfString(DeserializeToVectorOfString(*i), separator) << std::endl;
}
return oss.str();
}
std::string MEDPARTITIONER::SerializeFromVectorOfString(const std::vector<std::string>& vec)
{
std::ostringstream oss;
- for (const auto & i : vec)
- oss<< std::setw(5) << i.size() << "/" << i << "/";
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ oss<< std::setw(5) << (*i).size() << "/" << *i << "/";
return oss.str();
}
{
std::vector<std::string> res;
std::size_t pos=0;
- std::size_t const posmax=str.size();
+ std::size_t posmax=str.size();
if (posmax==0)
return res; //empty vector
std::size_t length;
std::string MEDPARTITIONER::EraseTagSerialized(const std::string& fromStr, const std::string& tag)
{
- std::vector<std::string> const vec=DeserializeToVectorOfString(fromStr);
+ std::vector<std::string> vec=DeserializeToVectorOfString(fromStr);
std::vector<std::string> res;
- for (const auto & i : vec)
+ for (std::size_t i=0; i<vec.size(); i++)
{
- if (i.find(tag)==std::string::npos)
- res.push_back(i);
+ if (vec[i].find(tag)==std::string::npos)
+ res.push_back(vec[i]);
}
return MEDPARTITIONER::SerializeFromVectorOfString(res);
}
std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map<std::string,mcIdType>& mymap)
{
std::vector<std::string> res;
- for (const auto & i : mymap)
+ for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
{
std::ostringstream oss;
- oss << i.second << "/" << i.first;
+ oss << (*i).second << "/" << (*i).first;
res.push_back(oss.str());
}
return res;
std::map<std::string,mcIdType> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string>& vec)
{
std::map<std::string,mcIdType> res;
- for (const auto & i : vec)
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
- std::size_t const pos=0;
- std::size_t const posmax=i.size();
- std::size_t const found=i.find('/'); //first slash
+ std::size_t pos=0;
+ std::size_t posmax=(*i).size();
+ std::size_t found=(*i).find('/'); //first slash
if ((found==std::string::npos) || (found<1))
throw INTERP_KERNEL::Exception("Error aIntNumber/anyString is expected");
mcIdType second;
- std::istringstream iss(i.substr(pos,found));
+ std::istringstream iss((*i).substr(pos,found));
iss >> second;
- std::string const first=i.substr(pos+found+1,posmax-found);
- auto const it=res.find(first);
+ std::string first=(*i).substr(pos+found+1,posmax-found);
+ std::map<std::string,mcIdType>::iterator it=res.find(first);
if (it!=res.end())
if ((*it).second!=second)
throw INTERP_KERNEL::Exception("Error not the same map value");
std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap)
{
std::vector<std::string> res;
- for (const auto & i : mymap)
+ for (std::map< std::string,std::vector<std::string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
{
- std::vector<std::string> vs=i.second; //a vector of string;
+ std::vector<std::string> vs=(*i).second; //a vector of string;
std::ostringstream oss;
- oss << "Keymap/" << i.first << "/" << i.second.size();
+ oss << "Keymap/" << (*i).first << "/" << (*i).second.size();
vs.insert(vs.begin(), oss.str());
res.push_back(SerializeFromVectorOfString(vs));
}
std::map< std::string,std::vector<std::string> > MEDPARTITIONER::DevectorizeToMapOfStringVectorOfString(const std::vector<std::string>& vec)
{
std::map< std::string,std::vector<std::string> > res;
- for (const auto & i : vec)
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
- std::vector<std::string> vs=DeserializeToVectorOfString(i);
+ std::vector<std::string> vs=DeserializeToVectorOfString(*i);
- std::string const enTete=vs[0];
- std::size_t const posmax=enTete.size();
- std::size_t const foundKey=enTete.find("Keymap/");
- std::size_t const foundSizeVector=enTete.find_last_of('/');
+ std::string enTete=vs[0];
+ std::size_t posmax=enTete.size();
+ std::size_t foundKey=enTete.find("Keymap/");
+ std::size_t foundSizeVector=enTete.find_last_of('/');
if ((foundKey==std::string::npos) || (foundKey!=0) || ((foundKey+7)>=foundSizeVector))
throw INTERP_KERNEL::Exception("Error Keymap/anyString/aIntNumber is expected");
int sizeVector;
std::istringstream iss(enTete.substr(foundSizeVector+1,posmax-foundSizeVector));
iss >> sizeVector;
- std::string const keymap=enTete.substr(foundKey+7,foundSizeVector-foundKey-7);
+ std::string keymap=enTete.substr(foundKey+7,foundSizeVector-foundKey-7);
for (int ii=1; ii<=sizeVector; ii++)
res[keymap].push_back(vs[ii]); //add unconditionally,so merge duplicates in second vector
}
std::vector<std::string> res;
if (vec.size()==0)
return res;
- for (const auto & i : vec)
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
- if (i.find(tag)!=std::string::npos) res.push_back(i);
+ if ((*i).find(tag)!=std::string::npos) res.push_back(*i);
}
return res;
}
if (vec.size()==0) return res;
//shit for unique and unique_copy for the duplicate CONSECUTIVE elements
//I do not want to sort
- for (const auto & i : vec)
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
bool found=false;
- for (const auto & re : res)
+ for (std::vector<std::string>::const_iterator j=res.begin(); j!=res.end(); ++j)
{
- if (i.compare(re)==0)
+ if ((*i).compare(*j)==0)
{
found=true;
break;
}
}
- if (!found) res.push_back(i);
+ if (!found) res.push_back(*i);
}
return res;
}
std::map< std::string,std::vector<std::string> > MEDPARTITIONER::DeleteDuplicatesInMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap)
{
std::map< std::string,std::vector<std::string> > res;
- for (const auto & i : mymap)
- res[i.first]=DeleteDuplicatesInVectorOfString(i.second);
+ for (std::map< std::string,std::vector<std::string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ res[(*i).first]=DeleteDuplicatesInVectorOfString((*i).second);
return res;
}
void MEDPARTITIONER::Cle1ToData(const std::string& key, std::string& s, int& inew)
{
- std::size_t const posmax=key.size();
- std::size_t const found=key.find(' ');
+ std::size_t posmax=key.size();
+ std::size_t found=key.find(' ');
if ((found==std::string::npos) || (found<1))
throw INTERP_KERNEL::Exception("Error 'aStringWithoutWhitespace aInt' is expected");
s=key.substr(0,found);
void MEDPARTITIONER::Cle2ToData(const std::string& key, std::string& s, int& inew, int& iold)
{
- std::size_t const posmax=key.size();
- std::size_t const found=key.find(' ');
+ std::size_t posmax=key.size();
+ std::size_t found=key.find(' ');
if ((found==std::string::npos) || (found<1))
throw INTERP_KERNEL::Exception("Error 'aStringWithoutWhitespace aInt aInt' is expected");
s=key.substr(0,found);
res=res.substr(0,found);
return res;
}
- std::size_t const lg=StrToInt(description.substr(found-6,found));
+ std::size_t lg=StrToInt(description.substr(found-6,found));
beg+=tag.length();
return description.substr(beg,lg-tag.length());
}
std::vector<std::string> res;
if (fd->getArray())
{
- std::size_t const nb=fd->getArray()->getNumberOfComponents();
+ std::size_t nb=fd->getArray()->getNumberOfComponents();
res.push_back("nbComponents="); res.back()+=IntToStr((int)nb);
for (unsigned int i=0; i<nb; i++)
{
std::vector<std::string> MEDPARTITIONER::BrowseAllFields(const std::string& myfile)
{
std::vector<std::string> res;
- std::vector<std::string> const meshNames=MEDCoupling::GetMeshNames(myfile);
+ std::vector<std::string> meshNames=MEDCoupling::GetMeshNames(myfile);
- for (const auto & meshName : meshNames)
+ for (std::size_t i=0; i<meshNames.size(); i++)
{
- std::vector<std::string> const fieldNames=
- MEDCoupling::GetAllFieldNamesOnMesh(myfile,meshName);
- for (const auto & fieldName : fieldNames)
+ std::vector<std::string> fieldNames=
+ MEDCoupling::GetAllFieldNamesOnMesh(myfile,meshNames[i]);
+ for (std::size_t j = 0; j < fieldNames.size(); j++)
{
- std::vector< MEDCoupling::TypeOfField > const typeFields=
- MEDCoupling::GetTypesOfField(myfile, meshName, fieldName);
- for (auto & typeField : typeFields)
+ std::vector< MEDCoupling::TypeOfField > typeFields=
+ MEDCoupling::GetTypesOfField(myfile, meshNames[i], fieldNames[j]);
+ for (std::size_t k = 0; k < typeFields.size(); k++)
{
- std::vector< std::pair< int, int > > const its=
- GetFieldIterations(typeField, myfile, meshName, fieldName);
+ std::vector< std::pair< int, int > > its=
+ GetFieldIterations(typeFields[k], myfile, meshNames[i], fieldNames[j]);
if (MyGlobals::_Is0verbose>100)
- std::cout<< "fieldName " << fieldName << " typeField " << typeField << " its.size() " << its.size() << std::endl;
- for (auto & it : its)
+ std::cout<< "fieldName " << fieldNames[j] << " typeField " << typeFields[k] << " its.size() " << its.size() << std::endl;
+ for (std::size_t m = 0; m < its.size(); m++)
{
std::vector<std::string> resi;
resi.push_back("fileName="); resi.back()+=myfile;
- resi.push_back("meshName="); resi.back()+=meshName;
- resi.push_back("fieldName="); resi.back()+=fieldName;
- resi.push_back("typeField="); resi.back()+=IntToStr((int)typeField);
- resi.push_back("DT="); resi.back()+=IntToStr((int)it.first);
- resi.push_back("IT="); resi.back()+=IntToStr((int)it.second);
+ resi.push_back("meshName="); resi.back()+=meshNames[i];
+ resi.push_back("fieldName="); resi.back()+=fieldNames[j];
+ resi.push_back("typeField="); resi.back()+=IntToStr((int)typeFields[k]);
+ resi.push_back("DT="); resi.back()+=IntToStr((int)its[m].first);
+ resi.push_back("IT="); resi.back()+=IntToStr((int)its[m].second);
res.push_back(SerializeFromVectorOfString(resi));
}
}
return res;
}
-std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, const char * /*meshName*/, const int idomain)
+std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, const char *meshName, const int idomain)
{
const int lggeom=10;
const med_geometry_type GEOMTYPE[lggeom]={ //MED_N_CELL_FIXED_GEO] = {
};
std::vector<std::string> res;
- med_idt const fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- med_int const nbFields=MEDnField(fid);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
if (MyGlobals::_Verbose>20)
std::cout << "on filename " << fileName << " nbOfField " << nbFields << std::endl;
//
//
for(int i=1; i<=nbFields; i++)
{
- med_int const ncomp=MEDfieldnComponent(fid,i);
+ med_int ncomp=MEDfieldnComponent(fid,i);
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1];
med_int nbPdt;
MEDfieldInfo(fid,i,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
- std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
- std::string const curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
for (int k=1; k<=nbPdt; k++)
{
MEDfieldComputingStepInfo(fid,nomcha,k,&numdt,&numo,&dt);
for (int j=0; j<lggeom; j++)
{
med_int profilesize=0,nbi=0;
- med_entity_type const enttype=ENTITYTYPE[ie];
+ med_entity_type enttype=ENTITYTYPE[ie];
//enttype=MED_NODE;enttype=MED_CELL;enttype=MED_NODE_ELEMENT;
char pflname[MED_NAME_SIZE+1]="";
char locname[MED_NAME_SIZE+1]="";
- med_int const nbofprofile=MEDfieldnProfile(fid,nomcha,numdt,numo,enttype,GEOMTYPE[j],pflname,locname);
- int const profileit=1;
+ med_int nbofprofile=MEDfieldnProfile(fid,nomcha,numdt,numo,enttype,GEOMTYPE[j],pflname,locname);
+ int profileit=1;
if (enttype==MED_NODE)
{
- med_geometry_type const mygeomtype=MED_UNDEF_ENTITY_TYPE;
- med_int const nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,enttype,mygeomtype,profileit,
+ med_geometry_type mygeomtype=MED_UNDEF_ENTITY_TYPE;
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,enttype,mygeomtype,profileit,
MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi);
if (nbOfVal>0)
{
}
else
{
- med_geometry_type const mygeomtype=GEOMTYPE[j];
- med_int const nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,enttype,mygeomtype,profileit,
+ med_geometry_type mygeomtype=GEOMTYPE[j];
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,enttype,mygeomtype,profileit,
MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi);
if (nbOfVal>0)
{
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 1 >;
break;
default:
- _tree=nullptr;
+ _tree=0;
throw INTERP_KERNEL::Exception("BBTreeOfDim(): wrong space dimension");
}
}
void BBTreeOfDim::getElementsAroundPoint( const double* coordsPtr,
std::vector<mcIdType>& elems ) const
{
- auto* me = (BBTreeOfDim*) this;
+ BBTreeOfDim* me = (BBTreeOfDim*) this;
(me->*_PgetElementsAroundPoint) ( coordsPtr, elems );
}
void BBTreeOfDim::getIntersectingElems(const double* bb,
std::vector<mcIdType>& elems) const
{
- auto* me = (BBTreeOfDim*) this;
+ BBTreeOfDim* me = (BBTreeOfDim*) this;
(me->*_PgetIntersectingElems) ( bb, elems );
}
}
#ifndef __MEDPARTITIONER_UTILS_HXX__
#define __MEDPARTITIONER_UTILS_HXX__
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MCAuto.hxx"
#include "MEDPARTITIONER.hxx"
#include "MEDCouplingUMesh.hxx"
#include "BBTree.txx"
-#include <cstddef>
#include <string>
#include <vector>
#include <map>
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "MEDPARTITIONER_Utils.hxx"
#include "MEDLoader.hxx"
+#include "MEDLoaderBase.hxx"
+#include "MEDFileUtilities.hxx"
+#include "CellModel.hxx"
+#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
#include "InterpKernelException.hxx"
+#include "MCAuto.hxx"
+#include "MEDCouplingMemArray.txx"
+#include "InterpKernelAutoPtr.hxx"
-#include <cstddef>
+#include <fstream>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
-#include <vector>
#ifdef HAVE_MPI
*/
std::vector<std::string> MEDPARTITIONER::SendAndReceiveVectorOfString(const std::vector<std::string>& vec, const int source, const int target)
{
- int const rank=MyGlobals::_Rank;
+ int rank=MyGlobals::_Rank;
MPI_Status status;
- int const tag = 111001;
+ int tag = 111001;
if (rank == source)
{
- std::string const str=SerializeFromVectorOfString(vec);
- int const size=(int)str.length();
+ std::string str=SerializeFromVectorOfString(vec);
+ int size=(int)str.length();
MPI_Send( &size, 1, MPI_INT, target, tag, MPI_COMM_WORLD );
MPI_Send( (void*)str.data(), (int)str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD );
}
if (rank == target)
{
MPI_Recv(&recSize, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
- std::string const recData(recSize,'x');
+ std::string recData(recSize,'x');
MPI_Recv((void*)recData.data(), recSize, MPI_CHAR, source, tag+100, MPI_COMM_WORLD, &status);
return DeserializeToVectorOfString(recData); //not empty one for target proc
}
if (MyGlobals::_World_Size==1) //nothing to do
return vec;
- int const world_size=MyGlobals::_World_Size;
+ int world_size=MyGlobals::_World_Size;
std::string str=SerializeFromVectorOfString(vec);
std::vector<int> indexes(world_size);
- int const size=(int)str.length();
+ int size=(int)str.length();
MPI_Allgather(&size, 1, MPI_INT,
&indexes[0], 1, MPI_INT, MPI_COMM_WORLD);
*/
void MEDPARTITIONER::SendDoubleVec(const std::vector<double>& vec, const int target)
{
- int const tag = 111002;
+ int tag = 111002;
int size=(int)vec.size();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendDoubleVec " << size << std::endl;
*/
std::vector<double>* MEDPARTITIONER::RecvDoubleVec(const int source)
{
- int const tag = 111002;
+ int tag = 111002;
int size;
#ifdef HAVE_MPI
MPI_Status status;
void MEDPARTITIONER::RecvDoubleVec(std::vector<double>& vec, const int source)
{
- int const tag = 111002;
+ int tag = 111002;
int size;
#ifdef HAVE_MPI
MPI_Status status;
*/
void MEDPARTITIONER::SendIntVec(const std::vector<mcIdType>& vec, const int target)
{
- int const tag = 111003;
+ int tag = 111003;
int size=(int)vec.size();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendIntVec " << size << std::endl;
*/
std::vector<int> *MEDPARTITIONER::RecvIntVec(const int source)
{
- int const tag = 111003;
+ int tag = 111003;
int size;
#ifdef HAVE_MPI
MPI_Status status;
void MEDPARTITIONER::RecvIntVec(std::vector<mcIdType>& vec, const int source)
{
- int const tag = 111003;
+ int tag = 111003;
int size;
#ifdef HAVE_MPI
MPI_Status status;
*/
void MEDPARTITIONER::SendDataArrayInt(const MEDCoupling::DataArrayInt *da, const int target)
{
- if (da==nullptr)
+ if (da==0)
throw INTERP_KERNEL::Exception("Problem send DataArrayInt* NULL");
- int const tag = 111004;
+ int tag = 111004;
int size[3];
size[0]=(int)da->getNbOfElems();
size[1]=(int)da->getNumberOfTuples();
*/
MEDCoupling::DataArrayInt *MEDPARTITIONER::RecvDataArrayInt(const int source)
{
- int const tag = 111004;
+ int tag = 111004;
int size[3];
#ifdef HAVE_MPI
MPI_Status status;
*/
void MEDPARTITIONER::SendDataArrayDouble(const MEDCoupling::DataArrayDouble *da, const int target)
{
- if (da==nullptr)
+ if (da==0)
throw INTERP_KERNEL::Exception("Problem send DataArrayDouble* NULL");
- int const tag = 111005;
+ int tag = 111005;
int size[3];
size[0]=(int)da->getNbOfElems();
size[1]=(int)da->getNumberOfTuples();
*/
MEDCoupling::DataArrayDouble* MEDPARTITIONER::RecvDataArrayDouble(const int source)
{
- int const tag = 111005;
+ int tag = 111005;
int size[3];
#ifdef HAVE_MPI
MPI_Status status;
void MEDPARTITIONER::TestMapOfStringIntMpi()
{
- int const rank=MyGlobals::_Rank;
+ int rank=MyGlobals::_Rank;
std::map<std::string,mcIdType> myMap;
myMap["one"]=1;
myMap["two"]=22; //a bug
void MEDPARTITIONER::TestMapOfStringVectorOfStringMpi()
{
- int const rank=MyGlobals::_Rank;
+ int rank=MyGlobals::_Rank;
std::vector<std::string> myVector;
std::ostringstream oss;
oss << "hello from " << std::setw(5) << MyGlobals::_Rank << " " << std::string(rank+1,'n') << " next is an empty one";
void MEDPARTITIONER::TestDataArrayMpi()
{
- int const rank=MyGlobals::_Rank;
+ int rank=MyGlobals::_Rank;
//int
{
MEDCoupling::DataArrayInt* send=MEDCoupling::DataArrayInt::New();
- MEDCoupling::DataArrayInt* recv=nullptr;
- int const nbOfTuples=5;
- int const numberOfComponents=3;
+ MEDCoupling::DataArrayInt* recv=0;
+ int nbOfTuples=5;
+ int numberOfComponents=3;
send->alloc(nbOfTuples,numberOfComponents);
std::vector<int> vals;
for (int j=0; j<nbOfTuples; j++)
//double
{
MEDCoupling::DataArrayDouble* send=MEDCoupling::DataArrayDouble::New();
- MEDCoupling::DataArrayDouble* recv=nullptr;
- int const nbOfTuples=5;
- int const numberOfComponents=3;
+ MEDCoupling::DataArrayDouble* recv=0;
+ int nbOfTuples=5;
+ int numberOfComponents=3;
send->alloc(nbOfTuples,numberOfComponents);
std::vector<double> vals;
for (int j=0; j<nbOfTuples; j++)
void MEDPARTITIONER::TestPersistantMpi0To1(int taille, int nb)
{
double temps_debut=MPI_Wtime();
- int const rank=MyGlobals::_Rank;
+ int rank=MyGlobals::_Rank;
std::vector<int> x, y;
- int const tag=111111;
+ int tag=111111;
MPI_Request requete0, requete1;
MPI_Status statut;
int ok=0;
void MEDPARTITIONER::TestPersistantMpiRingOnCommSplit(int size, int nb)
{
double temps_debut=MPI_Wtime();
- int const rank=MyGlobals::_Rank;
+ int rank=MyGlobals::_Rank;
MPI_Comm newcomm;
int color=1;
- int const rankMax=4;
+ int rankMax=4;
if (rank>=rankMax)
color=MPI_UNDEFINED;
//MPI_Comm_dup (MPI_COMM_WORLD, &newcomm) ;
#include "MEDPARTITIONERTest.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
#include "MEDPARTITIONER_MeshCollection.hxx"
#include "MEDPARTITIONER_ParallelTopology.hxx"
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "CellModel.hxx"
#include "MEDFileMesh.hxx"
#include "MEDLoader.hxx"
+#include "MEDLoaderBase.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingMemArray.txx"
+#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingMultiFields.hxx"
-#include "NormalizedGeometricTypes"
#include <cppunit/TestAssert.h>
-#include <iostream>
-#include <memory>
+#include <sstream>
#include <fstream>
#include <cmath>
+#include <list>
+#include <stdexcept>
#include <cstdlib>
-#include <string>
#include <vector>
#ifdef WIN32
#include<direct.h>
if (my_file.good())
return execName;
}
- execName = getcwd(nullptr, 0);
+ execName = getcwd(NULL, 0);
#ifndef WIN32
execName += "/../../MEDPartitioner/medpartitioner";
#else
std::copy(conn.begin()+i*8,conn.begin()+(i+1)*8,onehexa);
if (false) //(_verbose)
{
- for (long const j : onehexa) cout<<j<<" ";
+ for (int j=0; j<8; j++) cout<<onehexa[j]<<" ";
cout<<endl;
}
mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,onehexa);
for (int j=0; j<=_nj; j++)
for (int i=0; i<=_ni; i++)
{
- int const k=j;
+ int k=j;
coor.push_back(i+.1);
coor.push_back(j+.2);
coor.push_back(k+.3);
}
int ii;
- int const k=0;
+ int k=0;
for (int j=0; j<_nj; j++)
for (int i=0; i<_ni; i++)
{
std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
if (false) //(_verbose)
{
- for (long const j : onequa) cout<<j<<" ";
+ for (int j=0; j<4; j++) cout<<onequa[j]<<" ";
cout<<endl;
}
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,onequa);
for (int j=0; j<=_nj; j++)
for (int i=0; i<=_ni; i++)
{
- int const k=0;
+ int k=0;
coor.push_back(i+.1);
coor.push_back(j+.2);
coor.push_back(k+.3);
}
int ii;
- int const k=0;
+ int k=0;
for (int j=0; j<_nj; j++)
for (int i=0; i<_ni; i++)
{
std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
if (false) //(_verbose)
{
- for (long const j : onequa) cout<<j<<" ";
+ for (int j=0; j<4; j++) cout<<onequa[j]<<" ";
cout<<endl;
}
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,onequa);
}
MEDCouplingUMesh *mesh=ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0);
- mcIdType const nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
f1->setDescription("DescriptionOfFieldOnCells"); //not saved in file?
}
MEDCouplingUMesh *mesh=ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0);
- mcIdType const nbOfNodes=mesh->getNumberOfNodes();
+ mcIdType nbOfNodes=mesh->getNumberOfNodes();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VectorFieldOnNodes");
f1->setDescription("DescriptionOfFieldOnNodes"); //not saved in file?
DataArrayDouble* coords=mesh->getCoords();
//int nbOfComp=coords->getNumberOfComponents(); //be 3D
- mcIdType const nbOfTuple=coords->getNumberOfTuples();
+ mcIdType nbOfTuple=coords->getNumberOfTuples();
double* ptr=coords->getPointer();
double* ptrini=ptrInit;
for (mcIdType i=0; i<nbOfTuple; i++)
//more nbptgauss=8 by default needs set MEDCouplingFieldDiscretizationPerCell
//theory: (may be) http://www.code-aster.org/V2/doc/v9/fr/man_r/r3/r3.06.03.pdf
- int const nbptgauss=8; //nb pt de gauss by cell
- mcIdType const nbcell=f3->getMesh()->getNumberOfCells();
- mcIdType const nb=nbcell*nbptgauss;
- int const nbcomp=2;
+ int nbptgauss=8; //nb pt de gauss by cell
+ mcIdType nbcell=f3->getMesh()->getNumberOfCells();
+ mcIdType nb=nbcell*nbptgauss;
+ int nbcomp=2;
array->alloc(nb,nbcomp);
double *ptr=array->getPointer();
int ii=0;
createTestMeshes();
MyGlobals::_World_Size=1;
MyGlobals::_Rank=0;
- string const fileName=_file_name_with_faces;
+ string fileName=_file_name_with_faces;
MEDPARTITIONER::ParaDomainSelector parallelizer(false);
- MEDPARTITIONER::MeshCollection const collection(fileName,parallelizer);
+ MEDPARTITIONER::MeshCollection collection(fileName,parallelizer);
CPPUNIT_ASSERT(collection.isParallelMode());
CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension());
CPPUNIT_ASSERT(collection.getName()=="testMesh");
{
setSmallSize();
createHugeTestMesh(_ni, _nj, _nk, 2, 2, 2, 32); //xml but not so huge
- string const fileName=_file_name_huge_xml;
+ string fileName=_file_name_huge_xml;
MEDPARTITIONER::ParaDomainSelector parallelizer(false);
- MEDPARTITIONER::MeshCollection const collection(fileName,parallelizer);
+ MEDPARTITIONER::MeshCollection collection(fileName,parallelizer);
CPPUNIT_ASSERT(collection.isParallelMode());
CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension());
CPPUNIT_ASSERT(collection.getName()=="testMesh");
setSmallSize();
createTestMeshes();
//MyGlobals::_Verbose=500;
- string const fileName=_file_name_with_faces;
- int const ndomains=2;
+ string fileName=_file_name_with_faces;
+ int ndomains=2;
bool split_family=false;
bool empty_groups=false;
MEDPARTITIONER::ParaDomainSelector parallelizer(false);
MEDPARTITIONER::MeshCollection collection(fileName,parallelizer);
- auto* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
+ MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
//Creating the graph and partitioning it
auto_ptr< MEDPARTITIONER::Topology > new_topo;
{
setSmallSize();
createHugeTestMesh(_ni, _nj, _nk, 2, 2, 2, 32); //xml on 2*2*2 meshes but not so huge
- string const fileName=_file_name_huge_xml;
+ string fileName=_file_name_huge_xml;
bool split_family=false;
bool empty_groups=false;
MEDPARTITIONER::ParaDomainSelector parallelizer(false);
MEDPARTITIONER::MeshCollection collection(fileName,parallelizer);
- auto* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
+ MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
for (int ndomains=2 ; ndomains<=16 ; ndomains++)
//#if !defined(HAVE_MPI)
setSmallSize();
createTestMeshes();
- std::string const MetisOrScotch("metis");
+ std::string MetisOrScotch("metis");
launchMetisOrScotchMedpartitionerOnTestMeshes(MetisOrScotch);
verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(MetisOrScotch);
verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnCells(MetisOrScotch);
std::vector<MEDCoupling::MEDCouplingUMesh*>cellMeshes=collection.getMesh();
CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size());
mcIdType nbcells=0;
- for (auto & cellMeshe : cellMeshes)
- nbcells+=cellMeshe->getNumberOfCells();
+ for (std::size_t i = 0; i < cellMeshes.size(); i++)
+ nbcells+=cellMeshes[i]->getNumberOfCells();
CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
std::vector<MEDCoupling::MEDCouplingUMesh*>faceMeshes=collection.getFaceMesh();
CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size());
mcIdType nbfaces=0;
- for (auto & faceMeshe : faceMeshes)
- nbfaces+=faceMeshe->getNumberOfCells();
+ for (std::size_t i=0; i < faceMeshes.size(); i++)
+ nbfaces+=faceMeshes[i]->getNumberOfCells();
CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces);
//merge split meshes and test equality
mcIdType* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- std::size_t const i1=pc[i]*nbcomp;
- std::size_t const i2=i*nbcomp;
+ std::size_t i1=pc[i]*nbcomp;
+ std::size_t i2=i*nbcomp;
for (std::size_t j = 0; j < nbcomp; j++)
{
if (p1[i1+j]==p2[i2+j]) nbequal++;
}
int nbequal=0;
- int const nbptgauss=8;
+ int nbptgauss=8;
std::size_t nbcomp=field1->getNumberOfComponents();
double* p1=f1->getPointer();
double* p2=f2->getPointer();
mcIdType* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- std::size_t const i1=pc[i]*nbcomp*nbptgauss;
- std::size_t const i2=i*nbcomp*nbptgauss;
+ std::size_t i1=pc[i]*nbcomp*nbptgauss;
+ std::size_t i2=i*nbcomp*nbptgauss;
for (std::size_t j = 0; j < nbcomp*nbptgauss; j++)
{
if (p1[i1+j]==p2[i2+j]) nbequal++;
const int ndomains = 4;
ParaDomainSelector parallelizer(false);
MeshCollection collection(fileName,parallelizer);
- auto* aPT = (ParallelTopology*) collection.getTopology();
+ ParallelTopology* aPT = (ParallelTopology*) collection.getTopology();
aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
std::unique_ptr< Topology > new_topo;
#ifndef __MEDPARTITIONERTEST_HXX__
#define __MEDPARTITIONERTEST_HXX__
-#include <cppunit/TestFixture.h>
#ifdef WIN32
# if defined MEDPARTITIONERTEST_EXPORTS || defined MEDPARTITIONERTest_EXPORTS
# define MEDPARTITIONERTEST_EXPORT __declspec( dllexport )
#include <cppunit/extensions/HelperMacros.h>
+#include <set>
#include <string>
+#include <iostream>
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
void deleteTestMeshes();
//for CPPUNIT_TEST
- void setUp() override;
- void tearDown() override;
+ void setUp();
+ void tearDown();
void testMeshCollectionSingle();
void testMeshCollectionXml();
#if defined(MED_ENABLE_METIS)
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDPARTITIONERTest.hxx"
#include "MEDPARTITIONER_MeshCollection.hxx"
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_Utils.hxx"
+#include "CellModel.hxx"
#include "MEDFileMesh.hxx"
#include "MEDLoader.hxx"
+#include "MEDLoaderBase.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include <cppunit/TestAssert.h>
-#include <fstream>
-#include <iostream>
+#include <sstream>
#include <cmath>
+#include <list>
+#include <stdexcept>
#include <cstdlib>
-#include <string>
+#include <vector>
#include <unistd.h> // get_current_dir_name()
{
execName=getenv("MEDCOUPLING_ROOT_DIR");
execName+="/bin/medpartitioner_para";
- std::ifstream const my_file(execName.c_str());
+ std::ifstream my_file(execName.c_str());
if (my_file.good())
return execName;
}
input=targetName+".xml";
MEDPARTITIONER::ParaDomainSelector parallelizer(false);
- MEDPARTITIONER::MeshCollection const collection(input,parallelizer);
+ MEDPARTITIONER::MeshCollection collection(input,parallelizer);
CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension());
std::vector<MEDCoupling::MEDCouplingUMesh*>cellMeshes=collection.getMesh();
CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size());
int* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- int const i1=pc[i]*nbcomp;
- int const i2=i*nbcomp;
+ int i1=pc[i]*nbcomp;
+ int i2=i*nbcomp;
for (int j = 0; j < nbcomp; j++)
{
if (p1[i1+j]==p2[i2+j]) nbequal++;
}
int nbequal=0;
- int const nbptgauss=8;
+ int nbptgauss=8;
int nbcomp=field1->getNumberOfComponents();
double* p1=f1->getPointer();
double* p2=f2->getPointer();
int* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- int const i1=pc[i]*nbcomp*nbptgauss;
- int const i2=i*nbcomp*nbptgauss;
+ int i1=pc[i]*nbcomp*nbptgauss;
+ int i2=i*nbcomp*nbptgauss;
for (int j = 0; j < nbcomp*nbptgauss; j++)
{
if (p1[i1+j]==p2[i2+j]) nbequal++;
//include all MEDPARTITIONER Test
#include "MEDPARTITIONERTest.hxx"
-#include <cppunit/extensions/HelperMacros.h>
//Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION( MEDPARTITIONERTest );
#include "MEDPARTITIONER_Utils.hxx"
*/
-#include "InterpKernelException.hxx"
#include "MEDPARTITIONER_MeshCollection.hxx"
#include "MEDPARTITIONER_ParallelTopology.hxx"
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_Utils.hxx"
-#include <stdio.h>
-#include <memory>
-#include <cstdio>
-#include <exception>
#include <string>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <iostream>
-#include <vector>
using namespace std;
using namespace MEDPARTITIONER;
// Defining options
// by parsing the command line
- bool const split_family=false;
- bool const empty_groups=false;
+ bool split_family=false;
+ bool empty_groups=false;
bool mesure_memory=false;
- bool const filter_face=true;
+ bool filter_face=true;
string input;
string output;
- string const meshname;
+ string meshname;
string library="metis"; //default
int ndomains;
int help=0;
MyGlobals::_Create_Joints=0;
// Primitive parsing of command-line options
- string const desc ("Available options of medpartitioner V1.0:\n"
+ string desc ("Available options of medpartitioner V1.0:\n"
"\t--help : produces this help message\n"
"\t--verbose : echoes arguments\n"
"\t--input-file=<string> : name of the input .med file or .xml master file\n"
//testing whether it is possible to write a file at the specified location
if (MyGlobals::_Rank==0)
{
- string const outputtest = output + ".testioms.";
- ofstream const testfile (outputtest.c_str());
+ string outputtest = output + ".testioms.";
+ ofstream testfile (outputtest.c_str());
if (testfile.fail())
{
cerr << "output-file directory does not exist or is in read-only access" << endl;
}*/
MEDPARTITIONER::ParaDomainSelector parallelizer(mesure_memory);
MEDPARTITIONER::MeshCollection collection(input,parallelizer);
- auto* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
+ MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
//to have unique valid fields names/pointers/descriptions for partitionning
collection.prepareFieldDescriptions();
r2=SelectTagsInVectorOfString(r2,"meshName=");
if (r2.size()==(collection.getMesh()).size())
{
- for (auto & i : r2)
- i=EraseTagSerialized(i,"ioldDomain=");
+ for (std::size_t i=0; i<r2.size(); i++)
+ r2[i]=EraseTagSerialized(r2[i],"ioldDomain=");
r2=DeleteDuplicatesInVectorOfString(r2);
if (r2.size()==1)
{
- string const finalMesh="finalMeshName="+ExtractFromDescription(r2[0], "meshName=");
+ string finalMesh="finalMeshName="+ExtractFromDescription(r2[0], "meshName=");
finalInformations.push_back(SerializeFromString(finalMesh));
}
}
r2=SelectTagsInVectorOfString(r1,"fieldName=");
r2=SelectTagsInVectorOfString(r2,"nbComponents=");
//may be yes? or not?
- for (auto & i : r2)
- i=EraseTagSerialized(i,"ioldFieldDouble=");
+ for (std::size_t i=0; i<r2.size(); i++)
+ r2[i]=EraseTagSerialized(r2[i],"ioldFieldDouble=");
r2=DeleteDuplicatesInVectorOfString(r2);
- for (const auto & i : r2)
- finalInformations.push_back(i);
+ for (std::size_t i=0; i<r2.size(); i++)
+ finalInformations.push_back(r2[i]);
MyGlobals::_General_Informations=finalInformations;
if (MyGlobals::_Is0verbose)
*/
+#include "MEDPARTITIONER_MeshCollection.hxx"
+#include "MEDPARTITIONER_ParallelTopology.hxx"
+#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_Utils.hxx"
+#include "MEDLoader.hxx"
+#include <fstream>
#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <string>
#include <cstring>
#ifdef HAVE_MPI
using namespace std;
using namespace MEDPARTITIONER;
-int main(int /*argc*/, char** /*argv*/)
+int main(int argc, char** argv)
{
#if !defined(MED_ENABLE_PARMETIS)
cout << "Sorry, no one split method is available. Please, compile with ParMETIS."<<endl;
// Author : Anthony Geay (EDF R&D)
#include "ParaMEDFileMesh.hxx"
-#include "InterpKernelAutoPtr.hxx"
#include "MCAuto.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "MEDFileMesh.hxx"
#include "MEDFileMeshLL.hxx"
+#include "MEDLoader.hxx"
#include "MEDFileField1TS.hxx"
#include "MEDFileUtilities.hxx"
#include "MEDFileEntities.hxx"
-#include "med.h"
-#include "NormalizedGeometricTypes"
-#include "MEDLoader.hxx"
-#include <string>
+#include <iostream>
+#include <fstream>
// From MEDLOader.cxx TU
* Loads mesh \a mName in parallel using a custom partition of the mesh cells among the processes.
* See ParaMEDFileUMesh::ParaNew for detailed description.
*/
-MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, const MPI_Comm& com, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, const std::string& /*fileName*/, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, const MPI_Comm& com, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MCAuto<MEDFileUMesh> ret;
for(std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>::const_iterator iter=distrib.begin(); iter!= distrib.end(); iter++)
#include "mpi.h"
#include <string>
+#include <vector>
+#include <map>
+#include "MCIdType.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "NormalizedGeometricTypes"
-#include "MCIdType.hxx"
namespace MEDCoupling
{
class ParaMEDFileMesh
{
public:
- static MEDFileMesh *New(int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- static MEDFileMesh *ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
+ static MEDFileMesh *New(int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ static MEDFileMesh *ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
};
class ParaMEDFileUMesh
{
public:
- static MEDFileUMesh *New(int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- static MEDFileUMesh *ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
- static MEDFileUMesh *ParaNew(const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>&, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr);
+ static MEDFileUMesh *New(int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ static MEDFileUMesh *ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ static MEDFileUMesh *ParaNew(const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>&, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
private:
static MEDFileUMesh *NewPrivate(med_idt fid, int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
#include "BlockTopology.hxx"
#include "MEDCouplingUMesh.hxx"
-#include <cstddef>
#include <fstream>
#include <sstream>
using namespace MEDCoupling;
ParaMEDLoader::ParaMEDLoader()
-= default;
+{
+}
void ParaMEDLoader::WriteParaMesh(const char *fileName, MEDCoupling::ParaMESH *mesh)
{
if(!mesh->getBlockTopology()->getProcGroup()->containsMyRank())
return ;
- int const myRank=mesh->getBlockTopology()->getProcGroup()->myRank();
- int const nbDomains=mesh->getBlockTopology()->getProcGroup()->size();
+ int myRank=mesh->getBlockTopology()->getProcGroup()->myRank();
+ int nbDomains=mesh->getBlockTopology()->getProcGroup()->size();
std::vector<std::string> fileNames(nbDomains);
for(int i=0;i<nbDomains;i++)
{
//
#include "BlockTopology.hxx"
-#include "MCType.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingCMesh.hxx"
#include "CommInterface.hxx"
-#include "ParaIdType.hxx"
#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
#include "ComponentTopology.hxx"
#include "InterpKernelUtilities.hxx"
-#include <cstddef>
+#include <vector>
#include <algorithm>
#include <utility>
#include <iostream>
-#include <vector>
using namespace std;
*/
BlockTopology::BlockTopology(const ProcessorGroup& group, mcIdType nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false)
{
- auto* nbelems_per_proc = new mcIdType[group.size()];
- const auto* mpi_group=dynamic_cast<const MPIProcessorGroup*>(_proc_group);
+ mcIdType* nbelems_per_proc = new mcIdType[group.size()];
+ const MPIProcessorGroup* mpi_group=dynamic_cast<const MPIProcessorGroup*>(_proc_group);
const MPI_Comm* comm=mpi_group->getComm();
mcIdType nbtemp=nb_elem;
mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_ID_TYPE,
{
int subdomain_id=0;
mcIdType position=global;
- mcIdType const size=_nb_elems;
- std::size_t const size_procs=_proc_group->size();
+ mcIdType size=_nb_elems;
+ std::size_t size_procs=_proc_group->size();
mcIdType increment=size;
vector<mcIdType>axis_position(_dimension);
vector<mcIdType>axis_offset(_dimension);
std::size_t axis_size=_local_array_indices[idim].size()-1;
mcIdType axis_nb_elem=_local_array_indices[idim][axis_size];
increment=increment/axis_nb_elem;
- int const proc_increment = (int)(size_procs/axis_size);
- mcIdType const axis_pos=position/increment;
+ int proc_increment = (int)(size_procs/axis_size);
+ mcIdType axis_pos=position/increment;
position=position%increment;
int iaxis=1;
while (_local_array_indices[idim][iaxis]<=axis_pos)
mcIdType axis_nb_elem=_local_array_indices[idim][axis_size];
increment=axis_nb_elem==0?0:increment/axis_nb_elem;
proc_increment = proc_increment/axis_size;
- std::size_t const proc_axis=subdomain_id/proc_increment;
+ std::size_t proc_axis=subdomain_id/proc_increment;
subdomain_id=subdomain_id%proc_increment;
mcIdType local_axis_nb_elem=_local_array_indices[idim][proc_axis+1]-_local_array_indices[idim][proc_axis];
local_increment = (local_axis_nb_elem==0)?0:(local_increment/local_axis_nb_elem);
for (int i=_dimension-1; i>=0; i--)
{
increment *=_nb_procs_per_dim[i];
- int const idim=position%increment;
+ int idim=position%increment;
position=position/increment;
mcIdType imin=_local_array_indices[i][idim];
mcIdType imax=_local_array_indices[i][idim+1];
std::vector<std::pair<int,mcIdType> > BlockTopology::getLocalArrayMinMax() const
{
vector<pair<int,mcIdType> > local_indices (_dimension);
- int const myrank=_proc_group->myRank();
+ int myrank=_proc_group->myRank();
int increment=1;
for (int i=_dimension-1; i>=0; i--)
{
increment *=_nb_procs_per_dim[i];
- int const idim=myrank%increment;
+ int idim=myrank%increment;
local_indices[i].first=(int)_local_array_indices[i][idim];
local_indices[i].second=_local_array_indices[i][idim+1];
cout << local_indices[i].first << " "<< local_indices[i].second<<endl;
//serializing the comm group
mcIdType size_comm=_proc_group->size();
buffer.push_back(size_comm);
- MPIProcessorGroup const world_group(_proc_group->getCommInterface());
+ MPIProcessorGroup world_group(_proc_group->getCommInterface());
for (int i=0; i<size_comm;i++)
{
int world_rank=world_group.translateRank(_proc_group, i);
_local_array_indices[i][j]=*(ptr_serializer++);
}
set<int> procs;
- mcIdType const size_comm=*(ptr_serializer++);
+ mcIdType size_comm=*(ptr_serializer++);
for (int i=0; i<size_comm; i++)
procs.insert((int)*(ptr_serializer++));
#ifndef __BLOCKTOPOLOGY_HXX__
#define __BLOCKTOPOLOGY_HXX__
-#include "MCType.hxx"
-#include "CommInterface.hxx"
#include "Topology.hxx"
#include "ProcessorGroup.hxx"
-#include <utility>
#include <vector>
namespace MEDCoupling
BlockTopology(const ProcessorGroup& group, MEDCouplingCMesh *grid);
BlockTopology(const BlockTopology& geom_topo, const ComponentTopology& comp_topo);
BlockTopology(const ProcessorGroup& group, mcIdType nb_elem);
- ~BlockTopology() override;
+ virtual ~BlockTopology();
void release();
//!Retrieves the number of elements for a given topology
- mcIdType getNbElements()const override { return _nb_elems; }
- mcIdType getNbLocalElements() const override;
- const ProcessorGroup* getProcGroup()const override { return _proc_group; }
+ mcIdType getNbElements()const { return _nb_elems; }
+ mcIdType getNbLocalElements() const;
+ const ProcessorGroup* getProcGroup()const { return _proc_group; }
std::pair<int,mcIdType> globalToLocal (const mcIdType) const ;
mcIdType localToGlobal (const std::pair<int,mcIdType>) const;
std::vector<std::pair<int,mcIdType> > getLocalArrayMinMax() const ;
#include "ByStringMPIProcessorGroup.hxx"
-#include <cstddef>
-#include <string>
-#include "MPIProcessorGroup.hxx"
+#include <iostream>
+#include <set>
+#include <algorithm>
#include "mpi.h"
using namespace std;
}
ByStringMPIProcessorGroup::~ByStringMPIProcessorGroup()
- = default;
+ {
+ }
ByStringMPIProcessorGroup *ByStringMPIProcessorGroup::deepCopy() const
{
#define __BYSTRINGMPIPROCESSORGROUP_HXX__
#include "MPIProcessorGroup.hxx"
-#include <string>
namespace MEDCoupling
{
ByStringMPIProcessorGroup(const CommInterface& interface);
ByStringMPIProcessorGroup(const CommInterface& interface, const std::string& simCodeTag, const MPI_Comm& world_comm=MPI_COMM_WORLD);
ByStringMPIProcessorGroup(const ByStringMPIProcessorGroup& other);
- ~ByStringMPIProcessorGroup() override;
- ByStringMPIProcessorGroup *deepCopy() const override;
+ virtual ~ByStringMPIProcessorGroup();
+ virtual ByStringMPIProcessorGroup *deepCopy() const;
};
}
//
#include "CommInterface.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingMemArray.hxx"
namespace MEDCoupling
{
#pragma once
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingTraits.hxx"
#include "ParaIdType.hxx"
#include "MEDCouplingMemArray.hxx"
-#include <limits>
-#include <cstddef>
#include <mpi.h>
-#include <numeric>
#include <memory>
+#include <numeric>
namespace MEDCoupling
{
class CommInterface
{
public:
- CommInterface() = default;
- virtual ~CommInterface() = default;
+ CommInterface() { }
+ virtual ~CommInterface() { }
int worldSize() const {
int size;
MPI_Comm_size(MPI_COMM_WORLD, &size);
#include "ComponentTopology.hxx"
#include "ProcessorGroup.hxx"
+#include "InterpolationUtils.hxx"
namespace MEDCoupling
{
*/
ComponentTopology::ComponentTopology(int nb_comp, ProcessorGroup* group):_proc_group(group)
{
- int const nb_blocks=group->size();
+ int nb_blocks=group->size();
if (nb_blocks>nb_comp)
throw INTERP_KERNEL::Exception("ComponentTopology Number of components must be larger than number of blocks");
/* Generic constructor for \a nb_comp components equally parted
* in \a nb_blocks blocks
*/
- ComponentTopology::ComponentTopology(int nb_comp, int nb_blocks):_proc_group(nullptr)
+ ComponentTopology::ComponentTopology(int nb_comp, int nb_blocks):_proc_group(0)
{
if (nb_blocks>nb_comp)
throw INTERP_KERNEL::Exception("ComponentTopology Number of components must be larger than number of blocks");
}
//!Constructor for one block of \a nb_comp components
- ComponentTopology::ComponentTopology(int nb_comp):_proc_group(nullptr)
+ ComponentTopology::ComponentTopology(int nb_comp):_proc_group(0)
{
_component_array.resize(2);
}
//! Constructor for one component
- ComponentTopology::ComponentTopology():_proc_group(nullptr)
+ ComponentTopology::ComponentTopology():_proc_group(0)
{
_component_array.resize(2);
_component_array[0]=0;
}
ComponentTopology::~ComponentTopology()
- = default;
+ {
+ }
int ComponentTopology::nbLocalComponents() const
{
- if (_proc_group==nullptr)
+ if (_proc_group==0)
return nbComponents();
int nbcomp;
- int const myrank = _proc_group->myRank();
+ int myrank = _proc_group->myRank();
if (myrank!=-1)
nbcomp = _component_array[myrank+1]-_component_array[myrank];
else
int ComponentTopology::firstLocalComponent() const
{
- if (_proc_group==nullptr)
+ if (_proc_group==0)
return 0;
int icomp;
- int const myrank = _proc_group->myRank();
+ int myrank = _proc_group->myRank();
if (myrank!=-1)
icomp = _component_array[myrank];
else
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#include "CommInterface.hxx"
+#include "Topology.hxx"
+#include "BlockTopology.hxx"
+#include "ComponentTopology.hxx"
+#include "ParaFIELD.hxx"
+#include "ParaMESH.hxx"
#include "DEC.hxx"
+#include "ICoCoMEDDoubleField.hxx"
+#include "MPIProcessorGroup.hxx"
#include <cmath>
namespace MEDCoupling
{
- DEC::DEC():_comm_interface(nullptr)
+ DEC::DEC():_comm_interface(0)
{
}
}
DEC::~DEC()
- = default;
+ {
+ }
}
#ifndef __DEC_HXX__
#define __DEC_HXX__
+#include "MEDCouplingFieldDouble.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "DECOptions.hxx"
namespace MEDCoupling
{
protected:
std::string _method;
- bool _asynchronous{false};
- TimeInterpolationMethod _timeInterpolationMethod{WithoutTimeInterp};
- AllToAllMethod _allToAllMethod{Native};
- bool _forcedRenormalization{false};
+ bool _asynchronous;
+ TimeInterpolationMethod _timeInterpolationMethod;
+ AllToAllMethod _allToAllMethod;
+ bool _forcedRenormalization;
public:
- DECOptions():_method("P0")
-
+ DECOptions():_method("P0"),
+ _asynchronous(false),
+ _timeInterpolationMethod(WithoutTimeInterp),
+ _allToAllMethod(Native),
+ _forcedRenormalization(false)
{
}
#include "DisjointDEC.hxx"
#include "CommInterface.hxx"
-#include "DEC.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MEDCouplingPointSet.hxx"
-#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "Topology.hxx"
+#include "BlockTopology.hxx"
#include "ComponentTopology.hxx"
#include "ParaFIELD.hxx"
#include "ParaMESH.hxx"
+#include "ICoCoField.hxx"
#include "ICoCoMEDDoubleField.hxx"
#include "MPIProcessorGroup.hxx"
#include <cmath>
+#include <iostream>
namespace MEDCoupling
{
DisjointDEC::DisjointDEC(ProcessorGroup& source_group, ProcessorGroup& target_group):
- _local_field(nullptr),
+ _local_field(0),
_source_group(&source_group),
_target_group(&target_group),
- _comm_interface(nullptr),
+ _comm_interface(0),
_owns_field(false),
_owns_groups(false),
_union_comm(MPI_COMM_NULL)
DisjointDEC::DisjointDEC(const DisjointDEC& s):
DEC(s),
- _local_field(nullptr),
- _union_group(nullptr),
- _source_group(nullptr),
- _target_group(nullptr),
- _comm_interface(nullptr),
+ _local_field(0),
+ _union_group(0),
+ _source_group(0),
+ _target_group(0),
+ _comm_interface(0),
_owns_field(false),
_owns_groups(false),
_union_comm(MPI_COMM_NULL)
DisjointDEC::DisjointDEC(const std::set<int>& source_ids,
const std::set<int>& target_ids,
const MPI_Comm& world_comm):
- _local_field(nullptr),
- _comm_interface(nullptr),
+ _local_field(0),
+ _comm_interface(0),
_owns_field(false),
_owns_groups(true),
_union_comm(MPI_COMM_NULL)
{
- MEDCoupling::CommInterface const comm;
+ MEDCoupling::CommInterface comm;
// Create the list of procs including source and target
std::set<int> union_ids; // source and target ids in world_comm
union_ids.insert(source_ids.begin(),source_ids.end());
delete[] union_ranks_world;
if (_union_comm==MPI_COMM_NULL)
{ // This process is not in union
- _source_group=nullptr;
- _target_group=nullptr;
- _union_group=nullptr;
+ _source_group=0;
+ _target_group=0;
+ _union_group=0;
comm.groupFree(&union_group);
comm.groupFree(&world_group);
return;
void DisjointDEC::checkPartitionGroup() const
{
int size = -1;
- auto * tgt = static_cast<MPIProcessorGroup *>(_target_group);
- auto * src = static_cast<MPIProcessorGroup *>(_source_group);
+ MPIProcessorGroup * tgt = static_cast<MPIProcessorGroup *>(_target_group);
+ MPIProcessorGroup * src = static_cast<MPIProcessorGroup *>(_source_group);
MPI_Comm comm_t = tgt->getWorldComm();
MPI_Comm comm_s = src->getWorldComm();
if (comm_t != comm_s)
local_group=_target_group;
else
throw INTERP_KERNEL::Exception("Invalid procgroup for field attachment to DEC");
- auto *paramesh=new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())),*local_group,field->getMesh()->getName());
- auto *tmp=new ParaFIELD(field, paramesh, *local_group);
+ ParaMESH *paramesh=new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())),*local_group,field->getMesh()->getName());
+ ParaFIELD *tmp=new ParaFIELD(field, paramesh, *local_group);
tmp->setOwnSupport(true);
attachLocalField(tmp,true);
//_comm_interface=&(local_group->getCommInterface());
if (_source_group->containsMyRank())
for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
{
- double const total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs);
+ double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs);
double source_norm = total_norm;
_comm_interface->broadcast(&source_norm, 1, MPI_DOUBLE, 0,* dynamic_cast<MPIProcessorGroup*>(_union_group)->getComm());
{
for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
{
- double const total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs);
+ double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs);
double source_norm=total_norm;
_comm_interface->broadcast(&source_norm, 1, MPI_DOUBLE, 0,* dynamic_cast<MPIProcessorGroup*>(_union_group)->getComm());
{
if (_local_field)
{
- TypeOfField const entity = _local_field->getField()->getTypeOfField();
+ TypeOfField entity = _local_field->getField()->getTypeOfField();
if ( getMethod() == "P0" )
{
if ( entity != ON_CELLS )
#define __DISJOINTDEC_HXX__
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
+#include "NormalizedUnstructuredMesh.hxx"
#include "DEC.hxx"
#include <mpi.h>
class DisjointDEC : public DEC
{
public:
- DisjointDEC():_local_field(nullptr),_union_group(nullptr),_source_group(nullptr),_target_group(nullptr),
- _comm_interface(nullptr),
+ DisjointDEC():_local_field(0),_union_group(0),_source_group(0),_target_group(0),
+ _comm_interface(0),
_owns_field(false),_owns_groups(false),
_union_comm(MPI_COMM_NULL)
{ }
DisjointDEC &operator=(const DisjointDEC& s);
DisjointDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids,
const MPI_Comm& world_comm=MPI_COMM_WORLD);
- ~DisjointDEC() override;
+ virtual ~DisjointDEC();
void setNature(NatureOfField nature);
void attachLocalField( MEDCouplingFieldDouble *field);
virtual void prepareTargetDE() = 0;
virtual void recvData() = 0;
virtual void sendData() = 0;
- void sendRecvData(bool way=true) override;
- void synchronize() override = 0;
+ void sendRecvData(bool way=true);
+ virtual void synchronize() = 0;
virtual void computeProcGroup() { }
void renormalizeTargetField(bool isWAbs);
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <cstddef>
#include <mpi.h>
#include "CommInterface.hxx"
#include "ElementLocator.hxx"
-#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MCType.hxx"
-#include "ParaIdType.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "Topology.hxx"
+#include "BlockTopology.hxx"
#include "ParaFIELD.hxx"
#include "ParaMESH.hxx"
#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
+#include "MEDCouplingFieldDouble.hxx"
#include "MCAuto.hxx"
+#include "DirectedBoundingBox.hxx"
-#include <limits>
-#include <string>
-#include <vector>
-#include <set>
#include <map>
+#include <set>
+#include <limits>
using namespace std;
const MPI_Comm *ElementLocator::getCommunicator() const
{
- auto* group=static_cast<MPIProcessorGroup*> (_union_group);
+ MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group);
return group->getComm();
}
MEDCouplingPointSet*& distant_mesh,
mcIdType*& distant_ids)
{
- int const rank = _union_group->translateRank(&_distant_group,idistantrank);
+ int rank = _union_group->translateRank(&_distant_group,idistantrank);
if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end())
return;
#endif
DataArrayIdType *distant_ids_send;
- auto *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(elems->begin(),elems->end(),distant_ids_send);
+ MEDCouplingPointSet *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(elems->begin(),elems->end(),distant_ids_send);
_exchangeMesh(send_mesh, distant_mesh, idistantrank, distant_ids_send, distant_ids);
distant_ids_send->decrRef();
void ElementLocator::exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth)
{
CommInterface comm_interface=_union_group->getCommInterface();
- auto* group=static_cast<MPIProcessorGroup*> (_union_group);
+ MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group);
const MPI_Comm* comm=(group->getComm());
MPI_Status status;
// it must be converted to union numbering before communication
- int const idistRankInUnion = group->translateRank(&_distant_group,idistantrank);
+ int idistRankInUnion = group->translateRank(&_distant_group,idistantrank);
char *recv_buffer=new char[4];
std::vector<char> send_buffer(4);
std::copy(sourceMeth.begin(),sourceMeth.end(),send_buffer.begin());
*/
void ElementLocator::_computeBoundingBoxes()
{
- CommInterface const comm_interface =_union_group->getCommInterface();
- auto* group=static_cast<MPIProcessorGroup*> (_union_group);
+ CommInterface comm_interface =_union_group->getCommInterface();
+ MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group);
const MPI_Comm* comm = group->getComm();
_local_cell_mesh_space_dim = -1;
if(_local_cell_mesh->getMeshDimension() != -1)
if ( dbbData.size() < bbSize ) dbbData.resize(bbSize,0);
double * minmax= &dbbData[0];
#else
- int const bbSize = 2*_local_cell_mesh_space_dim;
+ int bbSize = 2*_local_cell_mesh_space_dim;
_domain_bounding_boxes = new double[bbSize*_union_group->size()];
- auto * minmax=new double [bbSize];
+ double * minmax=new double [bbSize];
if(_local_cell_mesh->getMeshDimension() != -1)
_local_cell_mesh->getBoundingBox(minmax);
else
for (int i=0; i< _distant_group.size(); i++)
{
- int const rank=_union_group->translateRank(&_distant_group,i);
+ int rank=_union_group->translateRank(&_distant_group,i);
if (_intersectsBoundingBox(rank))
{
const double eps = 1e-12;
for (int idim=0; idim < _local_cell_mesh_space_dim; idim++)
{
- bool const intersects = (distant_bb[idim*2]<local_bb[idim*2+1]+eps)
+ bool intersects = (distant_bb[idim*2]<local_bb[idim*2+1]+eps)
&& (local_bb[idim*2]<distant_bb[idim*2+1]+eps);
if (!intersects) return false;
}
tinyInfoLocal.push_back(distant_ids_send->getNumberOfTuples());
tinyInfoDistant.resize(tinyInfoLocal.size());
std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0);
- auto* group=static_cast<MPIProcessorGroup*> (_union_group);
+ MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group);
const MPI_Comm* comm=group->getComm();
MPI_Status status;
// iproc_distant is the number of proc in distant group
// it must be converted to union numbering before communication
- int const iprocdistant_in_union = group->translateRank(&_distant_group,
+ int iprocdistant_in_union = group->translateRank(&_distant_group,
iproc_distant);
comm_interface.sendRecv(&tinyInfoLocal[0], (int)tinyInfoLocal.size(), MPI_ID_TYPE, iprocdistant_in_union, 1112,
&tinyInfoDistant[0], (int)tinyInfoDistant.size(), MPI_ID_TYPE,iprocdistant_in_union,1112,
*comm, &status);
- DataArrayIdType *v1Local=nullptr;
- DataArrayDouble *v2Local=nullptr;
+ DataArrayIdType *v1Local=0;
+ DataArrayDouble *v2Local=0;
DataArrayIdType *v1Distant=DataArrayIdType::New();
DataArrayDouble *v2Distant=DataArrayDouble::New();
//serialization of local mesh to send data to distant proc.
{
policy.resize(_distant_proc_ids.size());
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
MPI_Status status;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
void ElementLocator::sendSumToLazySideW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds)
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
const vector<mcIdType>& eltIds=distantLocEltIds[procId];
void ElementLocator::recvSumFromLazySideW(std::vector< std::vector<double> >& globalSumRelToDistantIds)
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
MPI_Status status;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds)
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
const vector<mcIdType>& eltIds=distantLocEltIds[procId];
void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, std::vector< std::vector<mcIdType> >& globalIds)
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
MPI_Status status;
globalIds.resize(_distant_proc_ids.size());
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<mcIdType> >& globalIds)
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
MPI_Status status;
globalIds.resize(_distant_proc_ids.size());
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
void ElementLocator::sendPartialSumToLazyProcsW(const std::vector<mcIdType>& distantGlobIds, const std::vector<double>& sum)
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
int lgth=(int)distantGlobIds.size();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
void ElementLocator::sendCandidatesForAddElementsW(const std::vector<mcIdType>& distantGlobIds)
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
int lgth=(int)distantGlobIds.size();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
void ElementLocator::recvAddElementsFromLazyProcsW(std::vector<std::vector<mcIdType> >& elementsToAdd)
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
MPI_Status status;
int lgth=(int)_distant_proc_ids.size();
elementsToAdd.resize(lgth);
*/
int ElementLocator::sendPolicyToWorkingSideL()
{
- CommInterface const comm;
+ CommInterface comm;
int toSend;
DataArrayIdType *isCumulative=_local_para_field.returnCumulativeGlobalNumbering();
if(isCumulative)
{
_values_added.resize(_local_para_field.getField()->getNumberOfTuples());
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
_ids_per_working_proc.resize(_distant_proc_ids.size());
MPI_Status status;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
void ElementLocator::sendToWorkingSideL()
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
vector<mcIdType>& ids=_ids_per_working_proc[procId];
void ElementLocator::recvLocalIdsFromWorkingSideL()
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
_ids_per_working_proc.resize(_distant_proc_ids.size());
MPI_Status status;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
void ElementLocator::sendGlobalIdsToWorkingSideL()
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering();
const mcIdType *globalIdsC=globalIds->getConstPointer();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
std::size_t procId=0;
std::size_t wProcSize=_distant_proc_ids.size();
- CommInterface const comm;
+ CommInterface comm;
_ids_per_working_proc.resize(wProcSize);
_values_per_working_proc.resize(wProcSize);
MPI_Status status;
{
std::size_t procId=0;
std::size_t wProcSize=_distant_proc_ids.size();
- CommInterface const comm;
+ CommInterface comm;
_ids_per_working_proc3.resize(wProcSize);
MPI_Status status;
std::map<int,double> sums;
void ElementLocator::sendAddElementsToWorkingSideL()
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
const std::vector<mcIdType>& vals=_ids_per_working_proc3[procId];
void ElementLocator::sendCandidatesGlobalIdsToWorkingSideL()
{
int procId=0;
- CommInterface const comm;
+ CommInterface comm;
DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering();
const mcIdType *globalIdsC=globalIds->getConstPointer();
MCAuto<DataArrayIdType> candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes();
#ifndef __ELEMENTLOCATOR_HXX__
#define __ELEMENTLOCATOR_HXX__
-#include <mpi.h>
-
-#include <string>
-#include <vector>
-
#include "InterpolationOptions.hxx"
+#include "MEDCouplingNatureOfField.hxx"
#include "MCType.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
+
+#include <mpi.h>
+#include <vector>
+#include <set>
namespace MEDCoupling
{
MEDCouplingPointSet*& target_mesh,
mcIdType*& distant_ids);
void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth);
- const std::vector<int> &getDistantProcIds() const
- {
- return _distant_proc_ids;
- }
+ const std::vector<int>& getDistantProcIds() const { return _distant_proc_ids; }
const MPI_Comm *getCommunicator() const;
NatureOfField getLocalNature() const;
//! This method is used to informed if there is -1D mesh on distant_group side or on local_group side.
int _local_cell_mesh_space_dim;
bool _is_m1d_corr;
MEDCouplingPointSet* _local_face_mesh;
- std::vector<MEDCouplingPointSet *> _distant_cell_meshes;
- std::vector<MEDCouplingPointSet *> _distant_face_meshes;
+ std::vector<MEDCouplingPointSet*> _distant_cell_meshes;
+ std::vector<MEDCouplingPointSet*> _distant_face_meshes;
double* _domain_bounding_boxes;
const ProcessorGroup& _distant_group;
const ProcessorGroup& _local_group;
const MPI_Comm *_comm;
//Attributes only used by lazy side
std::vector<double> _values_added;
- std::vector<std::vector<mcIdType> > _ids_per_working_proc;
- std::vector<std::vector<mcIdType> > _ids_per_working_proc3;
- std::vector<std::vector<double> > _values_per_working_proc;
-
- public:
+ std::vector< std::vector<mcIdType> > _ids_per_working_proc;
+ std::vector< std::vector<mcIdType> > _ids_per_working_proc3;
+ std::vector< std::vector<double> > _values_per_working_proc;
+ public:
static const int CUMULATIVE_POLICY=3;
static const int NO_POST_TREATMENT_POLICY=7;
};
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <cstddef>
-#include <iostream>
#include <mpi.h>
-#include <utility>
#include "CommInterface.hxx"
-#include "ExplicitTopology.hxx"
-#include "MCType.hxx"
-#include "ParaIdType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
#include "Topology.hxx"
+#include "BlockTopology.hxx"
#include "ComponentTopology.hxx"
#include "ParaFIELD.hxx"
#include "MPIProcessorGroup.hxx"
#include "ExplicitCoincidentDEC.hxx"
+#include "ExplicitMapping.hxx"
#include "InterpKernelUtilities.hxx"
using namespace std;
/*! Constructor
*/
ExplicitCoincidentDEC::ExplicitCoincidentDEC():
- _toposource(nullptr),_topotarget(nullptr),
- _targetgroup(nullptr), _sourcegroup(nullptr),
- _sendcounts(nullptr), _recvcounts(nullptr),
- _senddispls(nullptr), _recvdispls(nullptr),
- _recvbuffer(nullptr), _sendbuffer(nullptr),
+ _toposource(0),_topotarget(0),
+ _targetgroup(0), _sourcegroup(0),
+ _sendcounts(0), _recvcounts(0),
+ _senddispls(0), _recvdispls(0),
+ _recvbuffer(0), _sendbuffer(0),
_distant_elems(), _explicit_mapping()
{
}
ExplicitCoincidentDEC::~ExplicitCoincidentDEC()
- = default;
+ {
+ }
/*! Synchronization process for exchanging topologies
*/
if (!_toposource->getProcGroup()->containsMyRank())
return;
- auto* group=new MPIProcessorGroup(_sourcegroup->getCommInterface());
+ MPIProcessorGroup* group=new MPIProcessorGroup(_sourcegroup->getCommInterface());
// Warning : the size of the target side is implicitly deduced
//from the size of MPI_COMM_WORLD
- int const target_size = _toposource->getProcGroup()->getCommInterface().worldSize()- _toposource->getProcGroup()->size() ;
+ int target_size = _toposource->getProcGroup()->getCommInterface().worldSize()- _toposource->getProcGroup()->size() ;
vector<int>* target_arrays=new vector<int>[target_size];
- mcIdType const nb_local = _toposource-> getNbLocalElements();
+ mcIdType nb_local = _toposource-> getNbLocalElements();
std::size_t union_size=group->size();
for (int ielem=0; ielem<nb_local; ielem++)
{
- int const ncomp = _toposource->getNbComponents();
+ int ncomp = _toposource->getNbComponents();
for (int icomp=0; icomp<ncomp; icomp++)
{
_sendbuffer[ielem*ncomp+icomp]=value[bufferindex[ielem]*ncomp+icomp];
{
if (!_topotarget->getProcGroup()->containsMyRank())
return;
- auto* group=new MPIProcessorGroup(_topotarget->getProcGroup()->getCommInterface());
+ MPIProcessorGroup* group=new MPIProcessorGroup(_topotarget->getProcGroup()->getCommInterface());
vector < vector <mcIdType> > source_arrays(_sourcegroup->size());
- mcIdType const nb_local = _topotarget-> getNbLocalElements();
+ mcIdType nb_local = _topotarget-> getNbLocalElements();
for (mcIdType ielem=0; ielem< nb_local ; ielem++)
{
//pair<int,mcIdType> source_local =_distant_elems[ielem];
for (int iproc=0; iproc < _sourcegroup->size(); iproc++)
{
//converts the rank in target to the rank in union communicator
- int const unionrank=group->translateRank(_sourcegroup,iproc);
+ int unionrank=group->translateRank(_sourcegroup,iproc);
_recvcounts[unionrank]=(int)(source_arrays[iproc].size()*_topotarget->getNbComponents());
}
for (std::size_t i=1; i<union_size; i++)
{
MPI_Status status;
- mcIdType* serializer=nullptr;
+ mcIdType* serializer=0;
mcIdType size;
- auto* group=new MPIProcessorGroup(*_comm_interface);
+ MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface);
// The send processors serialize the send topology
// and send the buffers to the recv procs
- if (toposend !=nullptr && toposend->getProcGroup()->containsMyRank())
+ if (toposend !=0 && toposend->getProcGroup()->containsMyRank())
{
toposend->serialize(serializer, size);
for (int iproc=0; iproc< group->size(); iproc++)
{
- int const itarget=iproc;
+ int itarget=iproc;
if (!toposend->getProcGroup()->contains(itarget))
{
_comm_interface->send(&size,1,MPI_ID_TYPE, itarget,tag+itarget,*(group->getComm()));
else
{
vector <int> size2(group->size());
- int const myworldrank=group->myRank();
+ int myworldrank=group->myRank();
for (int iproc=0; iproc<group->size();iproc++)
{
- int const isource = iproc;
+ int isource = iproc;
if (!toporecv->getProcGroup()->contains(isource))
{
mcIdType nbelem;
_comm_interface->recv(&nbelem, 1, MPI_ID_TYPE, isource, tag+myworldrank, *(group->getComm()), &status);
- auto* buffer = new mcIdType[nbelem];
+ mcIdType* buffer = new mcIdType[nbelem];
_comm_interface->recv(buffer, (int)nbelem, MPI_ID_TYPE, isource,tag+myworldrank, *(group->getComm()), &status);
- auto* topotemp=new ExplicitTopology();
+ ExplicitTopology* topotemp=new ExplicitTopology();
topotemp->unserialize(buffer, *_comm_interface);
delete[] buffer;
for (mcIdType ielem=0; ielem<toporecv->getNbLocalElements(); ielem++)
{
- mcIdType const global = toporecv->localToGlobal(ielem);
- mcIdType const sendlocal=topotemp->globalToLocal(global);
+ mcIdType global = toporecv->localToGlobal(ielem);
+ mcIdType sendlocal=topotemp->globalToLocal(global);
if (sendlocal!=-1)
{
size2[iproc]++;
void ExplicitCoincidentDEC::transferMappingToSource()
{
- auto* group=new MPIProcessorGroup(*_comm_interface);
+ MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface);
// sending source->target mapping which is stored by target
//in _distant_elems from target to source
- if (_topotarget!=nullptr && _topotarget->getProcGroup()->containsMyRank())
+ if (_topotarget!=0 && _topotarget->getProcGroup()->containsMyRank())
{
- int const world_size = _topotarget->getProcGroup()->getCommInterface().worldSize() ;
+ int world_size = _topotarget->getProcGroup()->getCommInterface().worldSize() ;
int* nb_transfer_union=new int[world_size];
int* dummy_recv=new int[world_size];
for (int i=0; i<world_size; i++)
}
int* recvcounts=new int[world_size];
int* recvdispls=new int[world_size];
- int *dummyrecv=nullptr;
+ int *dummyrecv=0;
for (int i=0; i <world_size; i++)
{
recvcounts[i]=0;
//receiving in the source subdomains the mapping sent by targets
else
{
- int const world_size = _toposource->getProcGroup()->getCommInterface().worldSize() ;
+ int world_size = _toposource->getProcGroup()->getCommInterface().worldSize() ;
int* nb_transfer_union=new int[world_size];
int* dummy_send=new int[world_size];
for (int i=0; i<world_size; i++)
int total_size=0;
for (int i=0; i< world_size; i++)
total_size+=nb_transfer_union[i];
- int const nbtarget = _targetgroup->size();
+ int nbtarget = _targetgroup->size();
int* targetranks = new int[ nbtarget];
for (int i=0; i<nbtarget; i++)
targetranks[i]=group->translateRank(_targetgroup,i);
- auto* mappingbuffer= new mcIdType [total_size*2];
+ mcIdType* mappingbuffer= new mcIdType [total_size*2];
int* sendcounts= new int [world_size];
int* senddispls = new int [world_size];
int* recvcounts=new int[world_size];
recvdispls[i]=recvdispls[i-1]+recvcounts[i-1];
}
- int *dummysend=nullptr;
+ int *dummysend=0;
for (int i=0; i <world_size; i++)
{
sendcounts[i]=0;
_recvbuffer, _recvcounts, _recvdispls, MPI_DOUBLE,MPI_COMM_WORLD);
cout<<"end AllToAll"<<endl;
mcIdType nb_local = _topotarget->getNbLocalElements();
- auto* value=new double[nb_local*_topotarget->getNbComponents()];
+ double* value=new double[nb_local*_topotarget->getNbComponents()];
vector<int> counters(_sourcegroup->size());
counters[0]=0;
for (int i=0; i<_sourcegroup->size()-1; i++)
{
- auto* group=new MPIProcessorGroup(*_comm_interface);
- int const worldrank=group->translateRank(_sourcegroup,i);
+ MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface);
+ int worldrank=group->translateRank(_sourcegroup,i);
counters[i+1]=counters[i]+_recvcounts[worldrank];
}
#include "ExplicitMapping.hxx"
#include "ExplicitTopology.hxx"
+#include <map>
namespace MEDCoupling
{
{
public:
ExplicitCoincidentDEC();
- ~ExplicitCoincidentDEC() override;
- void synchronize() override;
+ virtual ~ExplicitCoincidentDEC();
+ void synchronize();
void broadcastTopology(BlockTopology*&, int tag);
void broadcastTopology(const ExplicitTopology* toposend, ExplicitTopology* toporecv, int tag);
void transferMappingToSource();
- void prepareSourceDE() override;
- void prepareTargetDE() override;
- void recvData() override;
- void sendData() override;
+ void prepareSourceDE();
+ void prepareTargetDE();
+ void recvData();
+ void sendData();
private:
ExplicitTopology* _toposource;
ExplicitTopology* _topotarget;
//
#include "ExplicitMapping.hxx"
-#include <utility>
-#include "MCIdType.hxx"
-#include <vector>
-#include <map>
namespace MEDCoupling
{
ExplicitMapping::ExplicitMapping():
_mapping(), _distant_domains(),
- _numbers(nullptr), _domains(nullptr), _comm_buffer(nullptr),
- _buffer_index(nullptr), _send_counts(nullptr)
+ _numbers(0), _domains(0), _comm_buffer(0),
+ _buffer_index(0), _send_counts(0)
{ }
ExplicitMapping::~ExplicitMapping()
{
- if (_domains!=nullptr) delete[] _domains;
- if (_numbers!=nullptr) delete[] _numbers;
- if (_comm_buffer!=nullptr) delete[] _comm_buffer;
+ if (_domains!=0) delete[] _domains;
+ if (_numbers!=0) delete[] _numbers;
+ if (_comm_buffer!=0) delete[] _comm_buffer;
}
void ExplicitMapping::pushBackElem(std::pair<int,mcIdType> idistant)
{
if (_distant_domains.empty())
{
- for (const auto & iter : _mapping)
- _distant_domains.insert(iter.first);
+ for (std::vector <std::pair<int,mcIdType> >::const_iterator iter= _mapping.begin();
+ iter!=_mapping.end();
+ iter++)
+ _distant_domains.insert(iter->first);
}
return (int)_distant_domains.size();
}
int ExplicitMapping::getDistantDomain(int i)
{
- if (_domains==nullptr)
+ if (_domains==0)
computeNumbers();
return _domains[i];
int ExplicitMapping::getNbDistantElems(int i)
{
- if (_numbers==nullptr)
+ if (_numbers==0)
computeNumbers();
return _numbers[i];
}
for (int i=1; i<(int)_distant_domains.size();i++)
offsets[i]=offsets[i-1]+_numbers[i-1];
- for (auto & i : _mapping)
+ for (int i=0; i<(int)_mapping.size(); i++)
{
- mcIdType const offset= offsets[i.first];
+ mcIdType offset= offsets[_mapping[i].first];
_comm_buffer[offset*2]=idproc;
- _comm_buffer[offset*2+1]=i.second;
- offsets[i.first]++;
+ _comm_buffer[offset*2+1]=_mapping[i].second;
+ offsets[_mapping[i].first]++;
}
return _comm_buffer;
}
void ExplicitMapping::computeNumbers()
{
std::map <int,int> counts;
- if (_numbers==nullptr)
+ if (_numbers==0)
{
_numbers=new int[nbDistantDomains()];
_domains=new int[nbDistantDomains()];
- for (auto & i : _mapping)
+ for (int i=0; i<(int)_mapping.size(); i++)
{
- if ( counts.find(i.first) == counts.end())
- counts.insert(std::make_pair(i.first,1));
+ if ( counts.find(_mapping[i].first) == counts.end())
+ counts.insert(std::make_pair(_mapping[i].first,1));
else
- (counts[i.first])++;
+ (counts[_mapping[i].first])++;
}
int counter=0;
for (std::map<int,int>::const_iterator iter=counts.begin();
#include "MCIdType.hxx"
-#include <utility>
#include <vector>
+#include <map>
#include <set>
namespace MEDCoupling
//
#include "CommInterface.hxx"
-#include "MCType.hxx"
+#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
#include "ParaMESH.hxx"
+#include "Topology.hxx"
#include "ExplicitTopology.hxx"
#include "BlockTopology.hxx"
+#include "ComponentTopology.hxx"
-#include <iostream>
+#include <vector>
#include <algorithm>
using namespace std;
{
ExplicitTopology::ExplicitTopology():
- _proc_group(nullptr), _nb_elems(0), _nb_components(0),
- _loc2glob(nullptr), _glob2loc()
+ _proc_group(NULL), _nb_elems(0), _nb_components(0),
+ _loc2glob(NULL), _glob2loc()
{}
ExplicitTopology::ExplicitTopology(const ParaMESH& paramesh ):
ExplicitTopology::~ExplicitTopology()
{
- if (_loc2glob != nullptr) delete[] _loc2glob;
+ if (_loc2glob != 0) delete[] _loc2glob;
}
* after communication. Uses the same structure as the one used for serialize()
*
* */
-void ExplicitTopology::unserialize(const mcIdType* serializer,const CommInterface& /*comm_interface*/)
+void ExplicitTopology::unserialize(const mcIdType* serializer,const CommInterface& comm_interface)
{
const mcIdType* ptr_serializer=serializer;
cout << "unserialize..."<<endl;
#ifndef __EXPLICITTOPOLOGY_HXX__
#define __EXPLICITTOPOLOGY_HXX__
-#include "MCType.hxx"
-#include "CommInterface.hxx"
#include "ProcessorGroup.hxx"
#include "InterpKernelHashMap.hxx"
-#include "Topology.hxx"
+#include <vector>
#include <utility>
+#include <iostream>
namespace MEDCoupling
{
class ParaMESH;
+ class Topology;
class ComponentTopology;
/*!
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <cstddef>
#include <mpi.h>
-#include <string>
-#include <utility>
-#include "DisjointDEC.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "InterpKernelException.hxx"
+#include "CommInterface.hxx"
#include "Topology.hxx"
+#include "BlockTopology.hxx"
#include "ComponentTopology.hxx"
#include "ParaFIELD.hxx"
+#include "MPIProcessorGroup.hxx"
+#include "ParaMESH.hxx"
+#include "DEC.hxx"
#include "InterpolationMatrix.hxx"
#include "InterpKernelDEC.hxx"
#include "ElementLocator.hxx"
{
InterpKernelDEC::InterpKernelDEC():
DisjointDEC(),
- _interpolation_matrix(nullptr)
+ _interpolation_matrix(0)
{
}
*/
InterpKernelDEC::InterpKernelDEC(ProcessorGroup& source_group, ProcessorGroup& target_group):
DisjointDEC(source_group, target_group),
- _interpolation_matrix(nullptr)
+ _interpolation_matrix(0)
{
}
InterpKernelDEC::InterpKernelDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids,
const MPI_Comm& world_comm):
DisjointDEC(src_ids,trg_ids,world_comm),
- _interpolation_matrix(nullptr)
+ _interpolation_matrix(0)
{
}
*/
InterpKernelDEC::InterpKernelDEC(ProcessorGroup& generic_group, const std::string& source_group, const std::string& target_group):
DisjointDEC(generic_group.getProcIDsByName(source_group),generic_group.getProcIDsByName(target_group)),
- _interpolation_matrix(nullptr)
+ _interpolation_matrix(0)
{
}
ElementLocator locator(*_local_field, *_target_group, *_source_group);
//transferring option from InterpKernelDEC to ElementLocator
locator.copyOptions(*this);
- MEDCouplingPointSet* distant_mesh=nullptr;
- mcIdType* distant_ids=nullptr;
+ MEDCouplingPointSet* distant_mesh=0;
+ mcIdType* distant_ids=0;
std::string distantMeth;
for (int i=0; i<_target_group->size(); i++)
{
// int idistant_proc = (i+_source_group->myRank())%_target_group->size();
- int const idistant_proc=i;
+ int idistant_proc=i;
//gathers pieces of the target meshes that can intersect the local mesh
locator.exchangeMesh(idistant_proc,distant_mesh,distant_ids);
- if (distant_mesh !=nullptr)
+ if (distant_mesh !=0)
{
locator.exchangeMethod(_method,idistant_proc,distantMeth);
//adds the contribution of the distant mesh on the local one
- int const idistant_proc_in_union=_union_group->translateRank(_target_group,idistant_proc);
+ int idistant_proc_in_union=_union_group->translateRank(_target_group,idistant_proc);
//std::cout <<"add contribution from proc "<<idistant_proc_in_union<<" to proc "<<_union_group->myRank()<<std::endl;
_interpolation_matrix->addContribution(*distant_mesh,idistant_proc_in_union,distant_ids,_method,distantMeth);
distant_mesh->decrRef();
delete [] distant_ids;
- distant_mesh=nullptr;
- distant_ids=nullptr;
+ distant_mesh=0;
+ distant_ids=0;
}
}
_interpolation_matrix->finishContributionW(locator);
ElementLocator locator(*_local_field, *_source_group, *_target_group);
//transferring option from InterpKernelDEC to ElementLocator
locator.copyOptions(*this);
- MEDCouplingPointSet* distant_mesh=nullptr;
- mcIdType* distant_ids=nullptr;
+ MEDCouplingPointSet* distant_mesh=0;
+ mcIdType* distant_ids=0;
for (int i=0; i<_source_group->size(); i++)
{
// int idistant_proc = (i+_target_group->myRank())%_source_group->size();
- int const idistant_proc=i;
+ int idistant_proc=i;
//gathers pieces of the target meshes that can intersect the local mesh
locator.exchangeMesh(idistant_proc,distant_mesh,distant_ids);
//std::cout << " Data sent from "<<_union_group->myRank()<<" to source proc "<< idistant_proc<<std::endl;
- if (distant_mesh!=nullptr)
+ if (distant_mesh!=0)
{
std::string distantMeth;
locator.exchangeMethod(_method,idistant_proc,distantMeth);
distant_mesh->decrRef();
delete [] distant_ids;
- distant_mesh=nullptr;
- distant_ids=nullptr;
+ distant_mesh=0;
+ distant_ids=0;
}
}
_interpolation_matrix->finishContributionL(locator);
#define __INTERPKERNELDEC_HXX__
#include "DisjointDEC.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
#include "MxN_Mapping.hxx"
#include "InterpolationOptions.hxx"
-#include <string>
namespace MEDCoupling
{
InterpKernelDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids, const MPI_Comm& world_comm=MPI_COMM_WORLD);
InterpKernelDEC(ProcessorGroup& generic_group, const std::string& source_group, const std::string& target_group);
InterpKernelDEC(ProcessorGroup& generic_group, const std::string& interaction_group);
- ~InterpKernelDEC() override;
+ virtual ~InterpKernelDEC();
void release();
- void synchronize() override;
+ void synchronize();
void synchronizeWithDefaultValue(double val);
MCAuto<DataArrayIdType> retrieveNonFetchedIds() const;
- void recvData() override;
+ void recvData();
void recvData(double time);
- void sendData() override;
+ void sendData();
void sendData(double time , double deltatime);
- void prepareSourceDE() override { }
- void prepareTargetDE() override { }
+ void prepareSourceDE() { }
+ void prepareTargetDE() { }
private:
MCAuto<DataArrayIdType> retrieveNonFetchedIdsSource() const;
MCAuto<DataArrayIdType> retrieveNonFetchedIdsTarget() const;
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "DECOptions.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingNormalizedUnstructuredMesh.txx"
-#include "Interpolation2D.hxx"
-#include "Interpolation3D.hxx"
-#include "Interpolation2D3D.hxx"
-#include "Interpolation2D1D.hxx"
-#include "Interpolation1D.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
-#include "MCAuto.hxx"
-#include "InterpKernelException.hxx"
#include "ParaMESH.hxx"
#include "ParaFIELD.hxx"
#include "ProcessorGroup.hxx"
#include "MxN_Mapping.hxx"
#include "InterpolationMatrix.hxx"
+#include "TranslationRotationMatrix.hxx"
+#include "Interpolation.hxx"
+#include "Interpolation1D.txx"
#include "Interpolation2DCurve.hxx"
+#include "Interpolation2D.txx"
#include "Interpolation3DSurf.hxx"
#include "Interpolation3D.txx"
#include "Interpolation2D3D.txx"
#include "Interpolation2D1D.txx"
#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingNormalizedUnstructuredMesh.txx"
#include "InterpolationOptions.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "ElementLocator.hxx"
#include <algorithm>
-#include <string>
-#include <cstddef>
-#include <utility>
-#include <sstream>
-#include <limits>
using namespace std;
_source_group(source_group),
_target_group(target_group)
{
- mcIdType const nbelems = source_field->getField()->getNumberOfTuples();
+ mcIdType nbelems = source_field->getField()->getNumberOfTuples();
_row_offsets.resize(nbelems+1);
_coeffs.resize(nbelems);
_target_volume.resize(nbelems);
}
InterpolationMatrix::~InterpolationMatrix()
- = default;
+ {
+ }
/*!
//creating the interpolator structure
vector<map<mcIdType,double> > surfaces;
//computation of the intersection volumes between source and target elements
- auto *distant_supportC=dynamic_cast<MEDCouplingUMesh *>(&distant_support);
- auto *source_supportC=dynamic_cast<MEDCouplingUMesh *>(_source_support);
+ MEDCouplingUMesh *distant_supportC=dynamic_cast<MEDCouplingUMesh *>(&distant_support);
+ MEDCouplingUMesh *source_supportC=dynamic_cast<MEDCouplingUMesh *>(_source_support);
if ( distant_support.getMeshDimension() == -1 )
{
if(source_supportC->getMeshDimension()==2 && source_supportC->getSpaceDimension()==2)
{
throw INTERP_KERNEL::Exception("no interpolator exists for these mesh and space dimensions ");
}
- bool const needTargetSurf=isSurfaceComputationNeeded(targetMeth);
+ bool needTargetSurf=isSurfaceComputationNeeded(targetMeth);
- MEDCouplingFieldDouble *target_triangle_surf=nullptr;
+ MEDCouplingFieldDouble *target_triangle_surf=0;
if(needTargetSurf)
target_triangle_surf = distant_support.getMeasureField(getMeasureAbsStatus());
fillDSFromVM(iproc_distant,distant_elems,surfaces,target_triangle_surf);
void InterpolationMatrix::finishContributionW(ElementLocator& elementLocator)
{
- NatureOfField const nature=elementLocator.getLocalNature();
+ NatureOfField nature=elementLocator.getLocalNature();
switch(nature)
{
case IntensiveMaximum:
void InterpolationMatrix::finishContributionL(ElementLocator& elementLocator)
{
- NatureOfField const nature=elementLocator.getLocalNature();
+ NatureOfField nature=elementLocator.getLocalNature();
switch(nature)
{
case IntensiveMaximum:
void InterpolationMatrix::computeConservVolDenoL(ElementLocator& elementLocator)
{
- int const pol1=elementLocator.sendPolicyToWorkingSideL();
+ int pol1=elementLocator.sendPolicyToWorkingSideL();
if(pol1==ElementLocator::NO_POST_TREATMENT_POLICY)
{
elementLocator.recvFromWorkingSideL();
throw INTERP_KERNEL::Exception("Not managed policy detected on lazy side : not implemented !");
}
- void InterpolationMatrix::computeIntegralDenoW(ElementLocator& /*elementLocator*/)
+ void InterpolationMatrix::computeIntegralDenoW(ElementLocator& elementLocator)
{
MEDCouplingFieldDouble *source_triangle_surf = _source_support->getMeasureField(getMeasureAbsStatus());
_deno_multiply.resize(_coeffs.size());
_deno_reverse_multiply=_target_volume;
}
- void InterpolationMatrix::computeRevIntegralDenoW(ElementLocator& /*elementLocator*/)
+ void InterpolationMatrix::computeRevIntegralDenoW(ElementLocator& elementLocator)
{
_deno_multiply=_target_volume;
MEDCouplingFieldDouble *source_triangle_surf = _source_support->getMeasureField(getMeasureAbsStatus());
*/
void InterpolationMatrix::prepare()
{
- mcIdType const nbelems = _source_field->getField()->getNumberOfTuples();
+ mcIdType nbelems = _source_field->getField()->getNumberOfTuples();
for (mcIdType ielem=0; ielem < nbelems; ielem++)
{
_row_offsets[ielem+1]+=_row_offsets[ielem];
#ifndef __INTERPOLATIONMATRIX_HXX__
#define __INTERPOLATIONMATRIX_HXX__
-#include "MCType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingPointSet.hxx"
#include "MPIAccessDEC.hxx"
#include "MxN_Mapping.hxx"
#include "InterpolationOptions.hxx"
#include "DECOptions.hxx"
-#include "ParaFIELD.hxx"
-#include <string>
-#include <vector>
-#include <utility>
namespace MEDCoupling
{
//
#include "LinearTimeInterpolator.hxx"
-#include "TimeInterpolator.hxx"
using namespace std;
}
LinearTimeInterpolator::~LinearTimeInterpolator()
- = default;
+ {
+ }
void LinearTimeInterpolator::doInterp( double time0, double time1, double time,
- int recvcount , int /*nbuff0*/, int /*nbuff1*/,
+ int recvcount , int nbuff0, int nbuff1,
int **recvbuff0, int **recvbuff1, int *result )
{
for(int i = 0 ; i < recvcount ; i++ )
}
void LinearTimeInterpolator::doInterp( double time0, double time1, double time,
- int recvcount , int /*nbuff0*/, int /*nbuff1*/,
+ int recvcount , int nbuff0, int nbuff1,
double **recvbuff0, double **recvbuff1,
double *result )
{
#include "TimeInterpolator.hxx"
+#include <map>
+#include <iostream>
namespace MEDCoupling
{
public:
LinearTimeInterpolator( double InterpPrecision=0, int nStepBefore=1,
int nStepAfter=1 ) ;
- ~LinearTimeInterpolator() override;
+ virtual ~LinearTimeInterpolator();
void doInterp( double time0, double time1, double time, int recvcount,
int nbuff0, int nbuff1,
- int **recvbuff0, int **recvbuff1, int *result ) override;
+ int **recvbuff0, int **recvbuff1, int *result );
void doInterp( double time0, double time1, double time, int recvcount,
int nbuff0, int nbuff1,
- double **recvbuff0, double **recvbuff1, double *result ) override;
+ double **recvbuff0, double **recvbuff1, double *result );
};
}
#include "MPIAccess/MPIAccess.hxx"
-#include "MPIProcessorGroup.hxx"
+#include "InterpolationUtils.hxx"
-#include <cstddef>
-#include <cstdlib>
#include <iostream>
-#include <limits>
using namespace std;
int MPIAccess::newRequest( MPI_Datatype datatype, int tag , int destsourcerank ,
bool fromsourcerank , bool asynchronous )
{
- auto *mpiaccessstruct = new RequestStruct;
+ RequestStruct *mpiaccessstruct = new RequestStruct;
mpiaccessstruct->MPITag = tag ;
mpiaccessstruct->MPIDatatype = datatype ;
mpiaccessstruct->MPITarget = destsourcerank ;
// Returns in ArrayOfSendRequests with the dimension "size" all the
// SendRequestIds
- int MPIAccess::sendRequestIds(int /*size*/, int *ArrayOfSendRequests)
+ int MPIAccess::sendRequestIds(int size, int *ArrayOfSendRequests)
{
int destrank ;
int i = 0 ;
// Returns in ArrayOfRecvRequests with the dimension "size" all the
// RecvRequestIds
- int MPIAccess::recvRequestIds(int /*size*/, int *ArrayOfRecvRequests)
+ int MPIAccess::recvRequestIds(int size, int *ArrayOfRecvRequests)
{
int sourcerank ;
int i = 0 ;
int MPItag = newSendTag( datatype, target , aMethodIdent , false , RequestId ) ;
if ( aMethodIdent == _message_time )
{
- auto *aTimeMsg = (TimeMessage *) buffer ;
+ TimeMessage *aTimeMsg = (TimeMessage *) buffer ;
aTimeMsg->tag = MPItag ;
}
deleteRequest( RequestId ) ;
{
int sts = MPI_SUCCESS ;
RequestId = -1 ;
- if ( OutCount != nullptr )
+ if ( OutCount != NULL )
*OutCount = -1 ;
if ( count )
{
setMPICompleted( RequestId , true ) ;
deleteStatus( RequestId ) ;
}
- if ( OutCount != nullptr )
+ if ( OutCount != NULL )
*OutCount = outcount ;
if ( _trace )
cout << "MPIAccess::Recv" << _my_rank << " RecvRequestId "
int MPItag = newSendTag( datatype, target , aMethodIdent , true , RequestId ) ;
if ( aMethodIdent == _message_time )
{
- auto *aTimeMsg = (TimeMessage *) buffer ;
+ TimeMessage *aTimeMsg = (TimeMessage *) buffer ;
aTimeMsg->tag = MPItag ;
}
MPI_Request *aSendRequest = MPIRequest( RequestId ) ;
<< RecvRequestId << " outcount " << outcount << endl ;
}
}
- if ( OutCount != nullptr )
+ if ( OutCount != NULL )
{
*OutCount = outcount ;
if ( _trace )
return status ;
}
- int MPIAccess::waitAny(int /*count*/, int * /*array_of_RequestIds*/, int &RequestId)
+ int MPIAccess::waitAny(int count, int *array_of_RequestIds, int &RequestId)
{
int status = MPI_ERR_OTHER ;
RequestId = -1 ;
return status ;
}
- int MPIAccess::testAny(int /*count*/, int * /*array_of_RequestIds*/, int &RequestId, int &flag)
+ int MPIAccess::testAny(int count, int *array_of_RequestIds, int &RequestId, int &flag)
{
int status = MPI_ERR_OTHER ;
RequestId = -1 ;
return retstatus ;
}
- int MPIAccess::waitSome(int /*count*/, int * /*array_of_RequestIds*/, int /*outcount*/,
- int * /*outarray_of_RequestIds*/)
+ int MPIAccess::waitSome(int count, int *array_of_RequestIds, int outcount,
+ int *outarray_of_RequestIds)
{
int status = MPI_ERR_OTHER ;
cout << "MPIAccess::WaitSome not yet implemented" << endl ;
return status ;
}
- int MPIAccess::testSome(int /*count*/, int * /*array_of_RequestIds*/, int /*outcounts*/,
- int * /*outarray_of_RequestIds*/)
+ int MPIAccess::testSome(int count, int *array_of_RequestIds, int outcounts,
+ int *outarray_of_RequestIds)
{
int status = MPI_ERR_OTHER ;
cout << "MPIAccess::TestSome not yet implemented" << endl ;
#define __MPIACCESS_HXX__
#include "CommInterface.hxx"
+#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
-#include <cstddef>
-#include <iostream>
+#include <map>
#include <list>
#include <vector>
-#include <map>
+#include <iostream>
namespace MEDCoupling
{
int ISend(void* buffer, int count, MPI_Datatype datatype, int target,
int &RequestId) ;
int recv(void* buffer, int count, MPI_Datatype datatype, int source,
- int &RequestId, int *OutCount=nullptr) ;
+ int &RequestId, int *OutCount=NULL) ;
int IRecv(void* buffer, int count, MPI_Datatype datatype, int source,
int &RequestId) ;
int sendRecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dest,
int &SendRequestId, void* recvbuf, int recvcount,
MPI_Datatype recvtype, int source,
- int &RecvRequestId, int *OutCount=nullptr) ;
+ int &RecvRequestId, int *OutCount=NULL) ;
int ISendRecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dest,
int &SendRequestId, void* recvbuf, int recvcount,
MPI_Datatype recvtype, int source, int &RecvRequestId) ;
struct RequestStruct *aRequestStruct = _map_of_request_struct[ RequestId ];
if ( aRequestStruct )
return aRequestStruct->MPIStatus;
- return nullptr ;
+ return NULL ;
}
// Set the MPICompleted field of the structure Request corresponding to RequestId
//
#include "MPIAccess/MPIAccessDEC.hxx"
-#include "ProcessorGroup.hxx"
-#include "MPIProcessorGroup.hxx"
-#include "MPIAccess.hxx"
-#include "DECOptions.hxx"
-#include "LinearTimeInterpolator.hxx"
#include <cstring>
-#include <iostream>
using namespace std;
{
procs.insert(i) ;
}
- auto *mpilg = static_cast<MPIProcessorGroup *>(const_cast<ProcessorGroup *>(&source_group));
+ MPIProcessorGroup *mpilg = static_cast<MPIProcessorGroup *>(const_cast<ProcessorGroup *>(&source_group));
_MPI_union_group = new MEDCoupling::MPIProcessorGroup( union_group->getCommInterface(),procs,mpilg->getWorldComm());
delete union_group ;
_my_rank = _MPI_union_group->myRank() ;
_data_messages_type->resize( _group_size ) ;
_data_messages = new vector< vector< void * > > ;
_data_messages->resize( _group_size ) ;
- _time_interpolator = nullptr ;
+ _time_interpolator = NULL ;
_map_of_send_buffers = new map< int , SendBuffStruct * > ;
}
switch ( aTimeInterp )
{
case WithoutTimeInterp :
- _time_interpolator = nullptr ;
+ _time_interpolator = NULL ;
_n_step_before = 0 ;
_n_step_after = 0 ;
break ;
checkSent() ;
//DoSend + DoRecv : SendRecv
- SendBuffStruct * aSendDataStruct = nullptr ;
+ SendBuffStruct * aSendDataStruct = NULL ;
if ( _asynchronous && sendbuf )
{
aSendDataStruct = new SendBuffStruct ;
}
//DoSend + DoRecv : SendRecv
- SendBuffStruct * aSendDataStruct = nullptr ;
+ SendBuffStruct * aSendDataStruct = NULL ;
if ( _asynchronous && sendbuf )
{
aSendDataStruct = new SendBuffStruct ;
int SendTimeRequestId ;
int SendDataRequestId ;
- if ( _time_interpolator == nullptr )
+ if ( _time_interpolator == NULL )
{
return MPI_ERR_OTHER ;
}
}
//DoSend : Time + SendBuff
- SendBuffStruct * aSendTimeStruct = nullptr ;
- SendBuffStruct * aSendDataStruct = nullptr ;
+ SendBuffStruct * aSendTimeStruct = NULL ;
+ SendBuffStruct * aSendDataStruct = NULL ;
if ( sendbuf && sendcount )
{
- auto * aSendTimeMessage = new TimeMessage ;
+ TimeMessage * aSendTimeMessage = new TimeMessage ;
if ( _asynchronous )
{
aSendTimeStruct = new SendBuffStruct ;
int SendTimeRequestId ;
int SendDataRequestId ;
- if ( _time_interpolator == nullptr )
+ if ( _time_interpolator == NULL )
{
return MPI_ERR_OTHER ;
}
+ And if we are in synchronous mode we delete the SendMessages.
*/
//DoSend : Time + SendBuff
- SendBuffStruct * aSendTimeStruct = nullptr ;
- SendBuffStruct * aSendDataStruct = nullptr ;
+ SendBuffStruct * aSendTimeStruct = NULL ;
+ SendBuffStruct * aSendDataStruct = NULL ;
if ( sendbuf )
{
- auto * aSendTimeMessage = new TimeMessage ;
+ TimeMessage * aSendTimeMessage = new TimeMessage ;
if ( _asynchronous )
{
aSendTimeStruct = new SendBuffStruct ;
{
int sts = MPI_SUCCESS ;
int flag = WithWait ;
- int const size = _MPI_access->sendRequestIdsSize() ;
+ int size = _MPI_access->sendRequestIdsSize() ;
int * ArrayOfSendRequests = new int[ size ] ;
- int const nSendRequest = _MPI_access->sendRequestIds( size , ArrayOfSendRequests ) ;
- bool const SendTrace = false ;
+ int nSendRequest = _MPI_access->sendRequestIds( size , ArrayOfSendRequests ) ;
+ bool SendTrace = false ;
int i ;
for ( i = 0 ; i < nSendRequest ; i++ )
{
#ifndef __MPIACCESSDEC_HXX__
#define __MPIACCESSDEC_HXX__
-#include "DECOptions.hxx"
+#include "DEC.hxx"
+#include "LinearTimeInterpolator.hxx"
-#include <cstdlib>
+#include <map>
#include <iostream>
#include "MPIAccess.hxx"
-#include "ProcessorGroup.hxx"
-#include "MPIProcessorGroup.hxx"
-#include "TimeInterpolator.hxx"
namespace MEDCoupling
{
#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
#include "CommInterface.hxx"
+#include "InterpolationUtils.hxx"
-#include <cstdlib>
#include <iostream>
-#include <string>
+#include <set>
+#include <algorithm>
#include "mpi.h"
using namespace std;
_comm_interface.groupFree(&group_world);
throw INTERP_KERNEL::Exception("invalid argument in MPIProcessorGroup constructor (comm,pfirst,plast)");
}
- int const nprocs=pend-pstart+1;
+ int nprocs=pend-pstart+1;
int* ranks=new int[nprocs];
for (int i=pstart; i<=pend;i++)
{
*/
int MPIProcessorGroup::translateRank(const ProcessorGroup* group, int rank) const
{
- const auto* targetgroup=dynamic_cast<const MPIProcessorGroup*>(group);
+ const MPIProcessorGroup* targetgroup=dynamic_cast<const MPIProcessorGroup*>(group);
int local_rank;
MPI_Group_translate_ranks(targetgroup->_group, 1, &rank, _group, &local_rank);
return local_rank;
ProcessorGroup* MPIProcessorGroup::createComplementProcGroup() const
{
set <int> procs;
- int const world_size=_comm_interface.worldSize();
+ int world_size=_comm_interface.worldSize();
for (int i=0; i<world_size; i++)
procs.insert(i);
for (set<int>::const_iterator iter=_proc_ids.begin(); iter!= _proc_ids.end(); iter++)
#include "ProcessorGroup.hxx"
+#include <set>
#include <mpi.h>
-#include <string>
namespace MEDCoupling
{
MPIProcessorGroup (const ProcessorGroup& proc_group, std::set<int> proc_ids);
MPIProcessorGroup(const CommInterface& interface,int pstart, int pend, const MPI_Comm& world_comm=MPI_COMM_WORLD);
MPIProcessorGroup(const MPIProcessorGroup& other);
- ~MPIProcessorGroup() override;
+ virtual ~MPIProcessorGroup();
void release();
- MPIProcessorGroup *deepCopy() const override;
- ProcessorGroup* fuse (const ProcessorGroup&) const override;
- void intersect (ProcessorGroup&) override { }
- int myRank() const override;
- bool containsMyRank() const override { int rank; MPI_Group_rank(_group, &rank); return (rank!=MPI_UNDEFINED); }
- int translateRank(const ProcessorGroup* group, int rank) const override;
+ virtual MPIProcessorGroup *deepCopy() const;
+ virtual ProcessorGroup* fuse (const ProcessorGroup&) const;
+ void intersect (ProcessorGroup&) { }
+ int myRank() const;
+ bool containsMyRank() const { int rank; MPI_Group_rank(_group, &rank); return (rank!=MPI_UNDEFINED); }
+ int translateRank(const ProcessorGroup* group, int rank) const;
const MPI_Comm* getComm() const { return &_comm; }
- ProcessorGroup* createComplementProcGroup() const override;
- ProcessorGroup* createProcGroup() const override;
+ ProcessorGroup* createComplementProcGroup() const;
+ ProcessorGroup* createProcGroup() const;
MPI_Comm getWorldComm() { return _world_comm; }
private:
void updateMPISpecificAttributes();
//
#include "CommInterface.hxx"
-#include "DECOptions.hxx"
-#include "MCType.hxx"
-#include "ParaIdType.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
#include "MPIAccessDEC.hxx"
-#include <cstddef>
-#include <ostream>
#include "MxN_Mapping.hxx"
using namespace std;
void MxN_Mapping::prepareSendRecv()
{
- CommInterface const comm_interface=_union_group->getCommInterface();
+ CommInterface comm_interface=_union_group->getCommInterface();
// sending count pattern
int* nbsend=new int[_union_group->size()];
int* nbrecv=new int[_union_group->size()];
nbsend[i]=_send_proc_offsets[i+1]-_send_proc_offsets[i];
}
- auto* group = static_cast<MPIProcessorGroup*>(_union_group);
+ MPIProcessorGroup* group = static_cast<MPIProcessorGroup*>(_union_group);
const MPI_Comm* comm=group->getComm();
comm_interface.allToAll(nbsend, 1, MPI_INT,
nbrecv, 1, MPI_INT,
delete[] nbrecv;
_recv_ids.resize(_recv_proc_offsets[_union_group->size()]);
- mcIdType* isendbuf=nullptr;
- mcIdType* irecvbuf=nullptr;
+ mcIdType* isendbuf=0;
+ mcIdType* irecvbuf=0;
if (_sending_ids.size()>0)
isendbuf = new mcIdType[_sending_ids.size()];
if (_recv_ids.size()>0)
*/
void MxN_Mapping::sendRecv(double* sendfield, MEDCouplingFieldDouble& field) const
{
- CommInterface const comm_interface=_union_group->getCommInterface();
- const auto* group = static_cast<const MPIProcessorGroup*>(_union_group);
+ CommInterface comm_interface=_union_group->getCommInterface();
+ const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
int nbcomp=(int)field.getArray()->getNumberOfComponents();
- double* sendbuf=nullptr;
- double* recvbuf=nullptr;
+ double* sendbuf=0;
+ double* recvbuf=0;
if (_sending_ids.size() >0)
sendbuf = new double[_sending_ids.size()*nbcomp];
if (_recv_ids.size()>0)
recvptr++;
}
}
- if (sendbuf!=nullptr && getAllToAllMethod()== Native)
+ if (sendbuf!=0 && getAllToAllMethod()== Native)
delete[] sendbuf;
- if (recvbuf !=nullptr)
+ if (recvbuf !=0)
delete[] recvbuf;
delete[] sendcounts;
delete[] recvcounts;
*/
void MxN_Mapping::reverseSendRecv(double* recvfield, MEDCouplingFieldDouble& field) const
{
- CommInterface const comm_interface=_union_group->getCommInterface();
- const auto* group = static_cast<const MPIProcessorGroup*>(_union_group);
+ CommInterface comm_interface=_union_group->getCommInterface();
+ const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
int nbcomp=(int)field.getArray()->getNumberOfComponents();
- double* sendbuf=nullptr;
- double* recvbuf=nullptr;
+ double* sendbuf=0;
+ double* recvbuf=0;
if (_recv_ids.size() >0)
sendbuf = new double[_recv_ids.size()*nbcomp];
if (_sending_ids.size()>0)
recvptr++;
}
}
- if (sendbuf!=nullptr && getAllToAllMethod() == Native)
+ if (sendbuf!=0 && getAllToAllMethod() == Native)
delete[] sendbuf;
- if (recvbuf!=nullptr)
+ if (recvbuf!=0)
delete[] recvbuf;
delete[] sendcounts;
delete[] recvcounts;
#ifndef __MXN_MAPPING_HXX__
#define __MXN_MAPPING_HXX__
-#include "MCType.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MPIAccessDEC.hxx"
#include "DECOptions.hxx"
-#include <ostream>
+#include <vector>
namespace MEDCoupling
{
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <cstddef>
#include <mpi.h>
-#include <string>
+#include "CommInterface.hxx"
#include "Topology.hxx"
+#include "BlockTopology.hxx"
#include "ComponentTopology.hxx"
#include "ParaFIELD.hxx"
+#include "MPIProcessorGroup.hxx"
#include "DEC.hxx"
#include "NonCoincidentDEC.hxx"
}
NonCoincidentDEC::NonCoincidentDEC()
- = default;
+ {
+ }
/*! Constructor of a non coincident \ref para-dec "DEC" with
* a source group on which lies a field lying on a mesh and a
{}
NonCoincidentDEC::~NonCoincidentDEC()
- = default;
+ {
+ }
/*! Synchronization process. Calling this method
* synchronizes the topologies so that the target side
{
int nbelems = _local_field->getField()->getSupport()->getMesh()->getNumberOfElements(MED_EN::MED_CELL, MED_EN::MED_ALL_ELEMENTS);
int nbcomp = _local_field->getField()->getNumberOfComponents();
- auto* values = new double [nbelems*nbcomp];
+ double* values = new double [nbelems*nbcomp];
fvm_locator_exchange_point_var(_locator,
0,
values,
{
const double* values=_local_field->getField()->getValue();
int nbcomp = _local_field->getField()->getNumberOfComponents();
- auto* distant_values = new double [_nb_distant_points*nbcomp];
+ double* distant_values = new double [_nb_distant_points*nbcomp];
//cheap interpolation : the value of the cell is transferred to the point
for (int i=0; i<_nb_distant_points; i++)
#define __NONCOINCIDENTDEC_HXX__
#include "DEC.hxx"
-#include "ProcessorGroup.hxx"
struct _fvm_locator_t;
NonCoincidentDEC();
NonCoincidentDEC(ProcessorGroup& , ProcessorGroup&);
- ~NonCoincidentDEC() override;
+ virtual ~NonCoincidentDEC();
- void synchronize() override;
+ void synchronize();
void recvData();
#include "OverlapDEC.hxx"
#include "CommInterface.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMesh.hxx"
#include "ParaMESH.hxx"
#include "ParaFIELD.hxx"
#include "MPIProcessorGroup.hxx"
#include "OverlapElementLocator.hxx"
#include "OverlapInterpolationMatrix.hxx"
#include "ICoCoMEDDoubleField.hxx"
-#include <string>
-#include <ostream>
namespace MEDCoupling
{
OverlapDEC::OverlapDEC(const std::set<int>& procIds, const MPI_Comm& world_comm):
_load_balancing_algo(1),
- _own_group(true),_interpolation_matrix(nullptr), _locator(nullptr),
+ _own_group(true),_interpolation_matrix(0), _locator(0),
_default_field_value(0.0),
- _source_field(nullptr),_own_source_field(false),
- _target_field(nullptr),_own_target_field(false),
+ _source_field(0),_own_source_field(false),
+ _target_field(0),_own_target_field(false),
_comm(MPI_COMM_NULL)
{
- MEDCoupling::CommInterface const comm;
+ MEDCoupling::CommInterface comm;
int *ranks_world=new int[procIds.size()]; // ranks of sources and targets in world_comm
std::copy(procIds.begin(),procIds.end(),ranks_world);
MPI_Group group,world_group;
comm.groupFree(&world_group);
if(_comm==MPI_COMM_NULL)
{
- _group=nullptr;
+ _group=0;
return ;
}
std::set<int> idsUnion;
_locator = nullptr;
if (_comm != MPI_COMM_NULL)
{
- MEDCoupling::CommInterface const comm;
+ MEDCoupling::CommInterface comm;
comm.commFree(&_comm);
}
_comm = MPI_COMM_NULL;
_locator->copyOptions(*this);
_locator->exchangeMeshes(*_interpolation_matrix);
std::vector< std::pair<int,int> > jobs=_locator->getToDoList();
- std::string const srcMeth=_locator->getSourceMethod();
- std::string const trgMeth=_locator->getTargetMethod();
+ std::string srcMeth=_locator->getSourceMethod();
+ std::string trgMeth=_locator->getTargetMethod();
for(std::vector< std::pair<int,int> >::const_iterator it=jobs.begin();it!=jobs.end();it++)
{
const MEDCouplingPointSet *src=_locator->getSourceMesh((*it).first);
if(!isInGroup())
return ;
- auto *paramesh = new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())),
+ ParaMESH *paramesh = new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())),
*_group,field->getMesh()->getName());
- auto *tmpField=new ParaFIELD(field, paramesh, *_group);
+ ParaFIELD *tmpField=new ParaFIELD(field, paramesh, *_group);
tmpField->setOwnSupport(true);
attachSourceLocalField(tmpField,true);
}
if(!isInGroup())
return ;
- auto *paramesh = new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())),
+ ParaMESH *paramesh = new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())),
*_group,field->getMesh()->getName());
- auto *tmpField=new ParaFIELD(field, paramesh, *_group);
+ ParaFIELD *tmpField=new ParaFIELD(field, paramesh, *_group);
tmpField->setOwnSupport(true);
attachTargetLocalField(tmpField,true);
}
#include "DEC.hxx"
#include "InterpolationOptions.hxx"
-#include "MEDCouplingFieldDouble.hxx"
#include <mpi.h>
-#include <ostream>
+#include <string>
namespace ICoCo {
class MEDDoubleField;
{
public:
OverlapDEC(const std::set<int>& procIds,const MPI_Comm& world_comm=MPI_COMM_WORLD);
- ~OverlapDEC() override;
+ virtual ~OverlapDEC();
void release();
- void sendRecvData(bool way=true) override;
+ void sendRecvData(bool way=true);
void sendData();
void recvData();
- void synchronize() override;
+ void synchronize();
void attachSourceLocalField(ParaFIELD *field, bool ownPt=false);
void attachTargetLocalField(ParaFIELD *field, bool ownPt=false);
void attachSourceLocalField(MEDCouplingFieldDouble *field);
#include "OverlapElementLocator.hxx"
#include "CommInterface.hxx"
-#include "MCType.hxx"
-#include "ParaIdType.hxx"
-#include "MEDCouplingMesh.hxx"
#include "Topology.hxx"
+#include "BlockTopology.hxx"
#include "ParaFIELD.hxx"
#include "ParaMESH.hxx"
#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
#include "OverlapInterpolationMatrix.hxx"
-#include "MEDCouplingFieldDiscretization.hxx"
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldDiscretization.hxx"
+#include "DirectedBoundingBox.hxx"
#include "InterpKernelAutoPtr.hxx"
#include <limits>
-#include <ostream>
-#include <string>
using namespace std;
const ProcessorGroup& group, double epsAbs, int workSharingAlgo)
: _local_source_field(sourceField),
_local_target_field(targetField),
- _local_source_mesh(nullptr),
- _local_target_mesh(nullptr),
- _domain_bounding_boxes(nullptr),
+ _local_source_mesh(0),
+ _local_target_mesh(0),
+ _domain_bounding_boxes(0),
_epsAbs(epsAbs),
_group(group)
{
const MPI_Comm *OverlapElementLocator::getCommunicator() const
{
- const auto* group=static_cast<const MPIProcessorGroup*>(&_group);
+ const MPIProcessorGroup* group=static_cast<const MPIProcessorGroup*>(&_group);
return group->getComm();
}
void OverlapElementLocator::computeBoundingBoxesAndInteractionList()
{
- CommInterface const comm_interface=_group.getCommInterface();
- const auto* group=static_cast<const MPIProcessorGroup*> (&_group);
+ CommInterface comm_interface=_group.getCommInterface();
+ const MPIProcessorGroup* group=static_cast<const MPIProcessorGroup*> (&_group);
_local_space_dim=0;
if(_local_source_mesh)
_local_space_dim=_local_source_mesh->getSpaceDimension();
_local_space_dim=_local_target_mesh->getSpaceDimension();
//
const MPI_Comm* comm = group->getComm();
- int const bbSize=2*2*_local_space_dim;//2 (for source/target) 2 (min/max)
+ int bbSize=2*2*_local_space_dim;//2 (for source/target) 2 (min/max)
_domain_bounding_boxes=new double[bbSize*_group.size()];
INTERP_KERNEL::AutoPtr<double> minmax=new double[bbSize];
//Format minmax : Xmin_src,Xmax_src,Ymin_src,Ymax_src,Zmin_src,Zmax_src,Xmin_trg,Xmax_trg,Ymin_trg,Ymax_trg,Zmin_trg,Zmax_trg
//If _group.myRank()==myPair.first, current proc should fetch target mesh of myPair.second (if different from _group.myRank()).
//If _group.myRank()==myPair.second, current proc should fetch source mesh of myPair.second.
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
_to_do_list=_all_todo_lists[myProcId];
#ifdef DEC_DEBUG
//
// Final formatting - extract remaining keys in each map:
//
- int const myProcId = _group.myRank();
+ int myProcId = _group.myRank();
_all_todo_lists.resize(grp_size);
procID = 0;
for(const auto& itVector: full_set)
{
// Feeding now '_procs_to_send*'. A same id can appears twice. The second parameter in pair means what
// to send true=source, false=target
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
_procs_to_send_mesh.clear();
_procs_to_send_field.clear();
for(int i=0;i<_group.size();i++)
*/
void OverlapElementLocator::exchangeMeshes(OverlapInterpolationMatrix& matrix)
{
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
//starting to receive every procs whose id is lower than myProcId.
std::vector<Proc_SrcOrTgt> firstRcv, secondRcv;
for (const ProcCouple& pc: _to_do_list)
const MEDCouplingPointSet *OverlapElementLocator::getSourceMesh(int procId) const
{
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
if(myProcId==procId)
return _local_source_mesh;
Proc_SrcOrTgt p(procId,true);
const DataArrayIdType *OverlapElementLocator::getSourceIds(int procId) const
{
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
if(myProcId==procId)
- return nullptr;
+ return 0;
Proc_SrcOrTgt p(procId,true);
std::map<Proc_SrcOrTgt, AutoDAInt >::const_iterator it=_remote_elems.find(p);
return (*it).second;
const MEDCouplingPointSet *OverlapElementLocator::getTargetMesh(int procId) const
{
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
if(myProcId==procId)
return _local_target_mesh;
Proc_SrcOrTgt p(procId,false);
const DataArrayIdType *OverlapElementLocator::getTargetIds(int procId) const
{
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
if(myProcId==procId)
- return nullptr;
+ return 0;
Proc_SrcOrTgt p(procId,false);
std::map<Proc_SrcOrTgt, AutoDAInt >::const_iterator it=_remote_elems.find(p);
return (*it).second;
for (int idim=0; idim < _local_space_dim; idim++)
{
- bool const intersects = (target_bb[idim*2]<source_bb[idim*2+1]+_epsAbs)
+ bool intersects = (target_bb[idim*2]<source_bb[idim*2+1]+_epsAbs)
&& (source_bb[idim*2]<target_bb[idim*2+1]+_epsAbs);
if (!intersects)
return false;
#endif
//int myProcId=_group.myRank();
- const double *distant_bb=nullptr;
- MEDCouplingPointSet *local_mesh=nullptr;
- const ParaFIELD *field=nullptr;
+ const double *distant_bb=0;
+ MEDCouplingPointSet *local_mesh=0;
+ const ParaFIELD *field=0;
if(sourceOrTarget)//source for local mesh but target for distant mesh
{
distant_bb=_domain_bounding_boxes+procId*2*2*_local_space_dim+2*_local_space_dim;
}
AutoDAInt elems=local_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment());
DataArrayIdType *old2new_map;
- auto *send_mesh=static_cast<MEDCouplingPointSet *>(field->getField()->buildSubMeshData(elems->begin(),elems->end(),old2new_map));
+ MEDCouplingPointSet *send_mesh=static_cast<MEDCouplingPointSet *>(field->getField()->buildSubMeshData(elems->begin(),elems->end(),old2new_map));
if(sourceOrTarget)
matrix.keepTracksOfSourceIds(procId,old2new_map);
else
scout << "(" << rank << ") RCV part of " << st << " FROM: " << procId;
std::cout << scout.str() << "\n";
#endif
- DataArrayIdType *old2new_map=nullptr;
- MEDCouplingPointSet *m=nullptr;
+ DataArrayIdType *old2new_map=0;
+ MEDCouplingPointSet *m=0;
receiveMesh(procId,m,old2new_map);
Proc_SrcOrTgt p(procId,sourceOrTarget);
_remote_meshes[p]=m;
void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const
{
- CommInterface const comInterface=_group.getCommInterface();
+ CommInterface comInterface=_group.getCommInterface();
// First stage : exchanging sizes
vector<double> tinyInfoLocalD;//tinyInfoLocalD not used for the moment
comInterface.send(&lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm);
comInterface.send(&tinyInfoLocal[0],(int)tinyInfoLocal.size(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+1,*comm);
//
- DataArrayIdType *v1Local=nullptr;
- DataArrayDouble *v2Local=nullptr;
+ DataArrayIdType *v1Local=0;
+ DataArrayDouble *v2Local=0;
mesh->serialize(v1Local,v2Local);
comInterface.send(v1Local->getPointer(),(int)v1Local->getNbOfElems(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+2,*comm);
comInterface.send(v2Local->getPointer(),(int)v2Local->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm);
mcIdType lgth[2];
MPI_Status status;
const MPI_Comm *comm=getCommunicator();
- CommInterface const comInterface=_group.getCommInterface();
+ CommInterface comInterface=_group.getCommInterface();
comInterface.recv(lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm,&status);
std::vector<mcIdType> tinyInfoDistant(lgth[0]);
ids=DataArrayIdType::New();
#define __OVERLAPELEMENTLOCATOR_HXX__
#include "InterpolationOptions.hxx"
-#include "MCType.hxx"
+#include "MEDCouplingNatureOfField.hxx"
#include "MEDCouplingPointSet.hxx"
+#include "MEDCouplingMemArray.hxx"
#include "MCAuto.hxx"
#include <mpi.h>
-#include <utility>
-#include <string>
-#include <ostream>
+#include <vector>
+#include <map>
+#include <set>
//#define DEC_DEBUG
class ProcessorGroup;
class OverlapInterpolationMatrix;
- using ProcCouple = std::pair<int, int>; // a couple of proc IDs, typically used to define a exchange betw 2 procs
+ typedef std::pair<int,int> ProcCouple; // a couple of proc IDs, typically used to define a exchange betw 2 procs
class OverlapElementLocator : public INTERP_KERNEL::InterpolationOptions
{
void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const;
void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const;
private:
- using AutoMCPointSet = MCAuto<MEDCouplingPointSet>;
- using AutoDAInt = MCAuto<DataArrayInt64>;
- using Proc_SrcOrTgt = std::pair<int, bool>; ///< a key indicating a proc ID and whether the data is for source mesh/field or target mesh/field
+ typedef MCAuto< MEDCouplingPointSet > AutoMCPointSet;
+ typedef MCAuto< DataArrayIdType > AutoDAInt;
+ typedef std::pair<int,bool> Proc_SrcOrTgt; ///< a key indicating a proc ID and whether the data is for source mesh/field or target mesh/field
static const int START_TAG_MESH_XCH;
// Author : Anthony Geay (CEA/DEN)
#include "OverlapInterpolationMatrix.hxx"
-#include "DECOptions.hxx"
-#include "OverlapElementLocator.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingNormalizedUnstructuredMesh.txx"
-#include "Interpolation2D.hxx"
-#include "Interpolation3D.hxx"
-#include "Interpolation2D3D.hxx"
-#include "Interpolation2D1D.hxx"
-#include "Interpolation1D.hxx"
-#include "MEDCouplingNatureOfFieldEnum"
#include "ParaMESH.hxx"
#include "ParaFIELD.hxx"
#include "ProcessorGroup.hxx"
+#include "TranslationRotationMatrix.hxx"
+#include "Interpolation.hxx"
+#include "Interpolation1D.txx"
#include "Interpolation2DCurve.hxx"
+#include "Interpolation2D.txx"
#include "Interpolation3DSurf.hxx"
#include "Interpolation3D.txx"
#include "Interpolation2D3D.txx"
#include "Interpolation2D1D.txx"
#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingNormalizedUnstructuredMesh.txx"
#include "InterpolationOptions.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
#include "ElementLocator.hxx"
-#include "MEDCouplingFieldDouble.hxx"
+#include "InterpKernelAutoPtr.hxx"
-#include <string>
+#include <algorithm>
using namespace std;
}
OverlapInterpolationMatrix::~OverlapInterpolationMatrix()
- = default;
+ {
+ }
// TODO? Merge with MEDCouplingRemapper::prepareInterpKernelOnlyUU() ?
/**!
vector<SparseDoubleVec > sparse_matrix_part;
mcIdType colSize=0;
//computation of the intersection volumes between source and target elements
- const auto *trgC=dynamic_cast<const MEDCouplingUMesh *>(trg);
- const auto *srcC=dynamic_cast<const MEDCouplingUMesh *>(src);
+ const MEDCouplingUMesh *trgC=dynamic_cast<const MEDCouplingUMesh *>(trg);
+ const MEDCouplingUMesh *srcC=dynamic_cast<const MEDCouplingUMesh *>(src);
if ( src->getMeshDimension() == -1 )
{
if(trgC->getMeshDimension()==2 && trgC->getSpaceDimension()==2)
#ifndef __OVERLAPINTERPOLATIONMATRIX_HXX__
#define __OVERLAPINTERPOLATIONMATRIX_HXX__
-#include "MCType.hxx"
-#include "OverlapElementLocator.hxx"
+#include "MPIAccessDEC.hxx"
#include "OverlapMapping.hxx"
#include "InterpolationOptions.hxx"
#include "DECOptions.hxx"
-#include <string>
namespace MEDCoupling
{
// Author : Anthony Geay (CEA/DEN)
#include "OverlapMapping.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "MCIdType.hxx"
#include "MPIProcessorGroup.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MCAuto.hxx"
#include "InterpKernelAutoPtr.hxx"
-#include "OverlapElementLocator.hxx"
-#include "ParaIdType.hxx"
-#include <cstddef>
+#include <numeric>
#include <algorithm>
using namespace MEDCoupling;
*
* One of the 2 is necessarily null (the two can be null together)
*/
-void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType * /*trgIds*/, int trgProcId)
+void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType *trgIds, int trgProcId)
{
_matrixes_st.push_back(matrixST);
_source_proc_id_st.push_back(srcProcId);
printMatrixesST();
#endif
- CommInterface const commInterface=_group.getCommInterface();
- const auto *group=static_cast<const MPIProcessorGroup*>(&_group);
+ CommInterface commInterface=_group.getCommInterface();
+ const MPIProcessorGroup *group=static_cast<const MPIProcessorGroup*>(&_group);
const MPI_Comm *comm=group->getComm();
std::size_t grpSize=_group.size();
INTERP_KERNEL::AutoPtr<mcIdType> nbsend=new mcIdType[grpSize];
INTERP_KERNEL::AutoPtr<int> nbsend2=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbsend3=new int[grpSize];
std::fill<mcIdType *>(nbsend,nbsend+grpSize,0);
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
for(std::size_t i=0;i<_matrixes_st.size();i++)
if(_source_proc_id_st[i]==myProcId)
nbsend[_target_proc_id_st[i]]=(int)_matrixes_st[i].size();
INTERP_KERNEL::AutoPtr<int> nbrecv1=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbrecv2=new int[grpSize];
//
- mcIdType *tmp=nullptr;
+ mcIdType *tmp=0;
serializeMatrixStep0ST(nbrecv,
tmp,nbsend2,nbsend3,
nbrecv1,nbrecv2);
std::fill<int *>(nbsend2,nbsend2+grpSize,0);
INTERP_KERNEL::AutoPtr<int> nbrecv3=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbrecv4=new int[grpSize];
- double *tmp2=nullptr;
+ double *tmp2=0;
mcIdType lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2,
tmp,tmp2,
nbsend2,nbsend3,nbrecv3,nbrecv4);
*/
void OverlapMapping::computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg)
{
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
//
_the_deno_st.clear();
std::size_t sz1=_the_matrix_st.size();
void OverlapMapping::serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets,
int *countForRecv, int *offsetsForRecv) const
{
- std::size_t const grpSize=_group.size();
+ std::size_t grpSize=_group.size();
std::fill<int *>(count,count+grpSize,0);
std::size_t szz=0;
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
for(std::size_t i=0;i<_matrixes_st.size();i++)
{
if(_source_proc_id_st[i]==myProcId && _matrixes_st[i].size())// && _target_proc_id_st[i]!=myProcId
* This method performs step#1 and step#2/3. It returns the size of expected array to get allToAllV.
* It is where the locally computed matrices are serialized to be sent to adequate final proc.
*/
-mcIdType OverlapMapping::serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int * /*countStep0*/, const int *offsStep0,
+mcIdType OverlapMapping::serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int *countStep0, const int *offsStep0,
mcIdType *&bigArrI, double *&bigArrD, int *count, int *offsets,
int *countForRecv, int *offsForRecv) const
{
- std::size_t const grpSize=_group.size();
- int const myProcId=_group.myRank();
+ std::size_t grpSize=_group.size();
+ int myProcId=_group.myRank();
offsForRecv[0]=0;
mcIdType szz=0;
for(std::size_t i=0;i<grpSize;i++)
* - The second is the pseudo id of source proc (correspondence with true id is in attribute _the_matrix_st_source_proc_id and _the_matrix_st_source_ids)
* - the third is the srcId in the pseudo source proc
*/
-void OverlapMapping::unserializationST(mcIdType /*nbOfTrgElems*/,
+void OverlapMapping::unserializationST(mcIdType nbOfTrgElems,
const mcIdType *nbOfElemsSrcPerProc,//first all2all
- const mcIdType *bigArrRecv, const int * /*bigArrRecvCounts*/, const int *bigArrRecvOffs,//2nd all2all
- const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int * /*bigArrRecv2Count*/, const int *bigArrRecv2Offs)//3rd and 4th all2alls
+ const mcIdType *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,//2nd all2all
+ const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs)//3rd and 4th all2alls
{
_the_matrix_st.clear();
_the_matrix_st_source_proc_id.clear();
//
- std::size_t const grpSize=_group.size();
+ std::size_t grpSize=_group.size();
for(unsigned int i=0;i<grpSize;i++)
if(nbOfElemsSrcPerProc[i]!=0)
_the_matrix_st_source_proc_id.push_back(i);
_the_matrix_st[j].resize(nbOfElemsSrcPerProc[i]);
for(mcIdType k=0;k<nbOfElemsSrcPerProc[i];k++)
{
- mcIdType const offs=bigArrRecv[bigArrRecvOffs[i]+k];
- mcIdType const lgthOfMap=bigArrRecv[bigArrRecvOffs[i]+k+1]-offs;
+ mcIdType offs=bigArrRecv[bigArrRecvOffs[i]+k];
+ mcIdType lgthOfMap=bigArrRecv[bigArrRecvOffs[i]+k+1]-offs;
for(mcIdType l=0;l<lgthOfMap;l++)
_the_matrix_st[j][k][bigArrRecv2[bigArrRecv2Offs[i]+offs+l]]=bigArrDRecv2[bigArrRecv2Offs[i]+offs+l];
}
*/
void OverlapMapping::finishToFillFinalMatrixST()
{
- int const myProcId=_group.myRank();
+ int myProcId=_group.myRank();
std::size_t sz=_matrixes_st.size();
int nbOfEntryToAdd=0;
for(std::size_t i=0;i<sz;i++)
if(nbOfEntryToAdd==0)
return ;
std::size_t oldNbOfEntry=_the_matrix_st.size();
- std::size_t const newNbOfEntry=oldNbOfEntry+nbOfEntryToAdd;
+ std::size_t newNbOfEntry=oldNbOfEntry+nbOfEntryToAdd;
_the_matrix_st.resize(newNbOfEntry);
std::size_t j=oldNbOfEntry;
for(std::size_t i=0;i<sz;i++)
using namespace std;
std::size_t nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test
- CommInterface const commInterface=_group.getCommInterface();
- const auto *group=static_cast<const MPIProcessorGroup*>(&_group);
+ CommInterface commInterface=_group.getCommInterface();
+ const MPIProcessorGroup *group=static_cast<const MPIProcessorGroup*>(&_group);
const MPI_Comm *comm=group->getComm();
int grpSize=_group.size();
- int const myProcID=_group.myRank();
+ int myProcID=_group.myRank();
//
INTERP_KERNEL::AutoPtr<int> nbsend=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbsend2=new int[grpSize];
INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfCompo];
// By default field value set to default value - so mark which cells are hit
- mcIdType const ntup = fieldOutput->getNumberOfTuples();
+ mcIdType ntup = fieldOutput->getNumberOfTuples();
INTERP_KERNEL::AutoPtr<bool> hit_cells = new bool[ntup];
std::fill((bool *)hit_cells, (bool *)hit_cells+ntup, false);
/* When it is called, only the bits received from other processors (i.e. the remotely executed jobs) are in the
big matrix _the_matrix_st. */
- CommInterface const commInterface=_group.getCommInterface();
- int const myProcId=_group.myRank();
+ CommInterface commInterface=_group.getCommInterface();
+ int myProcId=_group.myRank();
std::size_t nbOfMatrixRecveived=_the_matrix_st_source_proc_id.size();
for(std::size_t i=0;i<nbOfMatrixRecveived;i++)
{
#ifndef __OVERLAPMAPPING_HXX__
#define __OVERLAPMAPPING_HXX__
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
+#include "MCAuto.hxx"
#include "OverlapElementLocator.hxx"
#include <vector>
#include <map>
-
//#define DEC_DEBUG
namespace MEDCoupling
// Author : Anthony Geay (EDF R&D)
#include "ParaDataArray.txx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.hxx"
using namespace MEDCoupling;
#pragma once
-#include "MCAuto.hxx"
-#include "MCType.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingTraits.hxx"
-#include <cstddef>
-#include <vector>
-#include <string>
namespace MEDCoupling
{
#pragma once
-#include "MEDCouplingTraits.hxx"
-#include "MCType.hxx"
-#include "MEDCouplingMemArray.txx"
-#include "MCAuto.hxx"
#include "ParaDataArray.hxx"
#include "CommInterface.hxx"
+#include "MEDCouplingMemArray.txx"
-#include <cstddef>
-#include <limits>
#include <sstream>
-#include <string>
namespace MEDCoupling
{
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingMemArray.hxx"
-#include "DisjointDEC.hxx"
-#include "MCType.hxx"
#include "Topology.hxx"
#include "BlockTopology.hxx"
#include "ComponentTopology.hxx"
#include "ParaFIELD.hxx"
#include "ParaMESH.hxx"
#include "InterpKernelUtilities.hxx"
+#include "InterpolationMatrix.hxx"
+#include <numeric>
namespace MEDCoupling
{
*/
ParaFIELD::ParaFIELD(TypeOfField type, TypeOfTimeDiscretization td, ParaMESH* para_support, const ComponentTopology& component_topology)
- :_field(nullptr),
- _component_topology(component_topology),_topology(nullptr),_own_support(false),
+ :_field(0),
+ _component_topology(component_topology),_topology(0),_own_support(false),
_support(para_support)
{
if (para_support->isStructured() || (para_support->getTopology()->getProcGroup()->size()==1 && component_topology.nbBlocks()!=1))
{
- const auto* source_topo = dynamic_cast<const BlockTopology*>(para_support->getTopology());
+ const BlockTopology* source_topo = dynamic_cast<const BlockTopology*>(para_support->getTopology());
_topology=new BlockTopology(*source_topo,component_topology);
}
else
throw INTERP_KERNEL::Exception(LOCALIZED("ParaFIELD constructor : Unstructured Support not taken into account with component topology yet"));
else
{
- const auto* source_topo=dynamic_cast<const BlockTopology*> (para_support->getTopology());
- int const nb_local_comp=component_topology.nbLocalComponents();
+ const BlockTopology* source_topo=dynamic_cast<const BlockTopology*> (para_support->getTopology());
+ int nb_local_comp=component_topology.nbLocalComponents();
_topology=new BlockTopology(*source_topo,nb_local_comp);
}
}
- int const nb_components = component_topology.nbLocalComponents();
+ int nb_components = component_topology.nbLocalComponents();
if (nb_components!=0)
{
_field=MEDCouplingFieldDouble::New(type,td);
This constructor supposes that support underlying \a subdomain_field has no ParaMESH
attached and it therefore recreates one. It therefore takes ownership over _support. The component topology associated with the field is a basic one (all components on the same processor).
*/
- ParaFIELD::ParaFIELD(MEDCouplingFieldDouble* subdomain_field, ParaMESH *sup, const ProcessorGroup& /*proc_group*/):
+ ParaFIELD::ParaFIELD(MEDCouplingFieldDouble* subdomain_field, ParaMESH *sup, const ProcessorGroup& proc_group):
_field(subdomain_field),
- _component_topology(ComponentTopology((int)_field->getNumberOfComponents())),_topology(nullptr),_own_support(false),
+ _component_topology(ComponentTopology((int)_field->getNumberOfComponents())),_topology(0),_own_support(false),
_support(sup)
{
if(_field)
_field->incrRef();
- const auto* source_topo=dynamic_cast<const BlockTopology*> (_support->getTopology());
+ const BlockTopology* source_topo=dynamic_cast<const BlockTopology*> (_support->getTopology());
_topology=new BlockTopology(*source_topo,_component_topology.nbLocalComponents());
}
_topology = nullptr;
}
- void ParaFIELD::synchronizeTarget(ParaFIELD* /*source_field*/)
+ void ParaFIELD::synchronizeTarget(ParaFIELD* source_field)
{
DisjointDEC* data_channel;
- if (dynamic_cast<BlockTopology*>(_topology)!=nullptr)
+ if (dynamic_cast<BlockTopology*>(_topology)!=0)
{
data_channel=new StructuredCoincidentDEC;
}
delete data_channel;
}
- void ParaFIELD::synchronizeSource(ParaFIELD* /*target_field*/)
+ void ParaFIELD::synchronizeSource(ParaFIELD* target_field)
{
DisjointDEC* data_channel;
- if (dynamic_cast<BlockTopology*>(_topology)!=nullptr)
+ if (dynamic_cast<BlockTopology*>(_topology)!=0)
{
data_channel=new StructuredCoincidentDEC;
}
DataArrayIdType* ParaFIELD::returnCumulativeGlobalNumbering() const
{
if(!_field)
- return nullptr;
- TypeOfField const type=_field->getTypeOfField();
+ return 0;
+ TypeOfField type=_field->getTypeOfField();
switch(type)
{
case ON_CELLS:
- return nullptr;
+ return 0;
case ON_NODES:
return _support->getGlobalNumberingNodeDA();
default:
- return nullptr;
+ return 0;
}
}
DataArrayIdType* ParaFIELD::returnGlobalNumbering() const
{
if(!_field)
- return nullptr;
- TypeOfField const type=_field->getTypeOfField();
+ return 0;
+ TypeOfField type=_field->getTypeOfField();
switch(type)
{
case ON_CELLS:
case ON_NODES:
return _support->getGlobalNumberingNodeDA();
default:
- return nullptr;
+ return 0;
}
}
over the all domain. */
double ParaFIELD::getVolumeIntegral(int icomp, bool isWAbs) const
{
- CommInterface const comm_interface = _topology->getProcGroup()->getCommInterface();
+ CommInterface comm_interface = _topology->getProcGroup()->getCommInterface();
double integral=_field->integral(icomp,isWAbs);
double total=0.;
const MPI_Comm* comm = (dynamic_cast<const MPIProcessorGroup*>(_topology->getProcGroup()))->getComm();
#include "ParaGRID.hxx"
#include "Topology.hxx"
#include "BlockTopology.hxx"
+#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingCMesh.hxx"
#include "InterpKernelUtilities.hxx"
+#include <iostream>
using namespace std;
_global_axis()
{
_block_topology = dynamic_cast<BlockTopology*>(topology);
- if(_block_topology==nullptr)
+ if(_block_topology==0)
throw INTERP_KERNEL::Exception(LOCALIZED("ParaGRID::ParaGRID topology must be block topology"));
if (!_block_topology->getProcGroup()->containsMyRank())
return;
- int const dimension=_block_topology->getDimension() ;
+ int dimension=_block_topology->getDimension() ;
if (dimension != global_grid->getSpaceDimension())
throw INTERP_KERNEL::Exception(LOCALIZED("ParaGrid::ParaGrid incompatible topology"));
_grid=global_grid;
#ifndef __PARAGRID_HXX__
#define __PARAGRID_HXX__
+#include "InterpolationUtils.hxx"
#include <vector>
//
#include "ParaMESH.hxx"
-#include "MEDCouplingPointSet.hxx"
-#include "MCType.hxx"
#include "ProcessorGroup.hxx"
+#include "MPIProcessorGroup.hxx"
#include "Topology.hxx"
#include "BlockTopology.hxx"
+#include "MEDCouplingMemArray.hxx"
-#include <string>
+#include <fstream>
+#include <vector>
//inclusion for the namespaces
using namespace std;
_cell_global.takeRef(CorrespElt_local2global);
}
- ParaMESH::ParaMESH( MEDCouplingPointSet *mesh, const ProcessorGroup& proc_group, const std::string& /*name*/):
+ ParaMESH::ParaMESH( MEDCouplingPointSet *mesh, const ProcessorGroup& proc_group, const std::string& name):
_my_domain_id(proc_group.myRank()),
_block_topology(new BlockTopology(proc_group, mesh->getNumberOfCells()))
{
_cell_mesh.takeRef(mesh);
- mcIdType const nb_elem=mesh->getNumberOfCells();
+ mcIdType nb_elem=mesh->getNumberOfCells();
_explicit_topology=new BlockTopology(proc_group,nb_elem);
- mcIdType const nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
_cell_global = DataArrayIdType::New();
_cell_global->alloc(nbOfCells,1);
mcIdType *cellglobal=_cell_global->getPointer();
#pragma once
-#include "MCType.hxx"
-#include "MCAuto.hxx"
#include "MEDCouplingPointSet.hxx"
#include "ProcessorGroup.hxx"
+#include "MEDCouplingMemArray.hxx"
#include <string>
+#include <vector>
namespace MEDCoupling
{
// Author : Anthony Geay (EDF R&D)
#include "ParaSkyLineArray.hxx"
-#include "MEDCouplingSkyLineArray.hxx"
-#include "MCType.hxx"
-#include "MCAuto.hxx"
+#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
+#include "Topology.hxx"
+#include "BlockTopology.hxx"
#include "CommInterface.hxx"
#include "MEDCouplingMemArray.hxx"
#include "mpi.h"
-#include <cstddef>
+#include <fstream>
#include <sstream>
+#include <numeric>
+#include <memory>
+#include <vector>
using namespace MEDCoupling;
MCAuto<ParaSkyLineArray> ParaSkyLineArray::equiRedistribute(mcIdType nbOfEntities) const
{
MPI_Comm comm(MPI_COMM_WORLD);
- CommInterface const ci;
+ CommInterface ci;
int size;
ci.commSize(comm,&size);
std::vector< MCAuto<MEDCouplingSkyLineArray> > skToBeSent(size);
#pragma once
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
#include "MEDCouplingSkyLineArray.hxx"
+#include "ProcessorGroup.hxx"
+#include "MEDCouplingMemArray.hxx"
-#include <cstddef>
#include <string>
#include <vector>
MCAuto<ParaSkyLineArray> equiRedistribute(mcIdType nbOfEntities) const;
MEDCouplingSkyLineArray *getSkyLineArray() const;
DataArrayIdType *getGlobalIdsArray() const;
- ~ParaSkyLineArray() override = default;
+ virtual ~ParaSkyLineArray() { }
private:
ParaSkyLineArray(MEDCouplingSkyLineArray *ska, DataArrayIdType *globalIds);
protected:
// Author : Anthony Geay (EDF R&D)
#include "ParaUMesh.hxx"
-#include "MEDCouplingUMesh.hxx"
-#include "MCAuto.hxx"
-#include "MCType.hxx"
-#include "ParaIdType.hxx"
-#include "MEDCouplingRefCountObject.hxx"
+#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
+#include "Topology.hxx"
+#include "BlockTopology.hxx"
#include "CommInterface.hxx"
-#include "MEDCouplingMemArray.txx"
+#include "MEDCouplingMemArray.hxx"
#include "mpi.h"
-#include <cstddef>
+#include <fstream>
+#include <sstream>
#include <numeric>
+#include <memory>
+#include <vector>
using namespace MEDCoupling;
MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodesTrue(const DataArrayIdType *globalNodeIds) const
{
MPI_Comm comm(MPI_COMM_WORLD);
- CommInterface const ci;
+ CommInterface ci;
int size;
ci.commSize(comm,&size);
std::unique_ptr<mcIdType[]> nbOfElems(new mcIdType[size]),nbOfElems2(new mcIdType[size]),nbOfElems3(new mcIdType[size]);
ci.allGather(&nbOfNodeIdsLoc,1,MPI_ID_TYPE,nbOfElems.get(),1,MPI_ID_TYPE,comm);
std::vector< MCAuto<DataArrayIdType> > tabs(size);
//store for each proc the local nodeids intercepted by current proc
- int const nbOfCollectiveCalls = 1;// this parameter controls the memory peak
+ int nbOfCollectiveCalls = 1;// this parameter controls the memory peak
// loop to avoid to all procs to have all the nodes per proc
for(int subDiv = 0 ; subDiv < nbOfCollectiveCalls ; ++subDiv)
{
{
MCAuto<DataArrayIdType> localNodeIds(tabs[curRk]);
localNodeIds->sort();
- MCAuto<DataArrayIdType> const localNodeIdsUnique(localNodeIds->buildUnique());
+ MCAuto<DataArrayIdType> localNodeIdsUnique(localNodeIds->buildUnique());
MCAuto<DataArrayIdType> localCellCaptured(_mesh->getCellIdsLyingOnNodes(localNodeIdsUnique->begin(),localNodeIdsUnique->end(),true));
MCAuto<DataArrayIdType> localCellCapturedGlob(_cell_global->selectByTupleIdSafe(localCellCaptured->begin(),localCellCaptured->end()));
tabs[curRk] = localCellCapturedGlob;
MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodesFalse(const DataArrayIdType *globalNodeIds) const
{
MPI_Comm comm(MPI_COMM_WORLD);
- CommInterface const ci;
+ CommInterface ci;
int size;
ci.commSize(comm,&size);
std::unique_ptr<mcIdType[]> nbOfElems(new mcIdType[size]),nbOfElems2(new mcIdType[size]),nbOfElems3(new mcIdType[size]);
mcIdType nbOfNodeIdsLoc(globalNodeIds->getNumberOfTuples());
ci.allGather(&nbOfNodeIdsLoc,1,MPI_ID_TYPE,nbOfElems.get(),1,MPI_ID_TYPE,comm);
// loop to avoid to all procs to have all the nodes per proc
- int const nbOfCollectiveCalls = 1;// this parameter controls the memory peak
+ int nbOfCollectiveCalls = 1;// this parameter controls the memory peak
std::vector< MCAuto<DataArrayIdType> > tabs(size);
for(int subDiv = 0 ; subDiv < nbOfCollectiveCalls ; ++subDiv)
{
globalNodeIdsOfCurProc->useArray(allGlobalNodeIds.get()+offset,false,DeallocType::CPP_DEALLOC,nbOfElemsSp[curRk],1);
offset += nbOfElemsSp[curRk];
MCAuto<DataArrayIdType> globalNodeIdsCaptured(_node_global->buildIntersection(globalNodeIdsOfCurProc));
- MCAuto<DataArrayIdType> const localNodeIdsToLocate(_node_global->findIdForEach(globalNodeIdsCaptured->begin(),globalNodeIdsCaptured->end()));
+ MCAuto<DataArrayIdType> localNodeIdsToLocate(_node_global->findIdForEach(globalNodeIdsCaptured->begin(),globalNodeIdsCaptured->end()));
MCAuto<DataArrayIdType> localCellCaptured(_mesh->getCellIdsLyingOnNodes(localNodeIdsToLocate->begin(),localNodeIdsToLocate->end(),false));
MCAuto<DataArrayIdType> localCellCapturedGlob(_cell_global->selectByTupleIdSafe(localCellCaptured->begin(),localCellCaptured->end()));
if(tabs[curRk].isNull())
ParaUMesh *ParaUMesh::redistributeCells(const DataArrayIdType *globalCellIds) const
{
MPI_Comm comm(MPI_COMM_WORLD);
- CommInterface const ci;
+ CommInterface ci;
std::unique_ptr<mcIdType[]> allGlobalCellIds,allGlobalCellIdsIndex;
int size(ci.allGatherArrays(comm,globalCellIds,allGlobalCellIds,allGlobalCellIdsIndex));
// Prepare ParaUMesh parts to be sent : compute for each proc the contribution of current rank.
globalCellIdsOfCurProc->useArray(allGlobalCellIds.get()+offset,false,DeallocType::CPP_DEALLOC,allGlobalCellIdsIndex[curRk+1]-offset,1);
// the key call is here : compute for rank curRk the cells to be sent
MCAuto<DataArrayIdType> globalCellIdsCaptured(_cell_global->buildIntersection(globalCellIdsOfCurProc));// OK for the global cellIds
- MCAuto<DataArrayIdType> const localCellIdsCaptured(_cell_global->findIdForEach(globalCellIdsCaptured->begin(),globalCellIdsCaptured->end()));
+ MCAuto<DataArrayIdType> localCellIdsCaptured(_cell_global->findIdForEach(globalCellIdsCaptured->begin(),globalCellIdsCaptured->end()));
MCAuto<MEDCouplingUMesh> meshPart(_mesh->buildPartOfMySelf(localCellIdsCaptured->begin(),localCellIdsCaptured->end(),true));
MCAuto<DataArrayIdType> o2n(meshPart->zipCoordsTraducer());// OK for the mesh
MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(meshPart->getNumberOfNodes()));
- MCAuto<DataArrayIdType> const globalNodeIdsPart(_node_global->selectByTupleIdSafe(n2o->begin(),n2o->end())); // OK for the global nodeIds
+ MCAuto<DataArrayIdType> globalNodeIdsPart(_node_global->selectByTupleIdSafe(n2o->begin(),n2o->end())); // OK for the global nodeIds
meshPartsToBeSent[curRk] = meshPart;
globalCellIdsToBeSent[curRk] = globalCellIdsCaptured;
globalNodeIdsToBeSent[curRk] = globalNodeIdsPart;
MCAuto<DataArrayIdType> aggregatedNodeIdsSorted(aggregatedNodeIds->copySorted());
MCAuto<DataArrayIdType> nodeIdsIntoAggregatedIds(DataArrayIdType::FindPermutationFromFirstToSecondDuplicate(aggregatedNodeIdsSorted,aggregatedNodeIds));
MCAuto<DataArrayIdType> idxOfSameNodeIds(aggregatedNodeIdsSorted->indexOfSameConsecutiveValueGroups());
- MCAuto<DataArrayIdType> const n2o_nodes(nodeIdsIntoAggregatedIds->selectByTupleIdSafe(idxOfSameNodeIds->begin(),idxOfSameNodeIds->end()-1));//new == new ordering so that global node ids are sorted . old == coarse ordering implied by the aggregation
+ MCAuto<DataArrayIdType> n2o_nodes(nodeIdsIntoAggregatedIds->selectByTupleIdSafe(idxOfSameNodeIds->begin(),idxOfSameNodeIds->end()-1));//new == new ordering so that global node ids are sorted . old == coarse ordering implied by the aggregation
MCAuto<DataArrayIdType> finalGlobalNodeIds(aggregatedNodeIdsSorted->selectByTupleIdSafe(idxOfSameNodeIds->begin(),idxOfSameNodeIds->end()-1));
MCAuto<DataArrayDouble> finalCoords(coords->selectByTupleIdSafe(n2o_nodes->begin(),n2o_nodes->end()));
finalCoords->copyStringInfoFrom(*_mesh->getCoords());
#pragma once
-#include "MEDCouplingRefCountObject.hxx"
-#include "MCAuto.hxx"
-#include "MEDCouplingTraits.hxx"
-#include "CommInterface.hxx"
-#include "MCType.hxx"
#include "MEDCouplingUMesh.hxx"
+#include "ProcessorGroup.hxx"
#include "MEDCouplingMemArray.hxx"
-#include <cstddef>
#include <string>
+#include <vector>
namespace MEDCoupling
{
DataArrayIdType *getGlobalCellIds() { return _cell_global; }
DataArrayIdType *getGlobalNodeIds() { return _node_global; }
protected:
- ~ParaUMesh() override = default;
+ virtual ~ParaUMesh() { }
ParaUMesh(MEDCouplingUMesh *mesh, DataArrayIdType *globalCellIds, DataArrayIdType *globalNodeIds);
std::string getClassName() const override { return "ParaUMesh"; }
std::size_t getHeapMemorySizeWithoutChildren() const override;
{
using DataArrayT = typename Traits<T>::ArrayType;
MPI_Comm comm(MPI_COMM_WORLD);
- CommInterface const ci;
+ CommInterface ci;
if( _cell_global->getNumberOfTuples() != fieldValueToRed->getNumberOfTuples() )
throw INTERP_KERNEL::Exception("PAraUMesh::redistributeCellFieldT : invalid input length of array !");
std::unique_ptr<mcIdType[]> allGlobalCellIds,allGlobalCellIdsIndex;
{
using DataArrayT = typename Traits<T>::ArrayType;
MPI_Comm comm(MPI_COMM_WORLD);
- CommInterface const ci;
+ CommInterface ci;
if( _node_global->getNumberOfTuples() != fieldValueToRed->getNumberOfTuples() )
throw INTERP_KERNEL::Exception("PAraUMesh::redistributeNodeFieldT : invalid input length of array !");
std::unique_ptr<mcIdType[]> allGlobalCellIds,allGlobalCellIdsIndex;
globalCellIdsOfCurProc->useArray(allGlobalCellIds.get()+offset,false,DeallocType::CPP_DEALLOC,allGlobalCellIdsIndex[curRk+1]-offset,1);
// the key call is here : compute for rank curRk the cells to be sent
MCAuto<DataArrayIdType> globalCellIdsCaptured(_cell_global->buildIntersection(globalCellIdsOfCurProc));// OK for the global cellIds
- MCAuto<DataArrayIdType> const localCellIdsCaptured(_cell_global->findIdForEach(globalCellIdsCaptured->begin(),globalCellIdsCaptured->end()));
+ MCAuto<DataArrayIdType> localCellIdsCaptured(_cell_global->findIdForEach(globalCellIdsCaptured->begin(),globalCellIdsCaptured->end()));
MCAuto<MEDCouplingUMesh> meshPart(_mesh->buildPartOfMySelf(localCellIdsCaptured->begin(),localCellIdsCaptured->end(),true));
MCAuto<DataArrayIdType> o2n(meshPart->zipCoordsTraducer());// OK for the mesh
MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(meshPart->getNumberOfNodes()));
//
#include "ProcessorGroup.hxx"
-#include "CommInterface.hxx"
+#include "InterpolationUtils.hxx"
namespace MEDCoupling
{
#include "CommInterface.hxx"
-#include <string>
+#include <set>
namespace MEDCoupling
{
ProcessorGroup (const CommInterface& interface, int start, int end);
ProcessorGroup(const CommInterface& interface,std::map<std::string,std::set<int>> proc_ids_by_name,const std::string& simCodeTag):
_comm_interface(interface),_proc_ids_by_name(proc_ids_by_name),_proc_ids(proc_ids_by_name.at(simCodeTag)) { }
- virtual ~ProcessorGroup() = default;
+ virtual ~ProcessorGroup() { }
virtual ProcessorGroup *deepCopy() const = 0;
virtual ProcessorGroup* fuse (const ProcessorGroup&) const = 0;
virtual void intersect (ProcessorGroup&) = 0;
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <cstddef>
#include <mpi.h>
-#include "DisjointDEC.hxx"
-#include "MCType.hxx"
-#include "ParaIdType.hxx"
+#include "CommInterface.hxx"
#include "Topology.hxx"
#include "BlockTopology.hxx"
#include "ComponentTopology.hxx"
#include "InterpKernelUtilities.hxx"
#include <iostream>
-#include <utility>
using namespace std;
if (!_topo_source->getProcGroup()->containsMyRank())
return;
- auto* group=new MPIProcessorGroup(_topo_source->getProcGroup()->getCommInterface());
+ MPIProcessorGroup* group=new MPIProcessorGroup(_topo_source->getProcGroup()->getCommInterface());
- int const myranksource = _topo_source->getProcGroup()->myRank();
+ int myranksource = _topo_source->getProcGroup()->myRank();
vector <mcIdType>* target_arrays=new vector<mcIdType>[_topo_target->getProcGroup()->size()];
//cout<<" topotarget size"<< _topo_target->getProcGroup()->size()<<endl;
- mcIdType const nb_local = _topo_source-> getNbLocalElements();
+ mcIdType nb_local = _topo_source-> getNbLocalElements();
for (mcIdType ielem=0; ielem< nb_local ; ielem++)
{
// cout <<"source local :"<<myranksource<<","<<ielem<<endl;
for (int iproc=0; iproc < _topo_target->getProcGroup()->size(); iproc++)
{
//converts the rank in target to the rank in union communicator
- int const unionrank=group->translateRank(_topo_target->getProcGroup(),iproc);
+ int unionrank=group->translateRank(_topo_target->getProcGroup(),iproc);
_send_counts[unionrank]=(int)target_arrays[iproc].size();
}
{
if (!_topo_target->getProcGroup()->containsMyRank())
return;
- auto* group=new MPIProcessorGroup(_topo_source->getProcGroup()->getCommInterface());
+ MPIProcessorGroup* group=new MPIProcessorGroup(_topo_source->getProcGroup()->getCommInterface());
- int const myranktarget = _topo_target->getProcGroup()->myRank();
+ int myranktarget = _topo_target->getProcGroup()->myRank();
vector < vector <mcIdType> > source_arrays(_topo_source->getProcGroup()->size());
- mcIdType const nb_local = _topo_target-> getNbLocalElements();
+ mcIdType nb_local = _topo_target-> getNbLocalElements();
for (mcIdType ielem=0; ielem< nb_local ; ielem++)
{
// cout <<"TS target local :"<<myranktarget<<","<<ielem<<endl;
for (int iproc=0; iproc < _topo_source->getProcGroup()->size(); iproc++)
{
//converts the rank in target to the rank in union communicator
- int const unionrank=group->translateRank(_topo_source->getProcGroup(),iproc);
+ int unionrank=group->translateRank(_topo_source->getProcGroup(),iproc);
_recv_counts[unionrank]=(int)source_arrays[iproc].size();
}
for (std::size_t i=1; i<union_size; i++)
{
MPI_Status status;
- mcIdType* serializer=nullptr;
+ mcIdType* serializer=0;
mcIdType size;
- auto* group=new MPIProcessorGroup(*_comm_interface);
+ MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface);
// The master proc creates a send buffer containing a serialized topology
int rank_master;
- if (topo!=nullptr && topo->getProcGroup()->myRank()==0)
+ if (topo!=0 && topo->getProcGroup()->myRank()==0)
{
MESSAGE ("Master rank");
topo->serialize(serializer, size);
// The topology is broadcasted to all processors in the group
_comm_interface->broadcast(&size, 1,MPI_ID_TYPE,rank_master,*(group->getComm()));
- auto* buffer=new mcIdType[size];
- if (topo!=nullptr && topo->getProcGroup()->myRank()==0)
+ mcIdType* buffer=new mcIdType[size];
+ if (topo!=0 && topo->getProcGroup()->myRank()==0)
copy(serializer, serializer+size, buffer);
_comm_interface->broadcast(buffer,(int)size,MPI_ID_TYPE,rank_master,*(group->getComm()));
// Processors which did not possess the source topology unserialize it
- auto* topotemp=new BlockTopology();
+ BlockTopology* topotemp=new BlockTopology();
topotemp->unserialize(buffer, *_comm_interface);
- if (topo==nullptr)
+ if (topo==0)
topo=topotemp;
else
delete topotemp;
// Memory cleaning
delete[] buffer;
- if (serializer!=nullptr)
+ if (serializer!=0)
delete[] serializer;
MESSAGE (" rank "<<group->myRank()<< " unserialize is over");
delete group;
_recv_buffer, _recv_counts, _recv_displs, MPI_DOUBLE,comm);
cout<<"end AllToAll"<<endl;
- mcIdType const nb_local = _topo_target->getNbLocalElements();
+ mcIdType nb_local = _topo_target->getNbLocalElements();
//double* value=new double[nb_local];
- auto* value=const_cast<double*>(_local_field->getField()->getArray()->getPointer());
+ double* value=const_cast<double*>(_local_field->getField()->getArray()->getPointer());
- int const myranktarget=_topo_target->getProcGroup()->myRank();
+ int myranktarget=_topo_target->getProcGroup()->myRank();
vector<int> counters(_topo_source->getProcGroup()->size());
counters[0]=0;
for (int i=0; i<_topo_source->getProcGroup()->size()-1; i++)
{
- auto* group=new MPIProcessorGroup(*_comm_interface);
- int const worldrank=group->translateRank(_topo_source->getProcGroup(),i);
+ MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface);
+ int worldrank=group->translateRank(_topo_source->getProcGroup(),i);
counters[i+1]=counters[i]+_recv_counts[worldrank];
delete group;
}
public:
StructuredCoincidentDEC();
StructuredCoincidentDEC( ProcessorGroup& source, ProcessorGroup& target);
- ~StructuredCoincidentDEC() override;
+ virtual ~StructuredCoincidentDEC();
void release();
- void synchronize() override;
- void recvData() override;
- void sendData() override;
- void prepareSourceDE() override;
- void prepareTargetDE() override;
+ void synchronize();
+ void recvData();
+ void sendData();
+ void prepareSourceDE();
+ void prepareTargetDE();
private :
void synchronizeTopology();
}
TimeInterpolator::~TimeInterpolator()
- = default;
+ {
+ }
}
#ifndef __TIMEINTERPOLATOR_HXX__
#define __TIMEINTERPOLATOR_HXX__
+#include "ProcessorGroup.hxx"
+#include <map>
+#include <iostream>
namespace MEDCoupling
{
#include "RENUMBER_BOOSTRenumbering.hxx"
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MCAuto.hxx"
+#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/cuthill_mckee_ordering.hpp>
-#include <boost/graph/graph_selectors.hpp>
-#include <boost/graph/detail/adjacency_list.hpp>
#include <boost/graph/properties.hpp>
-#include <boost/pending/property.hpp>
+#include <boost/graph/bandwidth.hpp>
void BOOSTRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm)
{
for (mcIdType j=index_graph[i];j<index_graph[i+1];++j)
add_edge(i,graph[j],G);
boost::property_map<Graph, boost::vertex_index_t>::type
- const index_map = boost::get(boost::vertex_index, G);
+ index_map = boost::get(boost::vertex_index, G);
boost::cuthill_mckee_ordering(G, out0->getPointer(), boost::get(boost::vertex_color, G),
boost::make_degree_map(G));
mcIdType *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer());
#ifndef __BOOSTRENUMBERING_HXX__
#define __BOOSTRENUMBERING_HXX__
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "RENUMBERDefines.hxx"
#include "RENUMBER_Renumbering.hxx"
class RENUMBER_EXPORT BOOSTRenumbering:public Renumbering
{
public:
- void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) override;
+ void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm);
};
#endif /*BOOSTRENUMBERING_HXX_*/
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MCIdType.hxx"
-#include "MCType.hxx"
-#include <vector>
-#include <algorithm>
#ifdef MED_ENABLE_PARMETIS
// include parmetis.h even if it is not needed here
// to avoid inclusion of c++ definitions within extern "C"
std::vector<idx_t> indexVec( index_graph, index_graph + indexSize );
std::vector<idx_t> graphVec( graph, graph + graphSize );
std::vector<idx_t> out0Vec( nbCell ), out1Vec( nbCell );
- auto nb = static_cast<idx_t>( nbCell );
+ idx_t nb = static_cast<idx_t>( nbCell );
METIS_NodeND(&nb,indexVec.data(),graphVec.data(),&num_flag,&options,out0Vec.data(),out1Vec.data());
std::copy( out0Vec.begin(),out0Vec.end(),out0->getPointer() );
std::copy( out1Vec.begin(),out1Vec.end(),out1->getPointer() );
#ifndef __METISRENUMBERING_HXX__
#define __METISRENUMBERING_HXX__
-#include "MCIdType.hxx"
-#include "MCType.hxx"
#include "RENUMBERDefines.hxx"
#include "RENUMBER_Renumbering.hxx"
class RENUMBER_EXPORT METISRenumbering:public Renumbering
{
public:
- void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nb_cell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) override;
+ virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nb_cell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm);
};
#endif /*METISRENUMBERING_HXX_*/
#ifndef RENUMBERING_HXX_
#define RENUMBERING_HXX_
-#include "MCIdType.hxx"
#include "RENUMBERDefines.hxx"
#include "MCType.hxx"
+#include <vector>
namespace MEDCoupling
{
{
public:
virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) = 0;
- virtual ~Renumbering() = default;
+ virtual ~Renumbering() { }
};
#endif /*RENUMBERING_HXX_*/
#include "RenumberingFactory.hxx"
#include "RENUMBER_Renumbering.hxx"
-#include <string>
-#include <cctype>
-#include <vector>
#ifdef MED_ENABLE_METIS
#include "RENUMBER_METISRenumbering.hxx"
#endif
else
{
std::cerr << "The method has to be METIS or BOOST" << std::endl;
- return nullptr;
+ return 0;
}
#endif
#ifndef ENABLE_BOOST
#include "RENUMBER_Renumbering.hxx"
#include <string>
-#include <vector>
namespace MED_RENUMBER
{
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MCAuto.hxx"
-#include "MCType.hxx"
-#include "MCIdType.hxx"
-#include "MEDCouplingMemArray.hxx"
#include "MEDFileData.hxx"
-#include "MEDFileFieldMultiTS.hxx"
-#include "MEDFileField1TS.hxx"
#include "MEDFileMesh.hxx"
#include "MEDFileField.hxx"
#include "MEDCouplingUMesh.hxx"
-#include "RENUMBER_Renumbering.hxx"
#include "RenumberingFactory.hxx"
-#include <sstream>
#include <time.h>
#include <string>
#include <cstdlib>
+#include <fstream>
#include <iostream>
using namespace std;
<< " filename_in meshname method[BOOST/METIS] filename_out" << endl << endl;
return -1;
}
- string const filename_in = argv[1];
- string const meshname = argv[2];
- string const type_renum = argv[3];
- string const filename_out = argv[4];
+ string filename_in = argv[1];
+ string meshname = argv[2];
+ string type_renum = argv[3];
+ string filename_out = argv[4];
if(type_renum!="METIS" && type_renum!="BOOST")
{
cout << "Reading : " << flush;
MCAuto<MEDFileData> fd(MEDFileData::New(filename_in));
MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname);
- auto *mc=dynamic_cast<MEDFileUMesh *>(m);
+ MEDFileUMesh *mc=dynamic_cast<MEDFileUMesh *>(m);
if(!mc)
{
std::ostringstream oss; oss << "In file \"" << filename_in << "\" the mesh name \"" << meshname<< "\" exists but is not unstructured !";
MCAuto<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
//std::vector<mcIdType> code=workMesh->getDistributionOfTypes();
cout << "Building the graph : " << flush;
- DataArrayIdType *neighb=nullptr,*neighbI=nullptr;
+ DataArrayIdType *neighb=0,*neighbI=0;
workMesh->computeNeighborsOfCells(neighb,neighbI);
MCAuto<DataArrayIdType> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe;
const mcIdType *graph=neighbSafe->begin();
const mcIdType *graph_index=neighbISafe->begin();
// Compute permutation iperm->new2old perm->old2new
- DataArrayIdType *iperm(nullptr),*perm(nullptr);
+ DataArrayIdType *iperm(0),*perm(0);
Renumbering *renumb=RenumberingFactory(type_renum);
renumb->renumber(graph,graph_index,workMesh->getNumberOfCells(),iperm,perm);
ipermSafe=iperm; permSafe=perm;
delete renumb;
- ipermSafe=nullptr;//erase new2old, we are using only old 2 new
+ ipermSafe=0;//erase new2old, we are using only old 2 new
t_compute_graph=(double)clock();
cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl;
cout.flush();
{
for(int i=0;i<fs->getNumberOfFields();i++)
{
- auto *fmts=dynamic_cast<MEDFileFieldMultiTS *>(fs->getFieldAtPos(i));
+ MEDFileFieldMultiTS *fmts=dynamic_cast<MEDFileFieldMultiTS *>(fs->getFieldAtPos(i));
if(!fmts) continue;
if(fmts->getMeshName()==meshname)
{
for(int j=0;j<fmts->getNumberOfTS();j++)
{
- auto *f1ts=dynamic_cast<MEDFileField1TS*>(fmts->getTimeStepAtPos(j));
+ MEDFileField1TS *f1ts=dynamic_cast<MEDFileField1TS*>(fmts->getTimeStepAtPos(j));
if(!f1ts) continue;
DataArrayDouble *arr=f1ts->getUndergroundDataArray();
arr->renumberInPlace(perm->begin());