DOLFIN
DOLFIN C++ interface
GlobalParameters.h
1// Copyright (C) 2009-2011 Anders Logg
2//
3// This file is part of DOLFIN.
4//
5// DOLFIN is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// DOLFIN is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17//
18// Modified by Fredrik Valdmanis, 2011
19//
20// First added: 2009-07-02
21// Last changed: 2013-06-21
22
23#ifndef __GLOBAL_PARAMETERS_H
24#define __GLOBAL_PARAMETERS_H
25
26#include "Parameters.h"
27#include <dolfin/la/KrylovSolver.h>
28#include <dolfin/la/LUSolver.h>
29
30namespace dolfin
31{
32
34
36 {
37 public:
38
41
43 virtual ~GlobalParameters();
44
46 virtual void parse(int argc, char* argv[]);
47
50 {
51 Parameters p("dolfin");
52
53 //-- General
54
55 // Prefix for timer tasks
56 p.add("timer_prefix", "");
57
58 // Allow extrapolation in function interpolation
59 p.add("allow_extrapolation", false);
60
61 //-- Input
62
63 // Warn if reading large XML files in parallel (MB)
64 p.add("warn_on_xml_file_size", 100);
65
66 //-- Output
67
68 // Print standard output on all processes
69 p.add("std_out_all_processes", true);
70
71 // Line width relative to edge length in SVG output
72 p.add("relative_line_width", 0.025);
73
74 // Print the level of thread support provided by the MPI library
75 p.add("print_mpi_thread_support_level", false);
76
77 //-- dof ordering
78
79 // DOF reordering when running in serial
80 p.add("reorder_dofs_serial", true);
81
82 // Add dof ordering library
83 std::string default_dof_ordering_library = "Boost";
84 #ifdef HAS_SCOTCH
85 default_dof_ordering_library = "SCOTCH";
86 #endif
87 p.add("dof_ordering_library", default_dof_ordering_library,
88 {"Boost", "random", "SCOTCH"});
89
90 //-- Meshes
91
92 // Mesh ghosting type
93 p.add("ghost_mode", "none",
94 {"shared_facet", "shared_vertex", "none"});
95
96 // Mesh ordering via SCOTCH and GPS
97 p.add("reorder_cells_gps", false);
98 p.add("reorder_vertices_gps", false);
99
100 // Set default graph/mesh partitioner
101 std::string default_mesh_partitioner = "SCOTCH";
102 #ifdef HAS_PARMETIS
103 #ifndef HAS_SCOTCH
104 default_mesh_partitioner = "ParMETIS";
105 #endif
106 #endif
107 p.add("mesh_partitioner", default_mesh_partitioner,
108 {"ParMETIS", "SCOTCH", "None"});
109
110 // Approaches to partitioning (following Zoltan syntax)
111 // but applies to ParMETIS
112 p.add("partitioning_approach", "PARTITION",
113 {"PARTITION", "REPARTITION", "REFINE"});
114
115 #ifdef HAS_PARMETIS
116 // Repartitioning parameter, determines how strongly to hold on
117 // to cells when shifting between processes
118 p.add("ParMETIS_repartitioning_weight", 1000.0);
119 #endif
120
121 // Mesh refinement
122 p.add("refinement_algorithm", "plaza",
123 {"regular_cut", "plaza", "plaza_with_parent_facets"});
124
125 //-- Graphs
126
127 // Graph coloring
128 std::set<std::string> allowed_coloring_libraries;
129 allowed_coloring_libraries.insert("Boost");
130 #ifdef HAS_TRILINOS
131 allowed_coloring_libraries.insert("Zoltan");
132 #endif
133 p.add("graph_coloring_library", "Boost", allowed_coloring_libraries);
134
135 //-- Linear algebra
136
137 // Linear algebra backend
138 std::string default_backend = "Eigen";
139 std::set<std::string> allowed_backends = {"Eigen"};
140 #ifdef HAS_PETSC
141 allowed_backends.insert("PETSc");
142 default_backend = "PETSc";
143 p.add("use_petsc_signal_handler", false);
144 #endif
145 #ifdef HAS_TRILINOS
146 allowed_backends.insert("Tpetra");
147 #ifndef HAS_PETSC
148 default_backend = "Tpetra";
149 #endif
150 #endif
151
152 p.add("linear_algebra_backend",
153 default_backend,
154 allowed_backends);
155
156 // Add nested parameter sets
159
160 return p;
161 }
162
163 };
164
166 extern GlobalParameters parameters;
167
168}
169
170#endif
This class defines the global DOLFIN parameter database.
Definition: GlobalParameters.h:36
GlobalParameters()
Constructor.
Definition: GlobalParameters.cpp:35
static Parameters default_parameters()
Default parameter values.
Definition: GlobalParameters.h:49
virtual ~GlobalParameters()
Destructor.
Definition: GlobalParameters.cpp:77
virtual void parse(int argc, char *argv[])
Parse parameters from command-line.
Definition: GlobalParameters.cpp:82
static Parameters default_parameters()
Default parameter values.
Definition: KrylovSolver.cpp:32
static Parameters default_parameters()
Default parameter values.
Definition: LUSolver.h:68
Definition: Parameters.h:95
void add(std::string key)
Definition: Parameters.h:128
Definition: adapt.h:30
GlobalParameters parameters
The global parameter database.
Definition: GlobalParameters.cpp:32