/[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 730 - (show annotations)
Mon May 15 04:03:49 2006 UTC (13 years, 4 months ago) by bcumming
File MIME type: text/plain
File size: 4098 byte(s)


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26