Skip to content

Commit

Permalink
[98] Variable modifications
Browse files Browse the repository at this point in the history
Remove possibility to create variables using unicode caracters (greek
alphabet, sum, prod and sqrt).
Generated code and LaTeX view are unchanged or equivalent.

Bug: cea-hpc#98
Signed-off-by: Vincent BLAIN <vincent.blain@obeosoft.com>
  • Loading branch information
vblainobeo committed Aug 5, 2022
1 parent 3fb974e commit 4d2ba44
Show file tree
Hide file tree
Showing 197 changed files with 9,040 additions and 9,156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
package fr.cea.nabla.ide.contentassist

import com.google.inject.Inject
import fr.cea.nabla.ir.transformers.ReplaceUtf8Chars
import fr.cea.nabla.services.NablaGrammarAccess
import org.eclipse.xtext.RuleCall
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistEntry
import org.eclipse.xtext.ide.editor.contentassist.IIdeContentProposalAcceptor
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider

Expand All @@ -30,23 +28,10 @@ class NablaIdeContentProposalProvider extends IdeContentProposalProvider
case simpleVarRule,
case connectivityVarRule:
{
buildGrecLetterProposals(context, acceptor)
}
default:
super._createProposals(ruleCall, context, acceptor)
}
}

private def void buildGrecLetterProposals(ContentAssistContext context, IIdeContentProposalAcceptor acceptor)
{
for (p : ReplaceUtf8Chars.UTF8Chars.keySet)
{
val trueEntry = new ContentAssistEntry => [
prefix = context.prefix
proposal = p
]
acceptor.accept(trueEntry, proposalPriorities.getDefaultPriority(trueEntry))
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class JobInterpreter

if (caller.main)
{
val log = String.format(Locale::ENGLISH, "START ITERATION %1$s: %2$5d - t: %3$.5f - deltat: %4$.5f",
val log = String.format(Locale::ENGLISH, "START ITERATION %1$s: %2$5d - t: %3$.5f - delta_t: %4$.5f",
iterationCounter.name,
iteration,
context.getReal(context.ir.currentTimeVariable),
Expand Down Expand Up @@ -96,7 +96,7 @@ class JobInterpreter
if (caller.main)
{
// force a last trace and output at the end
val log = String.format(Locale::ENGLISH, "FINAL TIME: %1$.5f - deltat: %2$.5f",
val log = String.format(Locale::ENGLISH, "FINAL TIME: %1$.5f - delta_t: %2$.5f",
context.getReal(context.ir.currentTimeVariable),
context.getReal(context.ir.timeStepVariable))
context.logFine(log)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class IrTransformationUtils
static def getCommonTransformation(boolean replaceAllReductions)
{
#[
new ReplaceUtf8Chars,
new ReplaceReductions(replaceAllReductions),
new ReplaceAffectations,
new CreateArrayOperators,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void ExplicitHeatEquationModule::init()
// initialization of other attributes
m_lastDump = numeric_limits<int>::min();
m_n = 0;
m_deltat = 0.001;
m_delta_t = 0.001;
m_alpha.resize(nbCell());

// calling jobs
Expand Down Expand Up @@ -144,12 +144,12 @@ void ExplicitHeatEquationModule::computeFaceLength()

/**
* Job computeTn called @1.0 in executeTimeLoopN method.
* In variables: deltat, t_n
* In variables: delta_t, t_n
* Out variables: t_nplus1
*/
void ExplicitHeatEquationModule::computeTn()
{
m_t_nplus1 = m_t_n + m_deltat;
m_t_nplus1 = m_t_n + m_delta_t;
}

/**
Expand Down Expand Up @@ -267,7 +267,7 @@ void ExplicitHeatEquationModule::updateU()
/**
* Job computeDeltaTn called @2.0 in simulate method.
* In variables: D, V
* Out variables: deltat
* Out variables: delta_t
*/
void ExplicitHeatEquationModule::computeDeltaTn()
{
Expand All @@ -283,8 +283,8 @@ void ExplicitHeatEquationModule::computeDeltaTn()
};
reduction0 = reducer.reduce();
}
m_deltat = reduction0 * 0.24;
m_global_deltat = m_deltat;
m_delta_t = reduction0 * 0.24;
m_global_deltat = m_delta_t;
}

/**
Expand Down Expand Up @@ -359,13 +359,13 @@ void ExplicitHeatEquationModule::setUpTimeLoopN()

/**
* Job computeAlphaCoeff called @3.0 in simulate method.
* In variables: V, Xc, deltat, faceConductivity, faceLength
* In variables: V, Xc, delta_t, faceConductivity, faceLength
* Out variables: alpha
*/
void ExplicitHeatEquationModule::computeAlphaCoeff()
{
auto command = makeCommand(m_default_queue);
auto in_deltat = m_deltat;
auto in_delta_t = m_delta_t;
auto in_V = ax::viewIn(command, m_V);
auto in_faceLength = ax::viewIn(command, m_faceLength);
auto in_faceConductivity = ax::viewIn(command, m_faceConductivity);
Expand All @@ -374,7 +374,7 @@ void ExplicitHeatEquationModule::computeAlphaCoeff()
command << RUNCOMMAND_ENUMERATE(Cell, cCells, allCells())
{
const auto cId(cCells);
Real alphaDiag(0.0);
Real alpha_Diag(0.0);
{
const auto neighbourCellsC(m_mesh->getNeighbourCells(cId));
const Int32 nbNeighbourCellsC(neighbourCellsC.size());
Expand All @@ -384,12 +384,12 @@ void ExplicitHeatEquationModule::computeAlphaCoeff()
const auto dCells(dId);
const auto fId(m_mesh->getCommonFace(cId, dId));
const auto fFaces(fId);
const Real alphaExtraDiag(in_deltat / in_V[cCells] * (in_faceLength[fFaces] * in_faceConductivity[fFaces]) / explicitheatequationfreefuncs::norm(explicitheatequationfreefuncs::operatorSub(in_Xc[cCells], in_Xc[dCells])));
out_alpha[cCells][dCells] = alphaExtraDiag;
alphaDiag = alphaDiag + alphaExtraDiag;
const Real alpha_ExtraDiag(in_delta_t / in_V[cCells] * (in_faceLength[fFaces] * in_faceConductivity[fFaces]) / explicitheatequationfreefuncs::norm(explicitheatequationfreefuncs::operatorSub(in_Xc[cCells], in_Xc[dCells])));
out_alpha[cCells][dCells] = alpha_ExtraDiag;
alpha_Diag = alpha_Diag + alpha_ExtraDiag;
}
}
out_alpha[cCells][cCells] = 1 - alphaDiag;
out_alpha[cCells][cCells] = 1 - alpha_Diag;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ExplicitHeatEquationModule
Int32 m_n;
static constexpr Real m_u0 = 1.0;
static constexpr Real2 m_vectOne = {1.0, 1.0};
Real m_deltat;
Real m_delta_t;
Real m_t_n;
Real m_t_nplus1;
Real m_t_n0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
need-sync="true"/>

<variable
field-name="deltatj"
name="deltatj"
field-name="delta_tj"
name="delta_tj"
data-type="real"
item-kind="cell"
dim="0"
Expand Down
Loading

0 comments on commit 4d2ba44

Please sign in to comment.