AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::sidre::Group Class Reference

Group holds a collection of Views and (child) Groups. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/sidre/core/Group.hpp>

Public Types

using ViewCollection = ItemCollection< View >
 
using GroupCollection = ItemCollection< Group >
 

Public Member Functions

View query methods.
bool hasView (const std::string &path) const
 Return true if Group includes a descendant View with given name or path; else false. More...
 
bool hasChildView (const std::string &name) const
 Return true if this Group owns a View with given name (not path); else false. More...
 
bool hasView (IndexType idx) const
 Return true if this Group owns a View with given index; else false. More...
 
IndexType getViewIndex (const std::string &name) const
 Return index of View with given name owned by this Group object. More...
 
const std::string & getViewName (IndexType idx) const
 Return name of View with given index owned by Group object. More...
 
View access methods.
ViewgetView (const std::string &path)
 Return pointer to non-const View with given name or path. More...
 
const ViewgetView (const std::string &path) const
 Return pointer to const View with given name or path. More...
 
ViewgetView (IndexType idx)
 Return pointer to non-const View with given index. More...
 
const ViewgetView (IndexType idx) const
 Return pointer to const View with given index. More...
 
View iteration methods.

Using these methods, a code can get the first View index and each succeeding index. This allows View iteration using the same constructs in C++, C, and Fortran. Example:

 sidre::IndexType idx = grp->getFirstValidViewIndex();
 while( sidre::indexIsValid(idx) )
 {
     View* view = grp->getView(idx);

     /// code here using view

     idx = grp -> getNextValidViewIndex(idx);
 } 
IndexType getFirstValidViewIndex () const
 Return first valid View index in Group object (i.e., smallest index over all Views). More...
 
IndexType getNextValidViewIndex (IndexType idx) const
 Return next valid View index in Group object after given index (i.e., smallest index over all View indices larger than given one). More...
 
Methods to create a View that has no associated data.
Attention
These methods do not allocate data or associate a View with data. Thus, to do anything useful with a View created by one of these methods, the View should be allocated, attached to a Buffer or attached to externally-owned data.

Each of these methods is a no-op if the given View name is an empty string or the Group already has a View with given name or path.

Additional conditions under which a method can be a no-op are described for each method.

ViewcreateView (const std::string &path)
 Create an undescribed (i.e., empty) View object with given name or path in this Group. More...
 
ViewcreateView (const std::string &path, TypeID type, IndexType num_elems)
 Create View object with given name or path in this Group that has a data description with data type and number of elements. More...
 
ViewcreateViewWithShape (const std::string &path, TypeID type, int ndims, const IndexType *shape)
 Create View object with given name or path in this Group that has a data description with data type and shape. More...
 
ViewcreateView (const std::string &path, const DataType &dtype)
 Create View object with given name or path in this Group that is described by a Conduit DataType object. More...
 
Methods to create a View with a Buffer attached.
Attention
The Buffer passed to each of these methods may or may not be allocated. Thus, to do anything useful with a View created by one of these methods, the Buffer must be allocated and it must be compatible with the View data description.

Each of these methods is a no-op if Group already has a View or child Group with the given name or path.

If this Group was created to hold items in list format, the path can be an empty string. Otherwise an empty string for the path will result in a no-op.

Also, calling one of these methods with a null Buffer pointer is similar to creating a View with no data association.

Additional conditions under which a method can be a no-op are described for each method.

ViewcreateView (const std::string &path, Buffer *buff)
 Create an undescribed View object with given name or path in this Group and attach given Buffer to it. More...
 
ViewcreateView (const std::string &path, TypeID type, IndexType num_elems, Buffer *buff)
 Create View object with given name or path in this Group that has a data description with data type and number of elements and attach given Buffer to it. More...
 
ViewcreateViewWithShape (const std::string &path, TypeID type, int ndims, const IndexType *shape, Buffer *buff)
 Create View object with given name or path in this Group that has a data description with data type and shape and attach given Buffer to it. More...
 
ViewcreateView (const std::string &path, const DataType &dtype, Buffer *buff)
 Create View object with given name or path in this Group that is described by a Conduit DataType object and attach given Buffer to it. More...
 
Methods to create a View with externally-owned data attached.
Attention
To do anything useful with a View created by one of these methods, the external data must be allocated and compatible with the View description.

Each of these methods is a no-op if the given View name is an empty string or the Group already has a View with given name or path.

Additional conditions under which a method can be a no-op are described for each method.

ViewcreateView (const std::string &path, void *external_ptr)
 Create View object with given name with given name or path in this Group and attach external data ptr to it. More...
 
ViewcreateView (const std::string &path, TypeID type, IndexType num_elems, void *external_ptr)
 Create View object with given name or path in this Group that has a data description with data type and number of elements and attach externally-owned data to it. More...
 
ViewcreateViewWithShape (const std::string &path, TypeID type, int ndims, const IndexType *shape, void *external_ptr)
 Create View object with given name or path in this Group that has a data description with data type and shape and attach externally-owned data to it. More...
 
ViewcreateView (const std::string &path, const DataType &dtype, void *external_ptr)
 Create View object with given name or path in this Group that is described by a Conduit DataType object and attach externally-owned data to it. More...
 
Methods to create a View and allocate data for it.

Each of these methods is a no-op if the given View name is an empty string or the Group already has a View with given name or path.

Additional conditions under which a method can be a no-op are described for each method.

ViewcreateViewAndAllocate (const std::string &path, TypeID type, IndexType num_elems, int allocID=INVALID_ALLOCATOR_ID)
 Create View object with given name or path in this Group that has a data description with data type and number of elements and allocate data for it. More...
 
ViewcreateViewWithShapeAndAllocate (const std::string &path, TypeID type, int ndims, const IndexType *shape, int allocID=INVALID_ALLOCATOR_ID)
 Create View object with given name or path in this Group that has a data description with data type and shape and allocate data for it. More...
 
ViewcreateViewAndAllocate (const std::string &path, const DataType &dtype, int allocID=INVALID_ALLOCATOR_ID)
 Create View object with given name or path in this Group that is described by a Conduit DataType object and allocate data for it. More...
 
template<typename ScalarType >
ViewcreateViewScalar (const std::string &path, ScalarType value)
 Create View object with given name or path in this Group set its data to given scalar value. More...
 
ViewcreateViewString (const std::string &path, const std::string &value)
 Create View object with given name or path in this Group set its data to given string. More...
 
View destruction methods.

Each of these methods is a no-op if the specified View does not exist.

void destroyView (const std::string &path)
 Destroy View with given name or path owned by this Group, but leave its data intect. More...
 
