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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6009 - (show annotations)
Wed Mar 2 04:13:26 2016 UTC (2 years, 11 months ago) by caltinay
File size: 4666 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 #include "NodeFile.h"
18 #include "Util.h"
19
20 namespace dudley {
21
22 /* allocates the node table within an node file to hold numNodes of nodes. The LinearTo mapping, if it exists, */
23 /* is frees. use Dudley_Mesh_setLinearMesh to create a new one. */
24 void Dudley_NodeFile_allocTable(Dudley_NodeFile* in, dim_t numNodes)
25 {
26 index_t *Id2 = NULL, *Tag2 = NULL, *globalDegreesOfFreedom2 = NULL, *globalReducedDOFIndex2 = NULL,
27 *globalReducedNodesIndex2 = NULL, *globalNodesIndex2 = NULL, *reducedNodesId2 = NULL, *degreesOfFreedomId2 =
28 NULL, *reducedDegreesOfFreedomId2 = NULL;
29 double *Coordinates2 = NULL;
30 dim_t n, i;
31
32 /* allocate memory: */
33 Id2 = new index_t[numNodes];
34 Coordinates2 = new double[numNodes * in->numDim];
35 Tag2 = new index_t[numNodes];
36 globalDegreesOfFreedom2 = new index_t[numNodes];
37 globalReducedDOFIndex2 = new index_t[numNodes];
38 globalReducedNodesIndex2 = new index_t[numNodes];
39 globalNodesIndex2 = new index_t[numNodes];
40 reducedNodesId2 = new index_t[numNodes];
41 degreesOfFreedomId2 = new index_t[numNodes];
42 reducedDegreesOfFreedomId2 = new index_t[numNodes];
43
44 /* if fine, free the old table and replace by new: */
45 Dudley_NodeFile_freeTable(in);
46 in->Id = Id2;
47 in->Coordinates = Coordinates2;
48 in->globalDegreesOfFreedom = globalDegreesOfFreedom2;
49 in->Tag = Tag2;
50 in->globalReducedDOFIndex = globalReducedDOFIndex2;
51 in->globalReducedNodesIndex = globalReducedNodesIndex2;
52 in->globalNodesIndex = globalNodesIndex2;
53 in->reducedNodesId = reducedNodesId2;
54 in->degreesOfFreedomId = degreesOfFreedomId2;
55 in->reducedDegreesOfFreedomId = reducedDegreesOfFreedomId2;
56 in->numNodes = numNodes;
57 /* this initialization makes sure that data are located on the right processor */
58 #pragma omp parallel for private(n,i) schedule(static)
59 for (n = 0; n < numNodes; n++)
60 {
61 in->Id[n] = -1;
62 for (i = 0; i < in->numDim; i++)
63 in->Coordinates[INDEX2(i, n, in->numDim)] = 0.;
64 in->Tag[n] = -1;
65 in->globalDegreesOfFreedom[n] = -1;
66 in->globalReducedDOFIndex[n] = -1;
67 in->globalReducedNodesIndex[n] = -1;
68 in->globalNodesIndex[n] = -1;
69 in->reducedNodesId[n] = -1;
70 in->degreesOfFreedomId[n] = -1;
71 in->reducedDegreesOfFreedomId[n] = -1;
72 }
73 }
74
75 /* frees the node table within an node file: */
76
77 void Dudley_NodeFile_freeTable(Dudley_NodeFile * in)
78 {
79 if (in != NULL)
80 {
81 delete[] in->Id;
82 delete[] in->Coordinates;
83 delete[] in->globalDegreesOfFreedom;
84 delete[] in->globalReducedDOFIndex;
85 delete[] in->globalReducedNodesIndex;
86 delete[] in->globalNodesIndex;
87 delete[] in->Tag;
88 delete[] in->reducedNodesId;
89 delete[] in->degreesOfFreedomId;
90 delete[] in->reducedDegreesOfFreedomId;
91 delete[] in->tagsInUse;
92 in->numTagsInUse = 0;
93 Dudley_NodeMapping_free(in->nodesMapping);
94 in->nodesMapping = NULL;
95 Dudley_NodeMapping_free(in->reducedNodesMapping);
96 in->reducedNodesMapping = NULL;
97 Dudley_NodeMapping_free(in->degreesOfFreedomMapping);
98 in->degreesOfFreedomMapping = NULL;
99 Dudley_NodeMapping_free(in->reducedDegreesOfFreedomMapping);
100 in->reducedDegreesOfFreedomMapping = NULL;
101 in->nodesDistribution.reset();
102 in->reducedNodesDistribution.reset();
103 in->degreesOfFreedomDistribution.reset();
104 in->reducedDegreesOfFreedomDistribution.reset();
105 in->degreesOfFreedomConnector.reset();
106 in->reducedDegreesOfFreedomConnector.reset();
107 in->numTagsInUse = 0;
108 in->numNodes = 0;
109 }
110 }
111
112 void Dudley_NodeFile_setTagsInUse(Dudley_NodeFile * in)
113 {
114 index_t *tagsInUse = NULL;
115 dim_t numTagsInUse;
116 if (in != NULL)
117 {
118 Dudley_Util_setValuesInUse(in->Tag, in->numNodes, &numTagsInUse, &tagsInUse, in->MPIInfo);
119 delete[] in->tagsInUse;
120 in->tagsInUse = tagsInUse;
121 in->numTagsInUse = numTagsInUse;
122 }
123 }
124
125 } // namespace dudley
126

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26