private double[] createRandomOrgansVolumesFrom(Individual individual, Func <IMuSigma, double> generateVolumeFunction)
        {
            var allOrgans    = individual.AllOrgans().ToList();
            var organVolumes = new double[allOrgans.Count()];

            _organDensity = new double[allOrgans.Count()];

            int iOrganIndex = 0;

            foreach (var organ in allOrgans)
            {
                var muSigma = _muSigmas[iOrganIndex];
                _organDensity[iOrganIndex] = organ.Parameter(CoreConstants.Parameter.DENSITY).Value;
                organVolumes[iOrganIndex]  = generateVolumeFunction(muSigma);

                if (organ.OrganType == OrganType.Skin)
                {
                    _skinIndex = iOrganIndex;
                }

                if (organ.OrganType == OrganType.Fat)
                {
                    _fatIndex = iOrganIndex;
                }

                iOrganIndex++;
            }

            //Scale skin
            organVolumes[_skinIndex] = getSkinVolume(_muSigmas[_skinIndex], organVolumes, generateVolumeFunction);

            return(organVolumes);
        }
        private double[] createDefaultOrgansVolumesFrom(Individual individual)
        {
            var allOrgans    = individual.AllOrgans().ToList();
            var organVolumes = new double[allOrgans.Count()];

            _organDensity = new double[allOrgans.Count()];

            int iOrganIndex = 0;

            foreach (var organ in allOrgans)
            {
                _organDensity[iOrganIndex] = organ.Parameter(CoreConstants.Parameter.DENSITY).Value;
                organVolumes[iOrganIndex]  = organ.Parameter(CoreConstants.Parameter.VOLUME).Value;

                if (organ.OrganType == OrganType.Skin)
                {
                    _skinIndex = iOrganIndex;
                }

                if (organ.OrganType == OrganType.Fat)
                {
                    _fatIndex = iOrganIndex;
                }

                iOrganIndex++;
            }

            return(organVolumes);
        }
 private void initializeMusAndSigmas(Individual individual)
 {
     //retrieve disitribution parameters for volumes parameters
     foreach (var organ in individual.AllOrgans())
     {
         var volumeParameter       = organ.Parameter(CoreConstants.Parameter.VOLUME);
         var allometricScaleFactor = volumeParameter.ParentContainer.Parameter(CoreConstants.Parameter.ALLOMETRIC_SCALE_FACTOR).Value;
         var musSigma = MuSigma.From(volumeParameter);
         musSigma.ScaleWith(_hrel, allometricScaleFactor);
         _muSigmas.Add(musSigma);
     }
 }
        private void setOrganVolumesTo(Individual individual, double[] organVolumes)
        {
            int organIndex = 0;

            foreach (var organ in individual.AllOrgans())
            {
                var volumeParameter = organ.Parameter(CoreConstants.Parameter.VOLUME);
                volumeParameter.Value        = organVolumes[organIndex];
                volumeParameter.DefaultValue = volumeParameter.Value;
                volumeParameter.IsFixedValue = false;
                organIndex++;
            }
        }