Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_FieldAggPattern.hpp
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#ifndef __Panzer_FieldAggPattern_hpp__
44#define __Panzer_FieldAggPattern_hpp__
45
47#include "Panzer_FieldType.hpp"
48
49#include <map>
50#include <vector>
51#include <tuple>
52
53#include "Teuchos_RCP.hpp"
54#include "Teuchos_Tuple.hpp"
55#include "Phalanx_KokkosDeviceTypes.hpp"
56
57namespace panzer {
58
67public:
68 // The FEI format for prescribing fields seems quite general,
69 // so it is my belief that an abstract can be written to it.
70
72
75 FieldAggPattern(std::vector<std::tuple<int,panzer::FieldType,Teuchos::RCP<const FieldPattern> > > & patterns,
76 const Teuchos::RCP<const FieldPattern> & geomAggPattern=Teuchos::null);
77
78 virtual ~FieldAggPattern() {}
79
82 virtual Teuchos::RCP<const FieldPattern> getGeometricAggFieldPattern() const;
83
88 virtual void buildPattern(const std::vector<std::tuple<int,panzer::FieldType,Teuchos::RCP<const FieldPattern> > > & patterns,
89 const Teuchos::RCP<const FieldPattern> & geomAggPattern=Teuchos::null);
90
91 // functions from the abstract FieldPattern
92 virtual int getDimension() const;
93 virtual int getSubcellCount(int dimension) const;
94 virtual const std::vector<int> & getSubcellIndices(int dimension, int subcell) const;
95 virtual void getSubcellClosureIndices(int, int, std::vector<int> &) const;
96 virtual shards::CellTopology getCellTopology() const;
97
99 virtual void print(std::ostream & os) const;
100
107 virtual Teuchos::RCP<const FieldPattern> getFieldPattern(int fieldId) const;
108
115 virtual FieldType getFieldType(int fieldId) const;
116
118
119
121 const std::vector<int> & numFieldsPerId() const { return numFields_; }
122
126 const std::vector<int> & fieldIds() const { return fieldIds_; }
127
129
131
132
150 const std::vector<int> & localOffsets(int fieldId) const;
151
169 const PHX::View<const int*> localOffsetsKokkos(int fieldId) const;
170
193 const std::pair<std::vector<int>,std::vector<int> > &
194 localOffsets_closure(int fieldId,int subcellDim,int subcellId) const;
195
197
198protected:
199 typedef Teuchos::RCP<const FieldPattern> FPPtr; // for convenience
200
205
211 void buildFieldIdsVector();
212
223 void mergeFieldPatterns(const FieldType& fieldType);
224
228 void addAllPatternSubcellIndices(int dim,int sc,std::vector<int> & indices);
229
233
236 void localOffsets_build(int fieldId,std::vector<int> & offsets) const;
237
238 std::size_t dimension_;
239 Teuchos::RCP<const FieldPattern> geomAggPattern_;
240
243 std::vector<std::vector<std::vector<int> > > patternData_;
244
245 // FEI patterns
246 std::vector<int> numFields_; // number of fields at each geometric ID
247 std::vector<int> fieldIds_; // field IDs at each geometric ID
248
249 // storage for patterns
250 std::vector<std::tuple<int,panzer::FieldType,Teuchos::RCP<const FieldPattern> > > patterns_;
251 std::map<int,int> fieldIdToPatternIdx_;
252
254 mutable std::map<int, std::vector<int> > fieldOffsets_;
255
257 mutable std::map<int, PHX::View<int*> > fieldOffsetsKokkos_;
258
259 struct LessThan
260 { bool operator()(const Teuchos::Tuple<int,3> & a,const Teuchos::Tuple<int,3> & b) const; };
261 mutable std::map<Teuchos::Tuple<int,3>, std::pair<std::vector<int>,std::vector<int> >,LessThan>
263};
264
265}
266
267#endif
PHX::View< const int * > offsets
std::map< int, int > fieldIdToPatternIdx_
virtual void buildPattern(const std::vector< std::tuple< int, panzer::FieldType, Teuchos::RCP< const FieldPattern > > > &patterns, const Teuchos::RCP< const FieldPattern > &geomAggPattern=Teuchos::null)
const std::pair< std::vector< int >, std::vector< int > > & localOffsets_closure(int fieldId, int subcellDim, int subcellId) const
virtual void getSubcellClosureIndices(int, int, std::vector< int > &) const
virtual Teuchos::RCP< const FieldPattern > getFieldPattern(int fieldId) const
void mergeFieldPatterns(const FieldType &fieldType)
Teuchos::RCP< const FieldPattern > geomAggPattern_
std::map< Teuchos::Tuple< int, 3 >, std::pair< std::vector< int >, std::vector< int > >, LessThan > fieldSubcellOffsets_closure_
void addAllPatternSubcellIndices(int dim, int sc, std::vector< int > &indices)
const std::vector< int > & fieldIds() const
const std::vector< int > & localOffsets(int fieldId) const
std::vector< std::tuple< int, panzer::FieldType, Teuchos::RCP< const FieldPattern > > > patterns_
virtual const std::vector< int > & getSubcellIndices(int dimension, int subcell) const
void localOffsets_build(int fieldId, std::vector< int > &offsets) const
virtual void print(std::ostream &os) const
Print this pattern.
Teuchos::RCP< const FieldPattern > FPPtr
std::map< int, PHX::View< int * > > fieldOffsetsKokkos_
Stores the Field offsets for the fieldId key. Note that the key is the fieldId, not the index into th...
std::vector< std::vector< std::vector< int > > > patternData_
virtual Teuchos::RCP< const FieldPattern > getGeometricAggFieldPattern() const
virtual int getSubcellCount(int dimension) const
virtual FieldType getFieldType(int fieldId) const
std::map< int, std::vector< int > > fieldOffsets_
Stores the Field offsets for the fieldId key. Note that the key is the fieldId, not the index into th...
virtual shards::CellTopology getCellTopology() const
const PHX::View< const int * > localOffsetsKokkos(int fieldId) const
const std::vector< int > & numFieldsPerId() const
Lenght of vector is number of Ids, value is how many ids per field.
FieldType
The type of discretization to use for a field pattern.
bool operator()(const Teuchos::Tuple< int, 3 > &a, const Teuchos::Tuple< int, 3 > &b) const