Field3D
Field3DFile.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------------//
2 
3 /*
4  * Copyright (c) 2014 Sony Pictures Imageworks Inc.,
5  * Pixar Animation Studios Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the
18  * distribution. Neither the name of Sony Pictures Imageworks nor the
19  * names of its contributors may be used to endorse or promote
20  * products derived from this software without specific prior written
21  * permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34  * OF THE POSSIBILITY OF SUCH DAMAGE.
35  */
36 
37 //----------------------------------------------------------------------------//
38 
46 //----------------------------------------------------------------------------//
47 
48 #ifndef _INCLUDED_Field3D_Field3DFile_H_
49 #define _INCLUDED_Field3D_Field3DFile_H_
50 
51 //----------------------------------------------------------------------------//
52 
53 #include <list>
54 #include <string>
55 #include <vector>
56 
57 #include <boost/shared_ptr.hpp>
58 
59 #include "EmptyField.h"
60 #include "Field.h"
61 #include "Field3DFileHDF5.h"
62 #include "FieldMetadata.h"
63 #include "ClassFactory.h"
64 #include "OgawaFwd.h"
65 
66 //----------------------------------------------------------------------------//
67 
68 #include "ns.h"
69 
70 //----------------------------------------------------------------------------//
71 
73 
74 //----------------------------------------------------------------------------//
75 // Forward declarations
76 //----------------------------------------------------------------------------//
77 
80 
81 //----------------------------------------------------------------------------//
82 // Layer
83 //----------------------------------------------------------------------------//
84 
87 namespace File {
88 
96 class Layer
97 {
98 public:
100  std::string name;
103  std::string parent;
104 };
105 
106 } // namespace File
107 
108 //----------------------------------------------------------------------------//
109 // Partition
110 //----------------------------------------------------------------------------//
111 
112 namespace File {
113 
122 {
123 public:
124 
125  typedef std::vector<Layer> LayerList;
126 
127  typedef boost::intrusive_ptr<Partition> Ptr;
128  typedef boost::intrusive_ptr<const Partition> CPtr;
129 
130  // RTTI replacement ----------------------------------------------------------
131 
134 
135  static const char *staticClassType()
136  {
137  return "Partition";
138  }
139 
140  // Ctors, dtor ---------------------------------------------------------------
141 
144  : RefBase()
145  { }
146 
147  // From RefBase --------------------------------------------------------------
148 
151 
152  virtual std::string className() const;
153 
155 
156  // Main methods --------------------------------------------------------------
157 
159  void addLayer(const File::Layer &layer);
160 
162  const File::Layer* layer(const std::string &name) const;
163 
165  void getLayerNames(std::vector<std::string> &names) const;
166 
168  OgOGroup& group() const;
170  void setGroup(boost::shared_ptr<OgOGroup> ptr);
171 
172  // Public data members -------------------------------------------------------
173 
175  std::string name;
178 
179 private:
180 
181  // Private data members ------------------------------------------------------
182 
186  boost::shared_ptr<OgOGroup> m_group;
187 
188  // Typedefs ------------------------------------------------------------------
189 
191  typedef RefBase base;
192 
193 };
194 
195 } // namespace File
196 
197 //----------------------------------------------------------------------------//
198 // Field3DFileBase
199 //----------------------------------------------------------------------------//
200 
208 //----------------------------------------------------------------------------//
209 
211 {
212 public:
213 
214  // Structs -------------------------------------------------------------------
215 
216  struct LayerInfo
217  {
218  std::string name;
219  std::string parentName;
221  LayerInfo(std::string par, std::string nm, int cpt)
222  : name(nm), parentName(par), components(cpt)
223  { /* Empty */ }
224  };
225 
226  // Typedefs ------------------------------------------------------------------
227 
228  typedef std::map<std::string, std::string> GroupMembershipMap;
229 
230  // Ctor, dtor ----------------------------------------------------------------
231 
234 
235  Field3DFileBase();
237  virtual ~Field3DFileBase() = 0;
238 
240 
241  // Main methods --------------------------------------------------------------
242 
244  void clear();
245 
249  bool close();
250 
253 
255  void getPartitionNames(std::vector<std::string> &names) const;
257  void getScalarLayerNames(std::vector<std::string> &names,
258  const std::string &partitionName) const;
260  void getVectorLayerNames(std::vector<std::string> &names,
261  const std::string &partitionName) const;
262 
264 
267 
269  void addGroupMembership(const GroupMembershipMap &groupMembers);
270 
272 
273  // Access to metadata --------------------------------------------------------
274 
277  {
278  if (m_hdf5Base) {
279  return m_hdf5Base->metadata();
280  }
281  return m_metadata;
282  }
283 
285  const FieldMetadata& metadata() const
286  {
287  if (m_hdf5Base) {
288  return m_hdf5Base->metadata();
289  }
290  return m_metadata;
291  }
292 
295  virtual void metadataHasChanged(const std::string &/* name */)
296  { /* Empty */ }
297 
298  // Debug ---------------------------------------------------------------------
299 
302 
303  void printHierarchy() const;
304 
306 
307 protected:
308 
309  // Internal typedefs ---------------------------------------------------------
310 
311  typedef std::vector<File::Partition::Ptr> PartitionList;
312  typedef std::map<std::string, int> PartitionCountMap;
313 
314  // Convenience methods -------------------------------------------------------
315 
318 
321  File::Partition::Ptr getPartition(const std::string &partitionName) const
322  { return partition(partitionName); }
323 
325  virtual void closeInternal() = 0;
328  File::Partition::Ptr partition(const std::string &partitionName);
331  File::Partition::Ptr partition(const std::string &partitionName) const;
332 
334  void getIntPartitionNames(std::vector<std::string> &names) const;
337  void getIntScalarLayerNames(std::vector<std::string> &names,
338  const std::string &intPartitionName) const;
341  void getIntVectorLayerNames(std::vector<std::string> &names,
342  const std::string &intPartitionName) const;
343 
345  int numIntPartitions(const std::string &partitionName) const;
346 
349  std::string makeIntPartitionName(const std::string &partitionsName,
350  int i) const;
351 
355  std::string intPartitionName(const std::string &partitionName,
356  const std::string &layerName,
357  FieldRes::Ptr field);
358 
361  std::string removeUniqueId(const std::string &partitionName) const;
362 
364 
365  // Data members --------------------------------------------------------------
366 
368  std::vector<LayerInfo> m_layerInfo;
369 
373  std::vector<std::string> m_partitionNames;
374 
378 
383 
386 
388  boost::shared_ptr<Field3DFileHDF5Base> m_hdf5Base;
389 
390 private:
391 
392  // Private member functions --------------------------------------------------
393 
395  void operator =(const Field3DFileBase&);
396 
397 };
398 
399 //----------------------------------------------------------------------------//
400 // Field3DInputFile
401 //----------------------------------------------------------------------------//
402 
411 //----------------------------------------------------------------------------//
412 
414 {
415 public:
416 
417  // Ctors, dtor ---------------------------------------------------------------
418 
421 
423  virtual ~Field3DInputFile();
424 
426 
427  // Main interface ------------------------------------------------------------
428 
431  bool open(const std::string &filename);
432 
434  const std::string &encoding() const
435  {
436  const static std::string encodings[2] = { "Ogawa", "HDF5" };
437  return encodings[m_hdf5 ? 1 : 0];
438  }
439 
442 
443  template <class Data_T>
444  typename Field<Data_T>::Vec
445  readLayers(const std::string &layerName = std::string("")) const;
446 
447  template <class Data_T>
448  typename Field<Data_T>::Vec
449  readLayers(const std::string &partitionName,
450  const std::string &layerName) const;
451 
454 
459  template <class Data_T>
460  typename Field<Data_T>::Vec
461  readScalarLayers(const std::string &layerName = std::string("")) const
462  {
463  if (m_hdf5) {
464  return m_hdf5->readScalarLayers<Data_T>(layerName);
465  }
466  return readLayers<Data_T>(layerName);
467  }
468 
470  template <class Data_T>
471  typename Field<Data_T>::Vec
472  readScalarLayers(const std::string &partitionName,
473  const std::string &layerName) const
474  {
475  if (m_hdf5) {
476  return m_hdf5->readScalarLayers<Data_T>(partitionName, layerName);
477  }
478  return readLayers<Data_T>(partitionName, layerName);
479  }
480 
485  template <class Data_T>
486  typename Field<FIELD3D_VEC3_T<Data_T> >::Vec
487  readVectorLayers(const std::string &layerName = std::string("")) const
488  {
489  if (m_hdf5) {
490  return m_hdf5->readVectorLayers<Data_T>(layerName);
491  }
492  return readLayers<FIELD3D_VEC3_T<Data_T> >(layerName);
493  }
494 
496  template <class Data_T>
497  typename Field<FIELD3D_VEC3_T<Data_T> >::Vec
498  readVectorLayers(const std::string &partitionName,
499  const std::string &layerName) const
500  {
501  if (m_hdf5) {
502  return m_hdf5->readVectorLayers<Data_T>(partitionName, layerName);
503  }
504  return readLayers<FIELD3D_VEC3_T<Data_T> >(partitionName, layerName);
505  }
506 
508 
511 
517  template <class Data_T>
518  typename EmptyField<Data_T>::Vec
519  readProxyLayer(const std::string &partitionName,
520  const std::string &layerName,
521  bool isVectorLayer) const;
522 
528  template <class Data_T>
529  typename EmptyField<Data_T>::Vec
530  readProxyScalarLayers(const std::string &name = std::string("")) const;
531 
537  template <class Data_T>
538  typename EmptyField<Data_T>::Vec
539  readProxyVectorLayers(const std::string &name = std::string("")) const;
540 
542 
543 private:
544 
545  // From Field3DFileBase ------------------------------------------------------
546 
547  virtual void closeInternal()
548  {
549  if (m_hdf5) {
550  m_hdf5->closeInternal();
551  return;
552  }
553 
554  cleanup();
555  }
556 
557  void cleanup()
558  {
559  // The destruction of the various Ogawa components must happen in the
560  // right order
561 
562  // First, the partition groups
563  m_partitions.clear();
564  // Then the root group
565  m_root.reset();
566  // Finally, the archive
567  m_archive.reset();
568  }
569 
570  // Convenience methods -------------------------------------------------------
571 
574  template <class Data_T>
575  typename Field<Data_T>::Ptr
576  readLayer(const std::string &intPartitionName,
577  const std::string &layerName) const;
578 
582  template <class Data_T>
583  typename EmptyField<Data_T>::Ptr
584  readProxyLayer(OgIGroup &location, const std::string &name,
585  const std::string &attribute,
586  FieldMapping::Ptr mapping) const;
587 
589  bool readPartitionAndLayerInfo();
590 
592  bool readMetadata(const OgIGroup &metadataGroup, FieldBase::Ptr field) const;
593 
595  bool readMetadata(const OgIGroup &metadataGroup);
596 
597  // Data members --------------------------------------------------------------
598 
600  std::string m_filename;
602  boost::shared_ptr<Alembic::Ogawa::IArchive> m_archive;
604  boost::shared_ptr<OgIGroup> m_root;
605 
607  boost::shared_ptr<Field3DInputFileHDF5> m_hdf5;
608 
609 };
610 
611 //----------------------------------------------------------------------------//
612 // Utility functions
613 //----------------------------------------------------------------------------//
614 
620 bool fileExists(const std::string &filename);
621 
622 //----------------------------------------------------------------------------//
623 // Field3DOutputFile
624 //----------------------------------------------------------------------------//
625 
634 //----------------------------------------------------------------------------//
635 
637 {
638 public:
639 
640  // Enums ---------------------------------------------------------------------
641 
642  enum CreateMode {
644  FailOnExisting
645  };
646 
647  // Ctors, dtor ---------------------------------------------------------------
648 
651 
653  virtual ~Field3DOutputFile();
654 
656 
657  // Main interface ------------------------------------------------------------
658 
660  bool create(const std::string &filename, CreateMode cm = OverwriteMode);
661 
663  static void useOgawa(const bool enabled)
664  {
665  // simple temporary endian check
666  union {
667  uint32_t l;
668  char c[4];
669  } u;
670 
671  u.l = 0x01234567;
672 
673  if (u.c[0] == 0x67) {
674  ms_doOgawa = enabled;
675  } else {
676  std::cerr << "WARNING: Field3D only supports Ogawa-backed files "
677  << "on little-endian systems." << std::endl;
678  ms_doOgawa = false;
679  }
680  }
681 
684 
686  template <class Data_T>
687  bool writeLayer(const std::string &layerName,
688  typename Field<Data_T>::Ptr layer)
689  {
690  return writeLayer<Data_T>(std::string("default"), layerName, layer);
691  }
692 
695  template <class Data_T>
696  bool writeLayer(const std::string &partitionName,
697  const std::string &layerName,
698  typename Field<Data_T>::Ptr layer);
699 
702  template <class Data_T>
703  bool writeLayer(typename Field<Data_T>::Ptr layer)
704  {
705  return writeLayer<Data_T>(layer->name, layer->attribute, layer);
706  }
707 
709 
712 
714  template <class Data_T>
715  bool writeScalarLayer(const std::string &layerName,
716  typename Field<Data_T>::Ptr layer)
717  {
718  if (m_hdf5) {
719  return m_hdf5->writeScalarLayer<Data_T>(layerName, layer);
720  }
721  return writeScalarLayer<Data_T>(std::string("default"), layerName, layer);
722  }
723 
726  template <class Data_T>
727  bool writeScalarLayer(const std::string &partitionName,
728  const std::string &layerName,
729  typename Field<Data_T>::Ptr layer)
730  {
731  if (m_hdf5) {
732  return m_hdf5->writeScalarLayer<Data_T>(partitionName, layerName, layer);
733  }
734  return writeLayer<Data_T>(partitionName, layerName, layer);
735  }
736 
739  template <class Data_T>
741  {
742  if (m_hdf5) {
743  return m_hdf5->writeScalarLayer<Data_T>(layer);
744  }
745  return writeLayer<Data_T>(layer);
746  }
747 
749  template <class Data_T>
750  bool writeVectorLayer(const std::string &layerName,
751  typename Field<FIELD3D_VEC3_T<Data_T> >::Ptr layer)
752  {
753  if (m_hdf5) {
754  return m_hdf5->writeVectorLayer<Data_T>(layerName, layer);
755  }
756  return writeVectorLayer<Data_T>(std::string("default"), layerName, layer);
757  }
758 
761  template <class Data_T>
762  bool writeVectorLayer(const std::string &partitionName,
763  const std::string &layerName,
764  typename Field<FIELD3D_VEC3_T<Data_T> >::Ptr layer)
765  {
766  if (m_hdf5) {
767  return m_hdf5->writeVectorLayer<Data_T>(partitionName, layerName, layer);
768  }
769  return writeLayer<FIELD3D_VEC3_T<Data_T> >(partitionName, layerName, layer);
770  }
771 
774  template <class Data_T>
775  bool writeVectorLayer(typename Field<FIELD3D_VEC3_T<Data_T> >::Ptr layer)
776  {
777  if (m_hdf5) {
778  return m_hdf5->writeVectorLayer<Data_T>(layer);
779  }
780  return writeLayer<FIELD3D_VEC3_T<Data_T> >(layer);
781  }
782 
784  bool writeGlobalMetadata();
785 
788  bool writeGroupMembership();
789 
791 
792 private:
793 
794  // From Field3DFileBase ------------------------------------------------------
795 
796  virtual void closeInternal()
797  {
798  if (m_hdf5) {
799  m_hdf5->closeInternal();
800  return;
801  }
802  cleanup();
803  }
804 
805  void cleanup()
806  {
807  // The destruction of the various Ogawa components must happen in the
808  // right order
809 
810  // First, the partition groups
811  m_partitions.clear();
812  // Then the root group
813  m_root.reset();
814  // Finally, the archive
815  m_archive.reset();
816  }
817 
818  // Convenience methods -------------------------------------------------------
819 
821  std::string incrementPartitionName(std::string &pname);
822 
825  createNewPartition(const std::string &partitionName,
826  const std::string &layerName, FieldRes::Ptr field);
830  bool writeMapping(OgOGroup &partitionGroup, FieldMapping::Ptr mapping);
831 
833  bool writeMetadata(OgOGroup &metadataGroup, FieldBase::Ptr layer);
834 
836  bool writeMetadata(OgOGroup &metadataGroup);
837 
838  // Data members --------------------------------------------------------------
839 
841  static bool ms_doOgawa;
842 
844  boost::shared_ptr<Alembic::Ogawa::OArchive> m_archive;
846  boost::shared_ptr<OgOGroup> m_root;
847 
849  boost::shared_ptr<Field3DOutputFileHDF5> m_hdf5;
850 
851 };
852 
853 //----------------------------------------------------------------------------//
854 
856 
857 //----------------------------------------------------------------------------//
858 
859 #endif
Field3DInputFile::m_archive
boost::shared_ptr< Alembic::Ogawa::IArchive > m_archive
Pointer to the Ogawa archive.
Definition: Field3DFile.h:602
FIELD3D_NAMESPACE_HEADER_CLOSE
#define FIELD3D_NAMESPACE_HEADER_CLOSE
Definition: ns.h:58
File::Partition::mapping
FieldMapping::Ptr mapping
Pointer to the mapping object.
Definition: Field3DFile.h:177
Field3DOutputFile
Provides writing of .f3d (internally, hdf5 or Ogawa) files.
Definition: Field3DFile.h:637
Field3DFileBase::LayerInfo::components
int components
Definition: Field3DFile.h:220
Field3DOutputFile::closeInternal
virtual void closeInternal()
Closes the file if open.
Definition: Field3DFile.h:796
Field3DInputFile::m_hdf5
boost::shared_ptr< Field3DInputFileHDF5 > m_hdf5
HDF5 fallback.
Definition: Field3DFile.h:607
EmptyField::Vec
std::vector< Ptr > Vec
Definition: EmptyField.h:94
Field::Ptr
boost::intrusive_ptr< Field > Ptr
Definition: Field.h:395
FieldMetadata.h
Basic container for metedata.
Field3DOutputFile::writeVectorLayer
bool writeVectorLayer(typename Field< FIELD3D_VEC3_T< Data_T > >::Ptr layer)
Writes a layer to a specific partition. The field name and attribute name are used for partition and ...
Definition: Field3DFile.h:775
Field3DOutputFile::writeVectorLayer
bool writeVectorLayer(const std::string &layerName, typename Field< FIELD3D_VEC3_T< Data_T > >::Ptr layer)
Writes a scalar layer to the "Default" partition.
Definition: Field3DFile.h:750
Field3DInputFile
Provides reading of .f3d (internally, hdf5 or Ogawa) files.
Definition: Field3DFile.h:414
Field3DFileBase::LayerInfo::parentName
std::string parentName
Definition: Field3DFile.h:219
Field3DOutputFile::writeLayer
bool writeLayer(typename Field< Data_T >::Ptr layer)
Writes a layer to a specific partition. The field name and attribute name are used for partition and ...
Definition: Field3DFile.h:703
File::Partition::LayerList
std::vector< Layer > LayerList
Definition: Field3DFile.h:125
FieldMapping::Ptr
boost::intrusive_ptr< FieldMapping > Ptr
Definition: FieldMapping.h:92
EmptyField::Ptr
boost::intrusive_ptr< EmptyField > Ptr
Definition: EmptyField.h:93
Field3DFileBase::metadata
FieldMetadata & metadata()
accessor to the m_metadata class
Definition: Field3DFile.h:276
MetadataCallback
Definition: FieldMetadata.h:71
FieldBase::name
std::string name
Optional name of the field.
Definition: Field.h:171
Field3DFileBase::partition
File::Partition::Ptr partition(const std::string &partitionName) const
Returns a pointer to the given partition.
Field3DOutputFile::writeScalarLayer
bool writeScalarLayer(const std::string &layerName, typename Field< Data_T >::Ptr layer)
Writes a scalar layer to the "Default" partition.
Definition: Field3DFile.h:715
Field3DOutputFile::m_hdf5
boost::shared_ptr< Field3DOutputFileHDF5 > m_hdf5
HDF5 fallback.
Definition: Field3DFile.h:849
FieldBase::Ptr
boost::intrusive_ptr< FieldBase > Ptr
Definition: Field.h:97
Field3DFileBase::metadataHasChanged
virtual void metadataHasChanged(const std::string &)
This function should implemented by concrete classes to get the callback when metadata changes.
Definition: Field3DFile.h:295
File::Partition::name
std::string name
Name of the partition.
Definition: Field3DFile.h:175
Field3DInputFile::closeInternal
virtual void closeInternal()
Closes the file if open.
Definition: Field3DFile.h:547
File::Partition
Definition: Field3DFile.h:122
Field3DInputFile::readScalarLayers
Field< Data_T >::Vec readScalarLayers(const std::string &partitionName, const std::string &layerName) const
This one allows the allows the partitionName to be passed in.
Definition: Field3DFile.h:472
OgawaFwd.h
Contains forward declarations for Ogawa classes.
Field3DOutputFile::writeScalarLayer
bool writeScalarLayer(typename Field< Data_T >::Ptr layer)
Writes a layer to a specific partition. The field name and attribute name are used for partition and ...
Definition: Field3DFile.h:740
File::Layer::parent
std::string parent
The name of the parent partition. We need this in order to open its group.
Definition: Field3DFile.h:103
ns.h
Field3DFileBase::m_hdf5Base
boost::shared_ptr< Field3DFileHDF5Base > m_hdf5Base
HDF5 fallback.
Definition: Field3DFile.h:388
Field3DFileBase::m_partitions
PartitionList m_partitions
Vector of partitions.
Definition: Field3DFile.h:371
Field3DFileBase::m_groupMembership
GroupMembershipMap m_groupMembership
Keeps track of group membership for each layer of partition name. The key is the "group" and the valu...
Definition: Field3DFile.h:382
FieldRes::Ptr
boost::intrusive_ptr< FieldRes > Ptr
Definition: Field.h:213
Field3DFileBase::LayerInfo::name
std::string name
Definition: Field3DFile.h:218
File::Partition::staticClassType
static const char * staticClassType()
Definition: Field3DFile.h:135
Field3DInputFile::encoding
const std::string & encoding() const
Returns an encoding descriptor of the given file.
Definition: Field3DFile.h:434
FieldBase::attribute
std::string attribute
Optional name of the attribute the field represents.
Definition: Field.h:173
Field3DOutputFile::OverwriteMode
@ OverwriteMode
Definition: Field3DFile.h:643
File::Partition::CPtr
boost::intrusive_ptr< const Partition > CPtr
Definition: Field3DFile.h:128
Field3DInputFile::m_filename
std::string m_filename
Filename, only to be set by open().
Definition: Field3DFile.h:600
Field::Vec
std::vector< Ptr > Vec
This is a convenience typedef for the list that Field3DInputFile::readScalarLayers() and Field3DInput...
Definition: Field.h:403
Field3DFileBase::m_metadata
FieldMetadata m_metadata
metadata
Definition: Field3DFile.h:385
Field3DInputFile::cleanup
void cleanup()
Definition: Field3DFile.h:557
FieldMetadata
Definition: FieldMetadata.h:85
Field3DFileBase::PartitionCountMap
std::map< std::string, int > PartitionCountMap
Definition: Field3DFile.h:312
Field3DOutputFile::m_archive
boost::shared_ptr< Alembic::Ogawa::OArchive > m_archive
Pointer to the Ogawa archive.
Definition: Field3DFile.h:844
Field3DFileHDF5.h
Contains the Field3DFileHDF5 classes.
Field.h
Contains Field, WritableField and ResizableField classes.
Field3DOutputFile::ms_doOgawa
static bool ms_doOgawa
Whether to output ogawa files.
Definition: Field3DFile.h:841
Field3DOutputFile::cleanup
void cleanup()
Definition: Field3DFile.h:805
Field3DOutputFileHDF5
Provides writing of .f3d (internally, hdf5) files.
Definition: Field3DFileHDF5.h:765
Field3DOutputFile::writeScalarLayer
bool writeScalarLayer(const std::string &partitionName, const std::string &layerName, typename Field< Data_T >::Ptr layer)
Writes a layer to a specific partition. The partition will be created if not specified.
Definition: Field3DFile.h:727
File::Partition::m_layers
LayerList m_layers
The layers belonging to this partition.
Definition: Field3DFile.h:184
Field3DFileBase::metadata
const FieldMetadata & metadata() const
Read only access to the m_metadata class.
Definition: Field3DFile.h:285
Field3DOutputFile::useOgawa
static void useOgawa(const bool enabled)
Whether to output ogawa files.
Definition: Field3DFile.h:663
Field3DFileBase::GroupMembershipMap
std::map< std::string, std::string > GroupMembershipMap
Definition: Field3DFile.h:228
Field3DOutputFile::writeLayer
bool writeLayer(const std::string &layerName, typename Field< Data_T >::Ptr layer)
Writes a scalar layer to the "Default" partition.
Definition: Field3DFile.h:687
Field3DFileBase::partition
File::Partition::Ptr partition(const std::string &partitionName)
Returns a pointer to the given partition.
Field3DFileBase::getPartition
File::Partition::Ptr getPartition(const std::string &partitionName) const
Returns a pointer to the given partition.
Definition: Field3DFile.h:321
File::Partition::Partition
Partition()
Ctor.
Definition: Field3DFile.h:143
Field3DFileBase::closeInternal
virtual void closeInternal()=0
Closes the file if open.
Field3DInputFile::readVectorLayers
Field< FIELD3D_VEC3_T< Data_T > >::Vec readVectorLayers(const std::string &partitionName, const std::string &layerName) const
This version allows you to pass in the partition name.
Definition: Field3DFile.h:498
Field3DFileBase::LayerInfo::LayerInfo
LayerInfo(std::string par, std::string nm, int cpt)
Definition: Field3DFile.h:221
Field3DInputFile::readScalarLayers
Field< Data_T >::Vec readScalarLayers(const std::string &layerName=std::string("")) const
Retrieves all the layers of scalar type and maintains their on-disk data types.
Definition: Field3DFile.h:461
Field3DInputFile::readVectorLayers
Field< FIELD3D_VEC3_T< Data_T > >::Vec readVectorLayers(const std::string &layerName=std::string("")) const
Retrieves all the layers of vector type and maintains their on-disk data types.
Definition: Field3DFile.h:487
EmptyField.h
Contains the EmptyField class.
Field3DOutputFile::CreateMode
CreateMode
Definition: Field3DFile.h:642
File::Partition::class_type
Partition class_type
Definition: Field3DFile.h:132
FIELD3D_API
#define FIELD3D_API
Definition: ns.h:77
FIELD3D_NAMESPACE_OPEN
Definition: FieldMapping.cpp:74
File::Partition::Ptr
boost::intrusive_ptr< Partition > Ptr
Definition: Field3DFile.h:127
Field3DFileBase::m_partitionNames
std::vector< std::string > m_partitionNames
This stores partition names.
Definition: Field3DFile.h:373
File::Partition::DEFINE_FIELD_RTTI_CONCRETE_CLASS
DEFINE_FIELD_RTTI_CONCRETE_CLASS
Definition: Field3DFile.h:133
Field
Definition: Field.h:390
File::Layer
Definition: Field3DFile.h:97
RefBase
Definition: RefCount.h:107
Field3DFileBase::LayerInfo
Definition: Field3DFile.h:217
Field3DInputFile::m_root
boost::shared_ptr< OgIGroup > m_root
Pointer to root group.
Definition: Field3DFile.h:604
Field3DOutputFile::writeVectorLayer
bool writeVectorLayer(const std::string &partitionName, const std::string &layerName, typename Field< FIELD3D_VEC3_T< Data_T > >::Ptr layer)
Writes a layer to a specific partition. The partition will be created if not specified.
Definition: Field3DFile.h:762
Field3DInputFileHDF5
Provides reading of .f3d (internally, hdf5) files.
Definition: Field3DFileHDF5.h:438
fileExists
bool fileExists(const std::string &filename)
checks to see if a file/directory exists or not
Definition: Field3DFile.cpp:1341
File
Namespace for file I/O specifics.
Definition: Field3DFile.h:87
ClassFactory.h
Contains the ClassFactory class for registering Field3D classes.
Field3DFileBase::Field3DFileBase
Field3DFileBase(const Field3DFileBase &)
File::Layer::name
std::string name
The name of the layer (always available)
Definition: Field3DFile.h:100
Field3DFileBase::PartitionList
std::vector< File::Partition::Ptr > PartitionList
Definition: Field3DFile.h:311
Field3DFileBase::m_partitionCount
PartitionCountMap m_partitionCount
Contains a counter for each partition name. This is used to keep multiple fields with the same name u...
Definition: Field3DFile.h:377
File::Partition::m_group
boost::shared_ptr< OgOGroup > m_group
Group representing the partition.
Definition: Field3DFile.h:186
Field3DFileBase
Definition: Field3DFile.h:211
File::Partition::base
RefBase base
Convenience typedef for referring to base class.
Definition: Field3DFile.h:191
Field3DFileBase::m_layerInfo
std::vector< LayerInfo > m_layerInfo
This stores layer info.
Definition: Field3DFile.h:368
Field3DOutputFile::m_root
boost::shared_ptr< OgOGroup > m_root
Pointer to root group.
Definition: Field3DFile.h:846