Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_SetupPartitionedWorksetUtilities.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 
14 #include "Panzer_Workset.hpp"
15 #include "Panzer_WorksetNeeds.hpp"
17 
18 namespace panzer
19 {
20 
21 namespace
22 {
23 void
24 convertMeshPartitionToWorkset(const panzer::LocalMeshPartition & partition,
25  const Teuchos::RCP<const OrientationsInterface> & orientations,
26  panzer::Workset & workset)
27 {
28  WorksetOptions options;
29  options.side_assembly_ = false;
30  options.align_side_points_ = false;
31  options.orientations_ = orientations;
32 
33  // Construct the workset from the partition
34  workset.setup(partition, options);
35 
36 }
37 }
38 
41  const panzer::WorksetDescriptor & description,
42  const Teuchos::RCP<const OrientationsInterface> & orientations)
43 {
44  Teuchos::RCP<std::vector<panzer::Workset> > worksets = Teuchos::rcp(new std::vector<panzer::Workset>());
45 
46  // Make sure it makes sense to partition
47  TEUCHOS_ASSERT(description.requiresPartitioning());
48 
49  // Each partition represents a chunk of the mesh
50  std::vector<panzer::LocalMeshPartition> partitions;
51  panzer::generateLocalMeshPartitions(mesh_info, description, partitions);
52 
53  int i=0;
54  for(const auto & partition : partitions){
55  worksets->push_back(panzer::Workset());
56  convertMeshPartitionToWorkset(partition, orientations, worksets->back());
57 
58  // We hash in a unique id the the given workset
59  size_t id = std::hash<WorksetDescriptor>()(description);
60  panzer::hash_combine(id, i++);
61  worksets->back().setIdentifier(id);
62  }
63 
64  return worksets;
65 }
66 
67 }
void generateLocalMeshPartitions(const panzer::LocalMeshInfo &mesh_info, const panzer::WorksetDescriptor &description, std::vector< panzer::LocalMeshPartition > &partitions)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< std::vector< panzer::Workset > > buildPartitionedWorksets(const panzer::LocalMeshInfo &mesh_info, const panzer::WorksetDescriptor &description, const Teuchos::RCP< const OrientationsInterface > &orientations)
void hash_combine(std::size_t &seed, const T &v)
#define TEUCHOS_ASSERT(assertion_test)
void setup(const LocalMeshPartition &partition, const WorksetOptions &options)
Constructs the workset details from a given chunk of the mesh.
bool requiresPartitioning() const
Do we need to partition the local mesh prior to generating worksets.