more size_t

This commit is contained in:
Joachim Schöberl 2017-02-25 17:11:30 +01:00
parent c143aafaea
commit c633035043
2 changed files with 25 additions and 27 deletions

View File

@ -36,54 +36,52 @@ namespace netgen
class Ng_Points class Ng_Points
{ {
public: public:
int num; size_t num;
const int * ptr; const int * ptr;
int Size() const { return num; } size_t Size() const { return num; }
int operator[] (int i) const { return ptr[i]-POINTINDEX_BASE; } int operator[] (size_t i) const { return ptr[i]-POINTINDEX_BASE; }
}; };
class Ng_Vertices class Ng_Vertices
{ {
public: public:
int num; size_t num;
const int * ptr; const int * ptr;
int Size() const { return num; } size_t Size() const { return num; }
int operator[] (int i) const { return ptr[i]-POINTINDEX_BASE; } int operator[] (size_t i) const { return ptr[i]-POINTINDEX_BASE; }
}; };
class Ng_Edges class Ng_Edges
{ {
public: public:
int num; size_t num;
const T_EDGE2 * ptr; const T_EDGE2 * ptr;
int Size() const { return num; } size_t Size() const { return num; }
// int operator[] (int i) const { return abs (ptr[i])-1; } int operator[] (size_t i) const { return ptr[i].nr; }
int operator[] (int i) const { return ptr[i].nr; }
}; };
class Ng_Faces class Ng_Faces
{ {
public: public:
int num; size_t num;
const T_FACE2 * ptr; const T_FACE2 * ptr;
int Size() const { return num; } size_t Size() const { return num; }
// int operator[] (int i) const { return (ptr[i]-1) / 8; } int operator[] (size_t i) const { return ptr[i].nr; }
int operator[] (int i) const { return ptr[i].nr; }
}; };
class Ng_Facets class Ng_Facets
{ {
public: public:
int num; size_t num;
const int * ptr; const int * ptr;
int Size() const { return num; } size_t Size() const { return num; }
int operator[] (int i) const { return ptr[i]; } int operator[] (size_t i) const { return ptr[i]; }
}; };
@ -229,10 +227,10 @@ namespace netgen
Ng_Point GetPoint (int nr) const; Ng_Point GetPoint (int nr) const;
template <int DIM> template <int DIM>
Ng_Element GetElement (int nr) const; Ng_Element GetElement (size_t nr) const;
template <int DIM> template <int DIM>
int GetElementIndex (int nr) const; int GetElementIndex (size_t nr) const;
/// material/boundary label of region, template argument is co-dimension /// material/boundary label of region, template argument is co-dimension
template <int DIM> template <int DIM>

View File

@ -5,13 +5,13 @@ NGX_INLINE DLL_HEADER Ng_Point Ngx_Mesh :: GetPoint (int nr) const
template <> template <>
NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<0> (int nr) const NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<0> (size_t nr) const
{ {
return (*mesh).pointelements[nr].index; return (*mesh).pointelements[nr].index;
} }
template <> template <>
NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<1> (int nr) const NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<1> (size_t nr) const
{ {
if(mesh->GetDimension()==3) if(mesh->GetDimension()==3)
return (*mesh)[SegmentIndex(nr)].edgenr; return (*mesh)[SegmentIndex(nr)].edgenr;
@ -20,21 +20,21 @@ NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<1> (int nr) const
} }
template <> template <>
NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<2> (int nr) const NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<2> (size_t nr) const
{ {
int ind = (*mesh)[SurfaceElementIndex(nr)].GetIndex(); int ind = (*mesh)[SurfaceElementIndex(nr)].GetIndex();
return mesh->GetFaceDescriptor(ind).BCProperty(); return mesh->GetFaceDescriptor(ind).BCProperty();
} }
template <> template <>
NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<3> (int nr) const NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<3> (size_t nr) const
{ {
return (*mesh)[ElementIndex(nr)].GetIndex(); return (*mesh)[ElementIndex(nr)].GetIndex();
} }
template <> template <>
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<0> (int nr) const NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<0> (size_t nr) const
{ {
const Element0d & el = mesh->pointelements[nr]; const Element0d & el = mesh->pointelements[nr];
@ -60,7 +60,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<0> (int nr) const
template <> template <>
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (int nr) const NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const
{ {
const Segment & el = mesh->LineSegment (SegmentIndex(nr)); const Segment & el = mesh->LineSegment (SegmentIndex(nr));
@ -107,7 +107,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (int nr) const
} }
template <> template <>
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (int nr) const NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (size_t nr) const
{ {
const Element2d & el = mesh->SurfaceElement (SurfaceElementIndex (nr)); const Element2d & el = mesh->SurfaceElement (SurfaceElementIndex (nr));
@ -146,7 +146,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (int nr) const
} }
template <> template <>
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<3> (int nr) const NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<3> (size_t nr) const
{ {
const Element & el = mesh->VolumeElement (ElementIndex (nr)); const Element & el = mesh->VolumeElement (ElementIndex (nr));