コード例 #1
0
        public virtual void test_withZValues_badSize()
        {
            InterpolatedNodalSurface @base = InterpolatedNodalSurface.of(METADATA, XVALUES, YVALUES, ZVALUES, INTERPOLATOR);

            assertThrowsIllegalArg(() => @base.withZValues(DoubleArray.EMPTY));
            assertThrowsIllegalArg(() => @base.withZValues(DoubleArray.of(4d, 6d)));
        }
コード例 #2
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            InterpolatedNodalSurface test = InterpolatedNodalSurface.of(METADATA, XVALUES, YVALUES, ZVALUES, INTERPOLATOR);

            coverImmutableBean(test);
            InterpolatedNodalSurface test2 = InterpolatedNodalSurface.builder().metadata(METADATA_ENTRIES).xValues(XVALUES2).yValues(YVALUES2).zValues(ZVALUES_BUMPED).interpolator(GridSurfaceInterpolator.of(DOUBLE_QUADRATIC, FLAT, FLAT, LINEAR, FLAT, FLAT)).build();

            coverBeanEquals(test, test2);
        }
コード例 #3
0
        //-------------------------------------------------------------------------
        public virtual void test_withZValues()
        {
            InterpolatedNodalSurface @base = InterpolatedNodalSurface.of(METADATA, XVALUES, YVALUES, ZVALUES, INTERPOLATOR);
            InterpolatedNodalSurface test  = @base.withZValues(ZVALUES_BUMPED);

            assertThat(test.Name).isEqualTo(SURFACE_NAME);
            assertThat(test.ParameterCount).isEqualTo(SIZE);
            assertThat(test.Metadata).isEqualTo(METADATA);
            assertThat(test.XValues).isEqualTo(XVALUES);
            assertThat(test.YValues).isEqualTo(YVALUES);
            assertThat(test.ZValues).isEqualTo(ZVALUES_BUMPED);
        }
コード例 #4
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         InterpolatedNodalSurface other = (InterpolatedNodalSurface)obj;
         return(JodaBeanUtils.equal(metadata, other.metadata) && JodaBeanUtils.equal(xValues, other.xValues) && JodaBeanUtils.equal(yValues, other.yValues) && JodaBeanUtils.equal(zValues, other.zValues) && JodaBeanUtils.equal(interpolator, other.interpolator));
     }
     return(false);
 }
コード例 #5
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            DeformedSurface test1 = DeformedSurface.of(METADATA, SURFACE_ORG, FUNCTION);

            coverImmutableBean(test1);
            Surface         surface1 = InterpolatedNodalSurface.of(DefaultSurfaceMetadata.of("TestSurface1"), XVALUES, YVALUES, ZVALUES, INTERPOLATOR);
            DeformedSurface test2    = DeformedSurface.of(DefaultSurfaceMetadata.of("DeformedTestSurface1"), surface1, (DoublesPair x) =>
            {
                return(ValueDerivatives.of(surface1.zValue(x), surface1.zValueParameterSensitivity(x).Sensitivity));
            });

            coverBeanEquals(test1, test2);
        }
コード例 #6
0
 public virtual void test_of_invalid()
 {
     // not enough nodes
     assertThrowsIllegalArg(() => InterpolatedNodalSurface.of(METADATA, DoubleArray.of(1d), DoubleArray.of(2d), DoubleArray.of(3d), INTERPOLATOR));
     // x node size != y node size
     assertThrowsIllegalArg(() => InterpolatedNodalSurface.of(METADATA, XVALUES, DoubleArray.of(1d, 3d), ZVALUES, INTERPOLATOR));
     // x node size != z node size
     assertThrowsIllegalArg(() => InterpolatedNodalSurface.of(METADATA, XVALUES, YVALUES, DoubleArray.of(1d, 3d), INTERPOLATOR));
     // parameter metadata size != node size
     assertThrowsIllegalArg(() => InterpolatedNodalSurface.of(METADATA_ENTRIES, DoubleArray.of(1d, 3d), DoubleArray.of(1d, 3d), DoubleArray.of(1d, 3d), INTERPOLATOR));
     // x not in order
     assertThrowsIllegalArg(() => InterpolatedNodalSurface.of(METADATA, DoubleArray.of(2d, 1d), DoubleArray.of(1d, 1d), DoubleArray.of(2d, 3d), INTERPOLATOR));
     // y not in order
     assertThrowsIllegalArg(() => InterpolatedNodalSurface.of(METADATA, DoubleArray.of(1d, 1d), DoubleArray.of(2d, 1d), DoubleArray.of(2d, 3d), INTERPOLATOR));
 }
