Пример #1
0
        public async Task <MakeHyparOutputs> Handler(MakeHyparInputs args, ILambdaContext context)
        {
            if (this.store == null)
            {
                // Preload the dependencies (if they exist),
                // so that they are available during model deserialization.
                var asmLocation = this.GetType().Assembly.Location;
                var asmDir      = Path.GetDirectoryName(asmLocation);
                var asmName     = Path.GetFileNameWithoutExtension(asmLocation);
                var depPath     = Path.Combine(asmDir, $"{asmName}.Dependencies.dll");

                if (File.Exists(depPath))
                {
                    Console.WriteLine($"Loading dependencies from assembly: {depPath}...");
                    Assembly.LoadFrom(depPath);
                    Console.WriteLine("Dependencies assembly loaded.");
                }

                this.store = new S3ModelStore <MakeHyparInputs>(RegionEndpoint.USWest1);
            }

            var l      = new InvocationWrapper <MakeHyparInputs, MakeHyparOutputs>(store, MakeHypar.Execute);
            var output = await l.InvokeAsync(args);

            return(output);
        }
Пример #2
0
        /// <summary>
        /// Construct a hypar.
        /// </summary>
        /// <param name="model">The model.
        /// Add elements to the model to have them persisted.</param>
        /// <param name="input">The arguments to the execution.</param>
        /// <returns>A HyparOutputs instance containing computed results.</returns>
        public static MakeHyparOutputs Execute(Model model, MakeHyparInputs input)
        {
            double minLength, maxLength, minEl, maxEl;
            var    beams = ContstructBeams(input.XAmplitude, input.YAmplitude, (int)input.Divisions,
                                           out maxLength, out minLength, out minEl, out maxEl);

            model.AddElements(beams);
            return(new MakeHyparOutputs(maxLength, minLength, minEl, maxEl));
        }
Пример #3
0
        public async Task <MakeHyparOutputs> Handler(MakeHyparInputs args, ILambdaContext context)
        {
            if (this.store == null)
            {
                this.store = new S3ModelStore <MakeHyparInputs>(RegionEndpoint.USWest1);
            }

            var l      = new InvocationWrapper <MakeHyparInputs, MakeHyparOutputs>(store, MakeHypar.Execute);
            var output = await l.InvokeAsync(args);

            return(output);
        }
Пример #4
0
        /// <summary>
        /// Construct a hypar.
        /// </summary>
        /// <param name="model">The model. 
        /// Add elements to the model to have them persisted.</param>
        /// <param name="input">The arguments to the execution.</param>
        /// <returns>A HyparOutputs instance containing computed results.</returns>
        public static MakeHyparOutputs Execute(Dictionary<string, Model> models, MakeHyparInputs input)
        {
            double minLength, maxLength, minEl, maxEl;
            var beams = ContstructBeams(input.XAmplitude, input.YAmplitude, (int)input.Divisions,
                out maxLength, out minLength, out minEl, out maxEl, input.UseHSSSections);

            var model = new Model();
            model.AddElements(beams);

            var outputs = new MakeHyparOutputs(maxLength, minLength, minEl, maxEl);
            outputs.Model = model;

            return outputs;
        }