// @HEADER // ***************************************************************************** // Panzer: A partial differential equation assembly // engine for strongly coupled complex multiphysics systems // // Copyright 2011 NTESS and the Panzer contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef __Panzer_STK_ParameterListCallback_hpp__ #define __Panzer_STK_ParameterListCallback_hpp__ #include "PanzerAdaptersSTK_config.hpp" #ifdef PANZER_HAVE_TEKO #include "Teuchos_RCP.hpp" #include "Teuchos_ParameterList.hpp" #include "Teko_RequestCallback.hpp" #include "Panzer_STKConnManager.hpp" #include "Panzer_GlobalIndexer_Utilities.hpp" #include #include namespace panzer_stk { class STKConnManager; /** Implements an interface used by the Teko request handler mechanism. * This particular class is usesd most frequently with an ML preconditioner that * requres the nodal coordinates for repartitioning. */ class ParameterListCallback : public Teko::RequestCallback > { public: ParameterListCallback(const std::string & coordFieldName, const std::map > & fp, const Teuchos::RCP & connManager, const Teuchos::RCP & ugi); Teuchos::RCP request(const Teko::RequestMesg & rm); bool handlesRequest(const Teko::RequestMesg & rm); void preRequest(const Teko::RequestMesg & rm); const std::vector & getCoordsVector(unsigned dim) const { switch(dim) { case 0: return getXCoordsVector(); case 1: return getYCoordsVector(); case 2: return getZCoordsVector(); default: TEUCHOS_ASSERT(false); } TEUCHOS_ASSERT(false); return xcoords_; // should never get here! } const std::vector & getXCoordsVector() const { return xcoords_; } const std::vector & getYCoordsVector() const { return ycoords_; } const std::vector & getZCoordsVector() const { return zcoords_; } //! Return the internally stored arraytofieldvector object. May return null if none constructed Teuchos::RCP getArrayToFieldVector() const { return arrayToVector_; } void buildCoordinates(); void buildArrayToVector(); //! Store a vector solely for the purpose of making it persist with this object void storeExtraVector(const Teuchos::RCP > & extra) { extraVecs_.push_back(extra); } private: void setFieldByKey(const std::string & key,Teuchos::ParameterList & pl) const; std::string coordFieldName_; std::map > fieldPatterns_; Teuchos::RCP connManager_; Teuchos::RCP ugi_; bool coordinatesBuilt_; std::vector xcoords_; std::vector ycoords_; std::vector zcoords_; mutable Teuchos::RCP arrayToVector_; std::vector > > extraVecs_; }; } #endif // PANZER_HAVE_TEKO #endif