/[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 6009 - (show annotations)
Wed Mar 2 04:13:26 2016 UTC (3 years, 1 month ago) by caltinay
File size: 3693 byte(s)
Much needed sync with trunk...

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 /****************************************************************************/
18
19 /* Dudley: Mesh: this will redistribute the Nodes and Elements including overlap */
20 /* according to the dof_distribution. It will create an element coloring but will not create any mappings. */
21
22 /****************************************************************************/
23
24 #include "Mesh.h"
25
26 namespace dudley {
27
28 void Dudley_Mesh_distributeByRankOfDOF(Dudley_Mesh* self, index_t* dof_distribution)
29 {
30 if (self == NULL)
31 return;
32
33 index_t min_dof_id, max_dof_id, *tmp_node_localDOF_map = NULL, *tmp_node_localDOF_mask = NULL;
34 index_t k;
35 dim_t len, n, numDOFs;
36
37 int* mpiRankOfDOF = new int[self->Nodes->numNodes];
38
39 Dudley_NodeFile_assignMPIRankToDOFs(self->Nodes, mpiRankOfDOF, dof_distribution);
40
41 /* first the elements are redistributed according to mpiRankOfDOF */
42 /* at the input the Node tables refering to a the local labeling of the nodes */
43 /* while at the output they refer to the global labeling which is rectified in the next step */
44 Dudley_ElementFile_distributeByRankOfDOF(self->Elements, mpiRankOfDOF, self->Nodes->Id);
45 Dudley_ElementFile_distributeByRankOfDOF(self->FaceElements, mpiRankOfDOF, self->Nodes->Id);
46 Dudley_ElementFile_distributeByRankOfDOF(self->Points, mpiRankOfDOF, self->Nodes->Id);
47
48 Dudley_Mesh_resolveNodeIds(self);
49
50 /* create a local labeling of the DOFs */
51 Dudley_NodeFile_setDOFRange(&min_dof_id, &max_dof_id, self->Nodes);
52 len = max_dof_id - min_dof_id + 1;
53 tmp_node_localDOF_mask = new index_t[len]; /* local mask for used nodes */
54 tmp_node_localDOF_map = new index_t[self->Nodes->numNodes];
55
56 #pragma omp parallel for private(n) schedule(static)
57 for (n = 0; n < len; n++)
58 tmp_node_localDOF_mask[n] = -1;
59
60 #pragma omp parallel for private (n) schedule(static)
61 for (n = 0; n < self->Nodes->numNodes; n++)
62 tmp_node_localDOF_map[n] = -1;
63
64 #pragma omp parallel for private(n) schedule(static)
65 for (n = 0; n < self->Nodes->numNodes; n++)
66 {
67 #ifdef BOUNDS_CHECK
68 if ((self->Nodes->globalDegreesOfFreedom[n] - min_dof_id) >= len
69 || (self->Nodes->globalDegreesOfFreedom[n] - min_dof_id) < 0)
70 {
71 printf("BOUNDS_CHECK %s %d\n", __FILE__, __LINE__);
72 exit(1);
73 }
74 #endif
75 tmp_node_localDOF_mask[self->Nodes->globalDegreesOfFreedom[n] - min_dof_id] = n;
76 }
77
78 numDOFs = 0;
79 for (n = 0; n < len; n++)
80 {
81 k = tmp_node_localDOF_mask[n];
82 if (k >= 0)
83 {
84 tmp_node_localDOF_mask[n] = numDOFs;
85 numDOFs++;
86 }
87 }
88 #pragma omp parallel for private (n,k)
89 for (n = 0; n < self->Nodes->numNodes; n++)
90 {
91 k = tmp_node_localDOF_mask[self->Nodes->globalDegreesOfFreedom[n] - min_dof_id];
92 tmp_node_localDOF_map[n] = k;
93 }
94 /* create element coloring */
95 Dudley_Mesh_createColoring(self, tmp_node_localDOF_map);
96
97 delete[] tmp_node_localDOF_mask;
98 delete[] tmp_node_localDOF_map;
99 delete[] mpiRankOfDOF;
100 }
101
102 } // namespace dudley
103

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