mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
Merge branch 'remove_pointgeominfo_limit' into 'master'
Remove limit of max 100 PointGeomInfos, add move assignment to ArrayMem See merge request jschoeberl/netgen!174
This commit is contained in:
commit
39e4e2bc12
@ -1110,6 +1110,25 @@ namespace ngcore
|
||||
return *this;
|
||||
}
|
||||
|
||||
ArrayMem & operator= (ArrayMem && a2)
|
||||
{
|
||||
if (a2.mem_to_delete)
|
||||
{
|
||||
ngcore::Swap (mem_to_delete, a2.mem_to_delete);
|
||||
ngcore::Swap (data, a2.data);
|
||||
ngcore::Swap (allocsize, a2.allocsize);
|
||||
ngcore::Swap (size, a2.size);
|
||||
}
|
||||
else
|
||||
{
|
||||
allocsize = S;
|
||||
for (size_t i = 0; i < S; i++)
|
||||
mem[i] = std::move(a2.mem[i]);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/// array copy
|
||||
ArrayMem & operator= (const FlatArray<T> & a2)
|
||||
{
|
||||
|
@ -7,20 +7,14 @@ namespace netgen
|
||||
int MultiPointGeomInfo ::
|
||||
AddPointGeomInfo (const PointGeomInfo & gi)
|
||||
{
|
||||
for (int k = 0; k < cnt; k++)
|
||||
if (mgi[k].trignum == gi.trignum)
|
||||
for (auto & pgi : mgi)
|
||||
if (pgi.trignum == gi.trignum)
|
||||
return 0;
|
||||
|
||||
if (cnt < MULTIPOINTGEOMINFO_MAX)
|
||||
{
|
||||
mgi[cnt] = gi;
|
||||
cnt++;
|
||||
mgi.Append(gi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
throw NgException ("Please report error: MPGI Size too small\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef PARALLEL
|
||||
|
@ -97,19 +97,22 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
#define MULTIPOINTGEOMINFO_MAX 100
|
||||
class MultiPointGeomInfo
|
||||
{
|
||||
int cnt;
|
||||
PointGeomInfo mgi[MULTIPOINTGEOMINFO_MAX];
|
||||
ArrayMem<PointGeomInfo, 100> mgi;
|
||||
public:
|
||||
MultiPointGeomInfo () { cnt = 0; }
|
||||
int AddPointGeomInfo (const PointGeomInfo & gi);
|
||||
void Init () { cnt = 0; }
|
||||
void DeleteAll () { cnt = 0; }
|
||||
void Init () { mgi.SetSize(0); }
|
||||
void DeleteAll () { mgi.SetSize(0); }
|
||||
|
||||
int GetNPGI () const { return cnt; }
|
||||
int GetNPGI () const { return mgi.Size(); }
|
||||
const PointGeomInfo & GetPGI (int i) const { return mgi[i-1]; }
|
||||
|
||||
MultiPointGeomInfo () = default;
|
||||
MultiPointGeomInfo (const MultiPointGeomInfo&) = default;
|
||||
MultiPointGeomInfo (MultiPointGeomInfo &&) = default;
|
||||
MultiPointGeomInfo & operator= (const MultiPointGeomInfo&) = default;
|
||||
MultiPointGeomInfo & operator= (MultiPointGeomInfo&&) = default;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user