Skip to content

Commit

Permalink
Fixed indentation to follow the real dealii standard
Browse files Browse the repository at this point in the history
  • Loading branch information
blaisb committed Aug 13, 2019
1 parent 6e0c908 commit d15d6f3
Show file tree
Hide file tree
Showing 37 changed files with 5,211 additions and 3,623 deletions.
171 changes: 171 additions & 0 deletions .clang-format
@@ -0,0 +1,171 @@
#
# The clang-format (Clang 6) style file used by deal.II.
#

AccessModifierOffset: -2

AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true

AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false

AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true

BinPackArguments: false
BinPackParameters: false

BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: true
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false

BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeComma
BreakStringLiterals: false

ColumnLimit: 80

CompactNamespaces: false

ConstructorInitializerIndentWidth: 2

ContinuationIndentWidth: 2

Cpp11BracedListStyle: true

DerivePointerAlignment: false

FixNamespaceComments: true

IncludeBlocks: Regroup
IncludeCategories:
# config.h must always be first:
- Regex: "deal.II/base/config.h"
Priority: -1
# deal.II folders in sorted order:
- Regex: "deal.II/algorithms/.*\\.h"
Priority: 110
- Regex: "deal.II/base/.*\\.h"
Priority: 120
- Regex: "deal.II/boost_adaptors/.*\\.h"
Priority: 125
- Regex: "deal.II/differentiation/.*\\.h"
Priority: 130
- Regex: "deal.II/distributed/.*\\.h"
Priority: 140
- Regex: "deal.II/dofs/.*\\.h"
Priority: 150
- Regex: "deal.II/fe/.*\\.h"
Priority: 160
- Regex: "deal.II/gmsh/.*\\.h"
Priority: 170
- Regex: "deal.II/grid/.*\\.h"
Priority: 180
- Regex: "deal.II/hp/.*\\.h"
Priority: 190
- Regex: "deal.II/integrators/.*\\.h"
Priority: 200
- Regex: "deal.II/lac/.*\\.h"
Priority: 210
- Regex: "deal.II/matrix_free/.*\\.h"
Priority: 220
- Regex: "deal.II/meshworker/.*\\.h"
Priority: 230
- Regex: "deal.II/multigrid/.*\\.h"
Priority: 240
- Regex: "deal.II/non_matching/.*\\.h"
Priority: 250
- Regex: "deal.II/numerics/.*\\.h"
Priority: 260
- Regex: "deal.II/opencascade/.*\\.h"
Priority: 270
- Regex: "deal.II/optimization/.*\\.h"
Priority: 280
- Regex: "deal.II/particles/.*\\.h"
Priority: 290
- Regex: "deal.II/physics/.*\\.h"
Priority: 300
- Regex: "deal.II/sundials/.*\\.h"
Priority: 310
# put boost right after deal:
- Regex: "<boost.*>"
Priority: 500
# try to group PETSc headers:
- Regex: "<petsc.*\\.h>"
Priority: 1000
# try to catch all third party headers and put them after deal.II but before
# standard headers:
- Regex: "<.*\\.(h|hpp|hxx)>"
Priority: 2000
# match all standard headers. Things like '#include <armadillo>' should be
# surrounded by #ifdef checks (which will not be merged by clang-format) so they
# should not be caught here
- Regex: "<[a-z_]+>"
Priority: 100000

IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 2

IndentWrappedFunctionNames: false

KeepEmptyLinesAtTheStartOfBlocks: false

Language: Cpp

MaxEmptyLinesToKeep: 3

NamespaceIndentation: All

PenaltyBreakBeforeFirstCallParameter: 90

PointerAlignment: Right

ReflowComments: true
CommentPragmas: '( \| |\*--|<li>|@ref | @p |@param |@name |@returns |@warning |@ingroup |@author |@date |@related |@relates |@relatesalso |@deprecated |@image |@return |@brief |@attention |@copydoc |@addtogroup |@todo |@tparam |@see |@note |@skip |@skipline |@until |@line |@dontinclude |@include)'

SortIncludes: true
SortUsingDeclarations: true

SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false

Standard: Cpp11

TabWidth: 2

UseTab: Never
9 changes: 9 additions & 0 deletions .clang-tidy
@@ -0,0 +1,9 @@
# Settings file automatically used by clang-tidy
#
# See ./contrib/utilities/run_clang_tidy.sh for details

# We disable performance-inefficient-string-concatenation because we don't care about "a"+to_string(5)+...

Checks: "-*,cppcoreguidelines-pro-type-static-cast-downcast,google-readability-casting,modernize-*,-modernize-pass-by-value,-modernize-raw-string-literal,-modernize-use-auto,-modernize-use-override,-modernize-use-default-member-init,-modernize-use-transparent-functors,use-emplace,mpi-*,performance-*,-performance-inefficient-string-concatenation"

WarningsAsErrors: '*'
157 changes: 89 additions & 68 deletions applications/cylinder/cylinder.cc
@@ -1,19 +1,26 @@
#include "glsNS.h"

template <int dim>
class VonKarmanNavierStokes : public GLSNavierStokesSolver<dim> {
class VonKarmanNavierStokes : public GLSNavierStokesSolver<dim>
{
public:
VonKarmanNavierStokes(NavierStokesSolverParameters<dim> nsparam,
const unsigned int degreeVelocity,
const unsigned int degreePressure)
: GLSNavierStokesSolver<dim>(nsparam, degreeVelocity, degreePressure) {}
void run();
void runTest();
const unsigned int degreeVelocity,
const unsigned int degreePressure)
: GLSNavierStokesSolver<dim>(nsparam, degreeVelocity, degreePressure)
{}
void
run();
void
runTest();
};

