14 p
= new_node(TYPE
) ; p
->type_type
= SIMPLE
; strcpy( p
->name
, "integer" ) ; add_node_to_end ( p
, &Type
) ;
15 p
= new_node(TYPE
) ; p
->type_type
= SIMPLE
; strcpy( p
->name
, "real" ) ; add_node_to_end ( p
, &Type
) ;
16 p
= new_node(TYPE
) ; p
->type_type
= SIMPLE
; strcpy( p
->name
, "logical" ) ; add_node_to_end ( p
, &Type
) ;
17 p
= new_node(TYPE
) ; p
->type_type
= SIMPLE
; strcpy( p
->name
, "character*256" ) ; add_node_to_end ( p
, &Type
) ;
18 p
= new_node(TYPE
) ; p
->type_type
= SIMPLE
; strcpy( p
->name
, "doubleprecision" ) ; add_node_to_end ( p
, &Type
) ;
23 set_state_dims ( char * dims
, node_t
* node
)
30 if ( dims
== NULL
) dims
= "-" ;
32 node
->proc_orient
= ALL_Z_ON_PROC
; /* default */
34 node
->boundary_array
= 0 ;
38 for ( c
= dims
; *c
; c
++ )
42 node
->scalar_array_member
= 1 ;
47 node
->has_scalar_array_tendencies
= 1 ;
52 node
->proc_orient
= ALL_X_ON_PROC
;
57 node
->proc_orient
= ALL_Y_ON_PROC
;
62 node
->boundary_array
= 1 ;
67 /* next dimspec seen represents a subgrid */
75 else if ( modifiers
== 0 )
77 if (( d
= get_dim_entry ( *c
)) == NULL
) { return(1) ; }
78 d1
= new_node( DIM
) ; /* make a copy */
80 if ( star
) { d1
->subgrid
= 1 ; node
->subgrid
|= (1<<node
->ndims
) ; } /* Mark the node has having a subgrid dim */
81 node
->dims
[node
->ndims
++] = d1
;
89 get_4d_entry ( char * name
)
92 if ( name
== NULL
) return (NULL
) ;
93 for ( p
= FourD
; p
!= NULL
; p
= p
->next4d
)
95 if ( !strcmp( p
->name
, name
) )
104 get_type_entry ( char * typename
)
106 return(get_entry(typename
,Type
)) ;
110 get_rconfig_entry ( char * name
)
113 if ((p
=get_entry(name
,Domain
.fields
))==NULL
) return(NULL
) ;
114 if (p
->node_kind
& RCONFIG
) return(p
) ;
119 get_entry ( char * name
, node_t
* node
)
122 if ( name
== NULL
) return (NULL
) ;
123 if ( node
== NULL
) return (NULL
) ;
124 for ( p
= node
; p
!= NULL
; p
= p
->next
)
126 if ( !strcmp( name
, "character" ) )
128 if ( !strncmp( p
->name
, name
, 9 ) )
133 if ( !strcmp( p
->name
, name
) )
142 /* this gets the entry for the node even if it */
143 /* is a derived data structure; does this by following */
144 /* the fully specified f90 reference. For example: */
145 /* "xa%f" for the field of derived type xa. */
146 /* note it will also take care to ignore the _1 or _2 */
147 /* suffixes from variables that have ntl > 1 */
148 /* 11/10/2001 -- added use field; if the entry has a use */
149 /* that starts with "dyn_" and use doesn't correspond to */
150 /* that, skip that entry and continue */
153 get_entry_r ( char * name
, char * use
, node_t
* node
)
156 char tmp
[NAMELEN
], *t1
, *t2
;
158 if ( name
== NULL
) return (NULL
) ;
159 if ( node
== NULL
) return (NULL
) ;
161 for ( p
= node
; p
!= NULL
; p
= p
->next
)
163 strcpy( tmp
, name
) ;
165 /* first check for exact match */
166 if ( !strcmp( p
->name
, tmp
) )
172 if ((t1
= index(tmp
,'%'))!= NULL
) *t1
= '\0' ;
176 if (( t2
= rindex( tmp
, '_' )) != NULL
)
178 /* be sure it really is an integer that follows the _ and that */
179 /* that is that is the last character */
180 if ((*(t2
+1) >= '0' && *(t2
+1) <= '9') && *(t2
+2)=='\0') *t2
= '\0' ;
184 /* also allow _tend */
185 if (( t2
= rindex( tmp
, '_' )) != NULL
) {
186 if (!strcmp(t2
,"_tend")) *t2
= '\0' ;
189 /* also allow _tend */
190 if (( t2
= rindex( tmp
, '_' )) != NULL
) {
191 if (!strcmp(t2
,"_old")) *t2
= '\0' ;
194 if ( !strcmp( p
->name
, tmp
) )
196 if ( t1
!= NULL
) return( get_entry_r( t1
+1 , use
, p
->type
->fields
) ) ;
204 get_dimnode_for_coord ( node_t
* node
, int coord_axis
)
207 if ( node
== NULL
) return(NULL
) ;
208 for ( i
= 0 ; i
< node
->ndims
; i
++ )
210 if ( node
->dims
[i
] == NULL
) continue ;
211 if ( node
->dims
[i
]->coord_axis
== coord_axis
)
213 return(node
->dims
[i
]) ;
220 get_index_for_coord ( node_t
* node
, int coord_axis
)
223 if ( node
== NULL
) return( -1 ) ;
224 for ( i
= 0 ; i
< node
->ndims
; i
++ )
226 if ( node
->dims
[i
] == NULL
) continue ;
227 if ( node
->dims
[i
]->coord_axis
== coord_axis
)
237 set_mem_order( node_t
* node
, char * str
, int n
)
242 if ( str
== NULL
|| node
== NULL
) return(NULL
) ;
244 if ( node
->boundary_array
)
246 strcpy(str
, "C") ; /* if this is called for a boundary array, just give it a */
247 /* "reasonable" value and move on. */
251 if ( node
->ndims
<= 0 )
253 strcat(str
,"0") ; return(str
) ;
255 for ( i
= 0 ; i
< node
->ndims
&& i
< n
; i
++ )
258 switch( p
->coord_axis
)
260 case(COORD_X
) : strcat(str
,"X") ; break ;
261 case(COORD_Y
) : strcat(str
,"Y") ; break ;
262 case(COORD_Z
) : strcat(str
,"Z") ; break ;
263 case(COORD_C
) : strcat(str
,"C") ; break ;