parallel / non parallel

This commit is contained in:
Joachim Schoeberl 2011-07-15 08:04:25 +00:00
parent 342983ee75
commit cad298149d
6 changed files with 83 additions and 51 deletions

View File

@ -72,7 +72,7 @@
{
bool parthread = netgen::mparam.parthread;
if (netgen::id > 0) parthread = true;
if (netgen::id > 0) parthread = false;
// if (netgen::ntasks > 1) parthread = false;
if (parthread)

View File

@ -103,7 +103,7 @@ namespace netgen
// overlap = 0;
}
/*
int ParallelMeshTopology :: Glob2Loc_Vert (int globnum)
{
for (int i = 1; i <= nv; i++)
@ -138,7 +138,7 @@ namespace netgen
locnum = i+1;
return locnum;
}
*/
void ParallelMeshTopology :: Print() const
@ -856,10 +856,72 @@ namespace netgen
NgProfiler::StartTimer (timere);
// exchange edges
int maxedge = 0;
for (int edge = 1; edge <= ned; edge++)
maxedge = max (maxedge, GetDistantEdgeNum (0, edge));
glob2loc.SetSize (maxedge);
glob2loc = -1;
for (int edge = 1; edge <= ned; edge++)
glob2loc[GetDistantEdgeNum(0, edge)] = edge;
cnt_send = 0;
int v1, v2;
for (int edge = 1; edge <= ned; edge++)
{
topology.GetEdgeVertices (edge, v1, v2);
for (int dest = 1; dest < ntasks; dest++)
if (IsExchangeVert (dest, v1) &&
IsExchangeVert (dest, v2))
{
cnt_send[dest-1]+=2;
}
}
TABLE<int> send_edges(cnt_send);
for (int edge = 1; edge <= ned; edge++)
{
topology.GetEdgeVertices (edge, v1, v2);
for (int dest = 1; dest < ntasks; dest++)
{
if (IsExchangeVert (dest, v1) &&
IsExchangeVert (dest, v2))
{
send_edges.Add (dest-1, GetDistantEdgeNum(0, edge));
send_edges.Add (dest-1, edge);
}
}
}
TABLE<int> recv_edges(ntasks-1);
MyMPI_ExchangeTable (send_edges, recv_edges, MPI_TAG_MESH+8, MPI_HIGHORDER_COMM);
*testout << "send exchange edges: " << send_edges << endl;
*testout << "recv exchange edges: " << recv_edges << endl;
for (int sender = 1; sender < ntasks; sender ++)
if (id != sender)
{
FlatArray<int> recvarray = recv_edges[sender-1];
for (int ii = 0; ii < recvarray.Size(); )
{
int globe = recvarray[ii++];
int diste = recvarray[ii++];
int loce = glob2loc[globe];
// *testout << "set distant face, sender = " << sender << ", locf = " << locf << "; distf = " << distf << endl;
if (loce != -1)
SetDistantEdgeNum (sender, loce, diste);
}
}
/*
sendarray.SetSize (0);
recvarray.SetSize (0);
// exchange edges
int maxedge = 0;
for (int edge = 1; edge <= ned; edge++)
@ -897,8 +959,9 @@ namespace netgen
}
}
}
*/
NgProfiler::StopTimer (timere);
NgProfiler::StartTimer (timerf);
glob2loc.SetSize (nfaglob);
@ -1157,6 +1220,7 @@ namespace netgen
void ParallelMeshTopology :: UpdateTopology ()
{
#ifdef OLD
const MeshTopology & topology = mesh.GetTopology();
int nfa = topology.GetNFaces();
int ned = topology.GetNEdges();
@ -1189,6 +1253,7 @@ namespace netgen
}
}
*/
#endif
}

View File

@ -62,10 +62,12 @@ namespace netgen
void GetVertNeighbours ( int vnum, Array<int> & dests ) const;
/*
int Glob2Loc_SurfEl ( int globnum );
int Glob2Loc_VolEl ( int globnum );
int Glob2Loc_Segm ( int globnum );
int Glob2Loc_Vert ( int globnum );
*/
int GetNDistantPNums ( int locpnum ) const
{ return loc2distvert[locpnum].Size() / 2 + 1; }

View File

@ -1080,7 +1080,6 @@ namespace netgen
#ifdef PARALLEL
(*testout) << " RESET Paralleltop" << endl;
paralleltop.Reset ();
#endif
@ -1207,26 +1206,15 @@ namespace netgen
;
// cout << "p" << id << ": " << "Partition " << id << " is totally local" << endl;
#endif
}
#ifdef PARALLEL
if ( isparallel )
{
paralleltop.Update();
if ( paralleltop.DoCoarseUpdate() )
{
paralleltop.UpdateCoarseGrid();
}
else
{
// paralleltop.UpdateRefinement();
}
// paralleltop.Print();
paralleltop.UpdateCoarseGrid();
}
#endif

View File

@ -1,4 +1,3 @@
if { [Ng_ACISCommand isACISavailable] == "yes" } {
.ngmenu.geometry add command -label "ACIS Topology Explorer..." \
-command { acisdialog; }

View File

@ -1,11 +1,11 @@
if {[catch {package require Tix } result ]} {
puts "cannot find package Tix"
puts "cannot load package Tix"
puts "error : $result"
}
# if {[catch {package require Togl 2.0 } result ]} {
# puts "cannot find package Togl 2.0"
# puts "error : $result"
# puts "cannot load package Togl 2.0"
# puts "error : $result"
# }
@ -43,7 +43,8 @@ if { [string length $nguserdir] == 0 } {
set batchmode [Ng_GetCommandLineParameter batchmode]
set solvemode 0
if { [Ng_GetCommandLineParameter solve] != "undefined" || [Ng_GetCommandLineParameter recent] == "defined" } {
if { [Ng_GetCommandLineParameter solve] != "undefined" || \
[Ng_GetCommandLineParameter recent] == "defined" } {
set solvemode defined
}
@ -98,21 +99,10 @@ catch { source ${ngdir}/occgeom.tcl }
source ${ngdir}/acisgeom.tcl
catch {
source ${ngdir}/nghelp.tcl
}
catch {
source ${ngdir}/ngvisual.tcl
}
catch {
source ${ngdir}/sockets.tcl
}
catch {
source ${ngdir}/acis.tcl
}
catch { source ${ngdir}/nghelp.tcl }
catch { source ${ngdir}/ngvisual.tcl }
catch { source ${ngdir}/sockets.tcl }
catch { source ${ngdir}/acis.tcl }
@ -286,25 +276,13 @@ if { [Ng_GetCommandLineParameter help]=="defined" } {
}
}
if { [file exists startup.tcl] } {
source startup.tcl }
##################################################
# catch { source ${ngdir}/trafo/trafo.tcl }
# catch { source ${ngdir}/trafoapp/smallmodels.tcl }
# catch {
# source ${ngdir}/ngshell.tcl
# source ${ngdir}/ngtesting.tcl
# }
catch { source ${ngdir}/demoapp.tcl }
catch { source ${ngdir}/dropsexp.tcl }