This file is indexed.

/usr/include/dune/grid/common/gridinfo.hh is in libdune-grid-dev 2.2.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// $Id: gridinfo.hh 7772 2011-11-15 09:31:37Z sander $

#ifndef DUNE_GRIDINFO_HH
#define DUNE_GRIDINFO_HH

#include <iostream>
#include <typeinfo>
#include <dune/common/exceptions.hh>
#include <dune/common/classname.hh>
#include <dune/geometry/referenceelements.hh>
#include "grid.hh"

/** @file
 * @author Peter Bastian
 * @brief Some functions to list information about a grid
 *
 */

namespace Dune
{
  /** 
   * @addtogroup Grid
   *
   * @{ 
   */

  /** @brief A function to print some information about the grid as a whole.
   */
  template<class G>
  void gridinfo (const G& grid, std::string prefix="")
  {
	// first we extract the dimensions of the grid  
	const int dim = G::dimension;
	const int dimworld = G::dimensionworld;

	// grid type and dimension
	std::cout << prefix << "=> " << className(grid)
			  << " (dim=" << dim
			  << ", dimworld=" << dimworld
			  << ")" << std::endl;

	// level information
	for (int level=0; level<=grid.maxLevel(); level++)
	  {
		std::cout << prefix << "level " << level;
		for (int cd=0; cd<=dim; cd++)
		  {
			std::cout << " codim[" << cd << "]=" << grid.size(level,cd);
		  }
		std::cout << std::endl;
	  }

	// leaf information
	std::cout << prefix << "leaf   ";
	for (int cd=0; cd<=dim; cd++)
	  {
		std::cout << " codim[" << cd << "]=" << grid.size(cd);
	  }
	std::cout << std::endl;

	std::cout << prefix << "leaf"
			  << " dim=" << dim
			  << " geomTypes=(";
	bool first=true;
	for (int c=0; c<=dim; c++)
	  {
		for (std::size_t i=0; i<grid.leafIndexSet().geomTypes(c).size(); i++)
		  {
			if (!first) std::cout << ",";
			std::cout << grid.leafIndexSet().geomTypes(c)[i]
					  << "[" << c << "]"
					  << "=" << grid.leafIndexSet().size(grid.leafIndexSet().geomTypes(c)[i]);
			first=false;
		  }
	  }
	std::cout << ")" << std::endl;


	return;
  }

 
  /** @brief A function to print info about a grid level and its entities
   */
  template<class G>
  void gridlevellist (const G& grid, int level, std::string prefix)
  {
	// first we extract the dimensions of the grid  
	const int dim = G::dimension;

	// type used for coordinates in the grid
	typedef typename G::ctype ct;

	// the grid has an iterator providing the access to
	// all elements (better codim 0 entities) on a grid level
	// Note the use of the typename and template keywords.
	typedef typename G::Traits::template Codim<0>::LevelIterator LevelIterator;

	// print info about this level
	std::cout << prefix << "level=" << level
			  << " dim=" << dim
			  << " geomTypes=(";
	bool first=true;
	for (unsigned i=0; i<grid.levelIndexSet(level).geomTypes(0).size(); i++)
	  {
		if (!first) std::cout << ",";
		std::cout << grid.levelIndexSet(level).geomTypes(0)[i]
				  << "=" << grid.levelIndexSet(level).size(grid.levelIndexSet(level).geomTypes(0)[i]);
		first=false;
	  }
	std::cout << ")" << std::endl;

	// print info about each element on given level
	LevelIterator eendit = grid.template lend<0>(level);
	for (LevelIterator it = grid.template lbegin<0>(level); it!=eendit; ++it)
	  {
		std::cout << prefix << "level=" << it->level()
				  << " " << it->type() << "[" << dim << "]"
				  << " index=" << grid.levelIndexSet(level).index(*it)
				  << " gid=" << grid.globalIdSet().template id<0>(*it)
				  << " leaf=" << it->isLeaf()
				  << " partition=" << PartitionName(it->partitionType())
				  << " center=(" 
				  << it->geometry().global(Dune::GenericReferenceElements<ct,dim>::general(it->type()).position(0,0))
				  << ")"
				  << " first=(" << it->geometry().corner(0) << ")"
				  << std::endl;

		std::cout << prefix << "codim " << dim << " subindex";
		for (int i=0; i<it->template count<dim>(); i++)
		  {
              std::cout << " " << i << ":" << grid.levelIndexSet(level).subIndex(*it,i,dim);
		  }
		std::cout << std::endl;
		
		std::cout << prefix << "codim " << dim-1 << " subindex";
		for (int i=0; i<it->template count<dim-1>(); i++)
		  {
              std::cout << " " << i << ":" << grid.levelIndexSet(level).subIndex(*it,i,dim-1);
		  }
		std::cout << std::endl;
		
	  }

	return;
  }


