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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 616 - (hide annotations)
Wed Mar 22 02:46:56 2006 UTC (13 years, 7 months ago) by elspeth
File MIME type: text/plain
File size: 3997 byte(s)
Copyright added to more source files.

1 jgs 150 /*
2 elspeth 616 ************************************************************
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 jgs 150 */
12    
13 jgs 82 /**************************************************************/
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     void Finley_NodeFile_allocTable(Finley_NodeFile* in ,int numNodes) {
32 jgs 123 index_t *Id2=NULL, *Tag2=NULL, *degreeOfFreedom2=NULL, *reducedDegreeOfFreedom2=NULL, *toReduced2=NULL;
33 jgs 82 double *Coordinates2=NULL;
34 jgs 123 dim_t n,i;
35 jgs 82
36     /* allocate memory: */
37    
38 jgs 123 Id2=MEMALLOC(numNodes,index_t);
39 jgs 102 Coordinates2=MEMALLOC(numNodes*in->numDim,double);
40 jgs 123 Tag2=MEMALLOC(numNodes,index_t);
41     degreeOfFreedom2=MEMALLOC(numNodes,index_t);
42     reducedDegreeOfFreedom2=MEMALLOC(numNodes,index_t);
43     toReduced2=MEMALLOC(numNodes,index_t);
44 jgs 82
45     /* if fine, deallocate the old table and replace by new: */
46    
47     if (Finley_checkPtr(Id2) || Finley_checkPtr(Coordinates2) || Finley_checkPtr(Tag2) ||
48     Finley_checkPtr(degreeOfFreedom2) || Finley_checkPtr(reducedDegreeOfFreedom2) || Finley_checkPtr(toReduced2) ) {
49     MEMFREE(Id2);
50     MEMFREE(Coordinates2);
51     MEMFREE(Tag2);
52     MEMFREE(degreeOfFreedom2);
53     MEMFREE(reducedDegreeOfFreedom2);
54     MEMFREE(toReduced2);
55     } else {
56     Finley_NodeFile_deallocTable(in);
57     in->Id=Id2;
58     in->Coordinates=Coordinates2;
59     in->Tag=Tag2;
60     in->degreeOfFreedom=degreeOfFreedom2;
61     in->reducedDegreeOfFreedom=reducedDegreeOfFreedom2;
62     in->toReduced=toReduced2;
63     in->numNodes=numNodes;
64     in->numDegreesOfFreedom=numNodes;
65     in->reducedNumDegreesOfFreedom=numNodes;
66     in->reducedNumNodes=numNodes;
67     /* this initialization makes sure that data are located on the right processor */
68     #pragma omp parallel for private(n,i) schedule(static)
69     for (n=0;n<numNodes;n++) {
70     for (i=0;i<in->numDim;i++) in->Coordinates[INDEX2(i,n,in->numDim)]=0.;
71     in->Id[n]=-1;
72     in->Tag[n]=-1;
73     in->degreeOfFreedom[n]=n;
74     in->reducedDegreeOfFreedom[n]=n;
75     in->toReduced[n]=n;
76     }
77     }
78     return;
79     }
80    
81     /* deallocates the node table within an node file: */
82    
83     void Finley_NodeFile_deallocTable(Finley_NodeFile* in) {
84     if (in!=NULL) {
85     MEMFREE(in->Id);
86     MEMFREE(in->Coordinates);
87     MEMFREE(in->Tag);
88     MEMFREE(in->degreeOfFreedom);
89     MEMFREE(in->reducedDegreeOfFreedom);
90     MEMFREE(in->toReduced);
91     in->numNodes=0;
92     in->numDegreesOfFreedom=0;
93     in->reducedNumDegreesOfFreedom=0;
94     in->reducedNumNodes=0;
95     }
96     }
97     /*
98     * $Log$
99 jgs 150 * Revision 1.6 2005/09/15 03:44:23 jgs
100     * Merge of development branch dev-02 back to main trunk on 2005-09-15
101     *
102     * Revision 1.5.2.1 2005/09/07 06:26:20 gross
103     * the solver from finley are put into the standalone package paso now
104     *
105 jgs 123 * Revision 1.5 2005/07/08 04:07:55 jgs
106     * Merge of development branch back to main trunk on 2005-07-08
107     *
108 jgs 102 * Revision 1.4 2004/12/15 07:08:33 jgs
109 jgs 97 * *** empty log message ***
110 jgs 123 * Revision 1.1.1.1.2.2 2005/06/29 02:34:54 gross
111     * some changes towards 64 integers in finley
112 jgs 82 *
113 jgs 123 * Revision 1.1.1.1.2.1 2004/11/24 01:37:15 gross
114     * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
115 jgs 97 *
116 jgs 82 *
117 jgs 123 *
118 jgs 82 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26