/[escript]/trunk/finley/src/NodeFile_allocTable.c
ViewVC logotype

Contents of /trunk/finley/src/NodeFile_allocTable.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 123 - (show annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years, 4 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/NodeFile_allocTable.c
File MIME type: text/plain
File size: 3275 byte(s)
Merge of development branch back to main trunk on 2005-07-08

1 /* $Id$ */
2 /**************************************************************/
3
4 /* Finley: Mesh: NodeFile */
5
6 /**************************************************************/
7
8 /* Copyrights by ACcESS Australia 2003 */
9 /* Author: gross@access.edu.au */
10 /* Version: $Id$ */
11
12 /**************************************************************/
13
14 #include "Finley.h"
15 #include "NodeFile.h"
16
17 /**************************************************************/
18
19 /* allocates the node table within an node file to hold numNodes of nodes. The LinearTo mapping, if it exists, */
20 /* is deallocated. use Finley_Mesh_setLinearMesh to create a new one. */
21
22 void Finley_NodeFile_allocTable(Finley_NodeFile* in ,int numNodes) {
23 index_t *Id2=NULL, *Tag2=NULL, *degreeOfFreedom2=NULL, *reducedDegreeOfFreedom2=NULL, *toReduced2=NULL;
24 double *Coordinates2=NULL;
25 dim_t n,i;
26
27 /* allocate memory: */
28
29 Id2=MEMALLOC(numNodes,index_t);
30 Coordinates2=MEMALLOC(numNodes*in->numDim,double);
31 Tag2=MEMALLOC(numNodes,index_t);
32 degreeOfFreedom2=MEMALLOC(numNodes,index_t);
33 reducedDegreeOfFreedom2=MEMALLOC(numNodes,index_t);
34 toReduced2=MEMALLOC(numNodes,index_t);
35
36 /* if fine, deallocate the old table and replace by new: */
37
38 if (Finley_checkPtr(Id2) || Finley_checkPtr(Coordinates2) || Finley_checkPtr(Tag2) ||
39 Finley_checkPtr(degreeOfFreedom2) || Finley_checkPtr(reducedDegreeOfFreedom2) || Finley_checkPtr(toReduced2) ) {
40 MEMFREE(Id2);
41 MEMFREE(Coordinates2);
42 MEMFREE(Tag2);
43 MEMFREE(degreeOfFreedom2);
44 MEMFREE(reducedDegreeOfFreedom2);
45 MEMFREE(toReduced2);
46 } else {
47 Finley_NodeFile_deallocTable(in);
48 in->Id=Id2;
49 in->Coordinates=Coordinates2;
50 in->Tag=Tag2;
51 in->degreeOfFreedom=degreeOfFreedom2;
52 in->reducedDegreeOfFreedom=reducedDegreeOfFreedom2;
53 in->toReduced=toReduced2;
54 in->numNodes=numNodes;
55 in->numDegreesOfFreedom=numNodes;
56 in->reducedNumDegreesOfFreedom=numNodes;
57 in->reducedNumNodes=numNodes;
58 /* this initialization makes sure that data are located on the right processor */
59 #pragma omp parallel for private(n,i) schedule(static)
60 for (n=0;n<numNodes;n++) {
61 for (i=0;i<in->numDim;i++) in->Coordinates[INDEX2(i,n,in->numDim)]=0.;
62 in->Id[n]=-1;
63 in->Tag[n]=-1;
64 in->degreeOfFreedom[n]=n;
65 in->reducedDegreeOfFreedom[n]=n;
66 in->toReduced[n]=n;
67 }
68 }
69 return;
70 }
71
72 /* deallocates the node table within an node file: */
73
74 void Finley_NodeFile_deallocTable(Finley_NodeFile* in) {
75 if (in!=NULL) {
76 MEMFREE(in->Id);
77 MEMFREE(in->Coordinates);
78 MEMFREE(in->Tag);
79 MEMFREE(in->degreeOfFreedom);
80 MEMFREE(in->reducedDegreeOfFreedom);
81 MEMFREE(in->toReduced);
82 in->numNodes=0;
83 in->numDegreesOfFreedom=0;
84 in->reducedNumDegreesOfFreedom=0;
85 in->reducedNumNodes=0;
86 }
87 }
88 /*
89 * $Log$
90 * Revision 1.5 2005/07/08 04:07:55 jgs
91 * Merge of development branch back to main trunk on 2005-07-08
92 *
93 * Revision 1.4 2004/12/15 07:08:33 jgs
94 * *** empty log message ***
95 * Revision 1.1.1.1.2.2 2005/06/29 02:34:54 gross
96 * some changes towards 64 integers in finley
97 *
98 * Revision 1.1.1.1.2.1 2004/11/24 01:37:15 gross
99 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
100 *
101 *
102 *
103 */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26