Debian Codegraph @

dune/uggrid/parallel/ddd/ctrl/debug.cc

raw
1 // SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LGPL-2.1-or-later
3 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 // vi: set et ts=4 sw=2 sts=2:
5 /****************************************************************************/
6 /* */
7 /* File: debug.c */
8 /* */
9 /* Purpose: produces lists for debugging DDD data structures */
10 /* */
11 /* Author: Klaus Birken */
12 /* Rechenzentrum Uni Stuttgart */
13 /* Universitaet Stuttgart */
14 /* Allmandring 30 */
15 /* 70550 Stuttgart */
16 /* internet: [email protected] */
17 /* */
18 /* History: 94/07/04 kb begin */
19 /* */
20 /* Remarks: */
21 /* */
22 /****************************************************************************/
23
24 /****************************************************************************/
25 /* */
26 /* include files */
27 /* system include files */
28 /* application include files */
29 /* */
30 /****************************************************************************/
31
32 /* standard C library */
33 #include <config.h>
34 #include <cstdlib>
35 #include <cstdio>
36
37 #include <algorithm>
38 #include <iomanip>
39 #include <iostream>
40 #include <tuple>
41
42 #include <dune/uggrid/parallel/ddd/dddi.h>
43
44 /* PPIF namespace: */
45 using namespace PPIF;
46
47 START_UGDIM_NAMESPACE
48
49 /****************************************************************************/
50 /* */
51 /* defines in the following order */
52 /* */
53 /* compile time constants defining static data size (i.e. arrays) */
54 /* other constants */
55 /* macros */
56 /* */
57 /****************************************************************************/
58
59
60
61 /****************************************************************************/
62 /* */
63 /* data structures */
64 /* */
65 /****************************************************************************/
66
67
68
69 /****************************************************************************/
70 /* */
71 /* definition of exported global variables */
72 /* */
73 /****************************************************************************/
74
75
76
77 /****************************************************************************/
78 /* */
79 /* definition of variables global to this source file only (static!) */
80 /* */
81 /****************************************************************************/
82
83
84
85
86 /****************************************************************************/
87 /* */
88 /* routines */
89 /* */
90 /****************************************************************************/
91
92
93
94 /****************************************************************************/
95 /* */
96 /* Function: ListLocalObjects */
97 /* */
98 /* Purpose: display list of all local objects */
99 /* */
100 /* Input: - */
101 /* */
102 /* Output: - */
103 /* */
104 /****************************************************************************/
105
106 static bool sort_LocalObjs(const DDD_HDR& a, const DDD_HDR& b)
107 {
108 return std::tie(OBJ_TYPE(a), OBJ_GID(a)) < std::tie(OBJ_TYPE(b), OBJ_GID(b));
109 }
110
111
112 void DDD_ListLocalObjects(const DDD::DDDContext& context)
113 {
114 using std::setw;
115 std::ostream& out = std::cout;
116
117 std::vector<DDD_HDR> locObjs = LocalObjectsList(context);
118 if (locObjs.empty())
119 return;
120
121 std::sort(locObjs.begin(), locObjs.end(), sort_LocalObjs);
122
123 for(int i=0; i < context.nObjs(); i++)
124 {
125 const auto& o = locObjs[i];
126
127 out << "#" << setw(4) << " adr=" << o << " gid=" << OBJ_GID(o)
128 << " type=" << OBJ_TYPE(o) << " prio=" << OBJ_PRIO(o)
129 << " attr=" << OBJ_ATTR(o) << "\n";
130 }
131 }
132
133 END_UGDIM_NAMESPACE