template <int dim> void VonKarmanNavierStokes<dim>::run() {
template <int dim>
void
VonKarmanNavierStokes<dim>::run()
{
this->read_mesh();
Point<dim, double> circleCenter(8, 8);
Point<dim, double> circleCenter(8, 8);
static const SphericalManifold<dim> boundary(circleCenter);
this->triangulation.set_all_manifold_ids_on_boundary(0, 0);
this->triangulation.set_manifold(0, boundary);
Expand All @@ -22,22 +29,26 @@ template <int dim> void VonKarmanNavierStokes<dim>::run() {

this->set_initial_condition(this->nsparam.initialCondition->type,
this->nsparam.restartParameters.restart);
while (this->simulationControl.integrate()) {
printTime(this->pcout, this->simulationControl);
this->refine_mesh();
this->iterate(this->simulationControl.firstIter());
this->postprocess();
this->finish_time_step();
}
while (this->simulationControl.integrate())
{
printTime(this->pcout, this->simulationControl);
this->refine_mesh();
this->iterate(this->simulationControl.firstIter());
this->postprocess();
this->finish_time_step();
}
}

template <int dim> void VonKarmanNavierStokes<dim>::runTest() {
template <int dim>
void
VonKarmanNavierStokes<dim>::runTest()
{
GridIn<dim> grid_in;
grid_in.attach_triangulation(this->triangulation);
std::ifstream input_file(this->nsparam.mesh.fileName);
grid_in.read_msh(input_file);

Point<dim, double> circleCenter(8, 8);
Point<dim, double> circleCenter(8, 8);
static const SphericalManifold<dim> boundary(circleCenter);
this->triangulation.set_all_manifold_ids_on_boundary(0, 0);
this->triangulation.set_manifold(0, boundary);
Expand All @@ -46,61 +57,71 @@ template <int dim> void VonKarmanNavierStokes<dim>::runTest() {

this->set_initial_condition(this->nsparam.initialCondition->type,
this->nsparam.restartParameters.restart);
while (this->simulationControl.integrate()) {
printTime(this->pcout, this->simulationControl);
this->iterate(this->simulationControl.firstIter());
this->postprocess();
this->refine_mesh();
this->finish_time_step();
for (unsigned int i = 0; i < this->forces_.size(); ++i) {
this->pcout << " fx : " << this->forces_[i][0] << std::endl;
while (this->simulationControl.integrate())
{
printTime(this->pcout, this->simulationControl);
this->iterate(this->simulationControl.firstIter());
this->postprocess();
this->refine_mesh();
this->finish_time_step();
for (unsigned int i = 0; i < this->forces_.size(); ++i)
{
this->pcout << " fx : " << this->forces_[i][0] << std::endl;
}
}
}
}

int main(int argc, char *argv[]) {
try {
if (argc != 2) {
std::cout << "Usage:" << argv[0] << " input_file" << std::endl;
std::exit(1);
}
Utilities::MPI::MPI_InitFinalize mpi_initialization(
int
main(int argc, char *argv[])
{
try
{
if (argc != 2)
{
std::cout << "Usage:" << argv[0] << " input_file" << std::endl;
std::exit(1);
}
Utilities::MPI::MPI_InitFinalize mpi_initialization(
argc, argv, numbers::invalid_unsigned_int);
ParameterHandler prm;
NavierStokesSolverParameters<2> nsparam;
nsparam.declare(prm);
// Parsing of the file
prm.parse_input(argv[1]);
nsparam.parse(prm);
ParameterHandler prm;
NavierStokesSolverParameters<2> nsparam;
nsparam.declare(prm);
// Parsing of the file
prm.parse_input(argv[1]);
nsparam.parse(prm);

VonKarmanNavierStokes<2> problem_2d(nsparam,
nsparam.femParameters.velocityOrder,
nsparam.femParameters.pressureOrder);
if (nsparam.test.enabled)
problem_2d.runTest();
else
problem_2d.run();
} catch (std::exception &exc) {
std::cerr << std::endl
<< std::endl
<< "----------------------------------------------------"
<< std::endl;
std::cerr << "Exception on processing: " << std::endl
<< exc.what() << std::endl
<< "Aborting!" << std::endl
<< "----------------------------------------------------"
<< std::endl;
return 1;
} catch (...) {
std::cerr << std::endl
<< std::endl
<< "----------------------------------------------------"
<< std::endl;
std::cerr << "Unknown exception!" << std::endl
<< "Aborting!" << std::endl
<< "----------------------------------------------------"
<< std::endl;
return 1;
}
VonKarmanNavierStokes<2> problem_2d(nsparam,
nsparam.femParameters.velocityOrder,
nsparam.femParameters.pressureOrder);
if (nsparam.test.enabled)
problem_2d.runTest();
else
problem_2d.run();
}
catch (std::exception &exc)
{
std::cerr << std::endl
<< std::endl
<< "----------------------------------------------------"
<< std::endl;
std::cerr << "Exception on processing: " << std::endl
<< exc.what() << std::endl
<< "Aborting!" << std::endl
<< "----------------------------------------------------"
<< std::endl;
return 1;
}
catch (...)
{
std::cerr << std::endl
<< std::endl
<< "----------------------------------------------------"
<< std::endl;
std::cerr << "Unknown exception!" << std::endl
<< "Aborting!" << std::endl
<< "----------------------------------------------------"
<< std::endl;
return 1;
}
return 0;
}

0 comments on commit d15d6f3

Please sign in to comment.