コード例 #7
0
        //-------------------------------------------------------------------------
        public virtual void test_lookup()
        {
            InterpolatedNodalSurface test = InterpolatedNodalSurface.of(METADATA, XVALUES, YVALUES, ZVALUES, INTERPOLATOR);

            assertThat(test.zValue(XVALUES.get(0), YVALUES.get(0))).isEqualTo(ZVALUES.get(0));
            assertThat(test.zValue(XVALUES.get(1), YVALUES.get(1))).isEqualTo(ZVALUES.get(1));
            assertThat(test.zValue(XVALUES.get(2), YVALUES.get(2))).isEqualTo(ZVALUES.get(2));
            assertThat(test.zValue(0d, 1.5d)).isEqualTo(6d);
            assertThat(test.zValue(1d, 3d)).isEqualTo(7d);

            BoundSurfaceInterpolator bound = INTERPOLATOR.bind(XVALUES, YVALUES, ZVALUES);

            assertThat(test.zValue(1.5d, 3.7d)).isEqualTo(bound.interpolate(1.5d, 3.7d));
            DoubleArray sensiValues       = test.zValueParameterSensitivity(1.5d, 1.5d).Sensitivity;
            DoubleArray sensiValuesInterp = bound.parameterSensitivity(1.5d, 1.5d);

            assertTrue(sensiValues.equalWithTolerance(sensiValuesInterp, 1e-8));
        }
コード例 #8
0
        //-------------------------------------------------------------------------
        public virtual void test_of_SurfaceMetadata()
        {
            InterpolatedNodalSurface test = InterpolatedNodalSurface.of(METADATA_ENTRIES, XVALUES, YVALUES, ZVALUES, INTERPOLATOR);

            assertThat(test.Name).isEqualTo(SURFACE_NAME);
            assertThat(test.ParameterCount).isEqualTo(SIZE);
            assertThat(test.getParameter(0)).isEqualTo(ZVALUES.get(0));
            assertThat(test.getParameter(1)).isEqualTo(ZVALUES.get(1));
            assertThat(test.getParameterMetadata(0)).isSameAs(METADATA_ENTRIES.ParameterMetadata.get().get(0));
            assertThat(test.getParameterMetadata(1)).isSameAs(METADATA_ENTRIES.ParameterMetadata.get().get(1));
            assertThat(test.withParameter(0, 2d)).isEqualTo(InterpolatedNodalSurface.of(METADATA_ENTRIES, XVALUES, YVALUES, ZVALUES.with(0, 2d), INTERPOLATOR));
            assertThat(test.withPerturbation((i, v, m) => v - 2d)).isEqualTo(InterpolatedNodalSurface.of(METADATA_ENTRIES, XVALUES, YVALUES, ZVALUES_BUMPED, INTERPOLATOR));
            assertThat(test.Interpolator).isEqualTo(INTERPOLATOR);
            assertThat(test.Metadata).isEqualTo(METADATA_ENTRIES);
            assertThat(test.XValues).isEqualTo(XVALUES);
            assertThat(test.YValues).isEqualTo(YVALUES);
            assertThat(test.ZValues).isEqualTo(ZVALUES);
        }
コード例 #9
0
        public virtual void test_serialization()
        {
            InterpolatedNodalSurface test = InterpolatedNodalSurface.of(METADATA, XVALUES, YVALUES, ZVALUES, INTERPOLATOR);

            assertSerialization(test);
        }
コード例 #10
0
        public virtual void test_withMetadata_badSize()
        {
            InterpolatedNodalSurface @base = InterpolatedNodalSurface.of(METADATA, XVALUES, YVALUES, ZVALUES, INTERPOLATOR);

            assertThrowsIllegalArg(() => @base.withMetadata(METADATA_ENTRIES2));
        }