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

Contents of /branches/trilinos_from_5897/dudley/src/ElementFile_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: 2890 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: ElementFile */
20
21 /* allocates and deallocates element table */
22
23 /****************************************************************************/
24
25 #include "ElementFile.h"
26 #include "Util.h"
27
28 namespace dudley {
29
30 /* allocates the element table within an element file to hold numElements: */
31
32 void Dudley_ElementFile_allocTable(Dudley_ElementFile* in, dim_t numElements)
33 {
34 index_t *Id2 = NULL, *Nodes2 = NULL, *Tag2 = NULL, *Color2 = NULL;
35 int *Owner2 = NULL;
36 dim_t numNodes, e, i;
37
38 /* allocate memory: */
39 numNodes = in->numNodes;
40 Owner2 = new int[numElements];
41 Id2 = new index_t[numElements];
42 Nodes2 = new index_t[numElements * in->numNodes];
43 Tag2 = new index_t[numElements];
44 Color2 = new index_t[numElements];
45
46 /* if fine, deallocate the old table and replace by new: */
47 Dudley_ElementFile_freeTable(in);
48 in->Owner = Owner2;
49 in->numElements = numElements;
50 in->Id = Id2;
51 in->Nodes = Nodes2;
52 in->Tag = Tag2;
53 in->Color = Color2;
54
55 /* this initialization makes sure that data are located on the right processor */
56
57 #pragma omp parallel for private(e,i) schedule(static)
58 for (e = 0; e < numElements; e++)
59 {
60 for (i = 0; i < numNodes; i++)
61 in->Nodes[INDEX2(i, e, numNodes)] = -1;
62 in->Owner[e] = -1;
63 in->Id[e] = -1;
64 in->Tag[e] = -1;
65 in->Color[e] = -1;
66 }
67 in->maxColor = -1;
68 in->minColor = 0;
69 }
70
71 void Dudley_ElementFile_setTagsInUse(Dudley_ElementFile * in)
72 {
73 index_t *tagsInUse = NULL;
74 dim_t numTagsInUse;
75 if (in != NULL)
76 {
77 Dudley_Util_setValuesInUse(in->Tag, in->numElements, &numTagsInUse, &tagsInUse, in->MPIInfo);
78 delete[] in->tagsInUse;
79 in->tagsInUse = tagsInUse;
80 in->numTagsInUse = numTagsInUse;
81 }
82 }
83
84 /* deallocates the element table within an element file: */
85
86 void Dudley_ElementFile_freeTable(Dudley_ElementFile * in)
87 {
88 delete[] in->Owner;
89 delete[] in->Id;
90 delete[] in->Nodes;
91 delete[] in->Tag;
92 delete[] in->Color;
93 delete[] in->tagsInUse;
94 in->numTagsInUse = 0;
95 in->numElements = 0;
96 in->maxColor = -1;
97 in->minColor = 0;
98 }
99
100 } // namespace dudley
101

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26