本文整理汇总了C#中Specification.GetMetric方法的典型用法代码示例。如果您正苦于以下问题:C# Specification.GetMetric方法的具体用法?C# Specification.GetMetric怎么用?C# Specification.GetMetric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Specification
的用法示例。
在下文中一共展示了Specification.GetMetric方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateBasicInfo
public static void GenerateBasicInfo(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd)
{
string accessModifier = Keywords.ConstAccessModifier(S);
string accessModifierArr = Keywords.ConstArrayAccessModifier(S);
string stringType = Keywords.StringType(S);
string boolType = G25.CG.Shared.CodeUtil.GetBoolType(S);
// dimension of space
new G25.CG.Shared.Comment("The dimension of the space").Write(SB, S, 1);
SB.AppendLine("\tpublic " + accessModifier + " int SpaceDim = " + S.m_dimension + ";");
// number of groups in general multivector
new G25.CG.Shared.Comment("Number of groups/grades of coordinates in a multivector").Write(SB, S, 1);
SB.AppendLine("\tpublic " + accessModifier + " int NbGroups = " + S.m_GMV.NbGroups + ";");
// Euclidean metric?
new G25.CG.Shared.Comment("Is the metric of the space Euclidean? (false or true)").Write(SB, S, 1);
SB.AppendLine("\tpublic " + accessModifier + " " + boolType + " MetricEuclidean = " +
(S.GetMetric("default").m_metric.IsEuclidean() ? "true" : "false") + ";");
// basis vector names
new G25.CG.Shared.Comment("Names of the basis vectors.").Write(SB, S, 1);
SB.AppendLine("\tpublic " + accessModifierArr + " " + stringType + "[] BasisVectorNames = new " + stringType + "[] {");
SB.Append("\t\t");
for (int i = 0; i < S.m_dimension; i++)
{
if (i > 0) SB.Append(", ");
SB.Append("\"" + S.m_basisVectorNames[i] + "\"");
}
SB.AppendLine("");
SB.AppendLine("\t};");
}
示例2: GenerateBasicInfo
public static void GenerateBasicInfo(Specification S, G25.CG.Shared.CGdata cgd, StringBuilder SB)
{
// dimension of space
SB.AppendLine("const int " + S.m_namespace + "_spaceDim = " + S.m_dimension + ";");
// number of groups of space
SB.AppendLine("const int " + S.m_namespace + "_nbGroups = " + S.m_GMV.NbGroups + ";");
// Euclidean metric?
SB.AppendLine("const int " + S.m_namespace + "_metricEuclidean = " +
(S.GetMetric("default").m_metric.IsEuclidean() ? "1" : "0") + ";");
// basis vector names
SB.AppendLine("const char *" + S.m_namespace + "_basisVectorNames[" + S.m_dimension + "] = {");
SB.Append("\t");
for (int i = 0; i < S.m_dimension; i++)
{
if (i > 0) SB.Append(", ");
SB.Append("\"" + S.m_basisVectorNames[i] + "\"");
}
SB.AppendLine("");
SB.AppendLine("};");
}
示例3: Init
/// <summary>
/// Must be called before CompleteFGS(), CheckDepencies() or WriteFunction() is called.
/// Subclass can override, but if so, must always call superclass version of Init()
/// </summary>
/// <param name="S"></param>
/// <param name="F"></param>
/// <param name="cgd">Where the generate code goes.</param>
public virtual void Init(Specification S, G25.fgs F, G25.CG.Shared.CGdata cgd)
{
m_specification = S;
m_fgs = F;
m_cgd = cgd;
m_gmv = m_specification.m_GMV;
m_G25M = m_specification.GetMetric(m_fgs.MetricName);
m_M = m_G25M.m_metric;
m_sane = true;
}