diff --git a/Jenkinsfile b/Jenkinsfile index 5612cf09a..f81ff420b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,184 +1,184 @@ pipeline { parameters {string(defaultValue: '', description: 'api-token', name: 'API_TOKEN') string(defaultValue: '', description: 'buildable phid', name: 'BUILD_TARGET_PHID') string(defaultValue: '', description: 'Commit id', name: 'COMMIT_ID') string(defaultValue: '', description: 'Diff id', name: 'DIFF_ID') string(defaultValue: 'PHID-PROJ-5eqyu6ooyjktagbhf473', description: 'ID of the project', name: 'PROJECT_ID') } options { disableConcurrentBuilds() //skipDefaultCheckout(true) } environment { PHABRICATOR_HOST = 'https://c4science.ch/api/' PYTHONPATH = sh returnStdout: true, script: 'echo ${WORKSPACE}/test/ci/script/' BLA_VENDOR = 'OpenBLAS' OMPI_MCA_plm = 'isolated' OMPI_MCA_btl = 'tcp,self' } agent { dockerfile { filename 'Dockerfile' dir 'test/ci/debian.testing' additionalBuildArgs '--tag akantu-environment' } } stages { stage('Checkout proper commit') { steps { - checkout scm: [$class: 'GitSCM', - branches: [[name: "${COMMIT_ID}" ]] - ], changelog: true + checkout scm: [$class: 'GitSCM', + branches: [[name: "${COMMIT_ID}" ]] + ], changelog: true } } stage('Lint') { steps { - sh """ + sh """ arc lint --output json --rev HEAD^ | jq . -srM | tee lint.json ./test/ci/scripts/hbm send-arc-lint -f lint.json """ } } stage('Configure') { steps { sh """#!/bin/bash set -o pipefail mkdir -p build cd build cmake -DAKANTU_COHESIVE_ELEMENT:BOOL=TRUE \ -DAKANTU_IMPLICIT:BOOL=TRUE \ -DAKANTU_PARALLEL:BOOL=TRUE \ -DAKANTU_STRUCTURAL_MECHANICS:BOOL=TRUE \ -DAKANTU_HEAT_TRANSFER:BOOL=TRUE \ -DAKANTU_DAMAGE_NON_LOCAL:BOOL=TRUE \ -DAKANTU_PYTHON_INTERFACE:BOOL=TRUE \ -DAKANTU_EXAMPLES:BOOL=TRUE \ -DAKANTU_BUILD_ALL_EXAMPLES:BOOL=TRUE \ -DAKANTU_TEST_EXAMPLES:BOOL=FALSE \ -DAKANTU_TESTS:BOOL=TRUE .. 2>&1 | tee configure.txt """ } post { - failure { - uploadArtifact('configure.txt', 'Configure') - deleteDir() - } + failure { + uploadArtifact('configure.txt', 'Configure') + deleteDir() + } } } stage('Compile') { steps { - sh '''#!/bin/bash + sh '''#!/bin/bash set -o pipefail make -C build/src | tee compilation.txt ''' } post { - failure { - uploadArtifact('compilation.txt', 'Compilation') - } + failure { + uploadArtifact('compilation.txt', 'Compilation') + } } } stage ('Warnings gcc') { steps { warnings(consoleParsers: [[parserName: 'GNU Make + GNU C Compiler (gcc)']]) } } stage('Compile python') { steps { sh '''#!/bin/bash set -o pipefail make -C build/python | tee compilation_python.txt ''' } post { - failure { - uploadArtifact('compilation_python.txt', 'Compilation_Python') - } + failure { + uploadArtifact('compilation_python.txt', 'Compilation_Python') + } } } stage('Compile tests') { steps { sh '''#!/bin/bash set -o pipefail make -C build/test | tee compilation_test.txt ''' } post { - failure { - uploadArtifact('compilation_test.txt', 'Compilation_Tests') - } + failure { + uploadArtifact('compilation_test.txt', 'Compilation_Tests') + } } } stage('Tests') { steps { sh ''' #rm -rf build/gtest_reports cd build/ #source ./akantu_environement.sh ctest -T test --no-compress-output || true tag=$(head -n 1 < Testing/TAG) if [ -e Testing/${tag}/Test.xml ]; then cp Testing/${tag}/Test.xml ../CTestResults.xml fi ''' } //post { - //failure { - //zip zipFile: 'build.zip', dir: 'build/', archive: true - //} + // failure { + // zip zipFile: 'build.zip', dir: 'build/', archive: true + // } //} } } post { always { createArtifact("./CTestResults.xml") step([$class: 'XUnitBuilder', - thresholds: [ + thresholds: [ [$class: 'SkippedThreshold', failureThreshold: '0'], [$class: 'FailedThreshold', failureThreshold: '0']], - tools: [ - [$class: 'CTestType', pattern: 'CTestResults.xml', skipNoTestFiles: true] - ]]) + tools: [ + [$class: 'CTestType', pattern: 'CTestResults.xml', skipNoTestFiles: true] + ]]) } success { passed() } failure { failed() } } } def failed() { sh "./test/ci/scripts/hbm failed" } def passed() { sh "./test/ci/scripts/hbm passed" } def createArtifact(filename) { sh "./test/ci/scripts/hbm send-uri -k 'Jenkins URI' -u ${BUILD_URL} -l 'View Jenkins result'" sh "./test/ci/scripts/hbm send-ctest-results -f ${filename}" } def uploadArtifact(artifact, name) { sh "./test/ci/scripts/hbm upload-file -f ${artifact} -n \"${name}\" -v ${PROJECT_ID}" } diff --git a/src/common/aka_array.hh b/src/common/aka_array.hh index 073cb5cb0..c8661039f 100644 --- a/src/common/aka_array.hh +++ b/src/common/aka_array.hh @@ -1,436 +1,436 @@ /** * @file aka_array.hh * * @author Till Junge * @author Nicolas Richart * * @date creation: Fri Jun 18 2010 * @date last modification: Tue Jan 16 2018 * * @brief Array container for Akantu * This container differs from the std::vector from the fact it as 2 dimensions * a main dimension and the size stored per entries * * @section LICENSE * * Copyright (©) 2010-2018 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ #ifndef __AKANTU_VECTOR_HH__ #define __AKANTU_VECTOR_HH__ /* -------------------------------------------------------------------------- */ #include "aka_common.hh" /* -------------------------------------------------------------------------- */ #include #include /* -------------------------------------------------------------------------- */ namespace akantu { /// class that afford to store vectors in static memory class ArrayBase { /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: explicit ArrayBase(ID id = "") : id(std::move(id)) {} ArrayBase(const ArrayBase & other, const ID & id = "") { this->id = (id == "") ? other.id : id; } ArrayBase(ArrayBase && other) = default; ArrayBase & operator=(const ArrayBase & other) = default; // ArrayBase & operator=(ArrayBase && other) = default; virtual ~ArrayBase() = default; /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: /// get the amount of space allocated in bytes virtual UInt getMemorySize() const = 0; /// set the size to zero without freeing the allocated space inline void empty(); /// function to print the containt of the class virtual void printself(std::ostream & stream, int indent = 0) const = 0; /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: /// Get the Size of the Array UInt size() const { return size_; } /// Get the number of components AKANTU_GET_MACRO(NbComponent, nb_component, UInt); /// Get the name of th array AKANTU_GET_MACRO(ID, id, const ID &); /// Set the name of th array AKANTU_SET_MACRO(ID, id, const ID &); /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ protected: /// id of the vector ID id{""}; /// the size used UInt size_{0}; /// number of components UInt nb_component{1}; }; /* -------------------------------------------------------------------------- */ namespace { template struct IteratorHelper {}; template struct IteratorHelper<0, T> { using type = T; }; template struct IteratorHelper<1, T> { using type = Vector; }; template struct IteratorHelper<2, T> { using type = Matrix; }; template struct IteratorHelper<3, T> { using type = Tensor3; }; template using IteratorHelper_t = typename IteratorHelper::type; } // namespace /* -------------------------------------------------------------------------- */ /* Memory handling layer */ /* -------------------------------------------------------------------------- */ enum class ArrayAllocationType { _default, _pod, }; template struct ArrayAllocationTrait : public std::conditional_t< std::is_scalar::value, std::integral_constant, std::integral_constant> {}; /* -------------------------------------------------------------------------- */ template ::value> class ArrayDataLayer : public ArrayBase { public: using value_type = T; using reference = value_type &; using pointer_type = value_type *; using const_reference = const value_type &; public: virtual ~ArrayDataLayer() = default; /// Allocation of a new vector explicit ArrayDataLayer(UInt size = 0, UInt nb_component = 1, const ID & id = ""); /// Allocation of a new vector with a default value ArrayDataLayer(UInt size, UInt nb_component, const_reference value, const ID & id = ""); /// Copy constructor (deep copy) ArrayDataLayer(const ArrayDataLayer & vect, const ID & id = ""); /// Copy constructor (deep copy) explicit ArrayDataLayer(const std::vector & vect); // copy operator ArrayDataLayer & operator=(const ArrayDataLayer & other); // move constructor ArrayDataLayer(ArrayDataLayer && other); // move assign ArrayDataLayer & operator=(ArrayDataLayer && other); protected: // deallocate the memory virtual void deallocate() {} // allocate the memory virtual void allocate(UInt size, UInt nb_component); // allocate and initialize the memory virtual void allocate(UInt size, UInt nb_component, const T & value); public: /// append a tuple of size nb_component containing value inline void push_back(const_reference value); /// append a vector // inline void push_back(const value_type new_elem[]); /// append a Vector or a Matrix template