コード例 #1
0
        private static void SetupFrictionData(List <SparseArray <float> > productions, List <SparseArray <float> > attractions,
                                              List <IDemographicCategory> cats, MultiBlendSet multiset, float[][][] productionSet, float[][][] attractionSet,
                                              IDemographicCategory[][] multiCatSet)
        {
            int subsetIndex = -1;

            foreach (var blendSet in multiset.Subsets)
            {
                subsetIndex++;
                var set           = blendSet.Set;
                var length        = set.Count;
                int place         = 0;
                int blendSetCount = 0;
                for (int i = 0; i < length; i++)
                {
                    for (int pos = set[i].Start; pos <= set[i].Stop; pos++)
                    {
                        blendSetCount++;
                    }
                }
                productionSet[subsetIndex] = new float[blendSetCount][];
                attractionSet[subsetIndex] = new float[blendSetCount][];
                multiCatSet[subsetIndex]   = new IDemographicCategory[blendSetCount];
                for (int i = 0; i < length; i++)
                {
                    for (int pos = set[i].Start; pos <= set[i].Stop; pos++)
                    {
                        productionSet[subsetIndex][place] = productions[pos].GetFlatData();
                        attractionSet[subsetIndex][place] = attractions[pos].GetFlatData();
                        multiCatSet[subsetIndex][place]   = cats[pos];
                        place++;
                    }
                }
            }
        }
コード例 #2
0
        private static int CountSetsInMultiSet(MultiBlendSet multiset)
        {
            var numberOfThingsToBlend = 0;

            foreach (var blendSet in multiset.Subsets)
            {
                var set    = blendSet.Set;
                var length = set.Count;
                for (int i = 0; i < length; i++)
                {
                    numberOfThingsToBlend += set[i].Stop - set[i].Start + 1;
                }
            }
            return(numberOfThingsToBlend);
        }
コード例 #3
0
 private static void SetupFrictionData(List<SparseArray<float>> productions, List<SparseArray<float>> attractions,
     List<IDemographicCategory> cats, MultiBlendSet multiset, float[][][] productionSet, float[][][] attractionSet,
     IDemographicCategory[][] multiCatSet)
 {
     int subsetIndex = -1;
     foreach ( var blendSet in multiset.Subsets )
     {
         subsetIndex++;
         var set = blendSet.Set;
         var length = set.Count;
         int place = 0;
         int blendSetCount = 0;
         for ( int i = 0; i < length; i++ )
         {
             for ( int pos = set[i].Start; pos <= set[i].Stop; pos++ )
             {
                 blendSetCount++;
             }
         }
         productionSet[subsetIndex] = new float[blendSetCount][];
         attractionSet[subsetIndex] = new float[blendSetCount][];
         multiCatSet[subsetIndex] = new IDemographicCategory[blendSetCount];
         for ( int i = 0; i < length; i++ )
         {
             for ( int pos = set[i].Start; pos <= set[i].Stop; pos++ )
             {
                 productionSet[subsetIndex][place] = productions[pos].GetFlatData();
                 attractionSet[subsetIndex][place] = attractions[pos].GetFlatData();
                 multiCatSet[subsetIndex][place] = cats[pos];
                 place++;
             }
         }
     }
 }
コード例 #4
0
 private static int CountSetsInMultiSet(MultiBlendSet multiset)
 {
     var numberOfThingsToBlend = 0;
     foreach ( var blendSet in multiset.Subsets )
     {
         var set = blendSet.Set;
         var length = set.Count;
         for ( int i = 0; i < length; i++ )
         {
             numberOfThingsToBlend += set[i].Stop - set[i].Start + 1;
         }
     }
     return numberOfThingsToBlend;
 }