parallel refinement

This commit is contained in:
Joachim Schoeberl 2016-02-28 06:05:19 +01:00
parent bcbc4294bc
commit ee6fbe65e7
4 changed files with 11 additions and 13 deletions

View File

@ -715,7 +715,8 @@ namespace netgen
template <class T, class S>
void QuickSort (FlatArray<T> & data, FlatArray<S> & slave)
{
QuickSortRec (data, slave, 0, data.Size()-1);
if (data.Size() > 1)
QuickSortRec (data, slave, 0, data.Size()-1);
}

View File

@ -23,6 +23,7 @@ namespace netgen
void ParallelMeshTopology :: Reset ()
{
cout << "ParallelMeshTopology::Reset called" << endl;
*testout << "ParallelMeshTopology::Reset" << endl;
if ( ntasks == 1 ) return;
@ -46,6 +47,7 @@ namespace netgen
SetNV(mesh.GetNV());
SetNE(mesh.GetNE());
}
cout << "ParallelMeshTopology::Reset complete" << endl;
}
@ -112,6 +114,7 @@ namespace netgen
void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
{
cout << "updatecoarsegridglobal called" << endl;
if (id == 0)
PrintMessage ( 3, "UPDATE GLOBAL COARSEGRID STARTS" );
@ -202,6 +205,7 @@ namespace netgen
void ParallelMeshTopology :: UpdateCoarseGrid ()
{
cout << "updatecoarsegrid called, is_updated = " << is_updated << endl;
if (is_updated) return;
Reset();
@ -235,15 +239,15 @@ namespace netgen
cout << "update refined vertices" << endl;
// update new vertices after mesh-refinement
if (loc2distvert.Size() < mesh.mlbetweennodes)
if (loc2distvert.Size() < mesh.mlbetweennodes.Size())
{
int oldnv = loc2distvert.Size();
int newnv = mesh.mlbetweennodes.Size();
loc2distvert.ChangeSize(mesh.mlbetweennodes.Size());
for (PointIndex pi = oldnv+PointIndex::BASE; nr < newnv+PointIndex::Base; nr++)
for (PointIndex pi = oldnv+PointIndex::BASE; pi < newnv+PointIndex::BASE; pi++)
{
PointIndex v1 = mesh.mlbetweennodex[pi][0];
PointIndex v2 = mesh.mlbetweennodex[pi][1];
PointIndex v1 = mesh.mlbetweennodes[pi][0];
PointIndex v2 = mesh.mlbetweennodes[pi][1];
for (int dest = 1; dest < ntasks; dest++)
if (IsExchangeVert (dest, v1) && IsExchangeVert (dest, v2))
SetDistantPNum(dest, pi);

View File

@ -333,17 +333,12 @@ DLL_HEADER void ExportNetgenMeshing()
if (id == 0)
{
cout << "I am proc " << id << " load the mesh" << endl;
self.Load(*infile);
cout << "i distribute" << endl;
self.Distribute();
cout << "dist done" << endl;
}
else
{
cout << "I am proc " << id << endl << " sendrec" << endl;
self.SendRecvMesh();
cout << "sendrec done" << endl;
}
#else
self.Load(*infile);

View File

@ -30,7 +30,6 @@ namespace netgen
// new version with consistent ordering across sub-domains
Array<INDEX_2> parents;
cout << "find edges" << endl;
for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++)
{
const Segment & el = mesh[si];
@ -74,7 +73,7 @@ namespace netgen
for (int i = 0; i < par_nr.Size(); i++)
par_nr[i] = i;
QuickSort (parents, par_nr);
mesh.mlbetweennodes.SetSize(mesh.GetNV()+parents.Size());
for (int i = 0; i < parents.Size(); i++)
{
between.Set (parents[i], mesh.GetNV()+i+PointIndex::BASE);
@ -131,7 +130,6 @@ namespace netgen
mesh.LineSegment(si) = ns1;
mesh.AddSegment (ns2);
}
cout << "have segments" << endl;
// refine surface elements