Intrepid2
Intrepid2_CellToolsDefDebug.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Intrepid2 Package
4//
5// Copyright 2007 NTESS and the Intrepid2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10
16#ifndef __INTREPID2_CELLTOOLS_DEBUG_DEF_HPP__
17#define __INTREPID2_CELLTOOLS_DEBUG_DEF_HPP__
18
19// disable clang warnings
20#if defined (__clang__) && !defined (__INTEL_COMPILER)
21#pragma clang system_header
22#endif
23
24namespace Intrepid2 {
25
26 //============================================================================================//
27 // //
28 // Debug //
29 // //
30 //============================================================================================//
31
32
33 template<class Scalar>
34 void CellTools<Scalar>::printSubcellVertices(const ordinal_type subcellDim,
35 const ordinal_type subcellOrd,
36 const shards::CellTopology & parentCell){
37
38 // Get number of vertices for the specified subcell and parent cell dimension
39 ordinal_type subcVertexCount = parentCell.getVertexCount(subcellDim, subcellOrd);
40 ordinal_type cellDim = parentCell.getDimension();
41
42 // Allocate space for the subcell vertex coordinates
43 FieldContainer<double> subcellVertices(subcVertexCount, cellDim);
44
45 // Retrieve the vertex coordinates
46 getReferenceSubcellVertices(subcellVertices,
47 subcellDim,
48 subcellOrd,
49 parentCell);
50
51 // Print the vertices
52 std::cout
53 << " Subcell " << std::setw(2) << subcellOrd
54 << " is " << parentCell.getName(subcellDim, subcellOrd) << " with vertices = {";
55
56 // Loop over subcell vertices
57 for(ordinal_type subcVertOrd = 0; subcVertOrd < subcVertexCount; subcVertOrd++){
58 std::cout<< "(";
59
60 // Loop over vertex Cartesian coordinates
61 for(ordinal_type dim = 0; dim < (ordinal_type)parentCell.getDimension(); dim++){
62 std::cout << subcellVertices(subcVertOrd, dim);
63 if(dim < (ordinal_type)parentCell.getDimension()-1 ) { std::cout << ","; }
64 }
65 std::cout<< ")";
66 if(subcVertOrd < subcVertexCount - 1) { std::cout << ", "; }
67 }
68 std::cout << "}\n";
69 }
70
71
72 template<class Scalar>
73 template<class ArrayCell>
74 void CellTools<Scalar>::printWorksetSubcell(const ArrayCell & cellWorkset,
75 const shards::CellTopology & parentCell,
76 const ordinal_type& pCellOrd,
77 const ordinal_type& subcellDim,
78 const ordinal_type& subcellOrd,
79 const ordinal_type& fieldWidth){
80
81 // Get the ordinals, relative to reference cell, of subcell cellWorkset
82 ordinal_type subcNodeCount = parentCell.getNodeCount(subcellDim, subcellOrd);
83 ordinal_type pCellDim = parentCell.getDimension();
84 std::vector<ordinal_type> subcNodeOrdinals(subcNodeCount);
85
86 for(ordinal_type i = 0; i < subcNodeCount; i++){
87 subcNodeOrdinals[i] = parentCell.getNodeMap(subcellDim, subcellOrd, i);
88 }
89
90 // Loop over parent cells and print subcell cellWorkset
91
92 std::cout
93 << " Subcell " << subcellOrd << " on parent cell " << pCellOrd << " is "
94 << parentCell.getName(subcellDim, subcellOrd) << " with node(s) \n ({";
95
96 for(ordinal_type i = 0; i < subcNodeCount; i++){
97
98 // print Cartesian coordinates of the node
99 for(ordinal_type dim = 0; dim < pCellDim; dim++){
100 std::cout
101 << std::setw(fieldWidth) << std::right << cellWorkset(pCellOrd, subcNodeOrdinals[i], dim);
102 if(dim < pCellDim - 1){ std::cout << ","; }
103 }
104 std::cout << "}";
105 if(i < subcNodeCount - 1){ std::cout <<", {"; }
106 }
107 std::cout << ")\n\n";
108 }
109
110}
111
112#endif