Panzer
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
disc-fe
src
lof
Panzer_LinearObjFactory_Utilities.cpp
Go to the documentation of this file.
1
#include "
Panzer_LinearObjFactory_Utilities.hpp
"
2
3
#include "Teuchos_RCP.hpp"
4
5
#include "
Panzer_GlobalIndexer.hpp
"
6
7
#include "Panzer_TpetraLinearObjFactory.hpp"
8
#include "
Panzer_BlockedTpetraLinearObjFactory.hpp
"
9
10
#ifdef PANZER_HAVE_EPETRA_STACK
11
#include "
Panzer_BlockedEpetraLinearObjFactory.hpp
"
12
#endif
13
14
namespace
panzer
{
15
16
Teuchos::RCP<const LinearObjFactory<panzer::Traits> >
cloneWithNewDomain
(
const
LinearObjFactory<panzer::Traits>
& lof,
17
const
Teuchos::RCP<const GlobalIndexer> & dUgi)
18
{
19
// This just forwards on to the general case. That makes things much easier
20
return
cloneWithNewRangeAndDomain
(lof,Teuchos::null,dUgi);
21
}
22
23
Teuchos::RCP<const LinearObjFactory<panzer::Traits> >
cloneWithNewRange
(
const
LinearObjFactory<panzer::Traits>
& lof,
24
const
Teuchos::RCP<const GlobalIndexer> & rUgi)
25
{
26
// This just forwards on to the general case. That makes things much easier
27
return
cloneWithNewRangeAndDomain
(lof,rUgi,Teuchos::null);
28
}
29
30
Teuchos::RCP<const LinearObjFactory<panzer::Traits> >
cloneWithNewRangeAndDomain
(
31
const
LinearObjFactory<panzer::Traits>
& lof,
32
const
Teuchos::RCP<const GlobalIndexer> & rUgi,
33
const
Teuchos::RCP<const GlobalIndexer> & dUgi)
34
{
35
using
Teuchos::null;
36
using
Teuchos::RCP;
37
using
Teuchos::rcp;
38
using
Teuchos::rcp_dynamic_cast;
39
using
Teuchos::Ptr;
40
using
Teuchos::ptr_dynamic_cast;
41
using
Teuchos::ptrFromRef;
42
43
/*
44
typedef GlobalIndexer<int,int> EpetraUGI;
45
typedef BlockedDOFManager BlockedEpetraUGI;
46
typedef BlockedDOFManager<int,panzer::GlobalOrdinal> BlockedTpetraUGI;
47
*/
48
typedef
TpetraLinearObjFactory<panzer::Traits,double,int,panzer::GlobalOrdinal>
TpetraLOF;
49
#ifdef PANZER_HAVE_EPETRA_STACK
50
typedef
BlockedEpetraLinearObjFactory<panzer::Traits,int>
BlockedEpetraLOF;
51
#endif
52
typedef
BlockedTpetraLinearObjFactory<panzer::Traits,double,int,panzer::GlobalOrdinal>
BlockedTpetraLOF;
53
54
// This proceeds by casting to a number of known LOF types (all explicitly instantiated)
55
// then trying to build a new one. Of course for many of these under implemented operation
56
// this fails and an error is thrown.
57
58
/*
59
Ptr<const EpetraLOF> epetra_lof = ptr_dynamic_cast<const EpetraLOF>(ptrFromRef(lof));
60
if(epetra_lof!=null) {
61
RCP<const EpetraUGI> rangeUGI = rcp_dynamic_cast<const EpetraUGI>(rUgi==null ? epetra_lof->getRangeGlobalIndexer() : rUgi,true);
62
RCP<const EpetraUGI> domainUGI = rcp_dynamic_cast<const EpetraUGI>(dUgi==null ? epetra_lof->getDomainGlobalIndexer() : dUgi,true);
63
RCP<Teuchos::MpiComm<int> > mpiComm = rcp(new Teuchos::MpiComm<int>(epetra_lof->getComm()));
64
return rcp(new EpetraLOF(mpiComm,rangeUGI,domainUGI));
65
}
66
*/
67
68
Ptr<const TpetraLOF> tpetra_lof = ptr_dynamic_cast<const TpetraLOF>(ptrFromRef(lof));
69
if
(tpetra_lof!=null) {
70
auto
rangeUGI = (rUgi==null ? tpetra_lof->getRangeGlobalIndexer() : rUgi);
71
auto
domainUGI = (dUgi==null ? tpetra_lof->getDomainGlobalIndexer() : dUgi);
72
auto
mpiComm = rcp(
new
Teuchos::MpiComm<int>
(tpetra_lof->getComm()));
73
74
return
rcp(
new
TpetraLOF(mpiComm,rangeUGI,domainUGI));
75
}
76
77
#ifdef PANZER_HAVE_EPETRA_STACK
78
Ptr<const BlockedEpetraLOF> blk_epetra_lof = ptr_dynamic_cast<const BlockedEpetraLOF>(ptrFromRef(lof));
79
if
(blk_epetra_lof!=null) {
80
auto
rangeUGI = (rUgi==null ? blk_epetra_lof->getRangeGlobalIndexer() : rUgi);
81
auto
domainUGI = (dUgi==null ? blk_epetra_lof->getDomainGlobalIndexer() : dUgi);
82
RCP<Teuchos::MpiComm<int> > mpiComm = rcp(
new
Teuchos::MpiComm<int>
(blk_epetra_lof->getComm()));
83
return
rcp(
new
BlockedEpetraLOF(mpiComm,rangeUGI,domainUGI));
84
}
85
#endif
86
87
Ptr<const BlockedTpetraLOF> blk_tpetra_lof = ptr_dynamic_cast<const BlockedTpetraLOF>(ptrFromRef(lof));
88
if
(blk_tpetra_lof!=null) {
89
TEUCHOS_TEST_FOR_EXCEPTION(
true
,std::logic_error,
90
"panzer::cloneWithNewRangeAndDomain: Blocked Tpetra LOF does not yet support "
91
"different range and domain indexers!"
);
92
}
93
94
TEUCHOS_TEST_FOR_EXCEPTION(
true
,std::logic_error,
95
"panzer::cloneWithNewRangeAndDomain: Could not determine the type of LOF, clone not support!"
);
96
97
return
Teuchos::null;
98
}
99
100
}
Panzer_BlockedEpetraLinearObjFactory.hpp
Panzer_BlockedTpetraLinearObjFactory.hpp
Panzer_GlobalIndexer.hpp
Panzer_LinearObjFactory_Utilities.hpp
Teuchos::MpiComm
Definition
Panzer_L2Projection.hpp:20
panzer::BlockedEpetraLinearObjFactory
Definition
Panzer_BlockedEpetraLinearObjFactory.hpp:87
panzer::BlockedTpetraLinearObjFactory
Definition
Panzer_BlockedTpetraLinearObjFactory.hpp:82
panzer::LinearObjFactory
Definition
Panzer_LinearObjFactory.hpp:104
panzer::TpetraLinearObjFactory
Definition
Panzer_TpetraLinearObjFactory_decl.hpp:76
panzer
Computes .
Definition
Panzer_BasisValues_Evaluator_decl.hpp:54
panzer::cloneWithNewDomain
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.
Definition
Panzer_LinearObjFactory_Utilities.cpp:16
panzer::cloneWithNewRange
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.
Definition
Panzer_LinearObjFactory_Utilities.cpp:23
panzer::cloneWithNewRangeAndDomain
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.
Definition
Panzer_LinearObjFactory_Utilities.cpp:30
Generated by
1.17.0