This file is indexed.

/usr/include/trilinos/CTrilinos_test_utils.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.

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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
/*! @HEADER */
/*
************************************************************************

                CTrilinos:  C interface to Trilinos
                Copyright (2009) Sandia Corporation

Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
license for use of this work by or on behalf of the U.S. Government.

This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
Questions? Contact M. Nicole Lemaster (mnlemas@sandia.gov)

************************************************************************
*/
/*! @HEADER */


/*! @file CTrilinos_test_utils.hpp
 * @brief Utility functions for CTrilinos testing. */


#ifndef CTRILINOS_TEST_UTILS_HPP
#define CTRILINOS_TEST_UTILS_HPP


#include "CTrilinos_config.h"
#include <string>

#include "CEpetra_Distributor_Cpp.hpp"
#include "CEpetra_SerialComm_Cpp.hpp"
#include "CEpetra_BLAS_Cpp.hpp"
#include "CEpetra_Comm_Cpp.hpp"
#include "CEpetra_Operator_Cpp.hpp"
#include "CEpetra_MultiVector_Cpp.hpp"
#include "CEpetra_OffsetIndex_Cpp.hpp"
#include "CEpetra_Object_Cpp.hpp"
#include "CEpetra_RowMatrix_Cpp.hpp"
#include "CEpetra_CompObject_Cpp.hpp"
#include "CEpetra_Directory_Cpp.hpp"
#include "CEpetra_Flops_Cpp.hpp"
#include "CEpetra_SrcDistObject_Cpp.hpp"
#ifdef HAVE_MPI
#include "CEpetra_MpiComm_Cpp.hpp"
#endif /* HAVE_MPI */
#include "CEpetra_CrsMatrix_Cpp.hpp"
#include "CEpetra_CrsGraph_Cpp.hpp"
#include "CEpetra_DistObject_Cpp.hpp"
#include "CEpetra_Vector_Cpp.hpp"
#include "CEpetra_Export_Cpp.hpp"
#include "CEpetra_Map_Cpp.hpp"
#include "CEpetra_BlockMap_Cpp.hpp"
#include "CEpetra_Import_Cpp.hpp"
#include "CEpetra_Time_Cpp.hpp"
#include "CEpetra_JadMatrix_Cpp.hpp"
#include "CEpetra_LinearProblem_Cpp.hpp"
#include "CEpetra_LAPACK_Cpp.hpp"
#include "CTeuchos_CommandLineProcessor_Cpp.hpp"
#include "CTeuchos_ParameterList_Cpp.hpp"
#include "CTeuchos_ParameterEntry_Cpp.hpp"
#include "CTeuchos_any_Cpp.hpp"
#ifdef HAVE_CTRILINOS_AMESOS
#include "CAmesos_BaseSolver_Cpp.hpp"
#endif /* HAVE_CTRILINOS_AMESOS */
#ifdef HAVE_CTRILINOS_AMESOS
#include "CAmesos_Cpp.hpp"
#endif /* HAVE_CTRILINOS_AMESOS */
#include "CEpetra_FECrsMatrix_Cpp.hpp"
#include "CEpetra_IntSerialDenseVector_Cpp.hpp"
#include "CEpetra_SerialDenseMatrix_Cpp.hpp"
#ifdef HAVE_CTRILINOS_AZTECOO
#include "CAztecOO_Cpp.hpp"
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
#include "CAztecOO_StatusTest_Cpp.hpp"
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
#include "CAztecOO_StatusTestCombo_Cpp.hpp"
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
#include "CAztecOO_StatusTestMaxIters_Cpp.hpp"
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
#include "CAztecOO_StatusTestResNorm_Cpp.hpp"
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_IFPACK
#include "CIfpack_Cpp.hpp"
#endif /* HAVE_CTRILINOS_IFPACK */
#ifdef HAVE_CTRILINOS_IFPACK
#include "CIfpack_Preconditioner_Cpp.hpp"
#endif /* HAVE_CTRILINOS_IFPACK */

#include "CTrilinos_enums.h"
#include "CTrilinos_utils.hpp"
#include "CTrilinos_utils_templ.hpp"


