Panzer
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
dof-mgr
src
Panzer_FieldPattern.cpp
Go to the documentation of this file.
1
// @HEADER
2
// ***********************************************************************
3
//
4
// Panzer: A partial differential equation assembly
5
// engine for strongly coupled complex multiphysics systems
6
// Copyright (2011) Sandia Corporation
7
//
8
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9
// the U.S. Government retains certain rights in this software.
10
//
11
// Redistribution and use in source and binary forms, with or without
12
// modification, are permitted provided that the following conditions are
13
// met:
14
//
15
// 1. Redistributions of source code must retain the above copyright
16
// notice, this list of conditions and the following disclaimer.
17
//
18
// 2. Redistributions in binary form must reproduce the above copyright
19
// notice, this list of conditions and the following disclaimer in the
20
// documentation and/or other materials provided with the distribution.
21
//
22
// 3. Neither the name of the Corporation nor the names of the
23
// contributors may be used to endorse or promote products derived from
24
// this software without specific prior written permission.
25
//
26
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
//
38
// Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39
// Eric C. Cyr (eccyr@sandia.gov)
40
// ***********************************************************************
41
// @HEADER
42
43
#include "
Panzer_FieldPattern.hpp
"
44
45
namespace
panzer
{
46
47
FieldPattern::~FieldPattern
() {}
48
49
int
FieldPattern::numberIds
()
const
50
{
51
int
count = 0;
52
int
dim =
getDimension
();
53
54
// compute number of IDs
55
for
(
int
i=0;i<dim+1;i++) {
56
for
(
int
sc=0;sc<
getSubcellCount
(i);sc++)
57
count +=
getSubcellIndices
(i,sc).size();
58
}
59
60
return
count;
61
}
62
63
void
FieldPattern::print
(std::ostream & os)
const
64
{
65
int
dim =
getDimension
()+1;
66
os <<
"FieldPattern: "
<< dim <<
" Subcell types"
<< std::endl;
67
for
(
int
i=0;i<dim;i++) {
68
int
subcells =
getSubcellCount
(i);
69
os <<
"FieldPattern: "
<< subcells <<
" subcells of type "
<< i << std::endl;
70
71
for
(
int
j=0;j<subcells;j++) {
72
const
std::vector<int> & indices =
getSubcellIndices
(i,j);
73
os <<
"FieldPattern: subcell "
<< j <<
" = [ "
;
74
for
(std::size_t k=0;k<indices.size();k++)
75
os << indices[k] <<
" "
;
76
os <<
"]"
<< std::endl;
77
}
78
}
79
}
80
81
bool
FieldPattern::sameGeometry
(
const
FieldPattern
& fp)
const
82
{
83
bool
equal =
true
;
84
85
// test same dimension
86
std::size_t dim =
getDimension
();
87
equal &= (dim==(std::size_t) fp.
getDimension
());
88
89
// check sub cells
90
for
(std::size_t d=0;d<dim;d++)
91
equal &=
getSubcellCount
(d)==fp.
getSubcellCount
(d);
92
93
return
equal;
94
}
95
96
bool
FieldPattern::consistentSubcells
()
const
97
{
98
bool
consistent =
true
;
99
100
std::size_t dim =
getDimension
();
101
for
(std::size_t d=0;d<dim+1;d++) {
102
int
numSC =
getSubcellCount
(d);
103
std::size_t sz =
getSubcellIndices
(d,0).size();
104
for
(
int
i=1;i<numSC;i++) {
105
consistent &= (sz==
getSubcellIndices
(d,i).size());
106
}
107
}
108
109
return
consistent;
110
}
111
112
bool
FieldPattern::equals
(
const
FieldPattern
& fp)
const
113
{
114
// same geometry is required
115
if
(not this->
sameGeometry
(fp))
116
return
false
;
117
118
// check to make sure subcell indices are equal
119
int
dimension = this->
getDimension
();
120
for
(
int
d=0;d<dimension+1;d++) {
121
for
(
int
sc=0;sc<this->
getSubcellCount
(d);sc++) {
122
const
std::vector<int> & myVector = this->
getSubcellIndices
(d,sc);
123
const
std::vector<int> & argVector = fp.
getSubcellIndices
(d,sc);
124
125
// check size of vectors
126
if
(myVector.size()!=argVector.size())
127
return
false
;
128
129
// check content of vectors
130
bool
eq = std::equal(myVector.begin(),myVector.end(),argVector.begin());
131
if
(not eq)
132
return
false
;
133
}
134
}
135
136
return
true
;
137
}
138
139
std::ostream &
operator<<
(std::ostream & os,
const
FieldPattern
& fp)
140
{
141
fp.
print
(os);
142
return
os;
143
}
144
145
}
Panzer_FieldPattern.hpp
panzer::FieldPattern
Definition
Panzer_FieldPattern.hpp:53
panzer::FieldPattern::~FieldPattern
virtual ~FieldPattern()=0
Do nothing destructor.
Definition
Panzer_FieldPattern.cpp:47
panzer::FieldPattern::getDimension
virtual int getDimension() const =0
panzer::FieldPattern::print
virtual void print(std::ostream &os) const
Definition
Panzer_FieldPattern.cpp:63
panzer::FieldPattern::getSubcellCount
virtual int getSubcellCount(int dim) const =0
panzer::FieldPattern::numberIds
virtual int numberIds() const
Definition
Panzer_FieldPattern.cpp:49
panzer::FieldPattern::getSubcellIndices
virtual const std::vector< int > & getSubcellIndices(int dim, int cellIndex) const =0
panzer::FieldPattern::consistentSubcells
virtual bool consistentSubcells() const
Definition
Panzer_FieldPattern.cpp:96
panzer::FieldPattern::equals
virtual bool equals(const FieldPattern &fp) const
Definition
Panzer_FieldPattern.cpp:112
panzer::FieldPattern::sameGeometry
virtual bool sameGeometry(const FieldPattern &fp) const
Definition
Panzer_FieldPattern.cpp:81
panzer
Computes .
Definition
Panzer_BasisValues_Evaluator_decl.hpp:54
panzer::operator<<
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
Definition
Panzer_AssemblyEngine_InArgs.hpp:147
Generated by
1.17.0