Skip to content
Snippets Groups Projects
Verified Commit a6daa288 authored by Paul Dechamps's avatar Paul Dechamps :speech_balloon:
Browse files

Merge branch 'docker_test' into dev

Update docker for pipeline + added validation case + refactor API
parents cf146d4c 7ea26f65
No related branches found
No related tags found
1 merge request!1BLASTER v1.0
Pipeline #49342 passed
default:
image: rboman/waves-py3:2020.3
image: pdechamps/blaster
before_script:
- wget https://bootstrap.pypa.io/get-pip.py
- python3 get-pip.py
- python3 -m pip install scipy==1.10.1 --user
- source /opt/intel/mkl/bin/mklvars.sh intel64
- source /opt/intel/tbb/bin/tbbvars.sh intel64
- "export INCLUDE=:/usr/include/mkl:"
- echo $(nproc)
- printenv | sort
......@@ -28,7 +24,7 @@ format:
<<: *global_tag_def
stage: build
script:
- clang-format --version # we use clang-format-10 exclusively
- clang-format-11 --version # we use clang-format-11 exclusively
- ./format/format.py
- mkdir -p patches
- if git diff --patch --exit-code > patches/clang-format.patch; then echo "Clang format changed nothing"; else echo "Clang format found changes to make!"; false; fi
......@@ -82,11 +78,15 @@ cvalidation:
stage: validation
script:
- set +e
- python3 run.py blast/validation/raeValidation.py -v
- python3 run.py blast/validation/oneraValidation.py -v
- python3 run.py blast/validation/lannValidation.py -v
- python3 run.py blast/validation/raeValidation.py -v; RAE_STATUS=$?
- python3 run.py blast/validation/oneraValidation.py -v; ONERA_STATUS=$?
- python3 run.py blast/validation/lannValidation.py -v; LANN_STATUS=$?
- set -e
- if [ $? -ne 0 ]; then exit 1; fi
- |
echo "RAE Validation Status: $RAE_STATUS"
echo "ONERA Validation Status: $ONERA_STATUS"
echo "LANN Validation Status: $LANN_STATUS"
- if [ $RAE_STATUS -ne 0 ] || [ $ONERA_STATUS -ne 0 ] || [ $LANN_STATUS -ne 0 ]; then exit 1; fi
dependencies:
- build
when: manual
## BLASTER
BLASTER (Boundary-Layer Adjoint Solver for Transonic External and high Reynolds number flow) is an open-source boundary layer solver written in C++ and python.
BLASTER (Boundary-Layer Adjoint Solver for Transonic External and high Reynolds number flow) is an open-source boundary layer solver and a Viscous-Inviscid Interaction (VII) interface written in C++ and python.
![](/logo/logo.png)
It is designed to work in a viscous-inviscid interaction (VII) scheme. Blaster is developed at the University of Liège by Paul Dechamps with the active collaboration of Adrien Crovato and Amaury Bilocq and the help of Romain Boman, and under the supervision of Vincent E. Terrapon and Grigorios Dimitriadis, since 2022.
Blaster is developed at the University of Liège by Paul Dechamps with the active collaboration of Adrien Crovato and Amaury Bilocq and the help of Romain Boman, and under the supervision of Grigorios Dimitriadis and Vincent E. Terrapon, since 2021.
# Working with
......
......@@ -19,7 +19,9 @@
## Initialize blast computation
# Paul Dechamps
def initBlast(cfg, icfg, iSolverName='DART'):
AVAILABLE_SOLVERS = ['DART']
def init_blaster(cfg, icfg, iSolverName='DART', task='analysis'):
"""
Inputs
------
......@@ -55,60 +57,61 @@ def initBlast(cfg, icfg, iSolverName='DART'):
from blast.coupler import Coupler
import blast
if iSolverName == 'DART':
if iSolverName not in AVAILABLE_SOLVERS:
raise RuntimeError('BLASTERAPI: Invalid inviscid solver name', iSolverName)
elif iSolverName == 'DART':
from blast.interfaces.dart.DartInterface import DartInterface as interface
# Check viscous solver parameters.
if 'Re' in cfg and cfg['Re'] > 0:
_Re = cfg['Re']
else:
raise RuntimeError('Missing or invalid Reynolds number')
if 'Minf' in cfg and cfg['Minf'] > 0:
_Minf = cfg['Minf']
else:
_Minf = 0.1
if 'CFL0' in cfg and cfg['CFL0'] > 0:
_CFL0 = cfg['CFL0']
else:
_CFL0 = 1
if 'Verb' in cfg and 0<= cfg['Verb'] <= 3:
_verbose = cfg['Verb']
else:
_verbose = 1
_xtrF = [-1, -1]
if 'xtrF' in cfg:
for i, xtr in enumerate(cfg['xtrF']):
if not(0 <= xtr <= 1) and xtr != -1:
raise RuntimeError("Incorrect forced transition location.")
_xtrF[i] = xtr
_span = 0
_nSections = 1
# Check coupler parameters.
if 'couplIter' in cfg and cfg['couplIter'] > 0:
__couplIter = cfg['couplIter']
else:
__couplIter = 150
if 'couplTol' in cfg:
__couplTol = cfg['couplTol']
else:
__couplTol = 1e-4
if 'iterPrint' in cfg:
__iterPrint = cfg['iterPrint']
else:
__iterPrint = 1
if 'resetInv' in cfg:
__resetInv = cfg['resetInv']
else:
__resetInv = False
# Viscous solver
if 'Re' not in cfg or cfg['Re'] <= 0.:
raise RuntimeError('BLASTERAPI: Missing or invalid Reynolds number')
_Re = cfg['Re']
_Minf = cfg.get('Minf', 0.1)
_cfl0 = cfg.get('CFL0', 1.)
_verbose = cfg.get('Verb', 0)
_xtrF = cfg.get('xtrF', [-1, -1])
_span = cfg.get('span', 1.)
_nSections = cfg.get('nSections', 1)
if _Minf <= 0:
raise RuntimeError('BLASTERAPI: Invalid Mach number', _Minf)
if _cfl0 <= 0:
raise RuntimeError('BLASTERAPI: Invalid CFL number', _cfl0)
for xtr in _xtrF:
if not(0 <= xtr <= 1) and xtr != -1:
raise RuntimeError("BLASTERAPI: Incorrect forced transition location.", xtr)
if _span < 0:
raise RuntimeError('BLASTERAPI: Invalid span', _span)
if _nSections <= 0:
raise RuntimeError('BLASTERAPI: Invalid number of sections', _nSections)
# Coupler
_couplIter = cfg.get('couplIter', 150)
_couplTol = cfg.get('couplTol', 1e-4)
_iterPrint = cfg.get('iterPrint', 1)
_resetInv = cfg.get('resetInv', False)
if _couplIter < 0:
raise RuntimeError('BLASTERAPI: Invalid number of coupling iterations', _couplIter)
if _couplTol <= 0:
raise RuntimeError('BLASTERAPI: Invalid coupling tolerance', _couplTol)
if _iterPrint < 0:
raise RuntimeError('BLASTERAPI: Invalid iteration print frequency', _iterPrint)
# Viscous solver object.
vSolver = blast.Driver(_Re, _Minf, _CFL0, _nSections, _xtrF[0], _xtrF[1], _span, _verbose =_verbose)
vSolver = blast.Driver(_Re, _Minf, _cfl0, _nSections, _xtrF[0], _xtrF[1], _span, _verbose =_verbose)
# Solvers interface.
solversAPI = interface(icfg, vSolver, cfg)
solverAPI = interface(icfg, vSolver, cfg)
# Coupler
coupler = Coupler(solversAPI, vSolver, _maxCouplIter = __couplIter, _couplTol = __couplTol, _iterPrint = __iterPrint, _resetInv = __resetInv)
coupler = Coupler(solverAPI, vSolver, _maxCouplIter = _couplIter, _couplTol = _couplTol, _iterPrint = _iterPrint, _resetInv = _resetInv)
# Adjoint objects
cAdj = None
if task == 'optimization':
cAdj = blast.CoupledAdjoint(solverAPI.adjointSolver, vSolver)
return {'coupler': coupler,
'solversAPI': solversAPI,
'vSolver': vSolver}
'isol': solverAPI,
'vsol': vSolver,
'adj': cAdj}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2022 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# @author Paul Dechamps
# @date 2024
# Test the blaster adjoint implementation.
# Imports.
import numpy as np
from fwk.wutils import parseargs
import fwk
from fwk.testing import *
from fwk.coloring import ccolors
import fwk
from fwk.testing import *
from fwk.coloring import ccolors
import numpy as np
import os
from matplotlib import pyplot as plt
from blast.api.blaster_api import init_blaster
import blast.utils as viscUtils
def cfgInviscid(nthrds, verb):
import os.path
# Parameters
return {
# Options
'scenario' : 'aerodynamic',
'task' : 'optimization',
'Threads' : nthrds, # number of threads
'Verb' : verb, # verbosity
# Model (geometry or mesh)
'File' : os.path.dirname(os.path.abspath(__file__)) + '/../models/dart/n0012.geo', # Input file containing the model
'Pars' : {'xLgt' : 50, 'yLgt' : 50, 'msF' : 10, 'msTe' : 0.01, 'msLe' : 0.01}, # parameters for input file model
'Dim' : 2, # problem dimension
'Format' : 'gmsh', # save format (vtk or gmsh)
# Markers
'Fluid' : 'field', # name of physical group containing the fluid
'Farfield' : ['upstream', 'farfield', 'downstream'], # LIST of names of physical groups containing the farfield boundaries (upstream/downstream should be first/last element)
'Wing' : 'airfoil', # LIST of names of physical groups containing the lifting surface boundary
'Wake' : 'wake', # LIST of names of physical group containing the wake
'WakeTip' : 'wakeTip', # LIST of names of physical group containing the edge of the wake
'Te' : 'te', # LIST of names of physical group containing the trailing edge
'dbc' : False,
'Upstream' : 'upstream',
# Freestream
'M_inf' : 0.2, # freestream Mach number
'AoA' : 2., # freestream angle of attack
# Geometry
'S_ref' : 1., # reference surface length
'c_ref' : 1., # reference chord length
'x_ref' : .25, # reference point for moment computation (x)
'y_ref' : 0.0, # reference point for moment computation (y)
'z_ref' : 0.0, # reference point for moment computation (z)
# Numerical
'LSolver' : 'SparseLu', # inner solver (Pardiso, MUMPS or GMRES)
'G_fill' : 2, # fill-in factor for GMRES preconditioner
'G_tol' : 1e-5, # tolerance for GMRES
'G_restart' : 50, # restart for GMRES
'Rel_tol' : 1e-6, # relative tolerance on solver residual
'Abs_tol' : 1e-8, # absolute tolerance on solver residual
'Max_it' : 20, # solver maximum number of iterations
}
def cfgBlast(verb):
return {
'Re' : 1e6, # Freestream Reynolds number
'Minf' : 0.2, # Freestream Mach number (used for the computation of the time step only)
'CFL0' : 1, # Inital CFL number of the calculation
'Verb': verb, # Verbosity level of the solver
'couplIter': 100, # Maximum number of iterations
'couplTol' : 1e-2, # Tolerance of the VII methodology
'iterPrint': 20, # int, number of iterations between outputs
'resetInv' : True, # bool, flag to reset the inviscid calculation at every iteration.
'sections' : [0], # List of sections for boundary layer calculation
'xtrF' : [-1, -1], # Forced transition location
'interpolator' : 'Matching', # Interpolator for the coupling
}
def main():
tms = fwk.Timers()
tms['total'].start()
# Parse agrs
args = parseargs()
verb = args.verb
nthrds = args.k
icfg = cfgInviscid(nthrds, verb)
cfg = cfgBlast(verb)
obj = init_blaster(cfg, icfg, iSolverName='DART', task='optimization')
coupler, isol, vsol, adj = obj['coupler'], obj['isol'], obj['vsol'], obj['adj']
# Forward problem
coupler.run()
# Adjoint problem
isol.adjointSolver.run()
adj.run()
vSolution = viscUtils.getSolution(isol.sec, write=False)[0]
#plotSolution(vSolution)
tms['total'].stop()
# Make the api crash
params = {
'Re': -1,
'Minf': -1,
'CFL0': -1,
'couplIter': -1,
'couplTol': -1,
'iterPrint': -1
}
# Loop over the parameters
for param, value in params.items():
original = cfg[param]
try:
cfg[param] = value
obj = init_blaster(cfg, icfg, iSolverName='DART', task='optimization')
raise AssertionError(f'API initialized with {param} = ', cfg[param])
except AssertionError as e:
raise RuntimeError(e)
except:
print(ccolors.ANSI_GREEN + f'API crashed with {param} = ' + str(cfg[param]) + ccolors.ANSI_RESET)
cfg[param] = original
print('Statistics')
print(tms)
print(ccolors.ANSI_BLUE + 'PyTesting' + ccolors.ANSI_RESET)
tests = CTests()
tests.add(CTest('Cl', isol.getCl(), 0.226, 1e-2))
tests.add(CTest('Cd', isol.getCd()+vsol.Cdf, 0.00587, 1e-2))
tests.add(CTest('dCl_dAoA', adj.tdCl_AoA, 5.47, 1e-3))
tests.add(CTest('dCd_dAoA', adj.tdCd_AoA, 0.09531, 1e-3))
tests.run()
# eof
print('')
def plotSolution(vSolution):
plt.figure()
plt.plot(vSolution['x'], vSolution['cf'], label='$c_f$')
plt.xlim([0, 1])
plt.xlabel('x/c')
plt.ylabel('$c_f$')
plt.legend()
plt.grid()
plt.savefig('cf.png')
plt.draw()
plt.figure()
plt.plot(vSolution['x'], vSolution['ctEq'], label='$ctEq$')
plt.xlim([0, 1])
plt.xlabel('x/c')
plt.ylabel('$ctEq$')
plt.legend()
plt.grid()
plt.savefig('cf.png')
plt.draw()
plt.figure()
plt.plot(vSolution['x'], vSolution['theta'], label='$\theta$')
plt.plot(vSolution['x'], vSolution['deltaStar'], label='$\delta^*$')
plt.plot(vSolution['x'], vSolution['theta']*vSolution['H'], label='$\delta^*from$')
plt.xlim([0, 1])
plt.xlabel('x/c')
plt.ylabel('$\delta^*$')
plt.legend()
plt.grid()
plt.savefig('cf.png')
plt.draw()
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -43,7 +43,7 @@ def cfgInviscid(nthrds, verb):
'Verb' : verb, # verbosity
# Model (geometry or mesh)
'File' : os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + '/modules/dartflo/dart/models/agard445.geo', # Input file containing the model
'Pars' : {'xL': 7., 'yL': 3., 'zL': 6., 'xO': -3, 'zO': -3, 'msLeRt': 0.0028, 'msTeRt': 0.0056, 'msLeTp': 0.0018, 'msTeTp': 0.0036, 'msF': 1.0}, # parameters for input file model
'Pars' : {'xL': 22., 'yL': 22., 'zL': 22., 'xO': -11., 'zO': -11., 'msLeRt': 0.0056, 'msTeRt': 0.0056, 'msLeTp': 0.0036, 'msTeTp': 0.0036, 'msF': 1.0}, # parameters for input file model
'Dim' : 3, # problem dimension
'Format' : 'vtk', # save format (vtk or gmsh)
# Markers
......@@ -57,7 +57,7 @@ def cfgInviscid(nthrds, verb):
'Upstream' : 'upstream',
# Freestream
'M_inf' : 0.96, # freestream Mach number
'AoA' : 1, # freestream angle of attack
'AoA' : 0., # freestream angle of attack
# Geometry
'S_ref' : 0.35, # reference surface length
'c_ref' : 0.47, # reference chord length
......@@ -71,16 +71,16 @@ def cfgInviscid(nthrds, verb):
'G_restart' : 50, # restart for GMRES
'Rel_tol' : 1e-6, # relative tolerance on solver residual
'Abs_tol' : 1e-8, # absolute tolerance on solver residual
'Max_it' : 50 # solver maximum number of iterations
'Max_it' : 75 # solver maximum number of iterations
}
def cfgBlast(verb):
return {
'Re' : 6.7e6, # Freestream Reynolds number
'Re' : 5.96e5, # Freestream Reynolds number
'Minf' : 0.96, # Freestream Mach number (used for the computation of the time step only)
'CFL0' : 1, # Inital CFL number of the calculation
'sections' : np.linspace(0.026, 0.7, 15),
'sections' : np.linspace(0.026, 0.73, 15),
'writeSections': np.linspace(0.01, 0.76, 15),
'Sym':[0.],
'span': 0.762,
......@@ -88,7 +88,7 @@ def cfgBlast(verb):
'rbftype': 'linear',
'smoothing': 1e-8,
'degree': 0,
'neighbors': 10,
'neighbors': 6,
'saveTag': 5,
'Verb': verb, # Verbosity level of the solver
......@@ -102,6 +102,7 @@ def cfgBlast(verb):
def main():
# Timer.
import os
tms = fwk.Timers()
tms['total'].start()
......@@ -109,19 +110,21 @@ def main():
icfg = cfgInviscid(args.k, args.verb)
vcfg = cfgBlast(args.verb)
AoAVec = [-1, 0., 1]
sfxVec = ['_AoAminus1deg', '_AoA0deg', '_AoA1deg']
for i in range(3):
#AoAVec = [-.01, 0.0, .01]
#sfxVec = ['_a1-', '_a0', '_a1']
AoAVec = [0.0]
sfxVec = ['_a0']
for i in range(len(AoAVec)):
vcfg['sfx'] = sfxVec[i]
icfg['AoA'] = AoAVec[i]
parsViscous = {'nLe': 15, 'nMid': 30, 'nTe': 7, 'nSpan': 60, 'nWake': 30,
'progLe': 1.07, 'progMid': 1.0, 'progTe': 1.0, 'progSpan': 1.0, 'progWake': 1.15}
parsViscous = {'nLe': 30, 'nMid': 45, 'nTe': 10, 'nSpan': 60, 'nWake': 25,
'progLe': 1.1, 'progMid': 1.0, 'progTe': 1.0, 'progSpan': 1.0, 'progWake': 1.2}
vMsh = viscUtils.mesh(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/models/dart/agard445_visc.geo', parsViscous)
vcfg['vMsh'] = vMsh
tms['pre'].start()
coupler, iSolverAPI, vSolver = viscUtils.initBlast(icfg, vcfg)
coupler, isol, vsol = viscUtils.initBlast(icfg, vcfg)
tms['pre'].stop()
print(ccolors.ANSI_BLUE + 'PySolving...' + ccolors.ANSI_RESET)
......@@ -132,17 +135,11 @@ def main():
# Display results.
print(ccolors.ANSI_BLUE + 'PyRes...' + ccolors.ANSI_RESET)
print(' Re M alpha Cl Cd Cdp Cdf Cm')
print('{0:6.1f}e6 {1:8.2f} {2:8.1f} {3:8.4f} {4:8.4f} {5:8.4f} {6:8.4f} {7:8.4f}'.format(vcfg['Re']/1e6, iSolverAPI.getMinf(), iSolverAPI.getAoA()*180/math.pi, iSolverAPI.getCl(), vSolver.Cdt, vSolver.Cdp, vSolver.Cdf, iSolverAPI.getCm()))
print('{0:6.1f}e6 {1:8.2f} {2:8.1f} {3:8.4f} {4:8.4f} {5:8.4f} {6:8.4f} {7:8.4f}'.format(vcfg['Re']/1e6, isol.getMinf(), isol.getAoA()*180/math.pi, isol.getCl(), vsol.Cdt, vsol.Cdp, vsol.Cdf, isol.getCm()))
# Write results to file.
vSolution = viscUtils.getSolution(vSolver)
# Write results to file.
for iSec in range(len(iSolverAPI.cfg['EffSections'])):
vSolution = viscUtils.getSolution(vSolver, iSec)
viscUtils.write(vSolution, vSolver.getRe(), sfx=sfxVec[i]+'slice'+str(iSec))
vSolution['Cdt_int'] = vSolver.Cdf + iSolverAPI.getCd()
tms['total'].stop()
isol.save(sfx='_viscous'+sfxVec[i])
vSolution = viscUtils.getSolution(isol.sec, write=True, toW='all')
print(ccolors.ANSI_BLUE + 'PyTiming...' + ccolors.ANSI_RESET)
print('CPU statistics')
......@@ -150,30 +147,43 @@ def main():
print('SOLVERS statistics')
print(coupler.tms)
cps = []
cps_v = []
cps_i = []
import os
# Get file dir
dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + '/workspace/blast_validation_agardValidation/'
for s in sfxVec:
cps_s = []
cps_s_v = []
cps_s_i = []
for i in range(len(vcfg['writeSections'])):
cps_s.append(np.loadtxt('/Users/pauldechamps/lab/softwares/blaster/workspace/blast_validation_agardValidation/agard445_viscous'+s+'_slice_'+str(i)+'.dat', delimiter=',', skiprows=1))
cps.append(cps_s)
cps_s_v.append(np.loadtxt(dir+'agard445_viscous'+s+'_slice_'+str(i)+'.dat', delimiter=',', skiprows=1))
cps_s_i.append(np.loadtxt(dir+'agard445_inviscid'+s+'_slice_'+str(i)+'.dat', delimiter=',', skiprows=1))
cps_v.append(cps_s_v)
cps_i.append(cps_s_i)
# Plotting
from matplotlib import pyplot as plt
for i in range(len(vcfg['writeSections'])):
plt.figure(i)
for j in range(len(sfxVec)):
plt.plot(cps[j][i][:,3], cps[j][i][:,4], label=sfxVec[j].replace('_', ' '))
plt.plot(cps_i[j][i][:,3], cps_i[j][i][:,4], label=sfxVec[j].replace('_', ' ')+'_invicid')
for j in range(len(sfxVec)):
plt.plot(cps_v[j][i][:,3], cps_v[j][i][:,4], label=sfxVec[j].replace('_', ' ')+'_viscous')
plt.legend()
plt.gca().invert_yaxis()
plt.title('Section ' + str(i))
plt.xlabel('x')
plt.ylabel('cp')
plt.show()
# Test solution
print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET)
tests = CTests()
tests.add(CTest('Cl', iSolverAPI.getCl(), 0.069, 5e-2))
tests.add(CTest('Cd', vSolution['Cdt_int'], 0.00498, 1e-3, forceabs=True))
tests.add(CTest('Iterations', len(aeroCoeffs), 8, 0, forceabs=True))
tests.run()
# Test solution only for AoA = 0.
if len(AoAVec) == 1 and AoAVec[0] == 0.0:
print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET)
tests = CTests()
tests.add(CTest('Cl', isol.getCl(), 0.0, 1e-3))
tests.add(CTest('Cd', isol.getCd()+vsol.Cdf, 0.00564, 1e-3, forceabs=True))
tests.add(CTest('Iterations', len(aeroCoeffs['Cl']), 5, 0, forceabs=True))
tests.run()
# eof
print('')
......
......@@ -96,7 +96,7 @@ def cfgBlast(verb):
'couplTol' : 5e-4, # Tolerance of the VII methodology
'iterPrint': 5, # int, number of iterations between outputs
'resetInv' : True, # bool, flag to reset the inviscid calculation at every iteration.
'xtrF' : [0., 0.],# Forced transition location
'xtrF' : [0.01, 0.01],# Forced transition location
'nDim' : 3
}
......
......@@ -5,16 +5,13 @@
# @authors A. Crovato, R. Boman
# Modified by P. Dechamps
import sys
import os
import fnmatch
import re
import subprocess
def all_files(root,
patterns='*',
skips='*.git*;*build*',
skips='*.git*;*build*;modules*',
single_level=False,
yield_folders=False):
# self.checkPath(root)
......@@ -38,20 +35,17 @@ def all_files(root,
if single_level:
break
def main():
# loop over all files and format them
encs = {}
for f in all_files(os.getcwd(), patterns='*.cpp;*.c;*.h;*.hpp'):
# print(f)
cmd = ['clang-format-10', "-style=file", "-i", f]
print('Checking file', 'blaster'+f.split('blaster', 1)[-1], end='...')
cmd = ['clang-format-11', "-style=file", "-i", f]
retcode = subprocess.call(cmd)
if retcode != 0:
print(f'ERROR: retcode = {retcode}')
break
print('done.')
if __name__ == "__main__":
# print('running format_code.py...')
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment