Panzer Version of the Day
Loading...
Searching...
No Matches
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"
17
18namespace panzer
19{
20
21namespace
22{
23void
24convertMeshPartitionToWorkset(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
39Teuchos::RCP<std::vector<panzer::Workset> >
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}
bool requiresPartitioning() const
Do we need to partition the local mesh prior to generating worksets.
void setup(const LocalMeshPartition &partition, const WorksetOptions &options)
Constructs the workset details from a given chunk of the mesh.
void hash_combine(std::size_t &seed, const T &v)
Teuchos::RCP< std::vector< panzer::Workset > > buildPartitionedWorksets(const panzer::LocalMeshInfo &mesh_info, const panzer::WorksetDescriptor &description, const Teuchos::RCP< const OrientationsInterface > &orientations)
void generateLocalMeshPartitions(const panzer::LocalMeshInfo &mesh_info, const panzer::WorksetDescriptor &description, std::vector< panzer::LocalMeshPartition > &partitions)