Commit 92735831 authored by Praetorius, Simon's avatar Praetorius, Simon

contribution guide extended, projects directory removed from official trunk,...

contribution guide extended, projects directory removed from official trunk, some warnings removed in Operators.inc.hpp
parent ea147f78
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.1)
project(dune-amdis CXX)
# set(ALBERTA_ROOT /opt/software/alberta)
# set(ALBERTA_INCLUDE_DIR /opt/software/alberta/include)
# set(CMAKE_PREFIX_PATH /opt/software/dune/lib/cmake)
# set(UG_DIR /opt/software/dune/lib/cmake/ug)
# set(Vc_DIR /opt/software/dune/lib/cmake/Vc)
if(NOT (dune-common_DIR OR dune-common_ROOT OR
"${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
string(REPLACE ${CMAKE_PROJECT_NAME} dune-common dune-common_DIR
......@@ -30,7 +22,6 @@ add_subdirectory("src")
add_subdirectory("dune")
add_subdirectory("doc")
add_subdirectory("cmake/modules")
add_subdirectory("projects")
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
# GIT Workflow
Follow the ideas of [a-successful-git-branching-model](http://nvie.com/posts/a-successful-git-branching-model), especially
- Create a new branch for all new features, following the naming convention `feature/XYZ`
- Merge features in the `develop` branch only
- Correct Bugs in issue branches, following the naming convention `issue/XYZ`
- Merge issues in the `develop` branch, except when it is a hotfix, then merge to `master` and `develop`
- For all merges create a meaningful *Merge Request* in GitLab
# Code Style-Guide
This style-guide is intended for developers writing code for AMDiS, is not complete and probably not applied to all parts of the AMDiS code. Feel free to edit existing source files in order to fulfill the styles.
......@@ -6,7 +15,7 @@ Parts of this convention are taken from well established style guides, like the
## File naming conventions
Filenames should be mixed lower and upper case, starting with an uppercase letter. They should not include underscores or dashed. Use an uppercase letter to indicate a new subword. Sourcefiles should end in `.cpp` and header files should end in `.hpp`. In case you move the code of a template class to a separate file, included textually at the end of the corresponding header file, use the extensions `.inc.hpp`.
Filenames should be mixed lower and upper case, starting with an uppercase letter. They should not include underscores or dashed. Use an uppercase letter to indicate a new subword. Sourcefiles should end in `.cpp` and header files should end in `.hpp`. In case you move the code of a template class to a separate file, included textually at the end of the corresponding header file, use the extensions `.inc.hpp`.
The name of a file should follow the name of the implemented class in this file.
......@@ -15,7 +24,7 @@ Examples of valid filenames:
* `AdaptInstat.cpp`
* `DOFVector.hpp`
* `DOFVector.cpp`
* `DOFVector.inc.hpp` (the implementation of the methods of the template class `DOFVector<T>`)
* `DOFVector.inc.hpp` (the implementation of the methods of the template class `DOFVector<T>`)
Do not use filenames that already exist in /usr/include or are stdandard C/C++ include files, such as `math.h` (remember that windows files-systems are case insensitive and thus, there is not difference between `math.h` and `Math.H`.)
......@@ -24,23 +33,23 @@ Every header file should start with a copyright notice and an include guard `#pr
``` c++
// Software License for AMDiS2
//
// Copyright (c) 2015 Institute for Scientific Computing TU-Dresden
//
// Copyright (c) 2015 Institute for Scientific Computing, TU-Dresden
// All rights reserved.
// Authors: Simon Praetorius
//
//
// This file is part of the AMDiS2 Library
// see also the LICENSE file in the distribution.
#pragma once
```
After the include guard a list of include files can be added, see *Names and Order of Includes*.
After the include guard a list of include files can be added, see *Names and Order of Includes*.
### Names and Order of Includes
All of a project's header files should be listed as descendants of the project's source directory. The includes should be grouped following the rules:
* [class header file] (for source files that implement an interface specified in a header file)
* [class header file] ... for source files that implement an interface specified in a header file
* C system files.
* C++ system files.
* Other external libraries' header files.
......@@ -73,7 +82,7 @@ For example, the includes in `io/VtkWriter.cpp` might look like this:
// ...
```
### Namespaces
### Namespaces
All implementation should be put into the namespace `AMDiS`. When a namespace closes, a corresponding comment should be added to the closing brackets:
......@@ -84,6 +93,8 @@ namespace AMDiS
} // end namespace AMDiS
```
Implementation details are put into a subnamespace `Impl`.
## Line length
Each line of text in your code should be at most 80 characters long.
......@@ -92,4 +103,11 @@ Each line of text in your code should be at most 80 characters long.
* An #include statement with a long path may exceed 80 columns.
* A raw-string literal may have content that exceeds 80 characters.
* ...
## Indentation
Use two spaces instead of tabs!
## Documentation
Use Doxygen-Style comments for the documentation of functions and classes, except when the function name already indicates its meaning completely.
......@@ -272,7 +272,6 @@ namespace AMDiS
{
AMDIS_FUNCNAME("Operator::assembleFirstOrderTermsGrdPhi(elementMatrix)");
using Element = typename RowView::Element;
auto element = rowView.element();
auto geometry = element.geometry();
const int dim = RowView::GridView::dimension;
......@@ -333,7 +332,6 @@ namespace AMDiS
{
AMDIS_FUNCNAME("Operator::assembleFirstOrderTermsGrdPsi(elementMatrix)");
using Element = typename RowView::Element;
auto element = rowView.element();
auto geometry = element.geometry();
const int dim = RowView::GridView::dimension;
......@@ -392,7 +390,6 @@ namespace AMDiS
{
AMDIS_FUNCNAME("Operator::assembleFirstOrderTermsGrdPsi(elementvector)");
using Element = typename RowView::Element;
auto element = rowView.element();
const int dim = RowView::GridView::dimension;
const int dow = RowView::GridView::dimensionworld;
......@@ -443,7 +440,6 @@ namespace AMDiS
{
AMDIS_FUNCNAME("Operator::assembleSecondOrderTerms(elementMatrix)");
using Element = typename RowView::Element;
auto element = rowView.element();
const int dim = RowView::GridView::dimension;
const int dow = RowView::GridView::dimensionworld;
......
add_subdirectory(director_field)
add_executable(director director.cc)
add_dune_alberta_flags(GRIDDIM 2 WORLDDIM 3 director)
target_link_dune_default_libraries(director)
target_link_libraries(director "duneamdis")
target_compile_definitions(director PRIVATE AMDIS_DIM=2 AMDIS_DOW=3)
#include <iostream>
#include <ctime>
#include <cmath>
#include <dune/amdis/AMDiS.hpp>
#include <dune/amdis/AdaptInstationary.hpp>
#include <dune/amdis/ProblemInstat.hpp>
#include <dune/amdis/ProblemStat.hpp>
#include <dune/amdis/Terms.hpp>
using namespace AMDiS;
using PolarParam = DefaultTraitsMesh<Dune::AlbertaGrid<2, 3>, 1, 1, 1, 1>;
using PolarProblem = ProblemStat<PolarParam>;
using PolarProblemInstat = ProblemInstat<PolarParam>;
using WorldVector = typename PolarProblem::WorldVector;
int main(int argc, char** argv)
{
AMDiS::init(argc, argv);
PolarProblem prob("polar");
prob.initialize(INIT_ALL);
PolarProblemInstat probInstat("polar", prob);
probInstat.initialize(INIT_UH_OLD);
AdaptInfo adaptInfo("adapt", prob.getNumComponents());
double wn = 1.0, K = 1.0, R = 1.0;
Parameters::get("polar->wn", wn);
Parameters::get("polar->K", K);
Parameters::get("polar->R", R);
double H = 0.0;
std::srand(std::time(0));
// define the differential operators
using Op = PolarProblem::OperatorType;
for_<0,2>([&](auto _i)
{
auto opTimeLhs = Op::zot( constant(1.0) );
prob.addMatrixOperator(opTimeLhs, _i, _i, probInstat.getInvTau());
auto opTimeRhs = Op::zot( valueOf(probInstat.getOldSolution(_i)) );
prob.addVectorOperator(opTimeRhs, _i, probInstat.getInvTau());
// <grad(q_i), grad(theta_i)>
auto opL = Op::sot( constant(1.0) );
prob.addMatrixOperator(opL, _i, 2+_i);
// <f(p1,p2) * grad(p_i), grad(theta_i)>
auto opL2 = Op::sot( func([wn](WorldVector const& grd_p0, WorldVector const& grd_p1)
{
return wn * (1.0 - inner(grd_p0, grd_p0) - inner(grd_p1, grd_p1));
}, gradientOf(prob.getSolution(_0)), gradientOf(prob.getSolution(_1)) )
);
prob.addMatrixOperator(opL2, _i, _i);
auto opL2Rhs = Op::fot( func([wn](WorldVector const& grd_pi, WorldVector const& grd_pj)
{
return ((-2.0*wn) * (inner(grd_pi, grd_pi) + inner(grd_pj, grd_pj))) * grd_pi;
}, gradientOf(prob.getSolution(_i)), gradientOf(prob.getSolution(_1 - _i)) ),
GRD_PSI);
prob.addVectorOperator(opL2Rhs, _i);
for_<0,2>([&](auto _j)
{
auto opL3 = Op::sot( func([wn](WorldVector const& grd_pi, WorldVector const& grd_pj)
{
return outer(grd_pj, (-2.0*wn)*grd_pi);
}, gradientOf(prob.getSolution(_i)), gradientOf(prob.getSolution(_j)) )
);
prob.addMatrixOperator(opL3, _i, _j);
});
// <q_i, psi_i>
auto opM = Op::zot( constant(-1.0/K) );
prob.addMatrixOperator(opM, 2+_i, 2+_i);
// <-K*grad(p_i), grad(psi_i)>
auto opL3 = Op::sot( constant(1.0) );
prob.addMatrixOperator(opL3, _2 + _i, _i);
for (auto& p : prob.getSolution(_i).getVector())
p = 2.0*(std::rand() / double(RAND_MAX)) - 1.0;
for (auto& q : prob.getSolution(_2 + _i).getVector())
q = 0.0;
});
AdaptInstationary adapt("adapt", prob, adaptInfo, probInstat, adaptInfo);
adapt.adapt();
AMDiS::finalize();
return 0;
}
{
"dimension of world": 3,
"sphereMesh": {
"macro file name": "./macro/sphere_flat.3d",
"global refinements": 0
},
"polar": {
"mesh": "sphereMesh",
"names": ["p0", "p1", "q0", "q1"],
"solver" : {
"name": "direct",
"ell": 3,
"max iteration": 5000,
"relative tolerance": 1e-6,
"info": 1
},
"output": {
"filename": "director",
"output directory": "output",
"ParaView format": 1
},
"wn": 100,
"K": 1.0,
"R": 1.0
},
"adapt": {
"timestep": 1.0e-4,
"start time": 0.0,
"end time": 1.0
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment