本文整理汇总了C#中G25.AbsoluteLargestConstantBasisBlade方法的典型用法代码示例。如果您正苦于以下问题:C# G25.AbsoluteLargestConstantBasisBlade方法的具体用法?C# G25.AbsoluteLargestConstantBasisBlade怎么用?C# G25.AbsoluteLargestConstantBasisBlade使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G25
的用法示例。
在下文中一共展示了G25.AbsoluteLargestConstantBasisBlade方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteLargestCoordinateFunctions
/// <summary>
/// Writes code for abs largest coordinate
/// </summary>
/// <param name="S"></param>
/// <param name="cgd">Results go here. Also intermediate data for code generation. Also contains plugins and cog.</param>
public static void WriteLargestCoordinateFunctions(Specification S, G25.CG.Shared.CGdata cgd, G25.FloatType FT, G25.SMV smv)
{
StringBuilder defSB = cgd.m_defSB;
defSB.AppendLine("");
const string smvName = G25.CG.Shared.SmvUtil.THIS;
const bool ptr = false;
string fabsFunc = G25.CG.Shared.CodeUtil.OpNameToLangString(S, FT, RefGA.Symbolic.UnaryScalarOp.ABS);
string[] AS = G25.CG.Shared.CodeUtil.GetAccessStr(S, smv, smvName, ptr);
RefGA.BasisBlade maxBasisBlade = smv.AbsoluteLargestConstantBasisBlade();
//string className = FT.GetMangledName(S, smv.Name);
for (int _returnBitmap = 0; _returnBitmap <= 1; _returnBitmap++)
{
bool returnBitmap = (_returnBitmap != 0);
// write comment
int nbTabs = 1;
if (returnBitmap)
new G25.CG.Shared.Comment("Returns the absolute largest coordinate,\nand the corresponding basis blade bitmap.").Write(defSB, S, nbTabs);
else new G25.CG.Shared.Comment("Returns the absolute largest coordinate.").Write(defSB, S, nbTabs);
string funcName = Util.GetFunctionName(S, ((returnBitmap) ? "largestBasisBlade" : "largestCoordinate"));
string funcDecl;
if ((S.OutputCSharp()) && returnBitmap)
{
funcDecl = FT.type + " " + funcName + "(int bm) ";
}
else if ((S.OutputJava()) && returnBitmap)
{
funcDecl = FT.type + "[] " + funcName + "() ";
}
else
{
funcDecl = FT.type + " " + funcName + "()";
}
string FINAL = (S.OutputJava()) ? "final " : "";
defSB.Append("\tpublic " + FINAL + funcDecl);
{
defSB.AppendLine(" {");
if ((S.OutputJava()) && returnBitmap)
defSB.AppendLine("\t\tint bm;");
int startIdx = 0;
if (maxBasisBlade != null)
{
defSB.AppendLine("\t\t" + FT.type + " maxValue = " + FT.DoubleToString(S, Math.Abs(maxBasisBlade.scale)) + ";");
if (returnBitmap)
defSB.AppendLine("\t\tbm = " + maxBasisBlade.bitmap + ";");
}
else
{
defSB.AppendLine("\t\t" + FT.type + " maxValue = " + fabsFunc + "(" + AS[0] + ");");
if (returnBitmap)
defSB.AppendLine("\t\tbm = 0;");
startIdx = 1;
}
for (int c = startIdx; c < smv.NbNonConstBasisBlade; c++)
{
defSB.Append("\t\tif (" + fabsFunc + "(" + AS[c] + ") > maxValue) { maxValue = " + fabsFunc + "(" + AS[c] + "); ");
if (returnBitmap) defSB.Append("bm = " + smv.NonConstBasisBlade(c).bitmap + "; ");
defSB.AppendLine("}");
}
if ((S.OutputJava()) && returnBitmap)
{
defSB.AppendLine("\t\treturn new " + FT.type + "[]{maxValue, (" + FT.type + ")bm};");
}
else
{
defSB.AppendLine("\t\treturn maxValue;");
}
defSB.AppendLine("\t}");
}
}
}