/
copasi.h
177 lines (146 loc) · 4.55 KB
/
copasi.h
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
// Copyright (C) 2019 - 2020 by Pedro Mendes, Rector and Visitors of the
// University of Virginia, University of Heidelberg, and University
// of Connecticut School of Medicine.
// All rights reserved.
// Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc., University of Heidelberg, and University of
// of Connecticut School of Medicine.
// All rights reserved.
// Copyright (C) 2010 - 2016 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc., University of Heidelberg, and The University
// of Manchester.
// All rights reserved.
// Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc., EML Research, gGmbH, University of Heidelberg,
// and The University of Manchester.
// All rights reserved.
// Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc. and EML Research, gGmbH.
// All rights reserved.
// copasi.h
//
// This file contains compatability issues
// (C) Stefan Hoops 2001
//
#ifndef COPASI_copasi
#define COPASI_copasi
#include <sbml/common/libsbml-namespace.h>
#include <sedml/common/libsedml-namespace.h>
LIBSBML_CPP_NAMESPACE_USE
LIBSEDML_CPP_NAMESPACE_USE
#ifdef WIN32
# pragma warning (disable: 4786)
# pragma warning (disable: 4243)
// warning C4355: 'this' : used in base member initializer list
# pragma warning (disable: 4355)
# if _MSC_VER >= 1400
# define _CRT_SECURE_NO_DEPRECATE
// avoid the following warning:
// The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
# pragma warning(disable : 4996)
# endif
#endif // WIN32
#include <assert.h>
#include <fstream>
#include <limits>
#include "copasi/core/CCore.h"
#ifdef min
# undef min
#endif
#ifdef max
# undef max
#endif
#if defined(HAVE_APPLE) || __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 3)
# include <cmath>
using std::isnan;
#endif
#if (defined __GNUC__ && __GNUC__ < 3)
# define ios_base ios
#endif
enum TriLogic
{
TriUnspecified = -1,
TriFalse = 0,
TriTrue = 1
};
/* This is necessary to link with Intel MKL or LAPACK compiled with Intel under Visual C++ 8 */
#if defined COPASI_MAIN && defined _MSC_VER && _MSC_VER > 1200 && defined _DLL && _MSC_VER < 1900
extern "C"
{
FILE _iob[3] = {__iob_func()[0], __iob_func()[1], __iob_func()[2]};
int __argc = 0;
char ** __argv = NULL;
}
#endif
#ifdef COPASI_MAIN
class CRootContainer;
CRootContainer * pRootContainer = NULL;
class QMutex;
QMutex * pCopasiGuiMutex = NULL;
#endif
/* Define Constructor/Destructor Trace */
#ifdef COPASI_DEBUG_TRACE
# include <time.h>
# if !defined(WIN32)
# include <sys/time.h>
# endif
# ifdef COPASI_MAIN
# if !defined(Darwin) && !defined(WIN32)
timeval C_init_time;
unsigned C_INT32 C_last_time = 0;
unsigned C_INT32 C_this_time;
# endif // !Darwin
std::ofstream DebugFile("trace");
# else // not COPASI_MAIN
# include <fstream>
# if !defined(Darwin) && !defined(WIN32)
extern timeval C_init_time;
extern unsigned C_INT32 C_last_time;
extern unsigned C_INT32 C_this_time;
# endif // !Darwin
extern std::ofstream DebugFile;
# endif // COPASI_MAIN
# if !defined(Darwin) && !defined(WIN32)
# include <iostream>
# define TIME_TRACE(f, l) {\
gettimeofday(&C_init_time, NULL); \
C_this_time = C_init_time.tv_sec * 1000 + C_init_time.tv_usec; \
DebugFile << f <<"(" << l << "):\t" << C_this_time - C_last_time << std::endl; \
C_last_time = C_this_time;\
}
# endif // !Darwin
# if (defined COPASI_TRACE_CONSTRUCTION)
# include <typeinfo>
# define CONSTRUCTOR_TRACE \
{DebugFile << "Construct:\t" << typeid(*this).name() \
<< "\tAddress:\t" << (void *) this << std::endl;}
# define DESTRUCTOR_TRACE \
{DebugFile << "Destruct:\t" << typeid(*this).name() \
<< "\tAddress:\t" << (void *) this << std::endl;}
# endif // COPASI_TRACE_CONSTRUCTION
# define DEBUG_OUT(s) {DebugFile << (s) << std::endl;}
#else
# if !defined (NDEBUG) && !defined (_DEBUG)
# define NDEBUG
# endif // !defined (NDEBUG) && !defined (_DEBUG)
# define DEBUG_OUT(s)
#endif // COPASI_DEBUG_TRACE
#ifndef CONSTRUCTOR_TRACE
# define CONSTRUCTOR_TRACE
#endif
#ifndef DESTRUCTOR_TRACE
# define DESTRUCTOR_TRACE
#endif
#ifndef TIME_TRACE
# define TIME_TRACE(f, l)
#endif
// protected free
#define pfree(p) {if (p) {free(p); p = NULL;}}
#define pdelete(p) {if (p) {delete p; p = NULL;}}
#define pdeletev(p) {if (p) {delete[] p; p = NULL;}}
#define pcleanup(p) {if (p) {p->cleanup(); delete p; p = NULL;}}
// suppress unused parameter warnings
#define C_UNUSED(p)
#define COPASI_DEPRECATED
#define NOMINMAX
#endif // COPASI_copasi