void destroyView (IndexType idx)
 Destroy View with given index owned by this Group, but leave its data intect. More...
 
void destroyViews ()
 Destroy all Views owned by this Group, but leave all their data intact. More...
 
void destroyViewAndData (const std::string &path)
 Destroy View with given name or path owned by this Group and deallocate its data if it's the only View associated with that data. More...
 
void destroyViewAndData (IndexType idx)
 Destroy View with given index owned by this Group and deallocate its data if it's the only View associated with that data. More...
 
void destroyViewsAndData ()
 Destroy all Views owned by this Group and deallocate data for each View when it's the only View associated with that data. More...
 
View move and copy methods.
ViewmoveView (View *view)
 Remove given View object from its owning Group and move it to this Group. More...
 
ViewcopyView (View *view)
 Create a (shallow) copy of given View object and add it to this Group. More...
 
ViewdeepCopyView (View *view, int allocID=INVALID_ALLOCATOR_ID)
 Create a deep copy of given View object and add it to this Group. More...
 
Child Group query methods.
bool hasGroup (const std::string &path) const
 Return true if this Group has a descendant Group with given name or path; else false. More...
 
bool hasChildGroup (const std::string &name) const
 Return true if this Group has a child Group with given name; else false. More...
 
bool hasGroup (IndexType idx) const
 Return true if Group has an immediate child Group with given index; else false. More...
 
IndexType getGroupIndex (const std::string &name) const
 Return the index of immediate child Group with given name. More...
 
const std::string & getGroupName (IndexType idx) const
 Return the name of immediate child Group with given index. More...
 
Group access and iteration methods.
GroupgetGroup (const std::string &path)
 Return pointer to non-const child Group with given name or path. More...
 
Group const * getGroup (const std::string &path) const
 Return pointer to const child Group with given name or path. More...
 
GroupgetGroup (IndexType idx)
 Return pointer to non-const immediate child Group with given index. More...
 
const GroupgetGroup (IndexType idx) const
 Return pointer to const immediate child Group with given index. More...
 
Group iteration methods.

