XdmfDomain.cpp 5.39 KB
Newer Older
Kenneth Leiter's avatar
Kenneth Leiter committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*****************************************************************************/
/*                                    XDMF                                   */
/*                       eXtensible Data Model and Format                    */
/*                                                                           */
/*  Id : XdmfDomain.cpp                                                      */
/*                                                                           */
/*  Author:                                                                  */
/*     Kenneth Leiter                                                        */
/*     kenneth.leiter@arl.army.mil                                           */
/*     US Army Research Laboratory                                           */
/*     Aberdeen Proving Ground, MD                                           */
/*                                                                           */
/*     Copyright @ 2011 US Army Research Laboratory                          */
/*     All Rights Reserved                                                   */
/*     See Copyright.txt for details                                         */
/*                                                                           */
/*     This software is distributed WITHOUT ANY WARRANTY; without            */
/*     even the implied warranty of MERCHANTABILITY or FITNESS               */
/*     FOR A PARTICULAR PURPOSE.  See the above copyright notice             */
/*     for more information.                                                 */
/*                                                                           */
/*****************************************************************************/
Kenneth Leiter's avatar
Kenneth Leiter committed
23 24

#include "XdmfDomain.hpp"
25
#include "XdmfCurvilinearGrid.hpp"
26
#include "XdmfGridCollection.hpp"
27 28 29
#include "XdmfRectilinearGrid.hpp"
#include "XdmfRegularGrid.hpp"
#include "XdmfUnstructuredGrid.hpp"
Kenneth Leiter's avatar
Kenneth Leiter committed
30

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
                             XdmfGridCollection,
                             GridCollection,
                             Name)
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
                             XdmfCurvilinearGrid,
                             CurvilinearGrid,
                             Name)
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
                             XdmfRectilinearGrid,
                             RectilinearGrid,
                             Name)
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
                             XdmfRegularGrid,
                             RegularGrid,
                             Name)
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain,
                             XdmfUnstructuredGrid,
                             UnstructuredGrid,
                             Name)
51

52
shared_ptr<XdmfDomain>
53
XdmfDomain::New()
54
{
55
  shared_ptr<XdmfDomain> p(new XdmfDomain());
56
  return p;
57 58
}

Kenneth Leiter's avatar
Kenneth Leiter committed
59 60 61 62 63 64 65 66
XdmfDomain::XdmfDomain()
{
}

XdmfDomain::~XdmfDomain()
{
}

67
const std::string XdmfDomain::ItemTag = "Domain";
68

69 70
std::map<std::string, std::string>
XdmfDomain::getItemProperties() const
71
{
72 73
  std::map<std::string, std::string> domainProperties;
  return domainProperties;
74 75
}

76 77
std::string
XdmfDomain::getItemTag() const
78
{
79
  return ItemTag;
80 81
}

82 83
void
XdmfDomain::populateItem(const std::map<std::string, std::string> & itemProperties,
84
                         std::vector<shared_ptr<XdmfItem> > & childItems,
85
                         const XdmfCoreReader * const reader)
86
{
87
  XdmfItem::populateItem(itemProperties, childItems, reader);
88
  for(std::vector<shared_ptr<XdmfItem> >::const_iterator iter = 
89 90 91
        childItems.begin();
      iter != childItems.end();
      ++iter) {
92 93
    if(shared_ptr<XdmfGridCollection> gridCollection =
       shared_dynamic_cast<XdmfGridCollection>(*iter)) {
94 95
      this->insert(gridCollection);
    }
96 97
    else if(shared_ptr<XdmfCurvilinearGrid> grid =
            shared_dynamic_cast<XdmfCurvilinearGrid>(*iter)) {
98 99
      this->insert(grid);
    }
100 101
    else if(shared_ptr<XdmfRectilinearGrid> grid =
            shared_dynamic_cast<XdmfRectilinearGrid>(*iter)) {
102 103
      this->insert(grid);
    }
104 105
    else if(shared_ptr<XdmfRegularGrid> grid =
            shared_dynamic_cast<XdmfRegularGrid>(*iter)) {
106 107
      this->insert(grid);
    }
108 109
    else if(shared_ptr<XdmfUnstructuredGrid> grid =
            shared_dynamic_cast<XdmfUnstructuredGrid>(*iter)) {
110 111 112
      this->insert(grid);
    }
  }
113 114
}

115
void
116
XdmfDomain::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
117
{
118
  XdmfItem::traverse(visitor);
119 120
  for(std::vector<shared_ptr<XdmfGridCollection> >::const_iterator iter = 
        mGridCollections.begin();
121 122 123 124
      iter != mGridCollections.end();
      ++iter) {
    (*iter)->accept(visitor);
  }
125 126
  for(std::vector<shared_ptr<XdmfCurvilinearGrid> >::const_iterator iter = 
        mCurvilinearGrids.begin();
127 128 129 130
      iter != mCurvilinearGrids.end();
      ++iter) {
    (*iter)->accept(visitor);
  }
131 132
  for(std::vector<shared_ptr<XdmfRectilinearGrid> >::const_iterator iter = 
        mRectilinearGrids.begin();
133 134 135 136
      iter != mRectilinearGrids.end();
      ++iter) {
    (*iter)->accept(visitor);
  }
137 138
  for(std::vector<shared_ptr<XdmfRegularGrid> >::const_iterator iter = 
        mRegularGrids.begin();
139 140 141 142
      iter != mRegularGrids.end();
      ++iter) {
    (*iter)->accept(visitor);
  }
143 144
  for(std::vector<shared_ptr<XdmfUnstructuredGrid> >::const_iterator iter = 
        mUnstructuredGrids.begin();
145 146 147 148
      iter != mUnstructuredGrids.end();
      ++iter) {
    (*iter)->accept(visitor);
  }
149
}