namespace CTrilinos {


/* isSameObject(generic_id, generic_id) */
bool
isSameObject( CTrilinos_Universal_ID_t id1, CTrilinos_Universal_ID_t id2 );

void
purgeAllTables(  );

/* isSameObject(RCP, RCP) */
template <class T1, class T2>
bool
isSameObject( const Teuchos::RCP<T1> &rcp1, const Teuchos::RCP<T2> &rcp2 )
{
    return (rcp1.shares_resource(rcp2));
}

/* isSameObject(RCP, generic_id) */
template <class T>
bool
isSameObject( const Teuchos::RCP<T> &rcp, CTrilinos_Universal_ID_t id )
{
    bool shares = false;

    if (id.is_const) {
        switch (id.table) {
        case CT_Epetra_Distributor_ID:
            shares = rcp.shares_resource(CEpetra::getConstDistributor(id));
            break;
        case CT_Epetra_SerialComm_ID:
            shares = rcp.shares_resource(CEpetra::getConstSerialComm(id));
            break;
        case CT_Epetra_BLAS_ID:
            shares = rcp.shares_resource(CEpetra::getConstBLAS(id));
            break;
        case CT_Epetra_Comm_ID:
            shares = rcp.shares_resource(CEpetra::getConstComm(id));
            break;
        case CT_Epetra_Operator_ID:
            shares = rcp.shares_resource(CEpetra::getConstOperator(id));
            break;
        case CT_Epetra_MultiVector_ID:
            shares = rcp.shares_resource(CEpetra::getConstMultiVector(id));
            break;
        case CT_Epetra_OffsetIndex_ID:
            shares = rcp.shares_resource(CEpetra::getConstOffsetIndex(id));
            break;
        case CT_Epetra_Object_ID:
            shares = rcp.shares_resource(CEpetra::getConstObject(id));
            break;
        case CT_Epetra_RowMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getConstRowMatrix(id));
            break;
        case CT_Epetra_CompObject_ID:
            shares = rcp.shares_resource(CEpetra::getConstCompObject(id));
            break;
        case CT_Epetra_Directory_ID:
            shares = rcp.shares_resource(CEpetra::getConstDirectory(id));
            break;
        case CT_Epetra_Flops_ID:
            shares = rcp.shares_resource(CEpetra::getConstFlops(id));
            break;
        case CT_Epetra_SrcDistObject_ID:
            shares = rcp.shares_resource(CEpetra::getConstSrcDistObject(id));
            break;
#ifdef HAVE_MPI
        case CT_Epetra_MpiComm_ID:
            shares = rcp.shares_resource(CEpetra::getConstMpiComm(id));
            break;
#endif /* HAVE_MPI */
        case CT_Epetra_CrsMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getConstCrsMatrix(id));
            break;
        case CT_Epetra_CrsGraph_ID:
            shares = rcp.shares_resource(CEpetra::getConstCrsGraph(id));
            break;
        case CT_Epetra_DistObject_ID:
            shares = rcp.shares_resource(CEpetra::getConstDistObject(id));
            break;
        case CT_Epetra_Vector_ID:
            shares = rcp.shares_resource(CEpetra::getConstVector(id));
            break;
        case CT_Epetra_Export_ID:
            shares = rcp.shares_resource(CEpetra::getConstExport(id));
            break;
        case CT_Epetra_Map_ID:
            shares = rcp.shares_resource(CEpetra::getConstMap(id));
            break;
        case CT_Epetra_BlockMap_ID:
            shares = rcp.shares_resource(CEpetra::getConstBlockMap(id));
            break;
        case CT_Epetra_Import_ID:
            shares = rcp.shares_resource(CEpetra::getConstImport(id));
            break;
        case CT_Epetra_Time_ID:
            shares = rcp.shares_resource(CEpetra::getConstTime(id));
            break;
        case CT_Epetra_JadMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getConstJadMatrix(id));
            break;
        case CT_Epetra_LinearProblem_ID:
            shares = rcp.shares_resource(CEpetra::getConstLinearProblem(id));
            break;
        case CT_Epetra_LAPACK_ID:
            shares = rcp.shares_resource(CEpetra::getConstLAPACK(id));
            break;
        case CT_Teuchos_CommandLineProcessor_ID:
            shares = rcp.shares_resource(CTeuchos::getConstCommandLineProcessor(id));
            break;
        case CT_Teuchos_ParameterList_ID:
            shares = rcp.shares_resource(CTeuchos::getConstParameterList(id));
            break;
        case CT_Teuchos_ParameterEntry_ID:
            shares = rcp.shares_resource(CTeuchos::getConstParameterEntry(id));
            break;
        case CT_Teuchos_any_ID:
            shares = rcp.shares_resource(CTeuchos::getConstany(id));
            break;
#ifdef HAVE_CTRILINOS_AMESOS
        case CT_Amesos_BaseSolver_ID:
            shares = rcp.shares_resource(CAmesos::getConstBaseSolver(id));
            break;
#endif /* HAVE_CTRILINOS_AMESOS */
#ifdef HAVE_CTRILINOS_AMESOS
        case CT_Amesos_ID:
            shares = rcp.shares_resource(CAmesos::getConstAmesos(id));
            break;
#endif /* HAVE_CTRILINOS_AMESOS */
        case CT_Epetra_FECrsMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getConstFECrsMatrix(id));
            break;
        case CT_Epetra_IntSerialDenseVector_ID:
            shares = rcp.shares_resource(CEpetra::getConstIntSerialDenseVector(id));
            break;
        case CT_Epetra_SerialDenseMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getConstSerialDenseMatrix(id));
            break;
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_ID:
            shares = rcp.shares_resource(CAztecOO::getConstAztecOO(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_StatusTest_ID:
            shares = rcp.shares_resource(CAztecOO::getConstStatusTest(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_StatusTestCombo_ID:
            shares = rcp.shares_resource(CAztecOO::getConstStatusTestCombo(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_StatusTestMaxIters_ID:
            shares = rcp.shares_resource(CAztecOO::getConstStatusTestMaxIters(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_StatusTestResNorm_ID:
            shares = rcp.shares_resource(CAztecOO::getConstStatusTestResNorm(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_IFPACK
        case CT_Ifpack_ID:
            shares = rcp.shares_resource(CIfpack::getConstIfpack(id));
            break;
#endif /* HAVE_CTRILINOS_IFPACK */
#ifdef HAVE_CTRILINOS_IFPACK
        case CT_Ifpack_Preconditioner_ID:
            shares = rcp.shares_resource(CIfpack::getConstPreconditioner(id));
            break;
#endif /* HAVE_CTRILINOS_IFPACK */
        default:
            break;
        }
    } else {
        switch (id.table) {
        case CT_Epetra_Distributor_ID:
            shares = rcp.shares_resource(CEpetra::getDistributor(id));
            break;
        case CT_Epetra_SerialComm_ID:
            shares = rcp.shares_resource(CEpetra::getSerialComm(id));
            break;
        case CT_Epetra_BLAS_ID:
            shares = rcp.shares_resource(CEpetra::getBLAS(id));
            break;
        case CT_Epetra_Comm_ID:
            shares = rcp.shares_resource(CEpetra::getComm(id));
            break;
        case CT_Epetra_Operator_ID:
            shares = rcp.shares_resource(CEpetra::getOperator(id));
            break;
        case CT_Epetra_MultiVector_ID:
            shares = rcp.shares_resource(CEpetra::getMultiVector(id));
            break;
        case CT_Epetra_OffsetIndex_ID:
            shares = rcp.shares_resource(CEpetra::getOffsetIndex(id));
            break;
        case CT_Epetra_Object_ID:
            shares = rcp.shares_resource(CEpetra::getObject(id));
            break;
        case CT_Epetra_RowMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getRowMatrix(id));
            break;
        case CT_Epetra_CompObject_ID:
            shares = rcp.shares_resource(CEpetra::getCompObject(id));
            break;
        case CT_Epetra_Directory_ID:
            shares = rcp.shares_resource(CEpetra::getDirectory(id));
            break;
        case CT_Epetra_Flops_ID:
            shares = rcp.shares_resource(CEpetra::getFlops(id));
            break;
        case CT_Epetra_SrcDistObject_ID:
            shares = rcp.shares_resource(CEpetra::getSrcDistObject(id));
            break;
#ifdef HAVE_MPI
        case CT_Epetra_MpiComm_ID:
            shares = rcp.shares_resource(CEpetra::getMpiComm(id));
            break;
#endif /* HAVE_MPI */
        case CT_Epetra_CrsMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getCrsMatrix(id));
            break;
        case CT_Epetra_CrsGraph_ID:
            shares = rcp.shares_resource(CEpetra::getCrsGraph(id));
            break;
        case CT_Epetra_DistObject_ID:
            shares = rcp.shares_resource(CEpetra::getDistObject(id));
            break;
        case CT_Epetra_Vector_ID:
            shares = rcp.shares_resource(CEpetra::getVector(id));
            break;
        case CT_Epetra_Export_ID:
            shares = rcp.shares_resource(CEpetra::getExport(id));
            break;
        case CT_Epetra_Map_ID:
            shares = rcp.shares_resource(CEpetra::getMap(id));
            break;
        case CT_Epetra_BlockMap_ID:
            shares = rcp.shares_resource(CEpetra::getBlockMap(id));
            break;
        case CT_Epetra_Import_ID:
            shares = rcp.shares_resource(CEpetra::getImport(id));
            break;
        case CT_Epetra_Time_ID:
            shares = rcp.shares_resource(CEpetra::getTime(id));
            break;
        case CT_Epetra_JadMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getJadMatrix(id));
            break;
        case CT_Epetra_LinearProblem_ID:
            shares = rcp.shares_resource(CEpetra::getLinearProblem(id));
            break;
        case CT_Epetra_LAPACK_ID:
            shares = rcp.shares_resource(CEpetra::getLAPACK(id));
            break;
        case CT_Teuchos_CommandLineProcessor_ID:
            shares = rcp.shares_resource(CTeuchos::getCommandLineProcessor(id));
            break;
        case CT_Teuchos_ParameterList_ID:
            shares = rcp.shares_resource(CTeuchos::getParameterList(id));
            break;
        case CT_Teuchos_ParameterEntry_ID:
            shares = rcp.shares_resource(CTeuchos::getParameterEntry(id));
            break;
        case CT_Teuchos_any_ID:
            shares = rcp.shares_resource(CTeuchos::getany(id));
            break;
#ifdef HAVE_CTRILINOS_AMESOS
        case CT_Amesos_BaseSolver_ID:
            shares = rcp.shares_resource(CAmesos::getBaseSolver(id));
            break;
#endif /* HAVE_CTRILINOS_AMESOS */
#ifdef HAVE_CTRILINOS_AMESOS
        case CT_Amesos_ID:
            shares = rcp.shares_resource(CAmesos::getAmesos(id));
            break;
#endif /* HAVE_CTRILINOS_AMESOS */
        case CT_Epetra_FECrsMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getFECrsMatrix(id));
            break;
        case CT_Epetra_IntSerialDenseVector_ID:
            shares = rcp.shares_resource(CEpetra::getIntSerialDenseVector(id));
            break;
        case CT_Epetra_SerialDenseMatrix_ID:
            shares = rcp.shares_resource(CEpetra::getSerialDenseMatrix(id));
            break;
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_ID:
            shares = rcp.shares_resource(CAztecOO::getAztecOO(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_StatusTest_ID:
            shares = rcp.shares_resource(CAztecOO::getStatusTest(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_StatusTestCombo_ID:
            shares = rcp.shares_resource(CAztecOO::getStatusTestCombo(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_StatusTestMaxIters_ID:
            shares = rcp.shares_resource(CAztecOO::getStatusTestMaxIters(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_AZTECOO
        case CT_AztecOO_StatusTestResNorm_ID:
            shares = rcp.shares_resource(CAztecOO::getStatusTestResNorm(id));
            break;
#endif /* HAVE_CTRILINOS_AZTECOO */
#ifdef HAVE_CTRILINOS_IFPACK
        case CT_Ifpack_ID:
            shares = rcp.shares_resource(CIfpack::getIfpack(id));
            break;
#endif /* HAVE_CTRILINOS_IFPACK */
#ifdef HAVE_CTRILINOS_IFPACK
        case CT_Ifpack_Preconditioner_ID:
            shares = rcp.shares_resource(CIfpack::getPreconditioner(id));
            break;
#endif /* HAVE_CTRILINOS_IFPACK */
        default:
            break;
        }
    }

    return shares;
}

/* isSameObject(RCP, specific_id) */
template <class T, typename S>
bool
isSameObject( const Teuchos::RCP<T> &rcp, S id )
{
    return isSameObject<T>(rcp, abstractType<S>(id));
}

/* isSameObject(specific_id, RCP) */
template <typename S, class T>
bool
isSameObject( S id, const Teuchos::RCP<T> &rcp )
{
    return isSameObject<T>(rcp, abstractType<S>(id));
}

/* isSameObject(specific_id, specific_id) */
template <typename S1, typename S2>
bool
isSameObject( S1 id1, S2 id2 )
{
    CTrilinos_Universal_ID_t id1a = abstractType<S1>(id1);
    CTrilinos_Universal_ID_t id2a = abstractType<S2>(id2);

    return isSameObject(id1a, id2a);
}


} // namespace CTrilinos


#endif