SheafSystem  0.0.0.0
dof_tuple_record_set.h
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // Interface for class dof_tuple_record_set
19 
20 #ifndef DOF_TUPLE_RECORD_SET_H
21 #define DOF_TUPLE_RECORD_SET_H
22 
23 #ifndef SHEAF_DLL_SPEC_H
24 #include "SheafSystem/sheaf_dll_spec.h"
25 #endif
26 
27 #ifndef RECORD_SET_H
28 #include "SheafSystem/record_set.h"
29 #endif
30 
31 #ifdef ZN_TO_BOOL_H
32 #include "SheafSystem/zn_to_bool.h"
33 #endif
34 
35 namespace sheaf
36  {
37 
55 class SHEAF_DLL_SPEC dof_tuple_record_set : public record_set
56 {
57 
58 public:
59 
60  // CANONICAL MEMBERS
61 
67 
73  virtual dof_tuple_record_set* clone() const;
74 
78  virtual ~dof_tuple_record_set();
79 
83  virtual bool invariant() const;
84 
88  virtual bool is_ancestor_of(const any* other) const;
89 
90  // DOF_TUPLE_RECORD_SET INTERFACE
91 
97  dof_tuple_record_set(const sheaf_file& xfile,
98  size_t xrecord_size,
99  int xrecord_buffer_ub,
100  const poset_scaffold& xscaffold);
101 
105  virtual const std::string& suffix() const;
106 
110  virtual void open();
111 
115  void internalize();
116 
120  void externalize();
121 
126  void externalize_domain(const scoped_index& xtuple_ext_id,
127  const scoped_index& xschema_id);
128 
132  size_type record_size() const;
133 
137  record_queue& queue();
138 
142  const record_queue& queue() const;
143 
147  pod_index_type compute_ext_id(const scoped_index& xtuple_id);
148 
153  size_type compute_ext_domain_size(const poset_dof_map& xdof_map,
154  const schema_poset_member& xschema) const;
155 
156 protected:
157 
161  virtual hid_t create_dataset();
162 
166  virtual void create_int_data_type();
167 
171  void read_records();
172 
176  void read_selection();
177 
181  void write_selection();
182 
186  void schematize();
187 
192 
200 
204  hsize_t (*_hdf_int_selection)[1];
205 
209  hsize_t (*_hdf_ext_selection)[1];
210 
215 
220 
224  char* _hdf_buf;
225 
229  size_t _hdf_buf_ub;
230 
239 
245 
250 
255 
261 
266 
271 
275  bool _writing;
276 
280  void externalize_all_dofs(schema_poset_member& xxfr_schema,
281  const poset_dof_map& xint_dof_map,
282  char*& xbuf,
283  size_t& xbuf_remainder);
284 
288  void internalize_all_dofs(schema_poset_member& xxfr_schema,
289  poset_dof_map& xext_dof_map,
290  char* xbuf,
291  size_t xbuf_remainder);
292 
296  void populate_internal_dof_map(const poset_dof_map& xext_dof_map,
297  poset_dof_map& xint_dof_map);
298 
302  char* get_next_record(char* xbuf);
303 
304 
309  char* get_first_record(pod_index_type xext_pod);
310 
316  pod_index_type get_internal_record(pod_index_type xext_rec_pod);
317 
323  pod_index_type advance_to_start_of_record(pod_index_type xext_pod);
324 
330  void externalize_one_domain(const scoped_index& xtuple_id,
331  const scoped_index& xschema_id);
332 
337  void attach_transfer_schema(schema_poset_member& xdof_map_schema,
338  const scoped_index& xdomain_schema_id);
339 };
340 
341  } // namespace sheaf
342 
343 #endif // ifndef DOF_TUPLE_RECORD_SET_H
344 
345 
346 
347 
348 
349 
An encapsulation of an HDF file containing sheaf data.
Definition: sheaf_file.h:49
size_type _record_size
The size in bytes of a record.
char * _hdf_buf
The HDF buffer.
pod_index_type _next_record_pod
The index of the next buffer record to allocate for a read or write operation.
The general, abstract map from dof ids to dof values.
Definition: poset_dof_map.h:59
record_map< pod_index_type, pod_index_type > _hdf_buf_record_map
The record id map for the hdf buffer.
Abstract base class with useful features for all objects.
Definition: any.h:39
A map from Zn (the integers mod n) to bools. A characteristic function used to represent subsets of Z...
Definition: zn_to_bool.h:52
record_queue _record_queue
The record queue.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
An abstract, indexed collection of records on secondary storage.
Definition: record_set.h:150
int _hdf_selection_ct
The number of records selected.
size_t _hdf_buf_ub
The HDF buffer upper bound.
int _hdf_selection_ub
The HDF record selection buffers upper bound.
A record_set which contains dof tuple records. Supports both record selection and record restriction ...
zn_to_bool _record_is_full
True if i-th record is full and should be written out.
size_t _hdf_scratch_buf_ub
The size of the scratch buffer in bytes.
A queue for record read requests.
Definition: record_queue.h:50
bool _writing
True if current operation is a write operation.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
Namespace for the sheaves component of the sheaf system.
A poset specific collection of data converters, various buffers and other data used while transferrin...
A client handle for a poset member which has been prepared for use as a schema.
char * _hdf_scratch_buf
Scratch buffer for internalizing dofs that span record boundaries.