/[escript]/branches/trilinos_from_5897/dudley/src/Mesh_distributeByRankOfDOF.cpp
ViewVC logotype

Contents of /branches/trilinos_from_5897/dudley/src/Mesh_distributeByRankOfDOF.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6079 - (show annotations)
Mon Mar 21 12:22:38 2016 UTC (2 years, 11 months ago) by caltinay
File size: 3007 byte(s)
Big commit - making dudley much more like finley to make it more
managable. Fixed quite a few issues that had been fixed in finley.
Disposed of all ReducedNode/ReducedDOF entities that dudley never supported.
Compiles and passes tests.

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 #include "Mesh.h"
18
19 namespace dudley {
20
21 /// redistributes the Nodes and Elements including overlap
22 /// according to the DOF distribution. It will create an element colouring
23 /// but will not create any mappings.
24 void Mesh::distributeByRankOfDOF(const std::vector<index_t>& dofDistribution)
25 {
26 const dim_t numNodes = Nodes->getNumNodes();
27 int* mpiRankOfDOF = new int[numNodes];
28 Nodes->assignMPIRankToDOFs(mpiRankOfDOF, dofDistribution);
29
30 // first, the elements are redistributed according to mpiRankOfDOF
31 // at the input the Node tables refer to a the local labeling of the nodes
32 // while at the output they refer to the global labeling which is rectified
33 // in the next step
34 Elements->distributeByRankOfDOF(mpiRankOfDOF, Nodes->Id);
35 FaceElements->distributeByRankOfDOF(mpiRankOfDOF, Nodes->Id);
36 Points->distributeByRankOfDOF(mpiRankOfDOF, Nodes->Id);
37
38 resolveNodeIds();
39
40 // create a local labeling of the DOFs
41 const std::pair<index_t,index_t> dofRange(Nodes->getDOFRange());
42 const dim_t len = dofRange.second - dofRange.first + 1;
43 // local mask for used nodes
44 index_t* localDOF_mask = new index_t[len];
45 index_t* localDOF_map = new index_t[numNodes];
46
47 #pragma omp parallel for
48 for (index_t n = 0; n < len; n++)
49 localDOF_mask[n] = -1;
50
51 #pragma omp parallel for
52 for (index_t n = 0; n < numNodes; n++)
53 localDOF_map[n] = -1;
54
55 #pragma omp parallel for
56 for (index_t n = 0; n < numNodes; n++) {
57 #ifdef BOUNDS_CHECK
58 if ((Nodes->globalDegreesOfFreedom[n] - dofRange.first) >= len
59 || (Nodes->globalDegreesOfFreedom[n] - dofRange.first) < 0) {
60 printf("BOUNDS_CHECK %s %d\n", __FILE__, __LINE__);
61 exit(1);
62 }
63 #endif
64 localDOF_mask[Nodes->globalDegreesOfFreedom[n] - dofRange.first] = n;
65 }
66
67 dim_t numDOFs = 0;
68 for (index_t n = 0; n < len; n++) {
69 const index_t k = localDOF_mask[n];
70 if (k >= 0) {
71 localDOF_mask[n] = numDOFs;
72 numDOFs++;
73 }
74 }
75 #pragma omp parallel for
76 for (index_t n = 0; n < numNodes; n++) {
77 localDOF_map[n] = localDOF_mask[
78 Nodes->globalDegreesOfFreedom[n] - dofRange.first];
79 }
80 // create element coloring
81 createColoring(localDOF_map);
82
83 delete[] localDOF_mask;
84 delete[] localDOF_map;
85 delete[] mpiRankOfDOF;
86 }
87
88 } // namespace dudley
89

Properties

Name Value
svn:mergeinfo /branches/4.0fordebian/dudley/src/Mesh_distributeByRankOfDOF.cpp:5567-5588 /branches/complex/dudley/src/Mesh_distributeByRankOfDOF.cpp:5866-5937 /branches/lapack2681/finley/src/Mesh_distributeByRankOfDOF.cpp:2682-2741 /branches/pasowrap/dudley/src/Mesh_distributeByRankOfDOF.cpp:3661-3674 /branches/py3_attempt2/dudley/src/Mesh_distributeByRankOfDOF.cpp:3871-3891 /branches/restext/finley/src/Mesh_distributeByRankOfDOF.cpp:2610-2624 /branches/ripleygmg_from_3668/dudley/src/Mesh_distributeByRankOfDOF.cpp:3669-3791 /branches/stage3.0/finley/src/Mesh_distributeByRankOfDOF.cpp:2569-2590 /branches/symbolic_from_3470/dudley/src/Mesh_distributeByRankOfDOF.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/src/Mesh_distributeByRankOfDOF.cpp:3517-3974 /release/3.0/finley/src/Mesh_distributeByRankOfDOF.cpp:2591-2601 /release/4.0/dudley/src/Mesh_distributeByRankOfDOF.cpp:5380-5406 /trunk/dudley/src/Mesh_distributeByRankOfDOF.cpp:4257-4344,5898-6007 /trunk/ripley/test/python/dudley/src/Mesh_distributeByRankOfDOF.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26