<commit_before>﻿/*
Trajectories
Copyright 2014, <NAME>

This file is part of Trajectories, under MIT license.
*/

//#define PRECOMPUTE_CACHE

using System;
using UnityEngine;

namespace Trajectories
{
    // this class abstracts the game aerodynamic computations to provide an unified interface wether the stock drag is used, or a supported mod is installed
    public abstract class VesselAerodynamicModel
    {
        private double mass_;
        public double mass { get { return mass_; } }

        public abstract string AerodynamicModelName { get; }

        protected Vessel vessel_;
        protected CelestialBody body_;
        private bool isValid;
        private double referenceDrag = 0;
        private int referencePartCount = 0;
        private DateTime nextAllowedAutomaticUpdate = DateTime.Now;

        public bool UseCache { get { return Settings.fetch.UseCache; } }
        protected AeroForceCache cachedForces;

        public static bool Verbose { get; set; }

        public static bool DebugParts { get; set; }

        public VesselAerodynamicModel(Vessel vessel, CelestialBody body)
        {
            vessel_ = vessel;
            body_ = body;

            referencePartCount = vessel.Parts.Count;

            updateVesselInfo();

            InitCache();
        }

        private void updateVesselInfo()
        {
            mass_ = 0.0;
            foreach (var part in vessel_.Parts)
            {
                if (part.physicalSignificance == Part.PhysicalSignificance.NONE)
                    continue;

                float partMass = part.mass + part.GetResourceMass() + part.GetPhysicslessChildMass();
                mass_ += partMass;
            }
        }

        private void InitCache()
        {
            Debug.Log("Trajectories: Initializing cache");
<commit_msg>simpler mass calculation for updateVesselInfo()<commit_after>﻿/*
Trajectories
Copyright 2014, <NAME>

This file is part of Trajectories, under MIT license.
*/

//#define PRECOMPUTE_CACHE

using System;
using UnityEngine;

namespace Trajectories
{
    // this class abstracts the game aerodynamic computations to provide an unified interface wether the stock drag is used, or a supported mod is installed
    public abstract class VesselAerodynamicModel
    {
        private double mass_;
        public double mass { get { return mass_; } }

        public abstract string AerodynamicModelName { get; }

        protected Vessel vessel_;
        protected CelestialBody body_;
        private bool isValid;
        private double referenceDrag = 0;
        private int referencePartCount = 0;
        private DateTime nextAllowedAutomaticUpdate = DateTime.Now;

        public bool UseCache { get { return Settings.fetch.UseCache; } }
        protected AeroForceCache cachedForces;

        public static bool Verbose { get; set; }

        public static bool DebugParts { get; set; }

        public VesselAerodynamicModel(Vessel vessel, CelestialBody body)
        {
            vessel_ = vessel;
            body_ = body;

            referencePartCount = vessel.Parts.Count;

            updateVesselInfo();

            InitCache();
        }

        private void updateVesselInfo()
        {
            mass_ = vessel_.totalMass;
        }

        private void InitCache()
        {
            Debug.Log("Trajectories: Initializing cache");

{'fraction_non_alphanumeric': 0.06418219461697723, 'fraction_numerical': 0.004140786749482402, 'mean_word_length': 2.2332695984703634, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6195435', 'n_tokens_mistral': 893, 'n_tokens_neox': 823, 'n_words': 280}