LILAC
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
defs.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2014, Sam Schetterer, Nathan Kutz, University of Washington
3 Authors: Sam Schetterer
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 
10 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11 
12 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 
16 */
17 #ifndef DEF_H
18 #define DEF_H
19 #ifdef CLANG
20 //this allows Eigen to compile under -Wall
21 #pragma clang diagnostic ignored "-Wdeprecated-register"
22 //Not every function uses the full interface
23 #pragma clang diagnostic ignored "-Wunused-parameter"
24 #endif
25 #include <complex>
26 #include <cstdlib>
27 #include <iostream>
28 #include <string>
29 #include <vector>
30 #include <memory>
31 //some commands to help with effeciency
32 #ifdef ICC
33 #define restr restrict
34 #define ALIGNED(x) __assume_aligned(x, 16)
35 #define MAKE_ALIGNED __declspec(align(16))
36 #define PREDICT(x, val) __builtin_expect(x, val)
37 #endif
38 
39 #ifdef CLANG
40 #define restr __restrict__
41 #define ALIGNED(x)
42 #define PREDICT(x, val) x
43 #define MAKE_ALIGNED alignas(16)
44 #endif
45 
46 #ifdef GCC
47 #define restr __restrict__
48 #define ALIGNED(x)
49 #define PREDICT(x, val) __builtin_expect(x, val)
50 #define MAKE_ALIGNED
51 #define alignas(x)
52 #endif
53 class item;
54 typedef std::complex<double> comp;
55 const static comp Id = comp(0, 1);
56 //#define NUM_TIME_STEPS (256) //number of time points
57 //#define LENGTH_T (60) //length of t-domain
58 //parameters taken from matlab main file
59 //can move to input parameters as well
60 //but for now these are defines
61 constexpr double D =-.4;
62 constexpr double K =(.1);
63 constexpr double A =(2.0/3.0);
64 constexpr double B =(1.0/3.0); //need to find a real value for this
65 constexpr double tau= (.1);
66 constexpr double Gamma= (.1);
67 constexpr double RTlength= (1.5);
68 constexpr double PI =(3.14159);
69 class item;
70 class _fatal{
71  public:
72  _fatal(){};
73 };
74 class _warning{
75  public:
76  _warning(){};
77 };
78 const static _fatal FATAL_ERROR;
79 const static _warning WARNING;
80 void err(std::string message, std::string function, std::string file, _fatal f);
81 void err(std::string message, std::string function, std::string file, _warning w);
82 void err(std::string message, std::string function, std::string file, const item* p, _fatal f);
83 void err(std::string message, std::string function, std::string file, const item* p, _warning f);
84 void err(std::string message, std::string function, std::string file, std::shared_ptr<item> p, _fatal f);
85 void err(std::string message, std::string function, std::string file, std::shared_ptr<item> p, _warning f);
86 
87 
88 void trim(std::string& curline, const std::string& val = "\n\r\t ");
89 void ltoken(std::string& tok, std::string& str, std::string delim=" ");
91 #endif