/[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 150 - (hide annotations)
Thu Sep 15 03:44:45 2005 UTC (14 years, 2 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/NodeFile_allocTable.c
File MIME type: text/plain
File size: 4319 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-15

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26