// @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_ParameterListCallbackBlocked_hpp__ #define __Panzer_STK_ParameterListCallbackBlocked_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" #ifdef PANZER_HAVE_EPETRA_STACK #include "Panzer_GlobalIndexer_EpetraUtilities.hpp" #endif #include "Panzer_BlockedDOFManager.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 ParameterListCallbackBlocked : public Teko::RequestCallback > { public: ParameterListCallbackBlocked(const Teuchos::RCP & connManager, const Teuchos::RCP & blkDofs, const Teuchos::RCP & auxBlkDofs=Teuchos::null); Teuchos::RCP request(const Teko::RequestMesg & rm); bool handlesRequest(const Teko::RequestMesg & rm); void preRequest(const Teko::RequestMesg & rm); private: bool isField(const std::string& field) const { // Check both the main and auxiliary UGIs. bool useAux(true); std::vector> fieldDOFMngrs = blocked_ugi_->getFieldDOFManagers(); for (int b(0); b < static_cast(fieldDOFMngrs.size()); ++b) { for (int f(0); f < fieldDOFMngrs[b]->getNumFields(); ++f) { if (fieldDOFMngrs[b]->getFieldString(f) == field) useAux = false; } } if (useAux) return (aux_blocked_ugi_->getFieldNum(field) != -1); else return (blocked_ugi_->getFieldNum(field) != -1); } void buildArrayToVectorTpetra(int block,const std::string & field, const bool useAux = false); void buildCoordinatesTpetra(const std::string & field, const bool useAux = false); #ifdef PANZER_HAVE_EPETRA_STACK void buildArrayToVectorEpetra(int block,const std::string & field, const bool useAux = false); void buildCoordinatesEpetra(const std::string & field, const bool useAux = false); #endif // this method assumes handlesRequest(rm)==true std::string getHandledField(const Teuchos::ParameterList & pl) const; void setFieldByKey(const std::string & key,const std::string & field,Teuchos::ParameterList & pl) const; // Get the coordinate vector by field, note that it will check to make sure "buildCoordinates" has // been called. const std::vector & getCoordinateByField(int dim,const std::string & field) const; // Access the field pattern associated with this field (this will not work if the field pattern // and element blocks are different Teuchos::RCP getFieldPattern(const std::string & fieldName, const bool useAux = false) const; // Generally used members Teuchos::RCP connManager_; Teuchos::RCP blocked_ugi_; Teuchos::RCP aux_blocked_ugi_; std::map > fieldPatterns_; // look up by field name (field name to coordinates std::map > xcoords_; std::map > ycoords_; std::map > zcoords_; mutable std::map > arrayToVectorTpetra_; #ifdef PANZER_HAVE_EPETRA_STACK mutable std::map > arrayToVectorEpetra_; #endif Teuchos::RCP > coordsVecTp_; #ifdef PANZER_HAVE_EPETRA_STACK Teuchos::RCP coordsVecEp_; #endif bool returnTpetraObjects_; }; } #endif // PANZER_HAVE_TEKO #endif