Skip to content

Commit 1bd4200

Browse files
committed
Work towards VSRC2013 compilation.
1 parent 25e6615 commit 1bd4200

File tree

10 files changed

+9
-107
lines changed

10 files changed

+9
-107
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ project(hermes)
265265
# This overrides CXX flags for MSVC
266266
if(MSVC)
267267
if(WIN64)
268-
set(MSVC_DEFINES "/DWIN64 /D_WINDOWS /Dpopen=_popen /Dpclose=_pclose /D__value=_value /Dfinite=_finite /Dhypot=_hypot /Disatty=_isatty /Dfileno=_fileno /D_CRT_SECURE_NO_WARNINGS /DYY_NO_UNISTD_H /D_USE_MATH_DEFINES /DIMPLEMENT_C99 /wd4275 /wd4251")
268+
set(MSVC_DEFINES "/DWIN64 /D_WINDOWS /Dfinite=_finite /wd4275 /wd4251")
269269
else(WIN64)
270-
set(MSVC_DEFINES "/DWIN32 /D_WINDOWS /Dpopen=_popen /Dpclose=_pclose /D__value=_value /Dfinite=_finite /Dhypot=_hypot /Disatty=_isatty /Dfileno=_fileno /D_CRT_SECURE_NO_WARNINGS /DYY_NO_UNISTD_H /D_USE_MATH_DEFINES /DIMPLEMENT_C99 /wd4275 /wd4251")
270+
set(MSVC_DEFINES "/DWIN32 /D_WINDOWS /Dfinite=_finite /wd4275 /wd4251")
271271
endif(WIN64)
272272
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Ob2 /MDd /Zi ${MSVC_DEFINES}")
273273
set(HERMES_DEBUG_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")

hermes2d/src/solver/linear_solver.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ namespace Hermes
101101
{
102102
this->info("\tLinearSolver: reusing Matrix, assembling RHS.");
103103
this->dp->assemble(coeff_vec, this->get_residual());
104-
this->linear_matrix_solver->set_reuse_scheme(HERMES_REUSE_MATRIX_STRUCTURE_COMPLETELY);
104+
this->linear_matrix_solver->set_reuse_scheme(Hermes::Solvers::HERMES_REUSE_MATRIX_STRUCTURE_COMPLETELY);
105105
}
106106
else
107107
{
@@ -110,7 +110,7 @@ namespace Hermes
110110
else
111111
this->info("\tLinearSolver: calculating the Matrix.");
112112
this->dp->assemble(coeff_vec, this->get_jacobian(), this->get_residual());
113-
this->linear_matrix_solver->set_reuse_scheme(HERMES_CREATE_STRUCTURE_FROM_SCRATCH);
113+
this->linear_matrix_solver->set_reuse_scheme(Hermes::Solvers::HERMES_CREATE_STRUCTURE_FROM_SCRATCH);
114114
}
115115

116116
this->process_matrix_output(this->get_jacobian(), 1);

hermes2d/test_examples/03-navier-stokes/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ int main(int argc, char* argv[])
162162
coeff_vec, Hermes::vector<NormType>(vel_proj_norm, vel_proj_norm, p_proj_norm));
163163

164164
newton.set_max_allowed_iterations(max_allowed_iterations);
165-
newton.set_tolerance(NEWTON_TOL, ResidualNormAbsolute);
165+
newton.set_tolerance(NEWTON_TOL, Hermes::Solvers::ResidualNormAbsolute);
166166
newton.set_sufficient_improvement_factor_jacobian(1e-2);
167167
//newton.set_jacobian_constant();
168168

hermes2d/test_examples/08-nonlinearity/main.cpp

+1-17
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
6868

6969
// Initialize Newton solver.
7070
NewtonSolver<double> newton(&dp);
71-
newton.set_tolerance(NEWTON_TOL, ResidualNormAbsolute);
71+
newton.set_tolerance(NEWTON_TOL, Hermes::Solvers::ResidualNormAbsolute);
7272
newton.set_max_allowed_residual_norm(1e99);
7373
newton.set_max_allowed_iterations(NEWTON_MAX_ITER);
7474

