IMsProblemCalculationSettings.EntriesFilter

Syntax

EntriesFilter: IMsCalculationChainFilter;

Description

The EntriesFilter property returns the collection of elements calculated by problem.

Comments

This property enables the user to calculate only part of calculation chain without saving metamodel.

If the following element is added to the collection:

Example

Executing the example requires that the repository contains a modeling container with the MS identifier containing a modeling problem with the PROBLEM_FILTER identifier. Metamodel calculated by this problem must contain several elements in calculation chain.

Add links to the Metabase and Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsKey: Integer;
    Problem: IMsProblem;
    CalcChain: IMsCalculationChainEntries;
    CalcSettings: IMsProblemCalculationSettings;
    ChainFilter: IMsCalculationChainFilter;
    Calculation: IMsProblemCalculation;
    i: Integer;
Begin
    mb := MetabaseClass.Active;
    // Get modelling container key
    MsKey := mb.GetObjectKeyById("MS");
    // Get modeling problem
    Problem := mb.ItemByIdNamespace("PROBLEM_FILTER", MsKey).Edit As IMsProblem;
    // Get problem calculation parameters
    CalcSettings := Problem.CreateCalculationSettings;
    // Get collection of calculated elements
    ChainFilter := CalcSettings.EntriesFilter;
    // Clear collection
    ChainFilter.Clear;
    // Get calculation chain
    CalcChain := Problem.EditMetaModel.CalculationChain;
    // Add only odd elements from calculation chain to collection of calculated elements
    For i := 1 To CalcChain.Count Do
        If (i Mod 2) <> 0 Then
            ChainFilter.Add(CalcChain.Item(i - 1));
        End If;
    End For;
    // Output names of calculated elements to console window
    Debug.WriteLine("Names of calculated elements:");
    For i := 0 To ChainFilter.Count - 1 Do
        Debug.WriteLine(ChainFilter.Item(i).Name);
    End For;
    // Calculate problem
    Calculation := Problem.Calculate(CalcSettings);
    Calculation.Run;
End Sub UserProc;

After executing the example only odd elements from calculation chain are used in problem calculation.

See also:

IMsProblemCalculationSettings