Skip to content

Commit

Permalink
trunk:
Browse files Browse the repository at this point in the history
* Refresh "Development How-To" section in documentation, move after "Manual" in navtree, refresh style guide info, remove superfluous page. [base]
* Including math.h instead of cmath is no longer necessary. [base, combigrid, datadriven, pde, scons]
* Try to fix some Windows warnings. [base, datadriven]

git-svn-id: https://ipvs.informatik.uni-stuttgart.de/SGpp/repos/trunk@5332 4eea3252-f0fb-4393-894d-40516dce545b
  • Loading branch information
valentjn committed Dec 9, 2015
1 parent 7dae048 commit 83e51ce
Show file tree
Hide file tree
Showing 24 changed files with 124 additions and 143 deletions.
151 changes: 98 additions & 53 deletions base/doc/doxygen/development.doxy
Original file line number Diff line number Diff line change
@@ -1,82 +1,127 @@
/**
@page development Developer How-Tos
@page development Development How-To

<div width=60% align=center style="color:#FF0000;">All code has to be documented in such a way that functions,
classes and all other entities appearing in this documentation are easily understandable
for @e all other developers.</div>
On this page, we describe best coding practices for SG++.

<div style="max-width:40em; padding:1em; margin:1em auto; color:red;">
All code has to be documented in such a way that functions,
classes, and all other entities appearing in this documentation are easily understandable
for @e all other developers.
</div>



<!-- ############################################################# -->
@section development__overview Overview
- @ref development__unittests (this page)
- @ref development__doxygen (this page)
- @ref development__windows (this page)
- @subpage styleguide
@section development_overview Overview
- @ref development_testing
- @ref development_doxygen
- @ref development_styleguide



<!-- ############################################################# -->
@section development__unittests Testing
@section development_testing Testing

We have both Python unit tests and unit test based on @c BOOST. They can be found
in the test subdirectory of each module. The @c BOOST unit tests are preferrably
to be used. However, there is some extra functionality in Python which
We have both Boost unit tests (in C++) and Python unit tests.
The tests can be found in the test subdirectory of each module.
New tests should be written preferably with Boost.
However, there is some extra functionality in Python which
can be tested only in Python, of course.

If you modify existing code, do not forget
to make sure that no new errors are introduced. If you write new
functionalities, do @em always add unit tests for each functionality!



<!-- ############################################################# -->
@section development__doxygen Doxygen
@section development_doxygen Doxygen

The documentation has to be Doxygen compatible. Doxygen
tags must be used in the Java-style way, i.e. starting with \@.
The documentation has to be Doxygen compatible.
Doxygen tags must be used in the Java-style way, i.e.,
starting with <tt>\@</tt>.

During development tags like \@todo should be used wherever applicable. They
are then listed on the @link todo ToDo@endlink-page.
During development tags like <tt>\@todo</tt> should be used wherever applicable.
They are then listed on the @ref todo "Todo page".

Different source files can be grouped together in so-called modules. The
link to the page listing all modules can be found in the navigation
bar of the documentation.
Different source files can be grouped together in so-called modules.
The link to the @ref modules "page listing all modules"
can be found in the navigation bar of the documentation.
Note that this page and the @ref examples "page listing all examples"
are autogenerated when running SCons.

Please correct any warnings or errors that appear when creating the
documentation with doxygen!
documentation with Doxygen!

@sa <a href="http://www.stack.nl/~dimitri/doxygen/manual.html"
target="_blank">Doxygen manual</a>
@sa <a href="http://www.stack.nl/~dimitri/doxygen/docblocks.html"
target="_blank">Documenting the code with Doxygen</a>
@sa <a href="http://www.stack.nl/~dimitri/doxygen/commands.html"
target="_blank">Special Doxygen commands</a>

@subsection development_doxygen_usage Usage

Executing <tt>doxygen</tt> in the main folder creates the
Doxygen documentation in the subfolder <tt>doc</tt>.
The settings for Doxygen are taken from <tt>Doxyfile</tt>.
This file is automatically created based on <tt>Doxyfile_template</tt>
each time @c scons is exectued,
therefore, for modifications, please change <tt>Doxyfile_template</tt> instead.

@sa Doxygen Manual http://www.stack.nl/~dimitri/doxygen/manual.html
@sa Documenting the code http://www.stack.nl/~dimitri/doxygen/docblocks.html
@sa Special Commands http://www.stack.nl/~dimitri/doxygen/commands.html


<!-- ############################################################# -->
@section development__windows Windows compatibility issues

- \b externals: external variables have been used to specify singletons
in some SG++ packages (base, optimization). To make the declaration
and platform independent one needs to add a preprocessor directive,
which distinguishes if one tries to build a static or a dynamic
library. In <tt>ClenshawCurtisTable.hpp</tt> this looks like
@verbatim
#if defined _WIN32 && !defined _USE_STATICLIB
extern __declspec(dllimport) ClenshawCurtisTable clenshawCurtisTable;
#else
extern ClenshawCurtisTable clenshawCurtisTable;
#endif
@endverbatim

-\b cmath: the cplusplus way to use constants like <tt>M_PI</tt> is to include
the <tt>cmath</tt> header. Well, this does not work on windows. To
access them you need to include the old <tt>math.h</tt> header and
define the additional symbol <tt>_D_MATH_DEFINES</tt>. The latter
part is done by scons automatically.

<!-- ============================================================= -->
@subsection development__doxygen__howto How to run, use and customize
@section development_styleguide Style Guide

Compliance with the style guide is important to write good code.
A style guide is more than a bunch of indentation rules;
rather, it is the art of creating easily reusable, understandable, and
refactorable code.

@subsection development_styleguide_comments Comments

The complete code has to be commented elaborately.
The comments, together with the identifiers, have to enable others to
familiarize with the code quickly.
Header files have to be commented completely.
In source files, it suffices to comment the codelines.
The comments have to be verbose enough so that one can understand what is
going on without reading the code!
Please use Doxygen-compatible comments for classes and methods.

@subsection development_styleguide_style Style

We adhere mostly to the
<a href="https://google.github.io/styleguide/cppguide.html" target="_blank">
Google C++ Style Guide</a>.
However, there are some exceptions, e.g.,
the indentation of namespaces.
The SG++ code style is defined by a set of
<a href="http://astyle.sourceforge.net/" target="_blank">astyle</a>
parameters.
It can be found in the file <tt>tools/astylerc</tt>.

@subsection development_styleguide_naming Naming

Naming:
- Directories: all lowercase, underscore separated
(e.g., <tt>test_problem</tt>)
- Classes: camel case starting uppercase
(e.g., <tt>GridStorage</tt>)
- Functions, Methods, Variables: camel case starting lowercase
(e.g., <tt>getLevel</tt>)
- Constants, Defines: all uppercase, underscore separated
(e.g., <tt>INITIAL_LEVEL</tt>)
- Nothing starts with underscores (only system/builtin/compiler).

Don't&hellip;
- &hellip; include <tt>sgpp_MODULENAME.hpp</tt>.
Only include the header files you require to avoid long building durations.
- &hellip; use <tt>using namespace</tt>.
- &hellip; use tabs, use two spaces instead!
Please configure your editor in order to do so!

Executing <tt>doxygen</tt> in the main folder creates the
Doxygen-documentation in the subfolder <tt>doc</tt>. The settings
for Doxygen are automatically taken from the file
<tt>Doxyfile</tt>. It is automatically created based on @c Doxyfile.template
each time @c scons is exectued.
*/

