global_options.hpp
1 /*
2  * This file is part of CasADi.
3  *
4  * CasADi -- A symbolic framework for dynamic optimization.
5  * Copyright (C) 2010-2023 Joel Andersson, Joris Gillis, Moritz Diehl,
6  * KU Leuven. All rights reserved.
7  * Copyright (C) 2011-2014 Greg Horn
8  *
9  * CasADi is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 3 of the License, or (at your option) any later version.
13  *
14  * CasADi is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with CasADi; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 
26 #ifndef CASADI_GLOBAL_OPTIONS_HPP
27 #define CASADI_GLOBAL_OPTIONS_HPP
28 
29 #include <fstream>
30 #include <iostream>
31 
32 #include "casadi/core/casadi_common.hpp"
33 #include <casadi/core/casadi_export.h>
34 
35 namespace casadi {
36 
48  class CASADI_EXPORT GlobalOptions {
49  private:
51  GlobalOptions();
52  public:
53 
54 #ifndef SWIG
61  static bool simplification_on_the_fly;
62 
63  static std::string casadipath;
64 
65  static std::string casadi_include_path;
66 
67  static bool hierarchical_sparsity;
68 
69  static casadi_int max_num_dir;
70 
71  static casadi_int start_index;
72 
73  static bool julia_initialized;
74 
75  static casadi_int copy_elision_min_size;
76 
77  static std::string temp_work_dir; // Temporary work directory
78 
102  static int numpy_mode;
103 
104 #endif //SWIG
105  // Setter and getter for simplification_on_the_fly
106  static void setSimplificationOnTheFly(bool flag) { simplification_on_the_fly = flag; }
107  static bool getSimplificationOnTheFly() { return simplification_on_the_fly; }
108 
109  // Setter and getter for hierarchical_sparsity
110  static void setHierarchicalSparsity(bool flag) { hierarchical_sparsity = flag; }
111  static bool getHierarchicalSparsity() { return hierarchical_sparsity; }
112 
113  static void setCasadiPath(const std::string & path) { casadipath = path; }
114  static std::string getCasadiPath() { return casadipath; }
115 
116  static void setCasadiIncludePath(const std::string & path) { casadi_include_path = path; }
117  static std::string getCasadiIncludePath() { return casadi_include_path; }
118 
119  static void setMaxNumDir(casadi_int ndir) { max_num_dir=ndir; }
120  static casadi_int getMaxNumDir() { return max_num_dir; }
121 
122  static void setCopyElisionMinSize(casadi_int sz) {
123  copy_elision_min_size=sz;
124  if (copy_elision_min_size!=-1 && copy_elision_min_size<2) {
125  copy_elision_min_size = 2;
126  }
127  }
128  static casadi_int getCopyElisionMinSize() { return copy_elision_min_size; }
129 
130  static void setTempWorkDir(const std::string& dir);
131  static std::string getTempWorkDir() { return temp_work_dir; }
132 
141  static void setNumpyMode(int mode) { numpy_mode = mode; }
142 
146  static int getNumpyMode() { return numpy_mode; }
147 
148  static void setDefaultBlas(const std::string& name);
149  static std::string getDefaultBlas();
150 
151  };
152 
153 } // namespace casadi
154 
155 #endif // CASADI_GLOBAL_OPTIONS_HPP
Collects global CasADi options.
static bool getHierarchicalSparsity()
static std::string getCasadiIncludePath()
static std::string getCasadiPath()
static void setCasadiPath(const std::string &path)
static void setTempWorkDir(const std::string &dir)
static void setCasadiIncludePath(const std::string &path)
static void setNumpyMode(int mode)
Set the numpy interop mode (issue #2959): 1 = casadi-aware.
static std::string getDefaultBlas()
static void setSimplificationOnTheFly(bool flag)
static void setCopyElisionMinSize(casadi_int sz)
static std::string getTempWorkDir()
static void setDefaultBlas(const std::string &name)
static void setHierarchicalSparsity(bool flag)
static casadi_int getCopyElisionMinSize()
static casadi_int getMaxNumDir()
static int getNumpyMode()
Get the current numpy interop mode. See setNumpyMode.
static bool getSimplificationOnTheFly()
static void setMaxNumDir(casadi_int ndir)
The casadi namespace.
Definition: archiver.hpp:32