2015-05-11 20:54:16 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.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.
|
|
|
|
//
|
|
|
|
// Copyright 2015 Sandia Corporation.
|
|
|
|
// Copyright 2015 UT-Battelle, LLC.
|
|
|
|
// Copyright 2015 Los Alamos National Security.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
|
|
|
// the U.S. Government retains certain rights in this software.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
|
|
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
|
|
|
// this software.
|
|
|
|
//============================================================================
|
2015-01-28 16:27:15 +00:00
|
|
|
#ifndef vtk_m_cont_DataSet_h
|
|
|
|
#define vtk_m_cont_DataSet_h
|
2015-01-27 21:22:21 +00:00
|
|
|
|
2015-02-09 22:04:09 +00:00
|
|
|
#include <vtkm/CellType.h>
|
2015-01-27 21:22:21 +00:00
|
|
|
#include <vtkm/cont/ArrayHandle.h>
|
2015-02-10 17:36:10 +00:00
|
|
|
#include <vtkm/cont/Field.h>
|
2015-01-27 21:22:21 +00:00
|
|
|
#include <vtkm/cont/DynamicArrayHandle.h>
|
2015-02-10 17:36:10 +00:00
|
|
|
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
2015-04-15 14:45:39 +00:00
|
|
|
#include <vtkm/cont/ExplicitConnectivity.h>
|
2015-05-15 19:29:55 +00:00
|
|
|
#include <vtkm/RegularConnectivity.h>
|
2015-04-15 16:43:12 +00:00
|
|
|
#include <vtkm/cont/CellSet.h>
|
|
|
|
#include <vtkm/cont/CellSetExplicit.h>
|
|
|
|
#include <vtkm/cont/CellSetStructured.h>
|
2015-05-20 16:46:00 +00:00
|
|
|
#include <vtkm/cont/CoordinateSystem.h>
|
2015-05-20 15:46:04 +00:00
|
|
|
#include <vtkm/cont/ErrorControlBadValue.h>
|
2015-01-27 21:22:21 +00:00
|
|
|
|
2015-05-28 19:30:13 +00:00
|
|
|
#include <boost/smart_ptr/shared_ptr.hpp>
|
|
|
|
|
2015-01-27 21:22:21 +00:00
|
|
|
namespace vtkm {
|
|
|
|
namespace cont {
|
2015-02-02 21:44:24 +00:00
|
|
|
|
2015-04-15 16:33:27 +00:00
|
|
|
class CellSet;
|
|
|
|
|
2015-01-28 16:27:15 +00:00
|
|
|
class DataSet
|
2015-01-27 21:22:21 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-05-19 20:49:17 +00:00
|
|
|
DataSet()
|
2015-02-10 17:36:10 +00:00
|
|
|
{
|
2015-05-19 20:49:17 +00:00
|
|
|
}
|
2015-05-19 20:21:15 +00:00
|
|
|
|
2015-05-19 20:49:17 +00:00
|
|
|
void AddField(Field f)
|
|
|
|
{
|
2015-05-19 20:21:15 +00:00
|
|
|
Fields.push_back(f);
|
2015-02-10 17:36:10 +00:00
|
|
|
}
|
2015-05-19 20:49:17 +00:00
|
|
|
|
2015-02-10 17:36:10 +00:00
|
|
|
vtkm::cont::Field &GetField(int index)
|
|
|
|
{
|
2015-05-20 15:46:04 +00:00
|
|
|
VTKM_ASSERT_CONT(index >= 0 && index <= int(Fields.size()));
|
2015-02-10 17:36:10 +00:00
|
|
|
return Fields[index];
|
|
|
|
}
|
|
|
|
|
2015-05-20 15:46:04 +00:00
|
|
|
vtkm::cont::Field &GetField(const std::string &n)
|
|
|
|
{
|
|
|
|
for (unsigned int i=0; i<Fields.size(); ++i)
|
|
|
|
{
|
|
|
|
if (Fields[i].GetName() == n)
|
|
|
|
return Fields[i];
|
|
|
|
}
|
|
|
|
throw vtkm::cont::ErrorControlBadValue("No field with requested name");
|
|
|
|
}
|
|
|
|
|
2015-05-28 19:30:13 +00:00
|
|
|
boost::shared_ptr<vtkm::cont::CellSet> GetCellSet(int index=0)
|
2015-04-15 17:01:00 +00:00
|
|
|
{
|
2015-05-20 15:46:04 +00:00
|
|
|
VTKM_ASSERT_CONT(index >= 0 && index <= int(CellSets.size()));
|
2015-04-15 17:01:00 +00:00
|
|
|
return CellSets[index];
|
|
|
|
}
|
2015-04-15 16:33:27 +00:00
|
|
|
|
2015-05-20 16:46:00 +00:00
|
|
|
void AddCoordinateSystem(vtkm::cont::CoordinateSystem cs)
|
|
|
|
{
|
|
|
|
CoordSystems.push_back(cs);
|
|
|
|
}
|
|
|
|
|
2015-05-28 19:30:13 +00:00
|
|
|
void AddCellSet(boost::shared_ptr<vtkm::cont::CellSet> cs)
|
2015-04-15 17:01:00 +00:00
|
|
|
{
|
|
|
|
CellSets.push_back(cs);
|
|
|
|
}
|
2015-02-10 17:36:10 +00:00
|
|
|
|
2015-05-12 18:57:32 +00:00
|
|
|
vtkm::Id GetNumberOfCellSets()
|
|
|
|
{
|
|
|
|
return static_cast<vtkm::Id>(this->CellSets.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
vtkm::Id GetNumberOfFields()
|
|
|
|
{
|
|
|
|
return static_cast<vtkm::Id>(this->Fields.size());
|
|
|
|
}
|
|
|
|
|
2015-05-20 19:26:10 +00:00
|
|
|
void PrintSummary(std::ostream &out)
|
|
|
|
{
|
|
|
|
out<<"DataSet:\n";
|
|
|
|
out<<" CoordSystems["<<CoordSystems.size()<<"]\n";
|
|
|
|
for (vtkm::Id i = 0; i < CoordSystems.size(); i++)
|
|
|
|
CoordSystems[i].PrintSummary(out);
|
|
|
|
out<<" CellSets["<<GetNumberOfCellSets()<<"]\n";
|
|
|
|
for (vtkm::Id i = 0; i < GetNumberOfCellSets(); i++)
|
|
|
|
GetCellSet(i)->PrintSummary(out);
|
|
|
|
out<<" Fields["<<GetNumberOfFields()<<"]\n";
|
|
|
|
for (vtkm::Id i = 0; i < GetNumberOfFields(); i++)
|
|
|
|
GetField(i).PrintSummary(out);
|
|
|
|
}
|
|
|
|
|
2015-02-10 17:36:10 +00:00
|
|
|
private:
|
2015-05-20 16:46:00 +00:00
|
|
|
std::vector<vtkm::cont::CoordinateSystem> CoordSystems;
|
2015-02-10 17:36:10 +00:00
|
|
|
std::vector<vtkm::cont::Field> Fields;
|
2015-05-28 19:30:13 +00:00
|
|
|
std::vector< boost::shared_ptr<vtkm::cont::CellSet> > CellSets;
|
2015-01-27 21:22:21 +00:00
|
|
|
};
|
|
|
|
|
2015-05-11 20:54:16 +00:00
|
|
|
} // namespace cont
|
|
|
|
} // namespace vtkm
|
2015-01-27 21:22:21 +00:00
|
|
|
|
|
|
|
|
2015-01-28 16:27:15 +00:00
|
|
|
#endif //vtk_m_cont_DataSet_h
|