Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_FieldSpy_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_FieldSpy_impl_hpp__
12 #define __Panzer_FieldSpy_impl_hpp__
13 
14 #include <cmath>
15 
16 #include "Phalanx_DataLayout_MDALayout.hpp"
17 
18 #include "Panzer_Workset.hpp"
19 
20 namespace panzer {
21 
22 //**********************************************************************
23 template <typename EvalT,typename Traits>
24 FieldSpy<EvalT,Traits>::FieldSpy(const std::string & name,
25  const Teuchos::RCP<PHX::DataLayout> & data_layout)
26 {
27  using Teuchos::RCP;
28  using Teuchos::rcp;
29 
30  dummyField = rcp(new PHX::Tag<ScalarT>("Field Spy: " + name,rcp(new PHX::MDALayout<panzer::Dummy>(0))));
31  this->addEvaluatedField(*dummyField);
32 
33  source = PHX::MDField<const ScalarT,Cell,Point>(name, data_layout);
34  this->addDependentField(source);
35 
36  std::string n = "Field Spy";
37  this->setName(n);
38 }
39 
40 //**********************************************************************
41 template <typename EvalT,typename Traits>
43 {
44  std::cout << "SPY: Name = \"" << source.fieldTag().identifier() << "\" at t = " << workset.time << "\n";
45  for (index_t cell=0;cell<workset.num_cells;++cell) {
46  std::cout << "SPY: ";
47  for (int point = 0; point < source.extent_int(1); ++point) {
48  std::cout << Sacado::scalarValue(source(cell,point)) << " ";
49  }
50  std::cout << std::endl;
51  }
52 }
53 
54 //**********************************************************************
55 }
56 
57 #endif
int num_cells
DEPRECATED - use: numCells()
void evaluateFields(typename Traits::EvalData d)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
FieldSpy(const std::string &name, const Teuchos::RCP< PHX::DataLayout > &data_layout)