*/
4 changes: 2 additions & 2 deletions base/doc/doxygen/mainpage.doxy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Welcome to the SG++ documentation.<br/>
The current version of SG++ can be found at @subpage downloads.

<div style="border-style:double; width:40em; padding:1em; margin:1em auto;">
<div style="border-style:double; max-width:40em; padding:1em; margin:1em auto;">
If you use any part of the software or any resource of this webpage and/or
documentation, you implicitly accept the copyright (see the \ref copyright).
This includes that you have to cite one of the papers dealing
Expand Down Expand Up @@ -74,8 +74,8 @@ You can find these pages and more in the menu to the left. If you do not see a m
Though we do not guarantee for anything, and though we do not have the money to provide quick and fast support, we are happy about any comments, recommendations, hints on missing information, ...

See also:
- @subpage development
- @subpage manual
- @subpage development
- @subpage copyright
- @ref downloads
- Online version of this documentation at http://sgpp.sparsegrids.org
Expand Down
64 changes: 0 additions & 64 deletions base/doc/doxygen/styleguide.doxy

This file was deleted.

2 changes: 1 addition & 1 deletion base/examples/predictive_ANOVArefinement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// sgpp.sparsegrids.org

#include <iostream>
#include <math.h>
#include <cmath>
// All SG++ headers
//#include <sgpp_base.hpp>