Using these methods, a code can get the first Group index and each succeeding index. This allows Group iteration using the same constructs in C++, C, and Fortran. Example: for (sidre::IndexType idx = grp->getFirstValidGroupIndex(); sidre::indexIsValid(idx); idx = grp->getNextValidGroupIndex(idx)) { Group * group = grp->getGroup(idx);

/// code here using group }

IndexType getFirstValidGroupIndex () const
 Return first valid child Group index (i.e., smallest index over all child Groups). More...
 
IndexType getNextValidGroupIndex (IndexType idx) const
 Return next valid child Group index after given index (i.e., smallest index over all child Group indices larger than given one). More...
 
Child Group creation and destruction methods.
GroupcreateGroup (const std::string &path, bool is_list=false)
 Create a child Group within this Group with given name or path. More...
 
GroupcreateUnnamedGroup (bool is_list=false)
 
void destroyGroup (const std::string &path)
 Destroy child Group in this Group with given name or path. More...
 
void destroyGroup (IndexType idx)
 Destroy child Group within this Group with given index. More...
 
void destroyGroupAndData (const std::string &path)
 Destroy child Group at the given path, and destroy data that is not shared elsewhere. More...
 
void destroyGroupAndData (IndexType idx)
 Destroy child Group with the given index, and destroy data that is not shared elsewhere. More...
 
void destroyGroupsAndData ()
 Destroy all child Groups held by this Group, and destroy data that is not shared elsewhere. More...
 
void destroyGroupSubtreeAndData ()
 Destroy the entire subtree of Groups and Views held by this Group, and destroy data that is not shared elsewhere. More...
 
void destroyGroups ()
 Destroy all child Groups in this Group. More...
 
Group move and copy methods.
GroupmoveGroup (Group *group)
 Remove given Group object from its parent Group and make it a child of this Group. More...
 
GroupcopyGroup (Group *group)
 Create a (shallow) copy of Group hierarchy rooted at given Group and make it a child of this Group. More...
 
GroupdeepCopyGroup (Group *group, int allocID=INVALID_ALLOCATOR_ID)
 Create a deep copy of Group hierarchy rooted at given Group and make it a child of this Group. More...
 
Group print methods.
void print () const
 Print JSON description of data Group to stdout. More...
 
void print (std::ostream &os) const
 Print JSON description of data Group to an ostream. More...
 
void printTree (const int nlevels, std::ostream &os) const
 Print given number of levels of Group sub-tree starting at this Group object to an output stream. More...
 
void copyToConduitNode (Node &n) const
 Copy description of Group hierarchy rooted at this Group to given Conduit node. More...
 
bool createNativeLayout (Node &n, const Attribute *attr=nullptr) const
 Copy Group's native layout to given Conduit node. More...
 
void createNoDataLayout (Node &n, const Attribute *attr=nullptr) const
 Copy Group's layout to given Conduit node without data. More...
 
bool createExternalLayout (Node &n, const Attribute *attr=nullptr) const
 Copy data Group external layout to given Conduit node. More...
 
bool isEquivalentTo (const Group *other, bool checkName=true) const
 Return true if this Group is equivalent to given Group; else false. More...
 
bool isUsingMap () const
 Return true if this Group holds items in map format. More...
 
bool isUsingList () const
 Return true if this Group holds items in list format. More...
 

Friends

class DataStore
 
class View
 

Basic query and accessor methods.

char getPathDelimiter () const
 Return the path delimiter. More...
 
IndexType getIndex () const
 Return index of Group object within parent Group. More...
 
const std::string & getName () const
 Return const reference to name of Group object. More...
 
std::string getPath () const
 Return path of Group object, not including its name. More...
 
std::string getPathName () const
 Return full path of Group object, including its name. More...
 
GroupgetParent ()
 Return pointer to non-const parent Group of a Group. More...
 
const GroupgetParent () const
 Return pointer to const parent Group of a Group. More...
 
IndexType getNumGroups () const
 Return number of child Groups in a Group object. More...
 
IndexType getNumViews () const
 Return number of Views owned by a Group object. More...
 
DataStoregetDataStore ()
 Return pointer to non-const DataStore object that owns this object. More...
 
const DataStoregetDataStore () const
 Return pointer to const DataStore object that owns this object. More...
 
bool isRoot () const
 Return true if this Group is the DataStore's root Group. More...
 
void getDataInfo (Node &n, bool recursive=true) const
 Insert information about data associated with Group subtree with this Group at root of tree (default 'recursive' is true), or for this Group only ('recursive' is false) in fields of given Conduit Node. More...
 
static const std::vector< std::string > & getValidIOProtocols ()
 static method to get valid protocols for Group I/O methods. More...
 
static std::string getDefaultIOProtocol ()
 static method to get the default I/O protocol. More...
 

Accessors for iterating the group and view collections.

These methods can be used to iterate over the collection of groups and views Example: for (auto& group : grp->groups()) { /// code here using group } for (auto& view : grp->views()) { /// code here using view }

ViewCollection::iterator_adaptor views ()
 Returns an adaptor to support iterating the collection of views. More...
 
ViewCollection::const_iterator_adaptor views () const
 Returns a const adaptor to support iterating the collection of views. More...
 
GroupCollection::iterator_adaptor groups ()
 Returns an adaptor to support iterating the collection of groups. More...
 
GroupCollection::const_iterator_adaptor groups () const
 Returns a const adaptor to support iterating the collection of groups. More...
 

Group I/O methods

These methods save and load Group trees to and from files. This includes the views and buffers used in by groups in the tree. We provide several "protocol" options:

protocols: sidre_hdf5 (default when Axom is configured with hdf5) sidre_conduit_json (default otherwise) sidre_json

conduit_hdf5 conduit_bin conduit_json json

Note
The sidre_hdf5 and conduit_hdf5 protocols are only available when Axom is configured with hdf5.

There are two overloaded versions for each of save, load, and loadExternalData. The first of each takes a file path and is intended for use in a serial context and can be called directly using any of the supported protocols. The second takes an hdf5 handle that has previously been created by the calling code. These mainly exist to handle parallel I/O calls from the SPIO component. They can only take the sidre_hdf5 or conduit_hdf5 protocols.

Note
The hdf5 overloads are only available when Axom is configured with hdf5.
bool save (const std::string &path, const std::string &protocol=Group::getDefaultIOProtocol(), const Attribute *attr=nullptr) const
 Save the Group to a file. More...
 
bool load (const std::string &path, const std::string &protocol=Group::getDefaultIOProtocol(), bool preserve_contents=false)
 Load a Group hierarchy from a file into this Group. More...
 
bool load (const std::string &path, const std::string &protocol, bool preserve_contents, std::string &name_from_file)
 Load a Group hierarchy from a file into this Group, reporting the Group name stored in the file. More...
 
GroupcreateGroupAndLoad (std::string &group_name, const std::string &path, const std::string &protocol, bool &load_success)
 Create a child Group and load a Group hierarchy from file into the new Group. More...
 
bool loadExternalData (const std::string &path)
 Load data into the Group's external views from a file. More...
 
bool rename (const std::string &new_name)
 Change the name of this Group. More...
 
bool importConduitTree (const conduit::Node &node, bool preserve_contents=false)
 Import data from a conduit Node into a Group. More...
 
bool importConduitTreeExternal (conduit::Node &node, bool preserve_contents=false)
 Import data from a conduit Node into a Group without copying arrays. More...
 

Detailed Description

Group holds a collection of Views and (child) Groups.

The Group class has the following properties:

  • Groups can be organized into a (tree) hierarchy by creating child Groups from the root Group owned by a DataStore object.
  • A Group object can only be created by another Group; the Group ctor is not visible externally. A Group is owned by the Group that creates it (its parent) and becomes a (direct) child Group of the parent. Groups in the subtree rooted at an ancestor Group are that Group's descendants.
  • A Group object has a unique name (string) within its parent Group.
  • A Group object maintains a pointer to its parent Group.
  • A Group object can be moved or copied to another Group.
  • Group objects can create View objects within them. The Group that creates a View owns it.
  • A View object has a unique name (string) within the Group that owns it.
  • A View object can be moved or copied to another Group.

Note that Views and child Groups within a Group can be accessed by name or index.

Note that certain methods for querying, creating, retrieving, and deleting Groups and Views take a string with path syntax, while others take the name of a direct child of the current Group. Methods that require the name of a direct child are marked with "Child", for example hasChildView() and hasChildGroup(). When a path string is passed to a method that accepts path syntax, the last item in the path indicates the item to be created, accessed, etc. For example,

 View* view = group->createView("foo/bar/baz");

is equivalent to

 View* view =
   group->createGroup("foo")->createGroup("bar")->createView("baz");

In particular, intermediate Groups "foo" and "bar" will be created in this case if they don't already exist.

Methods that access Views or Groups by index work with the direct children of the current Group because an index has no meaning outside of the indexed group. None of these methods is marked with "Child".

A Group can optionally be created to hold items in a "list format". In this format, any number of child Group or View items can be created to be held and accessed like a list. When using this format, the child items can be accessed only via iterators that iterate in the order that they were added to the parent Group.

It is recommended but not required that the items held in the list format be created without names. String names may be assigned to these items, but the names will not be useful for accessing them from their parent Group, and none of the methods that access child items by name or path will return a valid pointer. Additionally, strings with path syntax, (such as ("foo/bar/baz") will be considered invalid when creating items to be held in the list format, and the object creation methods will return a null pointer if such a string is provided. Unnamed Groups to be held in the list format should be created using the method createUnnamedGroup, while unnamed Views should be created by passing an empty string as the path argument to any of the createView methods.

Attention
when Views or Groups are created, destroyed, copied, or moved, indices of other Views and Groups in associated Group objects may become invalid. This is analogous to iterator invalidation for STL containers when the container contents change.

Member Typedef Documentation

◆ ViewCollection

◆ GroupCollection

Member Function Documentation

◆ getPathDelimiter()

char axom::sidre::Group::getPathDelimiter ( ) const
inline

Return the path delimiter.

◆ getValidIOProtocols()

static const std::vector<std::string>& axom::sidre::Group::getValidIOProtocols ( )
inlinestatic

static method to get valid protocols for Group I/O methods.

Only protocols that work for both input and output are returned.

◆ getDefaultIOProtocol()

static std::string axom::sidre::Group::getDefaultIOProtocol ( )
inlinestatic

static method to get the default I/O protocol.

◆ getIndex()

IndexType axom::sidre::Group::getIndex ( ) const
inline

Return index of Group object within parent Group.

◆ getName()

const std::string& axom::sidre::Group::getName ( ) const
inline

Return const reference to name of Group object.

See also
getPath(), getPathName()

◆ getPath()

std::string axom::sidre::Group::getPath ( ) const

Return path of Group object, not including its name.

See also
getName(), getPathName()

◆ getPathName()

std::string axom::sidre::Group::getPathName ( ) const
inline

Return full path of Group object, including its name.

If a DataStore contains a Group tree structure a/b/c/d/e, the following results are expected:

Method Call Result
e->getName() e
e->getPath() a/b/c/d
e->getPathName() a/b/c/d/e
See also
getName(), getPath(), View::getPathName()

References getName(), getPath(), and getPathDelimiter().

◆ getParent() [1/2]

Group* axom::sidre::Group::getParent ( )
inline

Return pointer to non-const parent Group of a Group.

Note that if this method is called on the root Group in a DataStore, a pointer to itself is returned. This allows root->getParent()->getParent() to always work similar to how the filesystem's cd /; cd ../.. works.

◆ getParent() [2/2]

const Group* axom::sidre::Group::getParent ( ) const
inline

Return pointer to const parent Group of a Group.

Note that if this method is called on the root Group in a DataStore, a pointer to itself is returned. This allows root->getParent()->getParent() to always work similar to how the filesystem's cd /; cd ../.. works.

◆ getNumGroups()

IndexType axom::sidre::Group::getNumGroups ( ) const

Return number of child Groups in a Group object.

◆ getNumViews()

IndexType axom::sidre::Group::getNumViews ( ) const

Return number of Views owned by a Group object.

◆ getDataStore() [1/2]

DataStore* axom::sidre::Group::getDataStore ( )
inline

Return pointer to non-const DataStore object that owns this object.

◆ getDataStore() [2/2]

const DataStore* axom::sidre::Group::getDataStore ( ) const
inline

Return pointer to const DataStore object that owns this object.

◆ isRoot()

bool axom::sidre::Group::isRoot ( ) const
inline

Return true if this Group is the DataStore's root Group.

◆ getDataInfo()

void axom::sidre::Group::getDataInfo ( Node n,
bool  recursive = true 
) const

Insert information about data associated with Group subtree with this Group at root of tree (default 'recursive' is true), or for this Group only ('recursive' is false) in fields of given Conduit Node.

Fields in Conduit Node will be named:

  • "num_groups" : total number of Groups in subtree or single Group
  • "num_views" : total number of Views in subtree or single Group
  • "num_views_empty" : total number of Views with no associated Buffer or data (may or may not be described)
  • "num_views_buffer" : total number of Views associated with a DataStore Buffer
  • "num_views_external" : total number of Views associated with external data
  • "num_views_scalar" : total number of Views associated with single scalar data item
  • "num_views_string" : total number of Views associated with string data
  • "num_bytes_assoc_with_views" : total number of bytes associated with Views in subtree or single Group that are allocated in Buffers in the DataStore. NOTE: This may be an over-count if data for two or more Views overlaps in a shared Buffer.
  • "num_bytes_external" : total number of bytes described by external Views in Group subtree or single Group. The data may or may not be allocated. NOTE: If there are overlaps in data associated with multiple external Views, this may be an over-count.
  • "num_bytes_in_buffers" : total number of bytes allocated in Buffers referenced by Views in subtree or single Group

Numeric values associated with these fields may be accessed as type axom::IndexType, which is defined at compile-time. For example,

Group* gp = ...;

Node n; gp->getDataInfo(n); axom::IndexType num_views = n["num_views"].value(); // etc...

◆ hasView() [1/2]

bool axom::sidre::Group::hasView ( const std::string &  path) const

Return true if Group includes a descendant View with given name or path; else false.

◆ hasChildView()

bool axom::sidre::Group::hasChildView ( const std::string &  name) const

Return true if this Group owns a View with given name (not path); else false.

This will always return false if this Group holds items using the list format, which does not use string names to identify child items.

◆ hasView() [2/2]

bool axom::sidre::Group::hasView ( IndexType  idx) const

Return true if this Group owns a View with given index; else false.

◆ getViewIndex()

IndexType axom::sidre::Group::getViewIndex ( const std::string &  name) const

Return index of View with given name owned by this Group object.

   If no such View exists, return sidre::InvalidIndex;

◆ getViewName()

const std::string& axom::sidre::Group::getViewName ( IndexType  idx) const

Return name of View with given index owned by Group object.

   If no such View exists, return sidre::InvalidName.

◆ getView() [1/4]

View* axom::sidre::Group::getView ( const std::string &  path)

Return pointer to non-const View with given name or path.

This method requires that all groups in the path exist if a path is given.

If no such View exists, nullptr is returned.

◆ getView() [2/4]

const View* axom::sidre::Group::getView ( const std::string &  path) const

Return pointer to const View with given name or path.

This method requires that all Groups in the path exist if a path is given.

If no such View exists, nullptr is returned.

◆ getView() [3/4]

View* axom::sidre::Group::getView ( IndexType  idx)

Return pointer to non-const View with given index.

If no such View exists, nullptr is returned.

◆ getView() [4/4]

const View* axom::sidre::Group::getView ( IndexType  idx) const

Return pointer to const View with given index.

If no such View exists, nullptr is returned.

◆ getFirstValidViewIndex()

IndexType axom::sidre::Group::getFirstValidViewIndex ( ) const

Return first valid View index in Group object (i.e., smallest index over all Views).

sidre::InvalidIndex is returned if Group has no Views.

See also
sidre::IndexType
sidre::indexIsValid()

◆ getNextValidViewIndex()

IndexType axom::sidre::Group::getNextValidViewIndex ( IndexType  idx) const

Return next valid View index in Group object after given index (i.e., smallest index over all View indices larger than given one).

sidre::InvalidIndex is returned if there is no valid index greater than given one.

See also
sidre::IndexType
sidre::indexIsValid()

◆ createView() [1/9]

View* axom::sidre::Group::createView ( const std::string &  path)

Create an undescribed (i.e., empty) View object with given name or path in this Group.

If path is an empty string, an unnamed view can be created only if this Group was created to hold items in a list format. Otherwise an empty string will result in a nullptr being returned.

Returns
pointer to new View object or nullptr if one is not created.

◆ createView() [2/9]

View* axom::sidre::Group::createView ( const std::string &  path,
TypeID  type,
IndexType  num_elems 
)

Create View object with given name or path in this Group that has a data description with data type and number of elements.

If given data type is undefined, or given number of elements is < 0, method is a no-op.

Returns
pointer to new View object or nullptr if one is not created.

◆ createViewWithShape() [1/3]

View* axom::sidre::Group::createViewWithShape ( const std::string &  path,
TypeID  type,
int  ndims,
const IndexType shape 
)

Create View object with given name or path in this Group that has a data description with data type and shape.

If given data type is undefined, or given number of dimensions is < 0, or given shape ptr is null, method is a no-op.

Returns
pointer to new View object or nullptr if one is not created.

◆ createView() [3/9]

View* axom::sidre::Group::createView ( const std::string &  path,
const DataType dtype 
)

Create View object with given name or path in this Group that is described by a Conduit DataType object.

Returns
pointer to new View object or nullptr if one is not created.

◆ createView() [4/9]

View* axom::sidre::Group::createView ( const std::string &  path,
Buffer buff 
)

Create an undescribed View object with given name or path in this Group and attach given Buffer to it.

Attention
The View cannot be used to access data in Buffer until it is described by calling a View::apply() method.

This method is equivalent to: group->createView(name)->attachBuffer(buff).

Returns
pointer to new View object or nullptr if one is not created.
See also
View::attachBuffer()

◆ createView() [5/9]

View* axom::sidre::Group::createView ( const std::string &  path,
TypeID  type,
IndexType  num_elems,
Buffer buff 
)

Create View object with given name or path in this Group that has a data description with data type and number of elements and attach given Buffer to it.

If given data type is undefined, or given number of elements is < 0, method is a no-op.

This method is equivalent to: group->createView(name, type, num_elems)->attachBuffer(buff), or group->createView(name)->attachBuffer(buff)->apply(type, num_elems).

Returns
pointer to new View object or nullptr if one is not created.
See also
View::attachBuffer()

◆ createViewWithShape() [2/3]

View* axom::sidre::Group::createViewWithShape ( const std::string &  path,
TypeID  type,
int  ndims,
const IndexType shape,
Buffer buff 
)

Create View object with given name or path in this Group that has a data description with data type and shape and attach given Buffer to it.

If given data type is undefined, or given number of dimensions is < 0, or given shape ptr is null, method is a no-op.

This method is equivalent to: group->createView(name, type, ndims, shape)->attachBuffer(buff), or group->createView(name)->attachBuffer(buff)->apply(type, ndims, shape).

Returns
pointer to new View object or nullptr if one is not created.
See also
View::attachBuffer()

◆ createView() [6/9]

View* axom::sidre::Group::createView ( const std::string &  path,
const DataType dtype,
Buffer buff 
)

Create View object with given name or path in this Group that is described by a Conduit DataType object and attach given Buffer to it.

This method is equivalent to: group->createView(name, dtype)->attachBuffer(buff), or group->createView(name)->attachBuffer(buff)->apply(dtype).

Returns
pointer to new View object or nullptr if one is not created.
See also
View::attachBuffer()

◆ createView() [7/9]

View* axom::sidre::Group::createView ( const std::string &  path,
void *  external_ptr 
)

Create View object with given name with given name or path in this Group and attach external data ptr to it.

Attention
Note that the View is "opaque" (it has no knowledge of the type or structure of the data) until a View::apply() method is called.

This method is equivalent to: group->createView(name)->setExternalDataPtr(external_ptr).

Returns
pointer to new View object or nullptr if one is not created.
See also
View::setExternalDataPtr()

◆ createView() [8/9]

View* axom::sidre::Group::createView ( const std::string &  path,
TypeID  type,
IndexType  num_elems,
void *  external_ptr 
)

Create View object with given name or path in this Group that has a data description with data type and number of elements and attach externally-owned data to it.

If given data type is undefined, or given number of elements is < 0, method is a no-op.

This method is equivalent to: group->createView(name, type, num_elems)->setExternalDataPtr(external_ptr), or group->createView(name)->setExternalDataPtr(external_ptr)-> apply(type, num_elems).

Returns
pointer to new View object or nullptr if one is not created.
See also
View::setExternalDataPtr()

◆ createViewWithShape() [3/3]

View* axom::sidre::Group::createViewWithShape ( const std::string &  path,
TypeID  type,
int  ndims,
const IndexType shape,
void *  external_ptr 
)

Create View object with given name or path in this Group that has a data description with data type and shape and attach externally-owned data to it.

If given data type is undefined, or given number of dimensions is < 0, or given shape ptr is null, method is a no-op.

This method is equivalent to: group->createView(name, type, ndims, shape)-> setExternalDataPtr(external_ptr), or group->createView(name)->setExternalDataPtr(external_ptr)-> apply(type, ndims, shape).

Returns
pointer to new View object or nullptr if one is not created.
See also
View::setExternalDataPtr()

◆ createView() [9/9]

View* axom::sidre::Group::createView ( const std::string &  path,
const DataType dtype,
void *  external_ptr 
)

Create View object with given name or path in this Group that is described by a Conduit DataType object and attach externally-owned data to it.

This method is equivalent to: group->createView(name, dtype)->setExternalDataPtr(external_ptr), or group->createView(name)->setExternalDataPtr(external_ptr)->apply(dtype).

Returns
pointer to new View object or nullptr if one is not created.
See also
View::attachBuffer()

◆ createViewAndAllocate() [1/2]

View* axom::sidre::Group::createViewAndAllocate ( const std::string &  path,
TypeID  type,
IndexType  num_elems,
int  allocID = INVALID_ALLOCATOR_ID 
)

Create View object with given name or path in this Group that has a data description with data type and number of elements and allocate data for it.

If given data type is undefined, or given number of elements is < 0, method is a no-op.

This is equivalent to: createView(name)->allocate(type, num_elems), or createView(name, type, num_elems)->allocate()

Returns
pointer to new View object or nullptr if one is not created.
See also
View::allocate()

◆ createViewWithShapeAndAllocate()

View* axom::sidre::Group::createViewWithShapeAndAllocate ( const std::string &  path,
TypeID  type,
int  ndims,
const IndexType shape,
int  allocID = INVALID_ALLOCATOR_ID 
)

Create View object with given name or path in this Group that has a data description with data type and shape and allocate data for it.

If given data type is undefined, or given number of dimensions is < 0, or given shape ptr is null, method is a no-op.

This method is equivalent to: group->createView(name)->allocate(type, ndims, shape), or createView(name, type, ndims, shape)->allocate().

Returns
pointer to new View object or nullptr if one is not created.
See also
View::allocate()

◆ createViewAndAllocate() [2/2]

View* axom::sidre::Group::createViewAndAllocate ( const std::string &  path,
const DataType dtype,
int  allocID = INVALID_ALLOCATOR_ID 
)

Create View object with given name or path in this Group that is described by a Conduit DataType object and allocate data for it.

This method is equivalent to: group->createView(name)->allocate(dtype), or group->createView(name, dtype)->allocate().

If given data type object is empty, data will not be allocated.

Returns
pointer to new View object or nullptr if one is not created.
See also
View::allocate()

◆ createViewScalar()

template<typename ScalarType >
View* axom::sidre::Group::createViewScalar ( const std::string &  path,
ScalarType  value 
)
inline

Create View object with given name or path in this Group set its data to given scalar value.

This is equivalent to: createView(name)->setScalar(value);

If given data type object is empty, data will not be allocated.

Returns
pointer to new View object or nullptr if one is not created.
See also
View::setScalar()

References createView(), and axom::sidre::View::setScalar().

◆ createViewString()

View* axom::sidre::Group::createViewString ( const std::string &  path,
const std::string &  value 
)

Create View object with given name or path in this Group set its data to given string.

This is equivalent to: createView(name)->setString(value);

If given data type object is empty, data will not be allocated.

Returns
pointer to new View object or nullptr if one is not created.
See also
View::setString()

◆ destroyView() [1/2]

void axom::sidre::Group::destroyView ( const std::string &  path)

Destroy View with given name or path owned by this Group, but leave its data intect.

◆ destroyView() [2/2]

void axom::sidre::Group::destroyView ( IndexType  idx)

Destroy View with given index owned by this Group, but leave its data intect.

◆ destroyViews()

void axom::sidre::Group::destroyViews ( )

Destroy all Views owned by this Group, but leave all their data intact.

◆ destroyViewAndData() [1/2]

void axom::sidre::Group::destroyViewAndData ( const std::string &  path)

Destroy View with given name or path owned by this Group and deallocate its data if it's the only View associated with that data.

◆ destroyViewAndData() [2/2]

void axom::sidre::Group::destroyViewAndData ( IndexType  idx)

Destroy View with given index owned by this Group and deallocate its data if it's the only View associated with that data.

◆ destroyViewsAndData()

void axom::sidre::Group::destroyViewsAndData ( )

Destroy all Views owned by this Group and deallocate data for each View when it's the only View associated with that data.

◆ moveView()

View* axom::sidre::Group::moveView ( View view)

Remove given View object from its owning Group and move it to this Group.

If given View pointer is null or Group already has a View with same name as given View, method is a no-op.

Returns
pointer to given argument View object or nullptr if View is not moved into this Group.

◆ copyView()

View* axom::sidre::Group::copyView ( View view)

Create a (shallow) copy of given View object and add it to this Group.

Note that View copying is a "shallow" copy; the data associated with the View is not copied. The new View object is associated with the same data as the original.

If given View pointer is null or Group already has a View with same name as given View, method is a no-op.

See also
deepCopyView
Returns
pointer to the new copied View object or nullptr if a View is not successfully copied into this Group.

◆ deepCopyView()

View* axom::sidre::Group::deepCopyView ( View view,
int  allocID = INVALID_ALLOCATOR_ID 
)

Create a deep copy of given View object and add it to this Group.

Note that for Views that use sidre Buffers or external data, the deep copy performs a copy of the data described by the View into a new Buffer attached to the destination View. If the source View describes only part of a Buffer or part of an external array, due to strides and or offsets into the data, only the values seen by the description will be copied into the new View. The new View will have a Buffer that is the exact size of the number of values that are copied, with an offset of zero and a stride of one.

If given View pointer is null or Group already has a View with same name as given View, method is a no-op.

Returns
pointer to the new copied View object or nullptr if a View is not copied into this Group.

◆ hasGroup() [1/2]

bool axom::sidre::Group::hasGroup ( const std::string &  path) const

Return true if this Group has a descendant Group with given name or path; else false.

◆ hasChildGroup()

bool axom::sidre::Group::hasChildGroup ( const std::string &  name) const

Return true if this Group has a child Group with given name; else false.

This will always return false if this Group holds items using the list format, which does not use string names to identify child items.

◆ hasGroup() [2/2]

bool axom::sidre::Group::hasGroup ( IndexType  idx) const

Return true if Group has an immediate child Group with given index; else false.

◆ getGroupIndex()

IndexType axom::sidre::Group::getGroupIndex ( const std::string &  name) const

Return the index of immediate child Group with given name.

   If no such child Group exists, return sidre::InvalidIndex;

◆ getGroupName()

const std::string& axom::sidre::Group::getGroupName ( IndexType  idx) const

Return the name of immediate child Group with given index.

   If no such child Group exists, return sidre::InvalidName.

◆ getGroup() [1/4]

Group* axom::sidre::Group::getGroup ( const std::string &  path)

Return pointer to non-const child Group with given name or path.

This method requires that all Groups in the path exist if a path is given.

If no such Group exists, nullptr is returned.

◆ getGroup() [2/4]

Group const* axom::sidre::Group::getGroup ( const std::string &  path) const

Return pointer to const child Group with given name or path.

This method requires that all Groups in the path exist if a path is given.

If no such Group exists, nullptr is returned.

◆ getGroup() [3/4]

Group* axom::sidre::Group::getGroup ( IndexType  idx)

Return pointer to non-const immediate child Group with given index.

If no such Group exists, nullptr is returned.

◆ getGroup() [4/4]

const Group* axom::sidre::Group::getGroup ( IndexType  idx) const

Return pointer to const immediate child Group with given index.

If no such Group exists, nullptr is returned.

◆ views() [1/2]

ViewCollection::iterator_adaptor axom::sidre::Group::views ( )

Returns an adaptor to support iterating the collection of views.

◆ views() [2/2]

ViewCollection::const_iterator_adaptor axom::sidre::Group::views ( ) const

Returns a const adaptor to support iterating the collection of views.

◆ groups() [1/2]

GroupCollection::iterator_adaptor axom::sidre::Group::groups ( )

Returns an adaptor to support iterating the collection of groups.

◆ groups() [2/2]

GroupCollection::const_iterator_adaptor axom::sidre::Group::groups ( ) const

Returns a const adaptor to support iterating the collection of groups.

◆ getFirstValidGroupIndex()

IndexType axom::sidre::Group::getFirstValidGroupIndex ( ) const

Return first valid child Group index (i.e., smallest index over all child Groups).

sidre::InvalidIndex is returned if Group has no child Groups.

See also
axom::sidre::indexIsValid()

◆ getNextValidGroupIndex()

IndexType axom::sidre::Group::getNextValidGroupIndex ( IndexType  idx) const

Return next valid child Group index after given index (i.e., smallest index over all child Group indices larger than given one).

sidre::InvalidIndex is returned if there is no valid index greater than given one.

See also
axom::sidre::indexIsValid()

◆ createGroup()

Group* axom::sidre::Group::createGroup ( const std::string &  path,
bool  is_list = false 
)

Create a child Group within this Group with given name or path.

If name is an empty string or Group already has a child Group with given name or path, method is a no-op.

The optional is_list argument is used to determine if the created child Group will hold items in list format.

Returns
pointer to created Group object or nullptr if new Group is not created.

◆ createUnnamedGroup()

Group* axom::sidre::Group::createUnnamedGroup ( bool  is_list = false)

◆ destroyGroup() [1/2]

void axom::sidre::Group::destroyGroup ( const std::string &  path)

Destroy child Group in this Group with given name or path.

If no such Group exists, method is a no-op.

◆ destroyGroup() [2/2]

void axom::sidre::Group::destroyGroup ( IndexType  idx)

Destroy child Group within this Group with given index.

If no such Group exists, method is a no-op.

◆ destroyGroupAndData() [1/2]

void axom::sidre::Group::destroyGroupAndData ( const std::string &  path)

Destroy child Group at the given path, and destroy data that is not shared elsewhere.

If a View in the subtree under the destroyed Group is the last View attached to a Buffer, the Buffer and its data will also be destroyed. Buffer data will not be destroyed if there are other Views associated with the Buffer.

If no Group exists at the given path, method is a no-op.

◆ destroyGroupAndData() [2/2]

void axom::sidre::Group::destroyGroupAndData ( IndexType  idx)

Destroy child Group with the given index, and destroy data that is not shared elsewhere.

If a View in the subtree under the destroyed Group is the last View attached to a Buffer, the Buffer and its data will also be destroyed. Buffer data will not be destroyed if there are other Views associated with the Buffer.

If no Group exists with the given index, method is a no-op.

◆ destroyGroupsAndData()

void axom::sidre::Group::destroyGroupsAndData ( )

Destroy all child Groups held by this Group, and destroy data that is not shared elsewhere.

If a View in a subtree under any of the destroyed Groups is the last View attached to a Buffer, the Buffer and its data will also be destroyed. Buffer data will not be destroyed if there are other Views associated with the Buffer.

◆ destroyGroupSubtreeAndData()

void axom::sidre::Group::destroyGroupSubtreeAndData ( )

Destroy the entire subtree of Groups and Views held by this Group, and destroy data that is not shared elsewhere.

If a View in the subtree being destroyed is the last View attached to a Buffer, the Buffer and its data will also be destroyed. Buffer data will not be destroyed if there are other Views associated with the Buffer.

◆ destroyGroups()

void axom::sidre::Group::destroyGroups ( )

Destroy all child Groups in this Group.

Note that this will recursively destroy entire Group sub-tree below this Group.

◆ moveGroup()

Group* axom::sidre::Group::moveGroup ( Group group)

Remove given Group object from its parent Group and make it a child of this Group.

If given Group pointer is null or Group already has a child Group with same name as given Group, method is a no-op.

Returns
pointer to given argument Group object or nullptr if Group is not moved into this Group.

◆ copyGroup()

Group* axom::sidre::Group::copyGroup ( Group group)

Create a (shallow) copy of Group hierarchy rooted at given Group and make it a child of this Group.

Note that all Views in the Group hierarchy are copied as well.

Note that Group copying is a "shallow" copy; the data associated with Views in a Group are not copied. In particular, the new Group hierarchy and all its Views is associated with the same data as the given Group.

If given Group pointer is null or Group already has a child Group with same name as given Group, method is a no-op.

See also
deepCopyGroup
Returns
pointer to the new copied Group object or nullptr if a Group is not copied into this Group.

◆ deepCopyGroup()

Group* axom::sidre::Group::deepCopyGroup ( Group group,
int  allocID = INVALID_ALLOCATOR_ID 
)

Create a deep copy of Group hierarchy rooted at given Group and make it a child of this Group.

Note that all Views in the Group hierarchy are deep copied as well.

The deep copy of the Group creates a duplicate of the entire Group hierarchy and performs a deep copy of the data described by the Views in the hierarchy.

The Views in the new Group hierarchy will each allocate and use new Buffers to hold their copied data. Each Buffer will be sized to receive only the data values seen by the description of the original View and will have zero offset and a strid of one.

If given Group pointer is null or Group already has a child Group with same name as given Group, method is a no-op.

See also
deepCopyGroup
Returns
pointer to the new copied Group object or nullptr if a Group is not copied into this Group.

◆ print() [1/2]

void axom::sidre::Group::print ( ) const

Print JSON description of data Group to stdout.

Note that this will recursively print entire Group sub-tree starting at this Group object.

◆ print() [2/2]

void axom::sidre::Group::print ( std::ostream &  os) const

Print JSON description of data Group to an ostream.

Note that this will recursively print entire Group sub-tree starting at this Group object.

◆ printTree()

void axom::sidre::Group::printTree ( const int  nlevels,
std::ostream &  os 
) const

Print given number of levels of Group sub-tree starting at this Group object to an output stream.

◆ copyToConduitNode()

void axom::sidre::Group::copyToConduitNode ( Node n) const

Copy description of Group hierarchy rooted at this Group to given Conduit node.

The description includes Views of this Group and all of its children recursively.

◆ createNativeLayout()

bool axom::sidre::Group::createNativeLayout ( Node n,
const Attribute attr = nullptr 
) const

Copy Group's native layout to given Conduit node.

The native layout is a Conduit Node hierarchy that maps the Conduit Node data externally to the Sidre View data so that it can be filled in from the data in the file (independent of file format) and can be accessed as a Conduit tree.

Returns
True if the Group or any of its children were added to the Node, false otherwise.

◆ createNoDataLayout()

void axom::sidre::Group::createNoDataLayout ( Node n,
const Attribute attr = nullptr 
) const

Copy Group's layout to given Conduit node without data.

This method copies only a metadata version of the Group's hierarchical layout to a Conduit Node. All of the Groups and Views in the hierarchy will be represented, but the actual data held by the Views will not be present. For every View, the Conduit schema describing its datatype will be copied but not the data. This is intended to provide an object that can be sent to a readable output format where the overall layout of the hierarchy can be seen without sending large arrays or other data to the output.

◆ createExternalLayout()

bool axom::sidre::Group::createExternalLayout ( Node n,
const Attribute attr = nullptr 
) const

Copy data Group external layout to given Conduit node.

The external layout is a Conduit Node hierarchy that maps the Conduit Node data externally to the Sidre View data so that it can be filled in from the data in the file (independent of file format) and can be accessed as a Conduit tree.

Only the Views which have external data are added to the node.

Returns
True if the Group or any of its children have an external View, false otherwise.

◆ isEquivalentTo()

bool axom::sidre::Group::isEquivalentTo ( const Group other,
bool  checkName = true 
) const

Return true if this Group is equivalent to given Group; else false.

Two Groups are equivalent if they are the root Groups of identical Group hierarchy structures with the same names for all Views and Groups in the hierarchy, and the Views are also equivalent.

Parameters
otherThe group to compare with
checkNameIf true (default), groups must have the same name to be equivalent. If false, disregard the name.
See also
View::isEquivalentTo()

◆ isUsingMap()

bool axom::sidre::Group::isUsingMap ( ) const
inline

Return true if this Group holds items in map format.

◆ isUsingList()

bool axom::sidre::Group::isUsingList ( ) const
inline

Return true if this Group holds items in list format.

◆ save()

bool axom::sidre::Group::save ( const std::string &  path,
const std::string &  protocol = Group::getDefaultIOProtocol(),
const Attribute attr = nullptr 
) const

Save the Group to a file.

Saves the tree starting at this Group and the Buffers used by the Views in this tree. Returns true (success) if no Conduit I/O error occurred since this Group's DataStore was created or had its error flag cleared; false, if an error occurred at some point.

If attr is a null pointer, dump all Views. Otherwise, only dump Views which have the Attribute set.

Parameters
pathfile path
protocolI/O protocol
attrSave Views that have Attribute set.
Returns
True if no error occurred, otherwise false.

◆ load() [1/2]

bool axom::sidre::Group::load ( const std::string &  path,
const std::string &  protocol = Group::getDefaultIOProtocol(),
bool  preserve_contents = false 
)

Load a Group hierarchy from a file into this Group.

This method instantiates the Group hierarchy and its Views stored in the file under this Group. The name of this Group is not changed.

If preserve_contents is true, then the names of the children held by the Node cannot be the same as the names of the children already held by this Group. If there is a naming conflict, an error will occur. Returns true (success) if no Conduit I/O error occurred since this Group's DataStore was created or had its error flag cleared; false, if an error occurred at some point.

Parameters
pathfile path
protocolI/O protocol
preserve_contentsIf true, any child Groups and Views held by this Group remain in place. If false, all child Groups and Views are destroyed before loading data from the file.
Returns
True if no error occurred, otherwise false.

◆ load() [2/2]

bool axom::sidre::Group::load ( const std::string &  path,
const std::string &  protocol,
bool  preserve_contents,
std::string &  name_from_file 
)

Load a Group hierarchy from a file into this Group, reporting the Group name stored in the file.

This method instantiates the Group hierarchy and its Views stored in the file under this Group. The name of this Group is not changed. The name of the group stored in the file is returned in the output parameter name_from_file. This can be used to rename the group in a subsequent call.

If preserve_contents is true, then the names of the children held by the Node cannot be the same as the names of the children already held by this Group. If there is a naming conflict, an error will occur. Returns true (success) if no Conduit I/O error occurred since this Group's DataStore was created or had its error flag cleared; false, if an error occurred at some point.

Parameters
[in]pathfile path to load
[in]protocolI/O protocol to use
[in]preserve_contentsIf true, any child Groups and Views held by this Group remain in place. If false, all child Groups and Views are destroyed before loading data from the file.
[out]name_from_fileGroup name stored in the file
Returns
True if no error occurred, otherwise false.

◆ createGroupAndLoad()

Group* axom::sidre::Group::createGroupAndLoad ( std::string &  group_name,
const std::string &  path,
const std::string &  protocol,
bool &  load_success 
)

Create a child Group and load a Group hierarchy from file into the new Group.

This is a convenience routine for the following sequence:

  • create a group with name or path group_name
  • load a Group hierarchy from a file into the newly-created Group
  • return the newly created Group, or nullptr if creation failed
  • out-parameters return:
    • the group name from the file
    • a flag indicating success reading the file

As with the createGroup() method, if group_name is empty or there already exists a child Group with that name or path, the child Group will not be created and this method will return nullptr.

As with the load() method, after calling createGroupAndLoad() a host code may choose to rename the newly-created Group with the string returned in group_name.

Parameters
[in,out]group_nameIn: name for the new group. Out: the group name stored in the file.
[in]pathfile path
[in]protocolI/O protocol
[out]load_successReport success of the load operation
Returns
pointer to created Group object or nullptr if new Group is not created.

◆ loadExternalData()

bool axom::sidre::Group::loadExternalData ( const std::string &  path)

Load data into the Group's external views from a file.

No protocol argument is needed, as this only is used with the sidre_hdf5 protocol.

Parameters
pathfile path
Returns
True if Axom was compiled with HDF5 and no error occurred in this method; otherwise false.

◆ rename()

bool axom::sidre::Group::rename ( const std::string &  new_name)

Change the name of this Group.

The name of this group is changed to the new name. If this group has a parent group, the name for this group held by the parent is also changed.

Warnings will occur and the name will not be changed under these conditions: If the new name is an empty string, if the new name contains a path delimiter (usually '/'), or if the new name is identical to a name that is already held by the parent for another Group or View object.

It is possible to rename the root Group, but a code cannot subsequently rename root Group back to its original empty string name.

Parameters
new_nameThe new name for this group.
Returns
Success or failure of rename.

◆ importConduitTree()

bool axom::sidre::Group::importConduitTree ( const conduit::Node &  node,
bool  preserve_contents = false 
)

Import data from a conduit Node into a Group.

This imports the hierarchy from the Node into a Sidre Group with the same tree structure.

If preserve_contents is true, then the names of the children held by the Node cannot be the same as the names of the children already held by this Group. If there is a naming conflict, an error will occur.

Parameters
nodeA conduit Node containing hierarchical data.
preserve_contentsIf true, any child Groups and Views held by this Group remain in place. If false, all child Groups and Views are destroyed before importing data from the Node.
Returns
true for success, false if the full conduit tree is not succesfully imported.

◆ importConduitTreeExternal()

bool axom::sidre::Group::importConduitTreeExternal ( conduit::Node &  node,
bool  preserve_contents = false 
)

Import data from a conduit Node into a Group without copying arrays.

This differs from the importConduitTree in that it does not copy any data held by the Node as an array. Instead it imports the existing pointer to the array as an external pointer.

This imports the hierarchy from the Node into a Sidre Group with the same tree structure.

If preserve_contents is true, then the names of the children held by the Node cannot be the same as the names of the children already held by this Group. If there is a naming conflict, an error will occur.

Parameters
nodeA conduit Node containing hierarchical data.
preserve_contentsIf true, any child Groups and Views held by this Group remain in place. If false, all child Groups and Views are destroyed before importing data from the Node.
Returns
true for success, false if the full conduit tree is not succesfully imported.

Friends And Related Function Documentation

◆ DataStore

friend class DataStore
friend

◆ View

friend class View
friend

The documentation for this class was generated from the following file: