| 876 | |
| 877 | template <class SCAL> template <int N, NODE_TYPE NTYPE> |
| 878 | void S_GridFunction<SCAL> :: SaveNodeType (ostream & ost, int mdcomp) const |
| 879 | { |
| 880 | static Timer t ("GridFunctionSave notetype"); RegionTimer r (t); |
| 881 | #ifdef PARALLEL |
| 882 | const auto& ma = fespace->GetMeshAccess(); |
| 883 | auto comm = ma->GetCommunicator(); |
| 884 | int id = comm.Rank(); |
| 885 | int ntasks = comm.Size(); |
| 886 | |
| 887 | const FESpace & fes = *GetFESpace(); |
| 888 | shared_ptr<ParallelDofs> par = fes.GetParallelDofs (); |
| 889 | |
| 890 | if(id > 0) |
| 891 | { |
| 892 | int nnodes = ma->GetNNodes (NTYPE); |
| 893 | |
| 894 | Array<Vec<N+1,int> > nodenums; |
| 895 | Array<SCAL> data; |
| 896 | |
| 897 | Array<DofId> dnums; |
| 898 | Array<int> pnums; |
| 899 | |
| 900 | for (size_t i = 0; i < nnodes; i++) |
| 901 | { |
| 902 | fes.GetDofNrs (NodeId(NTYPE,i), dnums); |
| 903 | |
| 904 | if (dnums.Size() == 0) continue; |
| 905 | if (!par->IsMasterDof (dnums[0])) continue; |
| 906 | |
| 907 | switch (NTYPE) |
| 908 | { |
| 909 | case NT_VERTEX: pnums.SetSize(1); pnums[0] = i; break; |
| 910 | case NT_EDGE: pnums = ma->GetEdgePNums (i); break; |
| 911 | case NT_FACE: pnums = ma->GetFacePNums (i); break; |
| 912 | case NT_CELL: pnums = ma->GetElVertices (ElementId(VOL,i)); break; |
| 913 | } |
| 914 | |
| 915 | Vec<N+1, int> points; |
| 916 | points = -1; |
| 917 | for (int j = 0; j < pnums.Size(); j++) |
| 918 | points[j] = ma->GetGlobalVertexNum (pnums[j]); |
| 919 | points[N] = dnums.Size(); |
| 920 | |
| 921 | nodenums.Append(points); |
| 922 | |
| 923 | Vector<SCAL> elvec(dnums.Size()*fes.GetDimension()); |
| 924 | GetElementVector (mdcomp, dnums, elvec); |
| 925 | |
| 926 | for (int j = 0; j < elvec.Size(); j++) |
| 927 | data.Append(elvec(j)); |
| 928 | } |
| 929 | |
| 930 | comm.Gather (nodenums.Size()); |
| 931 | comm.Gather (data.Size()); |
| 932 | |
| 933 | comm.Send(nodenums,0,22); |
| 934 | comm.Send(data,0,23); |
| 935 | } |
nothing calls this directly
no test coverage detected