From 150c7c1f109a5d17f54a8b5b6b38b3d2860c3056 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 8 Aug 2011 13:33:43 +0000 Subject: [PATCH] curved elements in parallel --- libsrc/meshing/curvedelems.cpp | 94 ++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/libsrc/meshing/curvedelems.cpp b/libsrc/meshing/curvedelems.cpp index 2b8eb6d5..279c23f3 100644 --- a/libsrc/meshing/curvedelems.cpp +++ b/libsrc/meshing/curvedelems.cpp @@ -442,6 +442,84 @@ namespace netgen ishighorder = (order > 1); return; } + + +#ifdef PARALLEL + if (id > 0) + { + cout << "id = " << id << ", get edge coeffs" << endl; + Array master_edgeorder; + Array master_edgecoeffsindex; + Array > master_edgecoeffs; + MyMPI_Bcast (master_edgeorder, 0); + MyMPI_Bcast (master_edgecoeffsindex, 0); + MyMPI_Bcast (master_edgecoeffs, 0); + + Array master_faceorder; + Array master_facecoeffsindex; + Array > master_facecoeffs; + + MyMPI_Bcast (master_faceorder, 0); + MyMPI_Bcast (master_facecoeffsindex, 0); + MyMPI_Bcast (master_facecoeffs, 0); + + + + const MeshTopology & top = mesh.GetTopology(); + const ParallelMeshTopology & partop = mesh.GetParallelTopology (); + + edgeorder.SetSize (top.GetNEdges()); + edgecoeffsindex.SetSize (top.GetNEdges()+1); + edgecoeffsindex[0] = 0; + for (int i = 0; i < top.GetNEdges(); i++) + { + int glob = partop.GetDistantEdgeNum (0, i+1); + edgeorder[i] = master_edgeorder[glob-1]; + int ncoefs = master_edgecoeffsindex[glob]-master_edgecoeffsindex[glob-1]; + edgecoeffsindex[i+1] = edgecoeffsindex[i] + ncoefs; + } + edgecoeffs.SetSize (edgecoeffsindex[top.GetNEdges()]); + + for (int i = 0; i < top.GetNEdges(); i++) + { + int glob = partop.GetDistantEdgeNum (0, i+1); + int ncoefs = master_edgecoeffsindex[glob]-master_edgecoeffsindex[glob-1]; + for (int j = 0; j < ncoefs; j++) + edgecoeffs[edgecoeffsindex[i]+j] = master_edgecoeffs[master_edgecoeffsindex[glob-1]+j]; + } + + faceorder.SetSize (top.GetNFaces()); + facecoeffsindex.SetSize (top.GetNFaces()+1); + facecoeffsindex[0] = 0; + for (int i = 0; i < top.GetNFaces(); i++) + { + int glob = partop.GetDistantFaceNum (0, i+1); + faceorder[i] = master_faceorder[glob-1]; + int ncoefs = master_facecoeffsindex[glob]-master_facecoeffsindex[glob-1]; + facecoeffsindex[i+1] = facecoeffsindex[i] + ncoefs; + } + facecoeffs.SetSize (facecoeffsindex[top.GetNFaces()]); + + for (int i = 0; i < top.GetNFaces(); i++) + { + int glob = partop.GetDistantFaceNum (0, i+1); + int ncoefs = master_facecoeffsindex[glob]-master_facecoeffsindex[glob-1]; + for (int j = 0; j < ncoefs; j++) + facecoeffs[facecoeffsindex[i]+j] = master_facecoeffs[master_facecoeffsindex[glob-1]+j]; + } + + /* + faceorder.SetSize (top.GetNFaces()); + faceorder = 1; + facecoeffsindex.SetSize (top.GetNFaces()+1); + facecoeffsindex = 0; + */ + + ishighorder = 1; + return; + } +#endif + PrintMessage (1, "Curve elements, order = ", aorder); if (rational) PrintMessage (1, "curved elements with rational splines"); @@ -954,6 +1032,22 @@ namespace netgen ishighorder = (order > 1); // (*testout) << "edgecoeffs = " << endl << edgecoeffs << endl; // (*testout) << "facecoeffs = " << endl << facecoeffs << endl; + + +#ifdef PARALLEL + if (ntasks > 1) + { + MyMPI_Bcast (edgeorder, 0); + MyMPI_Bcast (edgecoeffsindex, 0); + MyMPI_Bcast (edgecoeffs, 0); + + MyMPI_Bcast (faceorder, 0); + MyMPI_Bcast (facecoeffsindex, 0); + MyMPI_Bcast (facecoeffs, 0); + } +#endif + + }