From 87dad9739bfd5045b3395da1f9f72cd021d69af6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Romain=20Bron=C3=A8s?=
 <romain.broucquart@synchrotron-soleil.fr>
Date: Thu, 4 Jan 2024 10:59:15 +0100
Subject: [PATCH] fix(mapt): replace MATRIXCOEF multiple line by one

* Quick patch, better working on it elsewhere
* The 2D array is given line by line in the MAPT file
* This AWK rules replace that with a single global line
---
 recipes-bsp/variant-mapt/variant-mapt.bb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/recipes-bsp/variant-mapt/variant-mapt.bb b/recipes-bsp/variant-mapt/variant-mapt.bb
index a3d46ad..ae45f49 100644
--- a/recipes-bsp/variant-mapt/variant-mapt.bb
+++ b/recipes-bsp/variant-mapt/variant-mapt.bb
@@ -23,11 +23,12 @@ python () {
 
 }
 
-# Changing BAR of mapt files
+# Changing BAR of mapt files to 0 (field #5 receive 0)
+# Replace each line of MATRIX coeff by a global entry
 do_compile () {
     for MAPT in ${PL_MAPT_PATH}
     do
-        awk 'FNR>1 {$5=0} {print}' ${WORKDIR}/${MAPT} > ${WORKDIR}/${MAPT}.bar0
+        awk 'FNR>1 {$5=0} {if ($1 ~ /MATRIXCOEF\.[^0]/ ) next} {if ($1 ~ /MATRIXCOEF\.0/) {$1="APP.corr_matrix_0.MATRIXCOEF" ; $2="12800" ; $4="51200"}}  {print}' ${WORKDIR}/${MAPT} > ${WORKDIR}/${MAPT}.bar0
     done
 }
 
-- 
GitLab