• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Albany_Catalyst_Decorator.cpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2013 Kitware Inc.                     //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
00005 //*****************************************************************//
00006 
00007 #include "Albany_Catalyst_Adapter.hpp"
00008 #include "Albany_Catalyst_Decorator.hpp"
00009 #include "Albany_Catalyst_Grid.hpp"
00010 #include "Albany_Catalyst_TeuchosArrayRCPDataArray.hpp"
00011 
00012 #include <Shards_BasicTopologies.hpp>
00013 #include <Shards_CellTopology.hpp>
00014 #include <Shards_CellTopologyData.h>
00015 
00016 #include <vtkNew.h>
00017 #include <vtkPoints.h>
00018 
00019 namespace Albany {
00020 namespace Catalyst {
00021 
00022 Decorator::Decorator(
00023     Teuchos::RCP<AbstractDiscretization> discretization_,
00024     const Teuchos::RCP<Teuchos::ParameterList>& catalystParams_)
00025   : discretization(discretization_),
00026     timestep(0)
00027 {
00028   Adapter::initialize(catalystParams_);
00029 }
00030 
00031 Decorator::~Decorator()
00032 {
00033   Adapter::cleanup();
00034 }
00035 
00036 Teuchos::RCP<const Epetra_Map> Decorator::getMap() const
00037 {
00038   return discretization->getMap();
00039 }
00040 
00041 Teuchos::RCP<const Epetra_Map> Decorator::getOverlapMap() const
00042 {
00043   return discretization->getOverlapMap();
00044 }
00045 
00046 Teuchos::RCP<const Epetra_CrsGraph> Decorator::getJacobianGraph() const
00047 {
00048   return discretization->getJacobianGraph();
00049 }
00050 
00051 Teuchos::RCP<const Epetra_CrsGraph>
00052 Decorator::getOverlapJacobianGraph() const
00053 {
00054   return discretization->getOverlapJacobianGraph();
00055 }
00056 
00057 Teuchos::RCP<const Epetra_Map> Decorator::getNodeMap() const
00058 {
00059   return discretization->getNodeMap();
00060 }
00061 
00062 const NodeSetList &Decorator::getNodeSets() const
00063 {
00064   return discretization->getNodeSets();
00065 }
00066 
00067 const NodeSetCoordList &Decorator::getNodeSetCoords() const
00068 {
00069   return discretization->getNodeSetCoords();
00070 }
00071 
00072 const SideSetList &Decorator::getSideSets(const int workset) const
00073 {
00074   return discretization->getSideSets(workset);
00075 }
00076 
00077 WsLIDList &Decorator::getElemGIDws()
00078 {
00079   return discretization->getElemGIDws();
00080 }
00081 
00082 const WorksetArray<Teuchos::ArrayRCP<Teuchos::ArrayRCP<Teuchos::ArrayRCP<int> > > >::type &
00083 Decorator::getWsElNodeEqID() const
00084 {
00085   return discretization->getWsElNodeEqID();
00086 }
00087 
00088 Teuchos::ArrayRCP<double> &Decorator::getCoordinates() const
00089 {
00090   return discretization->getCoordinates();
00091 }
00092 
00093 const WorksetArray<Teuchos::ArrayRCP<Teuchos::ArrayRCP<double*> > >::type &Decorator::getCoords() const
00094 {
00095   return discretization->getCoords();
00096 }
00097 
00098 const WorksetArray<Teuchos::ArrayRCP<Teuchos::ArrayRCP<double> > >::type &Decorator::getSurfaceHeight() const
00099 {
00100   return discretization->getSurfaceHeight();
00101 }
00102 
00103 const WorksetArray<Teuchos::ArrayRCP<double> >::type &
00104 Decorator::getTemperature() const
00105 {
00106   return discretization->getTemperature();
00107 }
00108 
00109 const WorksetArray<Teuchos::ArrayRCP<Teuchos::ArrayRCP<double> > >::type &
00110 Decorator::getBasalFriction() const
00111 {
00112   return discretization->getBasalFriction();
00113 }
00114 
00115 const WorksetArray<Teuchos::ArrayRCP<Teuchos::ArrayRCP<double> > >::type &
00116 Decorator::getThickness() const
00117 {
00118   return discretization->getThickness();
00119 }
00120 
00121 void Decorator::printCoords() const
00122 {
00123   discretization->printCoords();
00124 }
00125 
00126 Teuchos::RCP<AbstractMeshStruct> Decorator::getMeshStruct() const
00127 {
00128   return discretization->getMeshStruct();
00129 }
00130 
00131 StateArrays &Decorator::getStateArrays()
00132 {
00133   return discretization->getStateArrays();
00134 }
00135 
00136 const WorksetArray<std::string>::type &Decorator::getWsEBNames() const
00137 {
00138   return discretization->getWsEBNames();
00139 }
00140 
00141 const WorksetArray<int>::type &Decorator::getWsPhysIndex() const
00142 {
00143   return discretization->getWsPhysIndex();
00144 }
00145 
00146 void Decorator::writeSolution(
00147     const Epetra_Vector &soln, const double time, const bool overlapped)
00148 {
00149   Adapter *adapter = Adapter::get();
00150   if (adapter)
00151     adapter->update(this->timestep++, time, *this, soln);
00152 
00153   discretization->writeSolution(soln, time, overlapped);
00154 }
00155 
00156 vtkUnstructuredGridBase *Decorator::newVtkUnstructuredGrid()
00157 {
00158   vtkNew<TeuchosArrayRCPDataArray<double> > coords;
00159   coords->SetArrayRCP(this->getCoordinates(), 3);
00160 
00161   vtkNew<vtkPoints> points;
00162   points->SetData(coords.GetPointer());
00163 
00164   Grid *grid = Grid::New();
00165   grid->SetPoints(points.GetPointer());
00166   grid->GetImplementation()->SetDecorator(this);
00167 
00168   return grid;
00169 }
00170 
00171 Teuchos::RCP<Epetra_Vector> Decorator::getSolutionField() const
00172 {
00173   return discretization->getSolutionField();
00174 }
00175 
00176 void Decorator::setResidualField(const Epetra_Vector &residual)
00177 {
00178   discretization->setResidualField(residual);
00179 }
00180 
00181 bool Decorator::hasRestartSolution() const
00182 {
00183   return discretization->hasRestartSolution();
00184 }
00185 
00186 bool Decorator::supportsMOR() const
00187 {
00188 // Currently, the MOR library will dynamic cast the discretication to the STK
00189 // implementation. Since this decorator cannot be cast to the STK class, the
00190 // code will crash. For now, just return false.
00191 //  return discretization->supportsMOR();
00192   return false;
00193 }
00194 
00195 double Decorator::restartDataTime() const
00196 {
00197   return discretization->restartDataTime();
00198 }
00199 
00200 int Decorator::getNumDim() const
00201 {
00202   return discretization->getNumDim();
00203 }
00204 
00205 int Decorator::getNumEq() const
00206 {
00207   return discretization->getNumEq();
00208 }
00209 
00210 } // end namespace Catalyst
00211 } // end namespace Albany

Generated on Wed Mar 26 2014 18:36:36 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1