Esempio n. 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ISolver2D     solverOpt = new ISolver2D();
            double        maxSize = 1, minSize = 1;
            bool          rightAngle = false;
            MeshSolvers2D solver     = MeshSolvers2D.Automatic;

            DA.GetData(1, ref minSize);
            DA.GetData(2, ref maxSize);
            DA.GetData(3, ref adaptive);
            DA.GetData(4, ref minElemPerTwoPi);
            DA.GetData(5, ref smoothingSteps);
            DA.GetData(6, ref ho_optimization);
            DA.GetData(7, ref rightAngle);

            if (minSize < 0.1 && MassiveRefinement == false)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, solverOpt.MinSizeWarning);
                minSize = 0.1;
            }

            double size = (maxSize + minSize) / 2;

            DA.GetData(0, ref size);

            if (rightAngle)
            {
                solver = MeshSolvers2D.PackingOfParallelograms;
            }

            solverOpt.MeshingAlgorithm                  = (int)solver;
            solverOpt.CharacteristicLengthMin           = minSize;
            solverOpt.CharacteristicLengthMax           = maxSize;
            solverOpt.CharacteristicLengthFromCurvature = adaptive;
            solverOpt.MinimumElementsPerTwoPi           = minElemPerTwoPi;
            solverOpt.OptimizationSteps                 = smoothingSteps;
            solverOpt.HighOrderOptimize                 = ho_optimization;
            solverOpt.Subdivide             = false;
            solverOpt.ElementOrder          = 2;
            solverOpt.SecondOrderIncomplete = false;
            solverOpt.Size = size;

            DA.SetData(0, solverOpt);

            this.Message = "6Tria";
        }
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            MeshSolvers2D solver = MeshSolvers2D.Automatic;
            ISolver2D     solverOpt = new ISolver2D();
            double        maxSize = 1, minSize = 1;

            DA.GetData(1, ref minSize);
            DA.GetData(2, ref maxSize);
            DA.GetData(3, ref adaptive);
            DA.GetData(4, ref minElemPerTwoPi);
            DA.GetData(5, ref smoothingSteps);
            DA.GetData(6, ref ho_optimization);

            maxSize *= 2;
            minSize *= 2;
            if (minSize < 0.1 && MassiveRefinement == false)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, solverOpt.MinSizeWarning);
                minSize = 0.1;
            }

            double size = (maxSize + minSize) / 2;

            DA.GetData(0, ref size);
            size *= 2;

            solverOpt.MeshingAlgorithm                  = (int)solver;
            solverOpt.CharacteristicLengthMin           = minSize;
            solverOpt.CharacteristicLengthMax           = maxSize;
            solverOpt.CharacteristicLengthFromCurvature = adaptive;
            solverOpt.MinimumElementsPerTwoPi           = minElemPerTwoPi;
            solverOpt.OptimizationSteps                 = smoothingSteps;
            solverOpt.HighOrderOptimize                 = ho_optimization;
            solverOpt.ElementOrder           = 2;
            solverOpt.RecombinationAlgorithm = 1;
            solverOpt.RecombineAll           = true;
            solverOpt.SubdivisionAlgorithm   = 1;
            solverOpt.Subdivide = true;
            solverOpt.Size      = size;
            solverOpt.Subdivide = false;

            DA.SetData(0, solverOpt);

            this.Message = "8Quad";
        }