1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114 | SAF_Suite *
saf_declare_suite(SAF_ParMode pmode, /* The parallel mode. */
SAF_Db *database, /* The SAF database handle. */
const char *name, /* The name of the suite. */
SAF_Set *mesh_space, /* The set representing the computational mesh.
* this is currently only a single set, so assume that the
* user cannot supply a list of mesh_space sets when declaring a suite */
SAF_Set *param_space, /* The set representing the parametric space, such as time. If this is NULL,
* a set will be created with a SIL role of type TYPE. */
SAF_Suite *suite /* [OUT] Optional memory for the returned handle. If null then a new handle is
* allocated by this function. */
)
{
SAF_ENTER(saf_declare_suite,0);
int l_numFound = 0;
int l_spacecatsFound = 0;
int l_paramcatsFound = 0;
SAF_Cat *space_cat=NULL, *param_cat=NULL;
SAF_Set param_set=SS_SET_NULL;
SAF_Rel suite_param_rel=SS_REL_NULL, suite_mesh_rel=SS_REL_NULL;
/* create a set with SIL role "SAF_SUITE" to uniquely identify this as a cross-product base space */
suite = saf_declare_set(pmode, database, name, 1, SAF_SUITE, SAF_EXTENDIBLE_TRUE, suite);
/* find the SAF_SPACE_SLICE collection/category, else create it */
saf_find_collections(pmode, suite, SAF_SPACE_SLICE,
SAF_CELLTYPE_ANY, SAF_ANY_TOPODIM, SAF_DECOMP_TORF,
&l_numFound, &space_cat);
if( l_numFound <= 0 ) {
_saf_free(space_cat);
space_cat = NULL;
saf_find_categories (pmode, database, SAF_UNIVERSE(XXX), SAF_ANY_NAME, SAF_SPACE_SLICE,
SAF_ANY_TOPODIM, &l_spacecatsFound, &space_cat);
if( l_spacecatsFound <= 0 ) {
/* space_cat = (SAF_Cat *)malloc(sizeof(SAF_Cat)); */
saf_declare_category(SAF_ALL, database, "space_slice_cat",
SAF_SPACE_SLICE, 1, space_cat);
}
if( space_cat == NULL ) {
SAF_ERROR(0, _saf_errmsg("SAF_SPACE_SLICE category could not be created"));
}
saf_declare_collection (pmode, suite, space_cat,
SAF_CELLTYPE_POINT, 1, SAF_1DC(1),
SAF_DECOMP_FALSE);
}
if( space_cat == NULL ) {
SAF_ERROR(0, _saf_errmsg("SAF_SPACE_SLICE category could not be created"));
}
/* find the SAF_PARAM_SLICE collection/category, else create it */
l_numFound = 0;
saf_find_collections(pmode, suite, SAF_PARAM_SLICE,
SAF_CELLTYPE_ANY, SAF_ANY_TOPODIM, SAF_DECOMP_TORF,
&l_numFound, ¶m_cat);
if( l_numFound <= 0 ) {
_saf_free(param_cat);
param_cat = NULL;
saf_find_categories (pmode, database, SAF_UNIVERSE(XXX), SAF_ANY_NAME, SAF_PARAM_SLICE,
SAF_ANY_TOPODIM, &l_paramcatsFound, ¶m_cat);
if( l_paramcatsFound <= 0 ) {
/* param_cat = (SAF_Cat *)malloc(sizeof(SAF_Cat)); */
saf_declare_category(SAF_ALL, database, "param_slice_cat",
SAF_PARAM_SLICE, 1, param_cat);
}
if( param_cat == NULL ) {
SAF_ERROR(0, _saf_errmsg("SAF_PARAM_SLICE category could not be created"));
}
saf_declare_collection (pmode, suite, param_cat,
SAF_CELLTYPE_POINT, 1, SAF_1DC(1),
SAF_DECOMP_FALSE);
}
if( param_cat == NULL ) {
SAF_ERROR(0, _saf_errmsg("SAF_PARAM_SLICE category could not be created"));
}
/* if param_space is NULL, create a set for the parametric space */
if ( param_space == NULL ) {
saf_declare_set(pmode, database, "suite_param_set", 1, SAF_TIME, SAF_EXTENDIBLE_TRUE, ¶m_set);
} else {
param_set = *param_space;
}
/* check whether this "param_slice_cat" collection already exists on the param_set ??? */
/* declare the collection on param_set for "slices" */
saf_declare_collection(pmode, ¶m_set, param_cat, SAF_CELLTYPE_POINT, 1, SAF_1DC(1), SAF_DECOMP_FALSE);
saf_declare_subset_relation(pmode, database, suite, ¶m_set, SAF_COMMON(param_cat), SAF_TUPLES, H5T_NATIVE_INT,
NULL, H5I_INVALID_HID, NULL, &suite_param_rel);
/* find or declare the "slice" cat/collection on mesh_space and create subset_relation */
saf_declare_collection(pmode, mesh_space, space_cat, SAF_CELLTYPE_POINT, 1, SAF_1DC(1),SAF_DECOMP_FALSE);
saf_declare_subset_relation(SAF_ALL, database, suite, mesh_space, SAF_COMMON(space_cat), SAF_TUPLES, SAF_INT, NULL,
H5I_INVALID_HID, NULL, &suite_mesh_rel);
free(space_cat);
free(param_cat);
SAF_LEAVE(suite);
}
|