IFPACK Development
Loading...
Searching...
No Matches
Ifpack_ConfigDefs.h
1/*@HEADER
2// ***********************************************************************
3//
4// Ifpack: Object-Oriented Algebraic Preconditioner Package
5// Copyright (2002) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38//
39// ***********************************************************************
40//@HEADER
41*/
42
43#ifndef _IFPACK_CONFIGDEFS_H_
44#define _IFPACK_CONFIGDEFS_H_
45
46#if defined(Ifpack_SHOW_DEPRECATED_WARNINGS)
47#ifdef __GNUC__
48#warning "The Ifpack package is deprecated"
49#endif
50#endif
51
52/*
53 * The macros PACKAGE, PACKAGE_NAME, etc, get defined for each package and need to
54 * be undef'd here to avoid warnings when this file is included from another package.
55 * KL 11/25/02
56 */
57#ifdef PACKAGE
58#undef PACKAGE
59#endif
60
61#ifdef PACKAGE_NAME
62#undef PACKAGE_NAME
63#endif
64
65#ifdef PACKAGE_BUGREPORT
66#undef PACKAGE_BUGREPORT
67#endif
68
69#ifdef PACKAGE_STRING
70#undef PACKAGE_STRING
71#endif
72
73#ifdef PACKAGE_TARNAME
74#undef PACKAGE_TARNAME
75#endif
76
77#ifdef PACKAGE_VERSION
78#undef PACKAGE_VERSION
79#endif
80
81#ifdef VERSION
82#undef VERSION
83#endif
84
85#include <Ifpack_config.h>
86
87#ifdef PACKAGE
88#undef PACKAGE
89#endif
90
91#ifdef PACKAGE_NAME
92#undef PACKAGE_NAME
93#endif
94
95#ifdef PACKAGE_BUGREPORT
96#undef PACKAGE_BUGREPORT
97#endif
98
99#ifdef PACKAGE_STRING
100#undef PACKAGE_STRING
101#endif
102
103#ifdef PACKAGE_TARNAME
104#undef PACKAGE_TARNAME
105#endif
106
107#ifdef PACKAGE_VERSION
108#undef PACKAGE_VERSION
109#endif
110
111#ifdef VERSION
112#undef VERSION
113#endif
114
115#ifdef HAVE_MPI
116
117#ifndef EPETRA_MPI
118#define EPETRA_MPI
119#endif
120
121#endif
122
123#include <cstdio>
124#include <string>
125#include <iostream>
126#include <algorithm>
127#include <vector>
128
129// prints out an error message if variable is not zero,
130// and returns this value.
131#define IFPACK_CHK_ERR(ifpack_err) \
132{ if (ifpack_err < 0) { \
133 std::cerr << "IFPACK ERROR " << ifpack_err << ", " \
134 << __FILE__ << ", line " << __LINE__ << std::endl; \
135 return(ifpack_err); } }
136
137// prints out an error message if variable is not zero,
138// and returns void
139#define IFPACK_CHK_ERRV(ifpack_err) \
140{ if (ifpack_err < 0) { \
141 std::cerr << "IFPACK ERROR " << ifpack_err << ", " \
142 << __FILE__ << ", line " << __LINE__ << std::endl; \
143 return; } }
144// prints out an error message if variable is not zero,
145// and returns false
146#define IFPACK_CHK_ERRB(ifpack_err) \
147{ if (ifpack_err < 0) { \
148 std::cerr << "IFPACK ERROR " << ifpack_err << ", " \
149 << __FILE__ << ", line " << __LINE__ << std::endl; \
150 return false; } }
151// prints out an error message and returns
152#define IFPACK_RETURN(ifpack_err) \
153{ if (ifpack_err < 0) { \
154 std::cerr << "IFPACK ERROR " << ifpack_err << ", " \
155 << __FILE__ << ", line " << __LINE__ << std::endl; \
156 } return(ifpack_err); }
157// prints out an error message if its *global* variable is not zero,
158// and returns this *global* value.
159#define IFPACK_CHK_GLOBAL_ERR(ifpack_err) \
160{ int local_err = ifpack_err; \
161 int global_min_err = 0; \
162 Comm().MinAll(&local_err, &global_min_err, 1); \
163 if (global_min_err < 0) { \
164 return global_min_err; \
165 } }
166
167#define IFPACK_SGN(x) (((x) < 0.0) ? -1.0 : 1.0) /* sign function */
168#define IFPACK_ABS(x) (((x) > 0.0) ? (x) : (-x)) /* abs function */
169
170#endif /*_IFPACK_CONFIGDEFS_H_*/