Expand Down
2 changes: 1 addition & 1 deletion base/examples/predictive_refinement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// sgpp.sparsegrids.org

#include <iostream>
#include <math.h>
#include <cmath>
// All SG++ headers
//#include <sgpp_base.hpp>

Expand Down
3 changes: 2 additions & 1 deletion base/src/sgpp/base/application/ScreenOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ namespace SGPP {
GetConsoleScreenBufferInfo(hCon, &info);

if (!first_run) {
pos.Y = static_cast<SHORT>(info.dwCursorPosition.Y) - 3;
pos.Y = static_cast<SHORT>(info.dwCursorPosition.Y) -
static_cast<SHORT>(3);
pos.X = 0;
SetConsoleCursorPosition(hCon, pos);
} else {
Expand Down
2 changes: 1 addition & 1 deletion base/src/sgpp/base/grid/common/Stretching.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define LOOKUPMAX 11

#include <cstddef>
#include <math.h>
#include <cmath>
#include <string>
#include <iostream>
#include <fstream>
Expand Down
2 changes: 1 addition & 1 deletion base/src/sgpp/base/tools/ClenshawCurtisTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef CLENSHAWCURTISTABLE_HPP
#define CLENSHAWCURTISTABLE_HPP

#include <math.h>
#include <cmath>
#include <cstddef>

#include <sgpp/globaldef.hpp>
Expand Down
4 changes: 4 additions & 0 deletions base/src/sgpp/globaldef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
* These seem not to be part of the C++ standard,
* and they're missing, e.g., on MinGW-w64.
*/
#ifdef _MSC_VER
#undef _MATH_DEFINES_DEFINED
#define _MATH_DEFINES_DEFINED
#endif
// e
#undef M_E
#define M_E 2.7182818284590452354
Expand Down
2 changes: 1 addition & 1 deletion base/tests/test_HashGridStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(testInsert) {
i.set(0, 1, 1);
size_t i2 = s->insert(i);

BOOST_CHECK_EQUAL(i2, 0);
BOOST_CHECK_EQUAL(i2, 0U);
BOOST_CHECK_EQUAL(s->size(), 1);

delete s;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// sgpp.sparsegrids.org

#include "CombiAtanSpecialStretching.hpp"
#include <math.h>
#include <cmath>

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion combigrid/src/sgpp/combigrid/domain/CombiTanStretching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// sgpp.sparsegrids.org

#include "CombiTanStretching.hpp"
#include <math.h>
#include <cmath>

using namespace std;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// sgpp.sparsegrids.org

#include "PoissonOperator.hpp"
#include <math.h>
#include <cmath>


combigrid::PoissonOperator::PoissonOperator(const FullGridD* fg ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "TikhonovOperator.hpp"
#include <sgpp/base/exception/operation_exception.hpp>
#include <math.h>
#include <cmath>


combigrid::TikhonovOperator::TikhonovOperator(const FullGridD* fg ,
Expand Down
2 changes: 1 addition & 1 deletion combigrid/src/sgpp/combigrid/utils/combigrid_ultils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define COMBIGRID_ULTILS_HPP_

/** In this hpp file we define the utilities for the combination technique */
#include <math.h>
#include <cmath>
#include <iostream>
#include <stack>
#include <functional>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <sgpp/datadriven/algorithm/DMWeightMatrix.hpp>

#include <math.h>
#include <cmath>
#include <string>
#include <utility>
#include <iostream>
Expand Down
3 changes: 2 additions & 1 deletion datadriven/src/sgpp/datadriven/application/BatchLearner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ namespace SGPP {

//iterate over all found lines
for (size_t i = 0; i < data.size() - 1; i++) {
auto classesHere = count(data[i].begin(), data[i].end(), ',');
size_t classesHere = static_cast<size_t>(
count(data[i].begin(), data[i].end(), ','));

// the first data entry ever found determines the number of dimensions of the data
if (dimensions == 0) {
Expand Down
Loading

0 comments on commit 83e51ce

Please sign in to comment.