parallal restructure

This commit is contained in:
Joachim Schoeberl 2009-01-25 13:06:46 +00:00
parent 3a5f9cb7d5
commit e2118a76b9
6 changed files with 117 additions and 108 deletions

View File

@ -53,12 +53,13 @@ AC_ARG_ENABLE([nglib],
AC_ARG_ENABLE([parallel], AC_ARG_ENABLE([parallel],
[ --enable-parallel enable mpi parallelization], [ --enable-parallel enable mpi parallelization],
[AC_SUBST([MPI_INCLUDES], "-I/opt/mpich/include -DPARALLEL -I/usr/share/metis/Lib -DMETIS") [AC_SUBST([MPI_INCLUDES], "-I/opt/mpich/include -DPARALLEL -I/home/joachim/download/metis-4.0/Lib -DMETIS")
AC_SUBST([MPI_LIBS], "-lmetis -L/opt/mpich/ch-p4/lib -lmpich") AC_SUBST([MPI_LIBS], "-L/home/joachim/download/metis-4.0 -lmetis -L/opt/mpich/ch-p4/lib64 -lmpich")
] ]
) )
# [AC_SUBST([MPI_INCLUDES], "-I/opt/mpich/include -DPARALLEL -I/usr/share/metis/Lib -DMETIS")
# AC_SUBST([MPI_LIBS], "-lmetis -L/opt/mpich/ch-p4/lib -lmpich")
# AC_HEADER_STDC # AC_HEADER_STDC

View File

@ -4,6 +4,14 @@
#include "parallel.hpp" #include "parallel.hpp"
#include "paralleltop.hpp" #include "paralleltop.hpp"
#ifdef METIS
namespace metis { extern "C" {
#include <metis.h>
} }
#endif
using namespace metis; using namespace metis;
namespace netgen namespace netgen
@ -66,7 +74,7 @@ namespace netgen
{ {
NgProfiler::RegionTimer reg(timer_pts); NgProfiler::RegionTimer reg(timer_pts);
ARRAY<double> pointarray; Array<double> pointarray;
MyMPI_Recv ( pointarray, 0 ); MyMPI_Recv ( pointarray, 0 );
int numvert = pointarray.Size() / 5; int numvert = pointarray.Size() / 5;
@ -88,7 +96,7 @@ namespace netgen
(*this)[PointIndex(vert+1)] .Singularity ( pointarray[vert*5+4] ); (*this)[PointIndex(vert+1)] .Singularity ( pointarray[vert*5+4] );
} }
ARRAY<int> dist_pnums; Array<int> dist_pnums;
MyMPI_Recv ( dist_pnums, 0); MyMPI_Recv ( dist_pnums, 0);
for (int hi = 0; hi < dist_pnums.Size(); hi += 3) for (int hi = 0; hi < dist_pnums.Size(); hi += 3)
@ -106,7 +114,7 @@ namespace netgen
Element el; Element el;
ARRAY<int> elarray; Array<int> elarray;
MyMPI_Recv ( elarray, 0); MyMPI_Recv ( elarray, 0);
int ind = 0; int ind = 0;
@ -132,7 +140,7 @@ namespace netgen
if (strcmp (st.c_str(), "facedescriptor") == 0) if (strcmp (st.c_str(), "facedescriptor") == 0)
{ {
ARRAY<double> doublebuf; Array<double> doublebuf;
MyMPI_Recv( doublebuf, 0 ); MyMPI_Recv( doublebuf, 0 );
int faceind = AddFaceDescriptor (FaceDescriptor(int(doublebuf[0]), int(doublebuf[1]), int(doublebuf[2]), 0)); int faceind = AddFaceDescriptor (FaceDescriptor(int(doublebuf[0]), int(doublebuf[1]), int(doublebuf[2]), 0));
GetFaceDescriptor(faceind).SetBCProperty (int(doublebuf[3])); GetFaceDescriptor(faceind).SetBCProperty (int(doublebuf[3]));
@ -472,7 +480,7 @@ namespace netgen
void Mesh :: PartHybridMesh () // ARRAY<int> & neloc ) void Mesh :: PartHybridMesh () // Array<int> & neloc )
{ {
int ne = GetNE(); int ne = GetNE();
@ -494,7 +502,7 @@ namespace netgen
xadj = new idxtype[nn+1]; xadj = new idxtype[nn+1];
part = new idxtype[nn]; part = new idxtype[nn];
ARRAY<int> cnt(nn+1); Array<int> cnt(nn+1);
cnt = 0; cnt = 0;
for ( int edge = 1; edge <= nedges; edge++ ) for ( int edge = 1; edge <= nedges; edge++ )
@ -533,7 +541,7 @@ namespace netgen
metis :: METIS_PartGraphKway ( &nn, xadj, adjacency, v_weights, e_weights, &weightflag, metis :: METIS_PartGraphKway ( &nn, xadj, adjacency, v_weights, e_weights, &weightflag,
&numflag, &nparts, options, &edgecut, part ); &numflag, &nparts, options, &edgecut, part );
ARRAY<int> nodesinpart(ntasks); Array<int> nodesinpart(ntasks);
for ( int el = 1; el <= ne; el++ ) for ( int el = 1; el <= ne; el++ )
{ {
@ -568,7 +576,7 @@ namespace netgen
} }
void Mesh :: PartDualHybridMesh ( ) // ARRAY<int> & neloc ) void Mesh :: PartDualHybridMesh ( ) // Array<int> & neloc )
{ {
int ne = GetNE(); int ne = GetNE();
@ -587,15 +595,15 @@ namespace netgen
int edgecut; int edgecut;
idxtype * part; idxtype * part;
ARRAY<int, 0> facevolels1(nfaces), facevolels2(nfaces); Array<int, 0> facevolels1(nfaces), facevolels2(nfaces);
facevolels1 = -1; facevolels1 = -1;
facevolels2 = -1; facevolels2 = -1;
ARRAY<int, 0> elfaces; Array<int, 0> elfaces;
xadj = new idxtype[ne+1]; xadj = new idxtype[ne+1];
part = new idxtype[ne]; part = new idxtype[ne];
ARRAY<int, 0> cnt(ne+1); Array<int, 0> cnt(ne+1);
cnt = 0; cnt = 0;
for ( int el=1; el <= ne; el++ ) for ( int el=1; el <= ne; el++ )
@ -650,7 +658,7 @@ namespace netgen
NgProfiler::StopTimer (timermetis); NgProfiler::StopTimer (timermetis);
ARRAY<int> nodesinpart(ntasks); Array<int> nodesinpart(ntasks);
for ( int el = 1; el <= ne; el++ ) for ( int el = 1; el <= ne; el++ )
{ {
@ -682,11 +690,11 @@ namespace netgen
int ne = GetNSE(); int ne = GetNSE();
int nv = GetNV(); int nv = GetNV();
ARRAY<idxtype> xadj(ne+1); Array<idxtype> xadj(ne+1);
ARRAY<idxtype> adjacency(ne*4); Array<idxtype> adjacency(ne*4);
// first, build the vertex 2 element table: // first, build the vertex 2 element table:
ARRAY<int, PointIndex::BASE> cnt(nv); Array<int, PointIndex::BASE> cnt(nv);
cnt = 0; cnt = 0;
for (SurfaceElementIndex sei = 0; sei < GetNSE(); sei++) for (SurfaceElementIndex sei = 0; sei < GetNSE(); sei++)
for (int j = 0; j < (*this)[sei].GetNP(); j++) for (int j = 0; j < (*this)[sei].GetNP(); j++)
@ -700,7 +708,7 @@ namespace netgen
// find all neighbour elements // find all neighbour elements
int cntnb = 0; int cntnb = 0;
ARRAY<int> marks(ne); // to visit each neighbour just once Array<int> marks(ne); // to visit each neighbour just once
marks = -1; marks = -1;
for (SurfaceElementIndex sei = 0; sei < ne; sei++) for (SurfaceElementIndex sei = 0; sei < ne; sei++)
{ {
@ -742,7 +750,7 @@ namespace netgen
int options[5]; int options[5];
options[0] = 0; options[0] = 0;
int edgecut; int edgecut;
ARRAY<idxtype> part(ne); Array<idxtype> part(ne);
for ( int el = 0; el < ne; el++ ) for ( int el = 0; el < ne; el++ )
BubbleSort (adjacency.Range (xadj[el], xadj[el+1])); BubbleSort (adjacency.Range (xadj[el], xadj[el+1]));
@ -759,7 +767,7 @@ namespace netgen
void Mesh :: SendMesh () const // Mesh * mastermesh, ARRAY<int> & neloc ) const void Mesh :: SendMesh () const // Mesh * mastermesh, Array<int> & neloc ) const
{ {
const Mesh * mastermesh = this; // the original plan was different const Mesh * mastermesh = this; // the original plan was different
@ -797,7 +805,7 @@ namespace netgen
// MPI_Barrier (MPI_COMM_WORLD); // MPI_Barrier (MPI_COMM_WORLD);
ARRAY<int> num_els_on_proc(ntasks); Array<int> num_els_on_proc(ntasks);
num_els_on_proc = 0; num_els_on_proc = 0;
for (ElementIndex ei = 0; ei < mastermesh->GetNE(); ei++) for (ElementIndex ei = 0; ei < mastermesh->GetNE(); ei++)
num_els_on_proc[(*this)[ei].GetPartition()]++; num_els_on_proc[(*this)[ei].GetPartition()]++;
@ -817,8 +825,8 @@ namespace netgen
// get number of vertices for each processor // get number of vertices for each processor
ARRAY<int> elarraysize(ntasks); Array<int> elarraysize(ntasks);
ARRAY<int> nelloc ( ntasks ); Array<int> nelloc ( ntasks );
nelloc = 0; nelloc = 0;
elarraysize = 1; elarraysize = 1;
@ -830,10 +838,10 @@ namespace netgen
els_of_proc.Add ( (*this)[ei].GetPartition(), ei); els_of_proc.Add ( (*this)[ei].GetPartition(), ei);
ARRAY<int, PointIndex::BASE> vert_flag ( GetNV() ); Array<int, PointIndex::BASE> vert_flag ( GetNV() );
ARRAY<int> num_verts_on_proc (ntasks); Array<int> num_verts_on_proc (ntasks);
ARRAY<int, PointIndex::BASE> num_procs_on_vert ( GetNV() ); Array<int, PointIndex::BASE> num_procs_on_vert ( GetNV() );
num_verts_on_proc = 0; num_verts_on_proc = 0;
num_procs_on_vert = 0; num_procs_on_vert = 0;
@ -903,7 +911,7 @@ namespace netgen
} }
ARRAY<int> nvi5(ntasks); Array<int> nvi5(ntasks);
for (int i = 0; i < ntasks; i++) for (int i = 0; i < ntasks; i++)
nvi5[i] = 5 * num_verts_on_proc[i]; nvi5[i] = 5 * num_verts_on_proc[i];
@ -934,7 +942,7 @@ namespace netgen
NgProfiler::StopTimer (timer3); NgProfiler::StopTimer (timer3);
NgProfiler::StartTimer (timer4); NgProfiler::StartTimer (timer4);
ARRAY<int> num_distpnums(ntasks); Array<int> num_distpnums(ntasks);
num_distpnums = 0; num_distpnums = 0;
for (int vert = 1; vert <= mastermesh -> GetNP(); vert++) for (int vert = 1; vert <= mastermesh -> GetNP(); vert++)
@ -1018,7 +1026,7 @@ namespace netgen
PrintMessage ( 3, "Sending Face Descriptors" ); PrintMessage ( 3, "Sending Face Descriptors" );
ARRAY<double> double6(6); Array<double> double6(6);
for ( int dest = 1; dest < ntasks; dest++) for ( int dest = 1; dest < ntasks; dest++)
for ( int fdi = 1; fdi <= mastermesh->GetNFD(); fdi++) for ( int fdi = 1; fdi <= mastermesh->GetNFD(); fdi++)
{ {
@ -1048,7 +1056,7 @@ namespace netgen
PrintMessage ( 3, "Sending Surface elements" ); PrintMessage ( 3, "Sending Surface elements" );
ARRAY <int> nlocsel(ntasks), bufsize ( ntasks), seli(ntasks); Array <int> nlocsel(ntasks), bufsize ( ntasks), seli(ntasks);
for ( int i = 0; i < ntasks; i++) for ( int i = 0; i < ntasks; i++)
{ {
nlocsel[i] = 0; nlocsel[i] = 0;
@ -1088,7 +1096,7 @@ namespace netgen
ARRAY<int> nselloc (ntasks); Array<int> nselloc (ntasks);
nselloc = 0; nselloc = 0;
for ( int dest = 1; dest < ntasks; dest++ ) for ( int dest = 1; dest < ntasks; dest++ )
@ -1165,7 +1173,7 @@ namespace netgen
MyMPI_Send ( "edgesegmentsgi", dest); MyMPI_Send ( "edgesegmentsgi", dest);
ARRAY <int> nlocseg(ntasks), segi(ntasks); Array <int> nlocseg(ntasks), segi(ntasks);
for ( int i = 0; i < ntasks; i++) for ( int i = 0; i < ntasks; i++)
{ {
nlocseg[i] = 0; nlocseg[i] = 0;
@ -1175,7 +1183,7 @@ namespace netgen
for ( int segi = 1; segi <= mastermesh -> GetNSeg(); segi ++ ) for ( int segi = 1; segi <= mastermesh -> GetNSeg(); segi ++ )
{ {
ARRAY<int> volels; Array<int> volels;
const MeshTopology & topol = mastermesh -> GetTopology(); const MeshTopology & topol = mastermesh -> GetTopology();
topol . GetSegmentVolumeElements ( segi, volels ); topol . GetSegmentVolumeElements ( segi, volels );
const Segment & segm = mastermesh -> LineSegment (segi); const Segment & segm = mastermesh -> LineSegment (segi);
@ -1207,7 +1215,7 @@ namespace netgen
// cout << "mastermesh " << mastermesh -> GetNSeg() << " lineseg " << mastermesh -> LineSegment (1) << endl; // cout << "mastermesh " << mastermesh -> GetNSeg() << " lineseg " << mastermesh -> LineSegment (1) << endl;
for ( int ls=1; ls <= mastermesh -> GetNSeg(); ls++) for ( int ls=1; ls <= mastermesh -> GetNSeg(); ls++)
{ {
ARRAY<int> volels; Array<int> volels;
mastermesh -> GetTopology().GetSegmentVolumeElements ( ls, volels ); mastermesh -> GetTopology().GetSegmentVolumeElements ( ls, volels );
const Segment & seg = mastermesh -> LineSegment (ls); const Segment & seg = mastermesh -> LineSegment (ls);
int dest; int dest;
@ -1290,7 +1298,7 @@ namespace netgen
void Mesh :: UpdateOverlap() void Mesh :: UpdateOverlap()
{ {
(*testout) << "UPDATE OVERLAP" << endl; (*testout) << "UPDATE OVERLAP" << endl;
ARRAY<int> * globelnums; Array<int> * globelnums;
#ifdef SCALASCA #ifdef SCALASCA
#pragma pomp inst begin(updateoverlap) #pragma pomp inst begin(updateoverlap)
@ -1308,7 +1316,7 @@ namespace netgen
int nfa = topology -> GetNFaces(); int nfa = topology -> GetNFaces();
int nel = GetNE(); int nel = GetNE();
ARRAY<int,PointIndex::BASE> glob2loc_vert(nvglob); Array<int,PointIndex::BASE> glob2loc_vert(nvglob);
glob2loc_vert = -1; glob2loc_vert = -1;
for ( int locv = 1; locv <= GetNV(); locv++) for ( int locv = 1; locv <= GetNV(); locv++)
@ -1322,7 +1330,7 @@ namespace netgen
addedpoint.Clear(); addedpoint.Clear();
addedel.Clear(); addedel.Clear();
ARRAY<int> distvert(ntasks), distel(ntasks), nsenddistel(ntasks); Array<int> distvert(ntasks), distel(ntasks), nsenddistel(ntasks);
nsenddistel = 0; nsenddistel = 0;
@ -1346,7 +1354,7 @@ namespace netgen
if ( node == cluster_rep ) continue; if ( node == cluster_rep ) continue;
ARRAY<int> dests; Array<int> dests;
int nneigh = 0; int nneigh = 0;
if ( node - GetNV() <= 0 ) // cluster representant is vertex if ( node - GetNV() <= 0 ) // cluster representant is vertex
{ {
@ -1403,16 +1411,16 @@ namespace netgen
sendsel.Add(i, 0); sendsel.Add(i, 0);
} }
ARRAY<int> nsentsel (ntasks); Array<int> nsentsel (ntasks);
nsentsel = 0; nsentsel = 0;
for ( int seli = 1; seli <= GetNSE(); seli++ ) for ( int seli = 1; seli <= GetNSE(); seli++ )
{ {
const Element2d & sel = SurfaceElement(seli); const Element2d & sel = SurfaceElement(seli);
int selnp = sel.GetNP(); int selnp = sel.GetNP();
ARRAY<int> vert (selnp); Array<int> vert (selnp);
ARRAY<int> alldests (0), dests; Array<int> alldests (0), dests;
bool isparsel = false; bool isparsel = false;
for ( int i = 0; i < selnp; i++ ) for ( int i = 0; i < selnp; i++ )
@ -1475,9 +1483,9 @@ namespace netgen
{ {
const Element & el = VolumeElement(eli); const Element & el = VolumeElement(eli);
int elnp = el.GetNP(); int elnp = el.GetNP();
ARRAY<int> vert (elnp); Array<int> vert (elnp);
ARRAY<int> alldests (0), dests; Array<int> alldests (0), dests;
for ( int i = 0; i < elnp; i++ ) for ( int i = 0; i < elnp; i++ )
{ {
@ -1515,19 +1523,19 @@ namespace netgen
{ {
const Element & el = VolumeElement(eli); const Element & el = VolumeElement(eli);
int elnp = el.GetNP(); int elnp = el.GetNP();
ARRAY<int> vert (elnp); Array<int> vert (elnp);
// append to point list: // append to point list:
// local pnum // local pnum
// global pnum // global pnum
// point coordinates // point coordinates
ARRAY<Point3d> points(elnp); Array<Point3d> points(elnp);
for ( int i = 0; i < elnp; i++ ) for ( int i = 0; i < elnp; i++ )
{ {
vert[i] = el.PNum(i+1); vert[i] = el.PNum(i+1);
points[i] = Point(vert[i]); points[i] = Point(vert[i]);
ARRAY<int> knowndests; Array<int> knowndests;
// send point to all dests which get the volume element // send point to all dests which get the volume element
for ( int dest = 0; dest < ntasks; dest ++ ) for ( int dest = 0; dest < ntasks; dest ++ )
{ {
@ -1598,9 +1606,9 @@ namespace netgen
distel = 0; distel = 0;
// sizes of sendpoints, sendelements, sendsels // sizes of sendpoints, sendelements, sendsels
ARRAY<int> sendsize_pts(ntasks), recvsize_pts(ntasks); Array<int> sendsize_pts(ntasks), recvsize_pts(ntasks);
ARRAY<int> sendsize_els(ntasks), recvsize_els(ntasks); Array<int> sendsize_els(ntasks), recvsize_els(ntasks);
ARRAY<int> sendsize_sels(ntasks), recvsize_sels(ntasks); Array<int> sendsize_sels(ntasks), recvsize_sels(ntasks);
for (int i = 0; i < ntasks; i++) for (int i = 0; i < ntasks; i++)
{ {
@ -1625,8 +1633,8 @@ namespace netgen
recvsel.SetElementSizesToMaxSizes (); recvsel.SetElementSizesToMaxSizes ();
/* /*
ARRAY<MPI_Request> sendrequest(3*ntasks), recvrequest(3*ntasks); Array<MPI_Request> sendrequest(3*ntasks), recvrequest(3*ntasks);
ARRAY<MPI_Status> status(3*ntasks); Array<MPI_Status> status(3*ntasks);
for ( int proc = 1; proc < ntasks; proc++) for ( int proc = 1; proc < ntasks; proc++)
{ {
@ -1655,7 +1663,7 @@ namespace netgen
} }
*/ */
ARRAY<MPI_Request> requests; Array<MPI_Request> requests;
for ( int proc = 1; proc < ntasks; proc++) for ( int proc = 1; proc < ntasks; proc++)
{ {
@ -1682,12 +1690,12 @@ namespace netgen
ARRAY<int> * distpnum2parpnum; Array<int> * distpnum2parpnum;
distpnum2parpnum = new ARRAY<int> [2]; distpnum2parpnum = new Array<int> [2];
distpnum2parpnum[0].SetSize(0); distpnum2parpnum[0].SetSize(0);
distpnum2parpnum[1].SetSize(0); distpnum2parpnum[1].SetSize(0);
ARRAY<int> firstdistpnum (ntasks); Array<int> firstdistpnum (ntasks);
for ( int sender = 1; sender < ntasks; sender++) for ( int sender = 1; sender < ntasks; sender++)
@ -1748,7 +1756,7 @@ namespace netgen
int distelnum = (recvelements[sender])[ii++]; int distelnum = (recvelements[sender])[ii++];
int globelnum = (recvelements[sender])[ii++] ; int globelnum = (recvelements[sender])[ii++] ;
int elnp = (recvelements[sender])[ii++] ; int elnp = (recvelements[sender])[ii++] ;
ARRAY<int> pnums(elnp), globpnums(elnp); Array<int> pnums(elnp), globpnums(elnp);
// append volel // append volel
ELEMENT_TYPE eltype; ELEMENT_TYPE eltype;
@ -1802,8 +1810,8 @@ namespace netgen
int distselnum = (recvsel[sender])[ii++]; int distselnum = (recvsel[sender])[ii++];
int selnp = (recvsel[sender])[ii++] ; int selnp = (recvsel[sender])[ii++] ;
ARRAY<int> globpnums(selnp); Array<int> globpnums(selnp);
ARRAY<int> pnums(selnp); Array<int> pnums(selnp);
// append volel // append volel
ELEMENT_TYPE eltype; ELEMENT_TYPE eltype;
@ -1840,7 +1848,7 @@ namespace netgen
} }
globelnums = new ARRAY<int>; globelnums = new Array<int>;
if ( id == 0 ) if ( id == 0 )
{ {
for ( int dest = 1; dest < ntasks; dest++) for ( int dest = 1; dest < ntasks; dest++)

View File

@ -216,7 +216,7 @@ int ParallelMeshTopology :: Glob2Loc_Segm (int globnum )
for ( int i = 1; i <= nfa; i++ ) for ( int i = 1; i <= nfa; i++ )
if ( IsExchangeFace(i) ) if ( IsExchangeFace(i) )
{ {
ARRAY<int> facevert; Array<int> facevert;
mesh . GetTopology().GetFaceVertices(i, facevert); mesh . GetTopology().GetFaceVertices(i, facevert);
(*testout) << "exchange face " << i << ": global vertices " ; (*testout) << "exchange face " << i << ": global vertices " ;
@ -235,7 +235,7 @@ int ParallelMeshTopology :: Glob2Loc_Segm (int globnum )
for ( int i = 1; i < mesh.GetNE(); i++) for ( int i = 1; i < mesh.GetNE(); i++)
{ {
if ( !IsExchangeElement(i) ) continue; if ( !IsExchangeElement(i) ) continue;
ARRAY<int> vert; Array<int> vert;
const Element & el = mesh.VolumeElement(i); const Element & el = mesh.VolumeElement(i);
(*testout) << "parallel local element " << i << endl; (*testout) << "parallel local element " << i << endl;
@ -333,7 +333,7 @@ int ParallelMeshTopology :: GetNDistantElNums ( int locelnum ) const
// gibt anzahl an distant pnums zurueck // gibt anzahl an distant pnums zurueck
// * pnums entspricht ARRAY<int[2] > // * pnums entspricht Array<int[2] >
int ParallelMeshTopology :: GetDistantPNums ( int locpnum, int * distpnums ) const int ParallelMeshTopology :: GetDistantPNums ( int locpnum, int * distpnums ) const
{ {
// distpnums[0] = loc2distvert[locpnum][0]; // distpnums[0] = loc2distvert[locpnum][0];
@ -520,7 +520,7 @@ int ParallelMeshTopology :: GetDistantElNums ( int locelnum, int * distelnums )
loc2distsegm.Add (locnum-1, distnum); loc2distsegm.Add (locnum-1, distnum);
} }
void ParallelMeshTopology :: GetVertNeighbours ( int vnum, ARRAY<int> & dests ) const void ParallelMeshTopology :: GetVertNeighbours ( int vnum, Array<int> & dests ) const
{ {
dests.SetSize(0); dests.SetSize(0);
int i = 1; int i = 1;
@ -577,7 +577,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
*testout << "ParallelMeshTopology :: UpdateCoarseGridGlobal" << endl; *testout << "ParallelMeshTopology :: UpdateCoarseGridGlobal" << endl;
const MeshTopology & topology = mesh.GetTopology(); const MeshTopology & topology = mesh.GetTopology();
ARRAY<int> sendarray, recvarray; Array<int> sendarray, recvarray;
nfa = topology . GetNFaces(); nfa = topology . GetNFaces();
ned = topology . GetNEdges(); ned = topology . GetNEdges();
@ -611,7 +611,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
SetExchangeVert ( dest, el.PNum(i+1) ); SetExchangeVert ( dest, el.PNum(i+1) );
SetExchangeVert ( el.PNum(i+1) ); SetExchangeVert ( el.PNum(i+1) );
} }
ARRAY<int> edges; Array<int> edges;
topology . GetElementEdges ( eli, edges ); topology . GetElementEdges ( eli, edges );
for ( int i = 0; i < edges.Size(); i++ ) for ( int i = 0; i < edges.Size(); i++ )
{ {
@ -651,7 +651,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
recvface.Clear(); recvface.Clear();
/* /*
ARRAY<int> edges, pnums, faces; Array<int> edges, pnums, faces;
for ( int el = 1; el <= ne; el++ ) for ( int el = 1; el <= ne; el++ )
{ {
topology.GetElementFaces (el, faces); topology.GetElementFaces (el, faces);
@ -705,7 +705,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
*/ */
// new version // new version
ARRAY<int> edges, pnums, faces, elpnums; Array<int> edges, pnums, faces, elpnums;
sendarray.Append (ne); sendarray.Append (ne);
for ( int el = 1; el <= ne; el++ ) for ( int el = 1; el <= ne; el++ )
{ {
@ -739,8 +739,8 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
edgeisinit.Clear(); edgeisinit.Clear();
vertisinit.Clear(); vertisinit.Clear();
// ARRAY for temporary use, to find local from global element fast // Array for temporary use, to find local from global element fast
ARRAY<int,1> glob2loc_el; Array<int,1> glob2loc_el;
if ( id != 0 ) if ( id != 0 )
{ {
glob2loc_el.SetSize (neglob); glob2loc_el.SetSize (neglob);
@ -789,8 +789,8 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
ARRAY<int> faces, edges; Array<int> faces, edges;
ARRAY<int> pnums, globalpnums; Array<int> pnums, globalpnums;
int recv_ne = recvarray[ii++]; int recv_ne = recvarray[ii++];
for (int hi = 0; hi < recv_ne; hi++) for (int hi = 0; hi < recv_ne; hi++)
@ -866,9 +866,9 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
if ( id == 0 ) return; if ( id == 0 ) return;
ARRAY<int> * sendarray, *recvarray; Array<int> * sendarray, *recvarray;
sendarray = new ARRAY<int> (0); sendarray = new Array<int> (0);
recvarray = new ARRAY<int>; recvarray = new Array<int>;
nfa = topology . GetNFaces(); nfa = topology . GetNFaces();
ned = topology . GetNEdges(); ned = topology . GetNEdges();
@ -888,7 +888,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
if ( !IsExchangeFace ( fa ) ) continue; if ( !IsExchangeFace ( fa ) ) continue;
ARRAY<int> edges, pnums; Array<int> edges, pnums;
int globfa = GetDistantFaceNum ( 0, fa ); int globfa = GetDistantFaceNum ( 0, fa );
topology.GetFaceEdges ( fa, edges ); topology.GetFaceEdges ( fa, edges );
@ -934,11 +934,11 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
edgeisinit.Clear(); edgeisinit.Clear();
vertisinit.Clear(); vertisinit.Clear();
// ARRAY for temporary use, to find local from global element fast // Array for temporary use, to find local from global element fast
// only for not too big meshes // only for not too big meshes
// seems ok, as low-order space is treated on one proc // seems ok, as low-order space is treated on one proc
ARRAY<int,1> * glob2locfa; Array<int,1> * glob2locfa;
glob2locfa = new ARRAY<int,1> ( nfaglob ); glob2locfa = new Array<int,1> ( nfaglob );
(*glob2locfa) = -1; (*glob2locfa) = -1;
for ( int locfa = 1; locfa <= nfa; locfa++) for ( int locfa = 1; locfa <= nfa; locfa++)
@ -988,10 +988,10 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
continue; continue;
} }
ARRAY<int> edges; Array<int> edges;
int fa = locfa; int fa = locfa;
ARRAY<int> pnums, globalpnums; Array<int> pnums, globalpnums;
topology.GetFaceEdges ( fa, edges ); topology.GetFaceEdges ( fa, edges );
topology.GetFaceVertices ( fa, pnums ); topology.GetFaceVertices ( fa, pnums );
@ -1090,9 +1090,9 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
// receive distant distnum, v1, v2 // receive distant distnum, v1, v2
// find matching // find matching
ARRAY<int> * sendarray, *recvarray; Array<int> * sendarray, *recvarray;
sendarray = new ARRAY<int> (0); sendarray = new Array<int> (0);
recvarray = new ARRAY<int>; recvarray = new Array<int>;
sendarray->SetSize (0); sendarray->SetSize (0);
@ -1101,7 +1101,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
for ( int el = 1; el <= ne; el++ ) for ( int el = 1; el <= ne; el++ )
{ {
ARRAY<int> edges, pnums, faces; Array<int> edges, pnums, faces;
topology.GetElementFaces (el, faces); topology.GetElementFaces (el, faces);
int globeli = GetLoc2Glob_VolEl(el); int globeli = GetLoc2Glob_VolEl(el);
for ( int fai = 0; fai < faces.Size(); fai++) for ( int fai = 0; fai < faces.Size(); fai++)
@ -1160,12 +1160,12 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
edgeisinit.Clear(); edgeisinit.Clear();
vertisinit.Clear(); vertisinit.Clear();
// ARRAY for temporary use, to find local from global element fast // Array for temporary use, to find local from global element fast
// only for not too big meshes // only for not too big meshes
// seems ok, as low-order space is treated on one proc // seems ok, as low-order space is treated on one proc
ARRAY<int,1> * glob2loc_el; Array<int,1> * glob2loc_el;
glob2loc_el = new ARRAY<int,1> ( neglob ); glob2loc_el = new Array<int,1> ( neglob );
(*glob2loc_el) = -1; (*glob2loc_el) = -1;
for ( int locel = 1; locel <= mesh.GetNE(); locel++) for ( int locel = 1; locel <= mesh.GetNE(); locel++)
(*glob2loc_el)[GetLoc2Glob_VolEl(locel)] = locel; (*glob2loc_el)[GetLoc2Glob_VolEl(locel)] = locel;
@ -1222,7 +1222,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
continue; continue;
} }
ARRAY<int> faces, edges; Array<int> faces, edges;
topology.GetElementFaces( volel, faces); topology.GetElementFaces( volel, faces);
topology.GetElementEdges ( volel, edges); topology.GetElementEdges ( volel, edges);
for ( int fai= 0; fai < faces.Size(); fai++ ) for ( int fai= 0; fai < faces.Size(); fai++ )
@ -1231,7 +1231,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
if ( !IsExchangeFace ( fa ) && sender != 0 ) continue; if ( !IsExchangeFace ( fa ) && sender != 0 ) continue;
// if ( recvface.Test ( fa-1 ) ) continue; // if ( recvface.Test ( fa-1 ) ) continue;
ARRAY<int> pnums, globalpnums; Array<int> pnums, globalpnums;
//topology.GetFaceEdges ( fa, edges ); //topology.GetFaceEdges ( fa, edges );
topology.GetFaceVertices ( fa, pnums ); topology.GetFaceVertices ( fa, pnums );
@ -1339,8 +1339,8 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
// nsurfel = mesh.GetNSE(); // nsurfel = mesh.GetNSE();
if ( id != 0 ) if ( id != 0 )
{ {
ARRAY<int> * sendarray; Array<int> * sendarray;
sendarray = new ARRAY<int> (4); sendarray = new Array<int> (4);
int sendnfa = 0, sendned = 0; int sendnfa = 0, sendned = 0;
@ -1382,7 +1382,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
else else
{ {
ARRAY<int> * recvarray = new ARRAY<int>; Array<int> * recvarray = new Array<int>;
for ( int sender = 1; sender < ntasks; sender++ ) for ( int sender = 1; sender < ntasks; sender++ )
{ {
@ -1443,7 +1443,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
} }
ARRAY<int> pnums; Array<int> pnums;
for ( int fa = 1; fa <= nfa; fa++) for ( int fa = 1; fa <= nfa; fa++)
{ {
topology.GetFaceVertices ( fa, pnums ); topology.GetFaceVertices ( fa, pnums );
@ -1472,7 +1472,7 @@ void ParallelMeshTopology :: UpdateExchangeElements()
{ {
if ( ! IsExchangeElement ( eli ) ) continue; if ( ! IsExchangeElement ( eli ) ) continue;
const Element & el = mesh.VolumeElement(eli); const Element & el = mesh.VolumeElement(eli);
ARRAY<int> faces, edges; Array<int> faces, edges;
int np = el.NP(); int np = el.NP();
topology.GetElementEdges ( eli, edges ); topology.GetElementEdges ( eli, edges );
@ -1495,14 +1495,14 @@ void ParallelMeshTopology :: UpdateExchangeElements()
ARRAY<int> ** elementonproc, ** recvelonproc; Array<int> ** elementonproc, ** recvelonproc;
elementonproc = new ARRAY<int>*[ntasks]; elementonproc = new Array<int>*[ntasks];
recvelonproc = new ARRAY<int>*[ntasks]; recvelonproc = new Array<int>*[ntasks];
for ( int i = 1; i < ntasks; i++ ) for ( int i = 1; i < ntasks; i++ )
{ {
elementonproc[i] = new ARRAY<int>(0); elementonproc[i] = new Array<int>(0);
recvelonproc[i] = new ARRAY<int>(0); recvelonproc[i] = new Array<int>(0);
} }

View File

@ -20,9 +20,9 @@
namespace netgen namespace netgen
{ {
int id, ntasks; int id, ntasks;
MPI_Group MPI_HIGHORDER_WORLD;
MPI_Comm MPI_HIGHORDER_COMM;
} }
MPI_Group MPI_HIGHORDER_WORLD;
MPI_Comm MPI_HIGHORDER_COMM;
#endif #endif
@ -96,8 +96,8 @@ int main(int argc, char ** argv)
process_ranks[i] = i+1; process_ranks[i] = i+1;
MPI_Comm_group ( MPI_COMM_WORLD, &MPI_GROUP_WORLD); MPI_Comm_group ( MPI_COMM_WORLD, &MPI_GROUP_WORLD);
MPI_Group_incl ( MPI_GROUP_WORLD, n_ho, process_ranks, & MPI_HIGHORDER_WORLD); MPI_Group_incl ( MPI_GROUP_WORLD, n_ho, process_ranks, & netgen::MPI_HIGHORDER_WORLD);
MPI_Comm_create ( MPI_COMM_WORLD, MPI_HIGHORDER_WORLD, &MPI_HIGHORDER_COMM); MPI_Comm_create ( MPI_COMM_WORLD, netgen::MPI_HIGHORDER_WORLD, & netgen::MPI_HIGHORDER_COMM);
#pragma pomp inst begin(main) #pragma pomp inst begin(main)
#endif #endif

View File

@ -3651,7 +3651,7 @@ namespace netgen
Tcl_Interp * interp, Tcl_Interp * interp,
int argc, tcl_const char *argv[]) int argc, tcl_const char *argv[])
{ {
#ifdef METIS #ifdef METISold
if (!mesh) if (!mesh)
{ {

View File

@ -35,10 +35,10 @@ namespace netgen {
namespace netgen namespace netgen
{ {
int id, ntasks; int id, ntasks;
}
MPI_Group MPI_HIGHORDER_WORLD;
MPI_Comm MPI_HIGHORDER_COMM;
MPI_Group MPI_HIGHORDER_WORLD;
MPI_Comm MPI_HIGHORDER_COMM;
}
#endif #endif