@@ -89,22 +89,6 @@ int main(int argc, char* argv[])
8989
{
9090
newton.solve(coeff_vec);
9191
}
92-
catch(Hermes::Exceptions::NonlinearException& e)
93-
{
94-
switch(e.get_exception_state())
95-
{
96-
case AboveMaxIterations:
97-
std::cout << std::endl << "\t\t\tAboveMaxIterations" << std::endl;
98-
break;
99-
case BelowMinDampingCoeff:
100-
std::cout << std::endl << "\t\t\tBelowMinDampingCoeff" << std::endl;
101-
break;
102-
case AboveMaxAllowedResidualNorm:
103-
std::cout << std::endl << "\t\t\tAboveMaxAllowedResidualNorm" << std::endl;
104-
break;
105-
}
106-
}
107-
10892
catch(std::exception& e)
10993
{
11094
std::cout << e.what();

hermes2d/test_examples/12-picard/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ int main(int argc, char* argv[])
8787
picard.use_Anderson_acceleration(false);
8888

8989
// Perform the Picard's iteration (Anderson acceleration on by default).
90-
picard.set_tolerance(1e-7, SolutionChangeRelative);
90+
picard.set_tolerance(1e-7, Hermes::Solvers::SolutionChangeRelative);
9191
picard.set_max_allowed_iterations(PICARD_MAX_ITER);
9292
picard.set_num_last_vector_used(PICARD_NUM_LAST_ITER_USED);
9393
picard.set_anderson_beta(PICARD_ANDERSON_BETA);

hermes_common/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ project(hermes_common)
3333
src/algebra/cs_matrix.cpp
3434
src/util/callstack.cpp
3535
src/util/qsort.cpp
36-
src/util/c99_functions.cpp
3736
src/data_structures/range.cpp
3837
src/data_structures/table.cpp
3938
src/solvers/matrix_solver.cpp
@@ -63,7 +62,6 @@ project(hermes_common)
6362
include/ord.h
6463
include/hermes_function.h
6564
include/exceptions.h
66-
include/util/c99_functions.h
6765
include/util/compat.h
6866
include/util/callstack.h
6967
include/util/qsort.h
@@ -142,7 +140,6 @@ project(hermes_common)
142140
"Source Files\\Utilities" FILES
143141
src/util/callstack.cpp
144142
src/util/qsort.cpp
145-
src/util/c99_functions.cpp
146143
)
147144

148145
SOURCE_GROUP(
@@ -191,7 +188,6 @@ project(hermes_common)
191188

192189
SOURCE_GROUP(
193190
"Header Files\\Utilities" FILES
194-
include/util/c99_functions.h
195191
include/util/compat.h
196192
include/util/callstack.h
197193
include/util/qsort.h

hermes_common/include/hermes_function.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ namespace Hermes
3434
/// {
3535
///&nbsp;/// Constructor.
3636
///&nbsp;MyRealSinSquared() : Hermes1DFunction<double>() {}
37-
///&nbsp;double value(double x) const { return std::sin(x) * std::sin(x); }
38-
///&nbsp;Ord ord(Hermes::Ord x) const { return std::sin(x) * std::sin(x); // Hermes::Ord arithmetics will take care of everything, the resulting order will be as high as possible, see other examples in this file for another possibility how to go about it. }
37+
///&nbsp;double value(double x) const { return sin(x) * sin(x); }
38+
///&nbsp;Ord ord(Hermes::Ord x) const { return sin(x) * sin(x); // Hermes::Ord arithmetics will take care of everything, the resulting order will be as high as possible, see other examples in this file for another possibility how to go about it. }
3939
///&nbsp;....
4040
/// }
4141
template<typename Scalar>

hermes_common/include/util/c99_functions.h

-40
This file was deleted.

hermes_common/include/util/compat.h

-11
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,6 @@ FILE *fmemopen (void *buf, size_t size, const char *opentype);
7070
#define strcasecmp strcmp
7171
#endif
7272

73-
//C99 functions
74-
#include "util/c99_functions.h"
75-
76-
// Microsoft does not recognize long double and handles it just like double.
77-
#ifdef _MSC_VER
78-
#ifdef strtold
79-
#undef strtold
80-
#endif
81-
#define strtold strtod
82-
#endif
83-
8473
#ifdef __GNUC__
8574
#define NORETURN __attribute__((noreturn))
8675
#else

hermes_common/src/util/c99_functions.cpp

-27
This file was deleted.

0 commit comments

Comments
 (0)