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

View File

@ -5,13 +5,13 @@ NGX_INLINE DLL_HEADER Ng_Point Ngx_Mesh :: GetPoint (int nr) const
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;
}
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)
return (*mesh)[SegmentIndex(nr)].edgenr;
@ -20,21 +20,21 @@ NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<1> (int nr) const
}
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();
return mesh->GetFaceDescriptor(ind).BCProperty();
}
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();
}
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];
@ -60,7 +60,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<0> (int nr) const
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));
@ -107,7 +107,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (int nr) const
}
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));
@ -146,7 +146,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (int nr) const
}
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));