Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_LinearObjFactory_Utilities.cpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
12
13#include "Teuchos_RCP.hpp"
14
16
17#include "Panzer_TpetraLinearObjFactory.hpp"
19
20#ifdef PANZER_HAVE_EPETRA_STACK
22#endif
23
24namespace panzer {
25
26Teuchos::RCP<const LinearObjFactory<panzer::Traits> > cloneWithNewDomain(const LinearObjFactory<panzer::Traits> & lof,
27 const Teuchos::RCP<const GlobalIndexer> & dUgi)
28{
29 // This just forwards on to the general case. That makes things much easier
30 return cloneWithNewRangeAndDomain(lof,Teuchos::null,dUgi);
31}
32
33Teuchos::RCP<const LinearObjFactory<panzer::Traits> > cloneWithNewRange(const LinearObjFactory<panzer::Traits> & lof,
34 const Teuchos::RCP<const GlobalIndexer> & rUgi)
35{
36 // This just forwards on to the general case. That makes things much easier
37 return cloneWithNewRangeAndDomain(lof,rUgi,Teuchos::null);
38}
39
40Teuchos::RCP<const LinearObjFactory<panzer::Traits> > cloneWithNewRangeAndDomain(
42 const Teuchos::RCP<const GlobalIndexer> & rUgi,
43 const Teuchos::RCP<const GlobalIndexer> & dUgi)
44{
45 using Teuchos::null;
46 using Teuchos::RCP;
47 using Teuchos::rcp;
48 using Teuchos::rcp_dynamic_cast;
49 using Teuchos::Ptr;
50 using Teuchos::ptr_dynamic_cast;
51 using Teuchos::ptrFromRef;
52
53/*
54 typedef GlobalIndexer<int,int> EpetraUGI;
55 typedef BlockedDOFManager BlockedEpetraUGI;
56 typedef BlockedDOFManager<int,panzer::GlobalOrdinal> BlockedTpetraUGI;
57*/
59#ifdef PANZER_HAVE_EPETRA_STACK
61#endif
63
64 // This proceeds by casting to a number of known LOF types (all explicitly instantiated)
65 // then trying to build a new one. Of course for many of these under implemented operation
66 // this fails and an error is thrown.
67
68/*
69 Ptr<const EpetraLOF> epetra_lof = ptr_dynamic_cast<const EpetraLOF>(ptrFromRef(lof));
70 if(epetra_lof!=null) {
71 RCP<const EpetraUGI> rangeUGI = rcp_dynamic_cast<const EpetraUGI>(rUgi==null ? epetra_lof->getRangeGlobalIndexer() : rUgi,true);
72 RCP<const EpetraUGI> domainUGI = rcp_dynamic_cast<const EpetraUGI>(dUgi==null ? epetra_lof->getDomainGlobalIndexer() : dUgi,true);
73 RCP<Teuchos::MpiComm<int> > mpiComm = rcp(new Teuchos::MpiComm<int>(epetra_lof->getComm()));
74 return rcp(new EpetraLOF(mpiComm,rangeUGI,domainUGI));
75 }
76*/
77
78 Ptr<const TpetraLOF> tpetra_lof = ptr_dynamic_cast<const TpetraLOF>(ptrFromRef(lof));
79 if(tpetra_lof!=null) {
80 auto rangeUGI = (rUgi==null ? tpetra_lof->getRangeGlobalIndexer() : rUgi);
81 auto domainUGI = (dUgi==null ? tpetra_lof->getDomainGlobalIndexer() : dUgi);
82 auto mpiComm = rcp(new Teuchos::MpiComm<int>(tpetra_lof->getComm()));
83
84 return rcp(new TpetraLOF(mpiComm,rangeUGI,domainUGI));
85 }
86
87#ifdef PANZER_HAVE_EPETRA_STACK
88 Ptr<const BlockedEpetraLOF> blk_epetra_lof = ptr_dynamic_cast<const BlockedEpetraLOF>(ptrFromRef(lof));
89 if(blk_epetra_lof!=null) {
90 auto rangeUGI = (rUgi==null ? blk_epetra_lof->getRangeGlobalIndexer() : rUgi);
91 auto domainUGI = (dUgi==null ? blk_epetra_lof->getDomainGlobalIndexer() : dUgi);
92 RCP<Teuchos::MpiComm<int> > mpiComm = rcp(new Teuchos::MpiComm<int>(blk_epetra_lof->getComm()));
93 return rcp(new BlockedEpetraLOF(mpiComm,rangeUGI,domainUGI));
94 }
95#endif
96
97 Ptr<const BlockedTpetraLOF> blk_tpetra_lof = ptr_dynamic_cast<const BlockedTpetraLOF>(ptrFromRef(lof));
98 if(blk_tpetra_lof!=null) {
99 TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
100 "panzer::cloneWithNewRangeAndDomain: Blocked Tpetra LOF does not yet support "
101 "different range and domain indexers!");
102 }
103
104 TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
105 "panzer::cloneWithNewRangeAndDomain: Could not determine the type of LOF, clone not support!");
106
107 return Teuchos::null;
108}
109
110}
Teuchos::RCP< const LinearObjFactory< panzer::Traits > > cloneWithNewDomain(const LinearObjFactory< panzer::Traits > &lof, const Teuchos::RCP< const GlobalIndexer > &dUgi)
Clone a linear object factory, but using a different domain.
Teuchos::RCP< const LinearObjFactory< panzer::Traits > > cloneWithNewRange(const LinearObjFactory< panzer::Traits > &lof, const Teuchos::RCP< const GlobalIndexer > &rUgi)
Clone a linear object factory, but using a different range.
Teuchos::RCP< const LinearObjFactory< panzer::Traits > > cloneWithNewRangeAndDomain(const LinearObjFactory< panzer::Traits > &lof, const Teuchos::RCP< const GlobalIndexer > &rUgi, const Teuchos::RCP< const GlobalIndexer > &dUgi)
Clone a linear object factory, but using a different range and domain.