/[escript]/trunk/esys2/finley/src/finleyC/ElementFile.c
ViewVC logotype

Contents of /trunk/esys2/finley/src/finleyC/ElementFile.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 100 - (show annotations)
Wed Dec 15 03:48:48 2004 UTC (14 years, 11 months ago) by jgs
File MIME type: text/plain
File size: 2561 byte(s)
*** empty log message ***

1 /* $Id$ */
2 /**************************************************************/
3
4 /* Finley: ElementFile */
5
6 /* allocates an element file to hold elements of type id and with integration order order. */
7 /* use Finley_Mesh_allocElementTable to allocate the element table (Id,Nodes,Tag). */
8
9 /**************************************************************/
10
11 /* Copyrights by ACcESS Australia 2003/04 */
12 /* Author: gross@access.edu.au */
13 /* Version: $Id$ */
14
15 /**************************************************************/
16
17 #include "Finley.h"
18 #include "ElementFile.h"
19
20 /**************************************************************/
21
22 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id,int order){
23 extern Finley_RefElementInfo Finley_RefElement_InfoList[];
24 int NQ;
25 Finley_ElementFile *out;
26
27 /* get the number of quadrature nodes needed to achieve integration order order: */
28
29 if (order<0) order=2*Finley_RefElement_InfoList[id].numOrder;
30 NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order);
31 if (Finley_ErrorCode!=NO_ERROR) return NULL;
32
33 /* allocate the return value */
34
35 out=(Finley_ElementFile*)MEMALLOC(sizeof(Finley_ElementFile));
36 if (Finley_checkPtr(out)) return NULL;
37 out->ReferenceElement=NULL;
38 out->LinearReferenceElement=NULL;
39 out->numElements=0;
40 out->Id=NULL;
41 out->Nodes=NULL;
42 out->Tag=NULL;
43 out->Color=NULL;
44 out->numColors=0;
45 out->order = order;
46
47 /* allocate the reference element: */
48
49 out->ReferenceElement=Finley_RefElement_alloc(id,NQ);
50 if (Finley_ErrorCode!=NO_ERROR) {
51 Finley_ElementFile_dealloc(out);
52 return NULL;
53 }
54 out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ);
55 if (Finley_ErrorCode!=NO_ERROR) {
56 Finley_ElementFile_dealloc(out);
57 return NULL;
58 }
59 return out;
60 }
61
62 /* deallocates an element file: */
63
64 void Finley_ElementFile_dealloc(Finley_ElementFile* in) {
65 if (in!=NULL) {
66 #ifdef Finley_TRACE
67 if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name);
68 #endif
69 Finley_RefElement_dealloc(in->ReferenceElement);
70 Finley_RefElement_dealloc(in->LinearReferenceElement);
71 Finley_ElementFile_deallocTable(in);
72 MEMFREE(in);
73 }
74 }
75 /*
76 * $Log$
77 * Revision 1.3 2004/12/15 03:48:45 jgs
78 * *** empty log message ***
79 *
80 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
81 * initial import of project esys2
82 *
83 * Revision 1.1.1.1 2004/06/24 04:00:40 johng
84 * Initial version of eys using boost-python.
85 *
86 *
87 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26