Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_STK_GatherRefCoords_impl.hpp
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
11#ifndef __PANZER_STK_GatherRefCoords_impl_hpp__
12#define __PANZER_STK_GatherRefCoords_impl_hpp__
13
14#include "Teuchos_Assert.hpp"
15#include "Phalanx_DataLayout.hpp"
16
18
19#include "Teuchos_FancyOStream.hpp"
20
21// **********************************************************************
22// Specialization: Residual
23// **********************************************************************
24
25template<typename EvalT, typename Traits>
27GatherRefCoords(const Teuchos::RCP<const STK_Interface> & mesh,
28 const panzer::BasisIRLayout & basis,
29 const std::string & fieldName)
30{
31 using panzer::Cell;
32 using panzer::NODE;
33
34 mesh_ = mesh;
35
36 coordField_ = PHX::MDField<ScalarT,panzer::Cell,panzer::NODE,panzer::Dim>(fieldName,basis.functional_grad);
37 this->addEvaluatedField(coordField_);
38
39 this->setName("Gather STK Fields");
40}
41
42// **********************************************************************
43template<typename EvalT, typename Traits>
45evaluateFields(typename Traits::EvalData workset)
46{
47 const std::vector<stk::mesh::Entity> & localElements = *mesh_->getElementsOrderedByLID();
48
49 // for convenience pull out some objects from workset
50 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
51
52 // convert to a vector of entity objects
53 std::vector<stk::mesh::Entity> selected_elements;
54 for(std::size_t cell=0;cell<localCellIds.size();cell++)
55 selected_elements.push_back(localElements[localCellIds[cell]]);
56
57 auto coordField = coordField_.get_view();
58 mesh_->getElementVertices_FromCoordsNoResize(selected_elements,coordField);
59}
60
61#endif
Teuchos::RCP< PHX::DataLayout > functional_grad
<Cell,Basis,Dim>
void evaluateFields(typename Traits::EvalData d)