  /** @brief A function to print info about a leaf grid and its entities
   */
  template<class G>
  void gridleaflist (const G& grid, std::string prefix)
  {
	// first we extract the dimensions of the grid  
	const int dim = G::dimension;

	// type used for coordinates in the grid
	typedef typename G::ctype ct;

	// the grid has an iterator providing the access to
	// all elements (better codim 0 entities) on a grid level
	// Note the use of the typename and template keywords.
	typedef typename G::Traits::template Codim<0>::LeafIterator LeafIterator;
	typedef typename G::Traits::template Codim<dim>::LeafIterator VLeafIterator;

	// print info about the leaf grid
	std::cout << prefix << "leaf"
			  << " dim=" << dim
			  << " geomTypes=(";
	bool first=true;
	for (int c=0; c<=dim; c++)
	  {
		for (unsigned i=0; i<grid.leafIndexSet().geomTypes(c).size(); i++)
		  {
			if (!first) std::cout << ",";
			std::cout << grid.leafIndexSet().geomTypes(c)[i]
					  << "[" << c << "]"
					  << "=" << grid.leafIndexSet().size(grid.leafIndexSet().geomTypes(c)[i]);
			first=false;
		  }
	  }
	std::cout << ")" << std::endl;

	// print info about nodes in leaf grid
	VLeafIterator veendit = grid.template leafend<dim>();
	for (VLeafIterator it = grid.template leafbegin<dim>(); it!=veendit; ++it)
	  {
		std::cout << prefix << "level=" << it->level()
				  << " " << it->type() << "[" << dim << "]"
				  << " index=" << grid.leafIndexSet().index(*it)
				  << " gid=" << grid.globalIdSet().template id<dim>(*it)
				  << " partition=" << PartitionName(it->partitionType())
				  << " pos=(" << it->geometry().corner(0) << ")"
				  << std::endl;
	  }

	// print info about each element in leaf grid
	LeafIterator eendit = grid.template leafend<0>();
	for (LeafIterator it = grid.template leafbegin<0>(); it!=eendit; ++it)
	  {
		std::cout << prefix << "level=" << it->level()
				  << " " << it->type() << "[" << dim << "]"
				  << " index=" << grid.leafIndexSet().index(*it)
				  << " gid=" << grid.globalIdSet().template id<0>(*it)
				  << " leaf=" << it->isLeaf()
				  << " partition=" << PartitionName(it->partitionType())
				  << " center=(" 
				  << it->geometry().global(Dune::GenericReferenceElements<ct,dim>::general(it->type()).position(0,0))
				  << ")"
				  << " first=(" << it->geometry().corner(0) << ")"
				  << std::endl;

		std::cout << prefix << "codim " << dim << " subindex";
		for (int i=0; i<it->template count<dim>(); i++)
		  {
              std::cout << " " << i << ":" << grid.leafIndexSet().subIndex(*it,i,dim);
		  }
		std::cout << std::endl;
		
		std::cout << prefix << "codim " << dim-1 << " subindex";
		for (int i=0; i<it->template count<dim-1>(); i++)
		  {
              std::cout << " " << i << ":" << grid.leafIndexSet().subIndex(*it,i,dim-1);
		  }
		std::cout << std::endl;
		
	  }

	return;
  }

 
  /** @} */

}
#endif