Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/post/src/elements/elements.c
3203 views
1
/*****************************************************************************
2
*
3
* Elmer, A Finite Element Software for Multiphysical Problems
4
*
5
* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program (in file fem/GPL-2); if not, write to the
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
* Boston, MA 02110-1301, USA.
21
*
22
*****************************************************************************/
23
24
/*******************************************************************************
25
*
26
* Main module for element model descriptions & utility routines.
27
*
28
*******************************************************************************
29
*
30
* Author: Juha Ruokolainen
31
*
32
* Address: CSC - IT Center for Science Ltd.
33
* Keilaranta 14, P.O. BOX 405
34
* 02101 Espoo, Finland
35
* Tel. +358 0 457 2723
36
* Telefax: +358 0 457 2302
37
* EMail: [email protected]
38
*
39
* Date: 20 Sep 1995
40
*
41
* Modification history:
42
*
43
* 28 Sep 1995, removed elm_triangle_normal
44
* Juha R
45
*
46
*
47
******************************************************************************/
48
49
#define MODULE_ELEMENTS
50
51
#include "../elmerpost.h"
52
#include <elements.h>
53
54
/*******************************************************************************
55
*
56
* Name: elm_element_type_add
57
*
58
* Purpose: Add an element to element type list
59
*
60
* Parameters:
61
*
62
* Input: (element_type_t *) structure describing the element type
63
*
64
* Output: Global list of element types is modified
65
*
66
* Return value: malloc() success
67
*
68
******************************************************************************/
69
int elm_add_element_type( element_type_t *Def )
70
{
71
element_type_t *ptr;
72
73
ptr = (element_type_t *)calloc( sizeof(element_type_t),1 );
74
75
if ( !ptr )
76
{
77
fprintf( stderr, "elm_add_element_type: FATAL: can't allocate (a few bytes of) memory.\n" );
78
return FALSE;
79
}
80
81
*ptr = *Def;
82
83
ptr->Next = ElementDefs.ElementTypes;
84
ElementDefs.ElementTypes = ptr;
85
86
return TRUE;
87
}
88
89
int elm_2node_bar_initialize();
90
int elm_3node_bar_initialize();
91
int elm_4node_bar_initialize();
92
93
int elm_3node_triangle_initialize();
94
int elm_4node_triangle_initialize();
95
int elm_6node_triangle_initialize();
96
int elm_10node_triangle_initialize();
97
98
int elm_4node_quad_initialize();
99
int elm_5node_quad_initialize();
100
int elm_8node_quad_initialize();
101
int elm_9node_quad_initialize();
102
int elm_12node_quad_initialize();
103
int elm_16node_quad_initialize();
104
int elm_4node_tetra_initialize();
105
int elm_8node_tetra_initialize();
106
int elm_10node_tetra_initialize();
107
108
int elm_5node_pyramid_initialize();
109
int elm_13node_pyramid_initialize();
110
111
int elm_6node_wedge_initialize();
112
int elm_15node_wedge_initialize();
113
114
int elm_8node_brick_initialize();
115
int elm_20node_brick_initialize();
116
int elm_27node_brick_initialize();
117
118
/*******************************************************************************
119
*
120
* Name: elm_initialize_element_types
121
*
122
* Purpose: Initialize all internal element types
123
*
124
* Parameters:
125
*
126
* Input: none
127
*
128
* Output: Global list of element types is modified
129
*
130
* Return value: malloc() success
131
*
132
******************************************************************************/
133
int elm_initialize_element_types()
134
{
135
if ( !elm_2node_bar_initialize() ) return FALSE;
136
if ( !elm_3node_bar_initialize() ) return FALSE;
137
if ( !elm_4node_bar_initialize() ) return FALSE;
138
139
if ( !elm_3node_triangle_initialize() ) return FALSE;
140
if ( !elm_4node_triangle_initialize() ) return FALSE;
141
if ( !elm_6node_triangle_initialize() ) return FALSE;
142
if ( !elm_10node_triangle_initialize() ) return FALSE;
143
144
if ( !elm_4node_quad_initialize() ) return FALSE;
145
if ( !elm_5node_quad_initialize() ) return FALSE;
146
if ( !elm_8node_quad_initialize() ) return FALSE;
147
if ( !elm_9node_quad_initialize() ) return FALSE;
148
if ( !elm_12node_quad_initialize() ) return FALSE;
149
if ( !elm_16node_quad_initialize() ) return FALSE;
150
151
if ( !elm_4node_tetra_initialize() ) return FALSE;
152
if ( !elm_8node_tetra_initialize() ) return FALSE;
153
if ( !elm_10node_tetra_initialize() ) return FALSE;
154
155
if ( !elm_5node_pyramid_initialize() ) return FALSE;
156
if ( !elm_13node_pyramid_initialize() ) return FALSE;
157
158
if ( !elm_6node_wedge_initialize() ) return FALSE;
159
if ( !elm_15node_wedge_initialize() ) return FALSE;
160
161
if ( !elm_8node_brick_initialize() ) return FALSE;
162
if ( !elm_20node_brick_initialize() ) return FALSE;
163
if ( !elm_27node_brick_initialize() ) return FALSE;
164
165
return TRUE;
166
}
167
168
void elm_force_load(int stat)
169
{
170
void elm_divergence(), elm_gradient(), elm_rotor_3D();
171
if ( stat ) {
172
elm_divergence();
173
elm_gradient();
174
elm_rotor_3D();
175
}
176
}
177
178