1 /*
2     Copyright (C) 1998  Dennis Roddeman
3     email: dennis.roddeman@feat.nl
4 
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software Foundation
17     59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA
18 */
19 
20 #include "tochnog.h"
21 
unknown_freeze(void)22 void unknown_freeze( void )
23 
24 {
25   long int i=0, iuknwn=0, icontrol=0, length=0, swit=0, ldum=0,
26     inod=0, max_node=0, control_unknown_freeze[MUKNWN],
27     dof_label[MUKNWN], *node_bounded=NULL;
28   double ddum[1];
29 
30   db( ICONTROL, 0, &icontrol, ddum, ldum, VERSION_NORMAL, GET );
31   if ( db_active_index( CONTROL_UNKNOWN_FREEZE, icontrol, VERSION_NORMAL ) ) {
32     swit = set_swit(-1,-1,"unknown_freeze");
33     if ( swit ) pri( "In routine UNKNOWN_FREEZE" );
34     db( DOF_LABEL, 0, dof_label, ddum, ldum, VERSION_NORMAL, GET_IF_EXISTS );
35     db( CONTROL_UNKNOWN_FREEZE, icontrol, control_unknown_freeze,
36       ddum, length, VERSION_NORMAL, GET );
37     db_max_index( NODE, max_node, VERSION_NORMAL, GET );
38     for ( inod=0; inod<=max_node; inod++ ) {
39       if ( db_active_index( NODE_BOUNDED, inod, VERSION_NORMAL ) ) {
40         node_bounded = db_int( NODE_BOUNDED, inod, VERSION_NORMAL );
41         for ( i=0; i<length; i++ ) {
42           if ( control_unknown_freeze[i]<0 )
43             array_member(dof_label,control_unknown_freeze[i],nuknwn,iuknwn);
44           else
45             iuknwn = control_unknown_freeze[i];
46           node_bounded[iuknwn] = 1;
47         }
48       }
49     }
50     if ( swit ) pri( "Out routine UNKNOWN_FREEZE" );
51   }
52 
53 }
54 
unknown_reset(void)55 void unknown_reset( void )
56 
57 {
58   long int i=0, iuknwn=0, icontrol=0,
59     length_control_unknown_reset_unknown=0, swit=0, ldum=0,
60     inod=0, max_node=0, use_geometry=0, in_geometry=0, idum[1],
61     control_unknown_reset_unknown[MUKNWN], control_unknown_reset_geometry[2],
62     dof_label[MUKNWN];
63   double rdum=0., control_unknown_reset_value=0.,
64     ddum[1], normal[MDIM], *node_dof=NULL;
65 
66   db( ICONTROL, 0, &icontrol, ddum, ldum, VERSION_NORMAL, GET );
67   if ( db_active_index( CONTROL_UNKNOWN_RESET_UNKNOWN, icontrol, VERSION_NORMAL ) ) {
68     swit = set_swit(-1,-1,"unknown_reset");
69     if ( swit ) pri( "In routine UNKNOWN_RESET" );
70     db( DOF_LABEL, 0, dof_label, ddum, ldum, VERSION_NORMAL, GET_IF_EXISTS );
71     db( CONTROL_UNKNOWN_RESET_UNKNOWN, icontrol, control_unknown_reset_unknown,
72       ddum, length_control_unknown_reset_unknown, VERSION_NORMAL, GET );
73     db( CONTROL_UNKNOWN_RESET_VALUE, icontrol, idum, &control_unknown_reset_value,
74       ldum, VERSION_NORMAL, GET_IF_EXISTS );
75     use_geometry = db( CONTROL_UNKNOWN_RESET_GEOMETRY, icontrol,
76       control_unknown_reset_geometry, ddum, ldum, VERSION_NORMAL, GET_IF_EXISTS );
77     db_max_index( NODE, max_node, VERSION_NORMAL, GET );
78     for ( inod=0; inod<=max_node; inod++ ) {
79       if ( db_active_index( NODE_DOF, inod, VERSION_NORMAL ) ) {
80         if ( use_geometry )
81           geometry( inod, ddum, control_unknown_reset_geometry, in_geometry, rdum,
82             normal, rdum, ddum, NODE_START_REFINED, PROJECT_EXACT, VERSION_NORMAL );
83         else
84           in_geometry = 1;
85         if ( in_geometry ) {
86           node_dof = db_dbl( NODE_DOF, inod, VERSION_NORMAL );
87           for ( i=0; i<length_control_unknown_reset_unknown; i++ ) {
88             if ( control_unknown_reset_unknown[i] == -ALL ) {
89               for ( iuknwn=0; iuknwn<nuknwn; iuknwn++ ) node_dof[iuknwn] = 0.;
90             }
91             else {
92               if ( control_unknown_reset_unknown[i]<0 )
93                 array_member(dof_label,control_unknown_reset_unknown[i],nuknwn,iuknwn);
94               else
95                 iuknwn = control_unknown_reset_unknown[i];
96               node_dof[iuknwn] = control_unknown_reset_value;
97             }
98           }
99         }
100       }
101     }
102     if ( swit ) pri( "Out routine UNKNOWN_RESET" );
103   }
104 
105 }
106