MOAB: Mesh Oriented datABase  (version 5.4.1)
wedge_test.cpp File Reference
#include <iostream>
#include <cstdlib>
#include "Mesquite.hpp"
#include "MeshImpl.hpp"
#include "MsqError.hpp"
#include "InstructionQueue.hpp"
#include "TerminationCriterion.hpp"
#include "QualityAssessor.hpp"
#include "LPtoPTemplate.hpp"
#include "LInfTemplate.hpp"
#include "TestUtil.hpp"
#include "IdealWeightMeanRatio.hpp"
#include "IdealWeightInverseMeanRatio.hpp"
#include "UntangleBetaQualityMetric.hpp"
#include "FeasibleNewton.hpp"
#include "ConditionNumberQualityMetric.hpp"
+ Include dependency graph for wedge_test.cpp:

Go to the source code of this file.

Defines

#define TOL   1e-5
#define CPPUNIT_ASSERT(A)
#define CPPUNIT_ASSERT_DOUBLES_EQUAL(E, V, T)
#define CPPUNIT_ASSERT_EQUAL(E, V)
#define CPPUNIT_ASSERT_VECTORS_EQUAL(E, V, T)

Functions

bool smooth_mesh (MeshImpl *mesh, Mesh *ref_mesh, Mesh::VertexHandle vertex_8, Mesh::VertexHandle vertex_9, Vector3D delta, QualityMetric *metric)
int main (int argc, char *[])

Variables

const unsigned NUM_ELEM = 6
const unsigned NUM_VERT = 14
const unsigned VERT_PER_ELEM = 6

Define Documentation

#define CPPUNIT_ASSERT (   A)
Value:
do                                                            \
    {                                                             \
        if( !( A ) )                                              \
        {                                                         \
            std::cout << "Assertion Failed: " << #A << std::endl; \
            std::cout << "  File: " << __FILE__ << std::endl;     \
            std::cout << "  Line: " << __LINE__ << std::endl;     \
            return 1;                                             \
        }                                                         \
    } while( false )

Definition at line 57 of file wedge_test.cpp.

Referenced by main(), and smooth_mesh().

#define CPPUNIT_ASSERT_DOUBLES_EQUAL (   E,
  V,
  T 
)
Value:
do                                                                             \
    {                                                                              \
        if( fabs( ( E ) - ( V ) ) > ( T ) )                                        \
        {                                                                          \
            std::cout << "Assertion Failed: " << #V << " == " << #E << std::endl;  \
            std::cout << "Expected: " << ( E ) << "  Got: " << ( V ) << std::endl; \
            std::cout << "  File: " << __FILE__ << std::endl;                      \
            std::cout << "  Line: " << __LINE__ << std::endl;                      \
            return 1;                                                              \
        }                                                                          \
    } while( false )

Definition at line 69 of file wedge_test.cpp.

Referenced by AveragingQMTest::check_average_and_weights(), AveragingQMTest::check_average_gradients(), SphericalDomainTest::check_closest_pt(), SphericalDomainTest::check_normal(), AveragingQMTest::check_pmean_hessian(), AveragingQMTest::check_pmean_hessian_diagonals(), PMeanPTemplateTest::check_result(), TargetCalculatorTest::check_valid_delta(), TargetCalculatorTest::check_valid_Q(), QualityMetricTester::compare_analytical_and_numerical_diagonals(), TMPQualityMetricTest< QMType >::compare_analytical_and_numerical_diagonals(), QualityMetricTester::compare_analytical_and_numerical_gradients(), TMPQualityMetricTest< QMType >::compare_analytical_and_numerical_gradients(), QualityMetricTester::compare_analytical_and_numerical_hessians(), TMPQualityMetricTest< QMType >::compare_analytical_and_numerical_hessians(), ObjectiveFunctionTests::compare_diagonal_gradient(), QualityMetricTester::compare_eval_and_eval_with_indices(), QualityMetricTester::compare_eval_with_diag_and_eval_with_hessian(), QualityMetricTester::compare_eval_with_grad_and_eval_with_diagonal(), QualityMetricTester::compare_eval_with_grad_and_eval_with_hessian(), QualityMetricTester::compare_eval_with_indices_and_eval_with_diagonal(), QualityMetricTester::compare_eval_with_indices_and_eval_with_gradient(), QualityMetricTester::compare_eval_with_indices_and_eval_with_hessian(), QualityMetricTest::compare_gradient(), ObjectiveFunctionTests::compare_hessian_diagonal(), ObjectiveFunctionTests::compare_hessian_gradient(), QualityMetricTest::compare_indices(), ObjectiveFunctionTests::compare_numerical_gradient(), LinearMappingFunctionTest::do_ideal_test(), IdealTargetTest::do_test(), TMPQualityMetricTest< AWQualityMetric >::get_nonideal_element(), main(), TargetReadWriteTest::read_write_weights(), TQualityMetricTest::regression_inverse_mean_ratio_grad(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), DomainClassifierTest::setUp(), TMPQualityMetricTest< AWQualityMetric >::test_2d_eval_ortho_quad(), TMPQualityMetricTest< AWQualityMetric >::test_3d_eval_ortho_hex(), MBMesquite::LineDomainTest::test_arc_length(), MBMesquite::CircleDomainTest::test_arc_length(), MsqMatrixTest::test_assign(), AveragingQMTest::test_average_metrics_geometric(), AveragingQMTest::test_average_metrics_harmonic(), AveragingQMTest::test_average_metrics_hms(), AveragingQMTest::test_average_metrics_liner(), AveragingQMTest::test_average_metrics_max_minus_min(), AveragingQMTest::test_average_metrics_max_over_min(), AveragingQMTest::test_average_metrics_maximum(), AveragingQMTest::test_average_metrics_minimum(), AveragingQMTest::test_average_metrics_rms(), AveragingQMTest::test_average_metrics_standard_deviation(), AveragingQMTest::test_average_metrics_sum(), AveragingQMTest::test_average_metrics_sum_of_ratios_squared(), AveragingQMTest::test_average_metrics_sum_squared(), Matrix3DTest::test_B_times_invA(), QualityAssessorTest::test_basic_stats_element(), QualityAssessorTest::test_basic_stats_sample(), QualityAssessorTest::test_basic_stats_vertex(), MsqMeshEntityTest::test_centroid(), MsqHessianTest::test_cg_solver(), MsqHessianTest::test_cholesky_preconditioner(), GeomPrimTest::test_circle_basic(), GeomPrimTest::test_circle_closest_with_tangent(), GeomPrimTest::test_circle_from_three_points(), GeomPrimTest::test_circle_from_two_points(), ObjectiveFunctionTests::test_clone(), CompositeOFTest::test_composite_clone(), ConicDomainTest::test_construct(), SphericalDomainTest::test_construct(), Matrix3DTest::test_det(), SymMatrix3DTest::test_determinant(), MsqMatrixTest::test_determinant(), QualityMetricTester::test_diagonal_with_fixed_vertex(), SymMatrix3DTest::test_divide(), SymMatrix3DTest::test_divide_eq(), MeshUtilTest::test_edge_length_distribution_types(), MeshUtilTest::test_edge_length_distribution_unique(), PMeanPMetricTest::test_element_evaluate(), ObjectiveFunctionTests::test_eval_type(), CompositeMetricTestBase::test_evaluate(), CompositeOFTest::test_evaluate(), test_evaluate(), TMPQualityMetricTest< QMType >::test_evaluate_2D(), TMPQualityMetricTest< AWQualityMetric >::test_evaluate_2D_weight(), TMPQualityMetricTest< QMType >::test_evaluate_3D(), TMPQualityMetricTest< AWQualityMetric >::test_evaluate_3D_weight(), TMPQualityMetricTest< QMType >::test_evaluate_surface(), TMPQualityMetricTest< AWQualityMetric >::test_evaluate_surface_weight(), TargetCalculatorTest::test_factor_2D(), TargetCalculatorTest::test_factor_3D(), TargetCalculatorTest::test_factor_surface(), PlanarGeometryTest::test_fit_plane(), SphericalDomainTest::test_fit_vertices(), MsqMatrixTest::test_frobenius(), Matrix3DTest::test_Frobenius_2(), QualityMetricTester::test_get_indices_fixed(), PatchDataTest::test_get_minmax_element_area(), MsqMatrixTest::test_get_set_column(), MsqMatrixTest::test_get_set_row(), PMeanPMetricTest::test_gradient(), TMPQualityMetricTest< QMType >::test_gradient_3D(), TMPQualityMetricTest< QMType >::test_gradient_common(), QualityMetricTester::test_gradient_with_fixed_vertex(), PMeanPMetricTest::test_hessian(), PMeanPMetricTest::test_hessian_diagonal(), QualityMetricTester::test_hessian_with_fixed_vertex(), QualityAssessorTest::test_histogram_known_range(), MappingFunctionTest::test_ideal_2d(), MappingFunctionTest::test_ideal_3d(), TriLagrangeShapeTest::test_ideal_jacobian(), QuadLagrangeShapeTest::test_ideal_jacobian(), TetLagrangeShapeTest::test_ideal_jacobian(), HexLagrangeShapeTest::test_ideal_jacobian(), SymMatrix3DTest::test_indices(), PMeanPMetricTest::test_indices(), SymMatrix3DTest::test_init_diag(), MsqMatrixTest::test_initialize(), MeshUtilTest::test_lambda_distribution(), GeomPrimTest::test_line_basic(), GeomPrimTest::test_line_closest_to_line(), GeomPrimTest::test_line_closest_to_point(), MsqMatrixTest::test_matrix_multiply(), ObjectiveFunctionTest::test_max_negate_flag(), SymMatrix3DTest::test_minus(), SymMatrix3DTest::test_minus_eq(), CompositeOFTest::test_multiply_hess_diagonal(), ObjectiveFunctionTests::test_negate_flag(), TargetCalculatorTest::test_new_aspect_2D(), TargetCalculatorTest::test_new_aspect_3D(), TMetricTest< Metric, DIM >::test_numerical_gradient_2D(), AWMetricTest::test_numerical_gradient_2D(), TMetricTest< Metric, DIM >::test_numerical_gradient_3D(), AWMetricTest::test_numerical_gradient_3D(), TMetricTest< Metric, DIM >::test_numerical_hessian_2D(), AWMetricTest::test_numerical_hessian_2D(), TMetricTest< Metric, DIM >::test_numerical_hessian_3D(), AWMetricTest::test_numerical_hessian_3D(), PatchDataTest::test_patch_contents(), GeomPrimTest::test_plane_basic(), GeomPrimTest::test_plane_distance(), GeomPrimTest::test_plane_intersect_plane(), SymMatrix3DTest::test_plus(), SymMatrix3DTest::test_plus_eq(), TMPDerivsTest::test_pluseq_scaled_2nd_deriv_of_det(), QualityAssessorTest::test_power_mean(), MsqMatrixTest::test_qr(), VtkTest::test_read_quadratic(), SymMatrix3DTest::test_scalar_multiply(), TMPDerivsTest::test_set_scaled_2nd_deriv_norm_sqr_adj(), TMPDerivsTest::test_set_scaled_2nd_deriv_of_det(), IdealElementTest::test_side_height_pyr(), TargetCalculatorTest::test_size_2D(), TargetCalculatorTest::test_size_3D(), TargetCalculatorTest::test_size_surface(), MBMesquite::CircleDomainTest::test_snap_to(), MBMesquite::LineDomainTest::test_snap_to(), GeomPrimTest::test_sphere_basic(), GeomPrimTest::test_sphere_intersect_plane(), GeomPrimTest::test_sphere_intersect_sphere(), TMPQualityMetricTest< AWQualityMetric >::test_surf_eval_ortho_quad(), QualityMetricTester::test_symmetric_Hessian_diagonal_blocks(), QualityAssessorTest::test_tag_element(), QualityAssessorTest::test_tag_vertex(), SymMatrix3DTest::test_times_eq(), QualityMetricTester::test_transform_invariant(), HigherOrderTest::test_tri_basic_ideal(), HigherOrderTest::test_tri_basic_mid_convex(), HigherOrderTest::test_tri_basic_mid_spin(), HigherOrderTest::test_tri_basic_peak_down(), HigherOrderTest::test_tri_basic_peak_over(), HigherOrderTest::test_tri_basic_peak_up(), HigherOrderTest::test_tri_open_domain(), HigherOrderTest::test_tri_slac(), IdealElementTest::test_unit_edge_hex(), IdealElementTest::test_unit_edge_pyr(), IdealElementTest::test_unit_edge_quad(), IdealElementTest::test_unit_edge_tet(), IdealElementTest::test_unit_edge_tri(), IdealElementTest::test_unit_edge_wdg(), IdealElementTest::test_unit_height_pyr(), IdealElementTest::test_unit_hex(), IdealElementTest::test_unit_pyr(), IdealElementTest::test_unit_quad(), IdealElementTest::test_unit_tet(), IdealElementTest::test_unit_tri(), IdealElementTest::test_unit_wdg(), MsqMeshEntityTest::test_unsigned_area_common(), MsqMeshEntityTest::test_unsigned_area_poly(), ObjectiveFunctionTests::test_value(), MsqMatrixTest::test_vec_length(), Matrix3DTest::test_vector_times(), PMeanPMetricTest::test_vertex_evaluate(), MeshInterfaceTest::test_vertices(), CylinderDomainTest::test_x_normal_at(), BoundedCylinderDomainTest::test_x_snap_to(), CylinderDomainTest::test_x_snap_to(), CylinderDomainTest::test_z_normal_at(), CylinderDomainTest::test_z_snap_to(), and BoundedCylinderDomainTest::test_z_snap_to().

#define CPPUNIT_ASSERT_EQUAL (   E,
 
)
Value:
do                                                                             \
    {                                                                              \
        if( ( E ) != ( V ) )                                                       \
        {                                                                          \
            std::cout << "Assertion Failed: " << #V << " == " << #E << std::endl;  \
            std::cout << "Expected: " << ( E ) << "  Got: " << ( V ) << std::endl; \
            std::cout << "  File: " << __FILE__ << std::endl;                      \
            std::cout << "  Line: " << __LINE__ << std::endl;                      \
            return 1;                                                              \
        }                                                                          \
    } while( false )

Definition at line 82 of file wedge_test.cpp.

Referenced by VtkTest::check_4quad_structured(), VtkTest::check_8hex_structured(), VtkTest::check_field_attrib(), PatchDataTest::check_higher_order_vertices_slaved(), PMeanPTemplateTest::check_result(), PatchDataTest::check_sub_patch(), QualityMetricTester::compare_analytical_and_numerical_diagonals(), TMPQualityMetricTest< QMType >::compare_analytical_and_numerical_diagonals(), QualityMetricTester::compare_analytical_and_numerical_gradients(), TMPQualityMetricTest< QMType >::compare_analytical_and_numerical_gradients(), QualityMetricTester::compare_analytical_and_numerical_hessians(), TMPQualityMetricTest< QMType >::compare_analytical_and_numerical_hessians(), ObjectiveFunctionTests::compare_diagonal_gradient(), QualityMetricTester::compare_eval_with_diag_and_eval_with_hessian(), QualityMetricTester::compare_eval_with_grad_and_eval_with_diagonal(), QualityMetricTester::compare_eval_with_grad_and_eval_with_hessian(), QualityMetricTester::compare_eval_with_indices_and_eval_with_diagonal(), QualityMetricTester::compare_eval_with_indices_and_eval_with_gradient(), QualityMetricTester::compare_eval_with_indices_and_eval_with_hessian(), QualityMetricTest::compare_gradient(), ObjectiveFunctionTests::compare_hessian_diagonal(), ObjectiveFunctionTests::compare_hessian_gradient(), ObjectiveFunctionTests::compare_numerical_gradient(), TopologyInfoTest::compare_sides(), FauxMetric< B >::evaluate(), OFTestBadQM::evaluate(), OFTestBadQM::evaluate_with_gradient(), OFTestBadQM::evaluate_with_Hessian(), FauxMetric< B >::evaluate_with_indices(), OFTestBadQM::evaluate_with_indices(), TopologyInfoTest::find_edge(), TopologyInfoTest::find_face(), TopologyInfoTest::find_side(), FakeTargetCalc::get_2D_target(), FakeTargetCalc::get_3D_target(), PatchDataTest::get_higher_order_vertices(), FakeTargetCalc::get_surface_target(), TopologyInfoTest::higher_order_from_side(), main(), iMeshTest::matchElementConnectivity(), iMeshTest::matchVertexCoordinates(), MBMesquite::move_vertex(), TQualityMetricTest::regression_inverse_mean_ratio_grad(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), DomainClassifierTest::setUp(), QualityAssessorTest::setUp(), iMeshTest::setUp(), TopologyInfoTest::side_from_higher_order(), MeshImplTest::skin_mesh_higher_order(), MeshImplTest::skin_mesh_mixed(), iMeshTest::tearDown(), TMPQualityMetricTest< AWQualityMetric >::test_2d_eval_ortho_quad(), CachingTargetTest::test_2d_target_subpatch(), CachingTargetTest::test_2d_targets_cached(), TMPQualityMetricTest< AWQualityMetric >::test_3d_eval_ortho_hex(), CachingTargetTest::test_3d_target_subpatch(), CachingTargetTest::test_3d_targets_cached(), TerminationCriterionTest::test_abs_vtx_movement_culling(), InstructionQueueTest::test_add_remove_vertex_slaver(), MsqMeshEntityTest::test_all_nodes(), test_bad_element(), QualityAssessorTest::test_basic_stats_element(), QualityAssessorTest::test_basic_stats_sample(), QualityAssessorTest::test_basic_stats_vertex(), CachingTargetTest::test_cache_cleared(), MsqMeshEntityTest::test_check_element_orientation(), NodeSetTest::test_clear_node(), CompositeOFTest::test_composite_clone(), ObjectiveFunctionTest::test_compute_ana_hessian_tet(), ObjectiveFunctionTest::test_compute_ana_hessian_tet_scaled(), BoundedCylinderDomainTest::test_create_curve_from_mesh(), ArrayMeshTest::test_delete_tag(), PMeanPTemplateTest::test_diagonal(), QualityMetricTest::test_diagonal_constant(), QualityMetricTest::test_diagonal_linear(), QualityMetricTest::test_diagonal_parabolic(), QualityMetricTest::test_diagonal_tau(), QualityMetricTester::test_diagonal_with_fixed_vertex(), QualityMetricTester::test_domain_deviation_gradient(), QualityMetricTester::test_domain_deviation_quality(), BoundedCylinderDomainTest::test_domain_DoF(), CylinderDomainTest::test_domain_DoF(), XYRectangleTest::test_domain_DoF(), MeshUtilTest::test_edge_length_distribution_empty(), ArrayMeshTest::test_element_iterator(), MeshInterfaceTest::test_elements(), ArrayMeshTest::test_elements_get_attached_vertices(), ArrayMeshTest::test_elements_get_attached_vertices_mixed(), ArrayMeshTest::test_elements_get_attached_vertices_mixed_one_based(), ArrayMeshTest::test_elements_get_topologies(), ArrayMeshTest::test_elements_get_topologies_mixed(), MeshInterfaceTest::test_elements_get_topology(), CompositeOFTest::test_eval_fails(), TMPQualityMetricTest< QMType >::test_evaluate_2D(), TMPQualityMetricTest< QMType >::test_evaluate_3D(), TMPQualityMetricTest< QMType >::test_evaluate_surface(), ExtraDataTest::test_finalize(), QualityMetricTest::test_fixed_vertex_list(), QualityAssessorTest::test_free_only(), ArrayMeshTest::test_get_all_elements(), ArrayMeshTest::test_get_all_vertices(), ArrayMeshTest::test_get_all_vertices_one_based(), QualityMetricTester::test_get_edge_evaluations(), QualityMetricTester::test_get_edge_indices(), PMeanPMetricTest::test_get_element_evaluations(), QualityMetricTester::test_get_element_evaluations(), QualityMetricTester::test_get_element_indices(), ArrayMeshTest::test_get_geometric_dimension(), MeshInterfaceTest::test_get_geometric_dimension(), QualityMetricTester::test_get_indices_fixed(), QualityMetricTester::test_get_sample_evaluations(), QualityMetricTester::test_get_sample_indices(), PMeanPMetricTest::test_get_vertex_evaluations(), QualityMetricTester::test_get_vertex_evaluations(), QualityMetricTester::test_get_vertex_indices(), QualityMetricTester::test_grad_transform_invariant(), PMeanPTemplateTest::test_gradient(), QualityMetricTest::test_gradient_constant(), QualityMetricTest::test_gradient_linear(), QualityMetricTest::test_gradient_parabolic(), QualityMetricTester::test_gradient_reflects_quality(), QualityMetricTest::test_gradient_tau(), QualityMetricTester::test_gradient_with_fixed_vertex(), test_handle(), PMeanPTemplateTest::test_Hessian(), QualityMetricTest::test_Hessian_constant(), PMeanPMetricTest::test_hessian_diagonal(), QualityMetricTest::test_Hessian_linear(), QualityMetricTest::test_Hessian_parabolic(), QualityMetricTest::test_Hessian_tau(), QualityMetricTester::test_hessian_transform_invariant(), QualityMetricTester::test_hessian_with_fixed_vertex(), MsqVertexTest::test_hex_vertices(), MsqMeshEntityTest::test_hex_vertices(), QualityAssessorTest::test_histogram_known_range(), QualityAssessorTest::test_histogram_unknown_range(), QualityMetricTester::test_ideal_element_positive_definite_Hessian(), QualityMetricTester::test_ideal_element_zero_gradient(), QualityMetricTester::test_ideal_element_zero_vertex_gradient(), ExtraDataTest::test_initialize(), QualityAssessorTest::test_invalid_count(), QualityAssessorTest::test_inverted_count(), MappingFunctionTest::test_jacobian_2d(), MappingFunctionTest::test_jacobian_3d(), MeshUtilTest::test_lambda_distribution_empty(), QualityMetricTester::test_measures_quality(), QualityMetricTester::test_measures_transform(), QualityMetricTester::test_measures_vertex_quality(), ExtraDataTest::test_multiple_data(), CompositeOFTest::test_multiply_hess_diagonal(), ObjectiveFunctionTests::test_negate_flag(), TMPQualityMetricTest< AWQualityMetric >::test_negate_flag(), ExtraDataTest::test_notify_destroyed(), ExtraDataTest::test_notify_new_patch_fill(), ExtraDataTest::test_notify_new_patch_sub(), ExtraDataTest::test_notify_subpatch(), NodeSetTest::test_num_before(), NodeSetTest::test_num_nodes(), TerminationCriterionTest::test_number_of_iterates_inner(), TerminationCriterionTest::test_number_of_iterates_outer(), PatchDataTest::test_patch_contents(), QualityAssessorTest::test_print_inverted(), QualityAssessorTest::test_print_name(), PatchDataTest::test_quad8_patch(), HigherOrderTest::test_quad_basic_ideal(), HigherOrderTest::test_quad_basic_left_down(), HigherOrderTest::test_quad_basic_left_over(), HigherOrderTest::test_quad_basic_mid_convex(), HigherOrderTest::test_quad_basic_mid_spin(), HigherOrderTest::test_quad_basic_right_up(), HigherOrderTest::test_quad_basic_top_down(), VtkTest::test_read_fixed_attrib(), VtkTest::test_read_quadratic(), VtkTest::test_read_simple_scalar_attrib(), VtkTest::test_read_unstructured(), VtkTest::test_read_vector_attrib(), QualityMetricTest::test_remove_fixed_gradients(), QualityMetricTest::test_remove_fixed_hessians(), NodeSetTest::test_set_node(), TMPQualityMetricTest< AWQualityMetric >::test_surf_eval_ortho_quad(), CachingTargetTest::test_surface_target_subpatch(), CachingTargetTest::test_surface_targets_cached(), QualityMetricTester::test_symmetric_Hessian_diagonal_blocks(), ArrayMeshTest::test_tag_data(), QualityAssessorTest::test_tag_element(), QualityAssessorTest::test_tag_inverted(), QualityAssessorTest::test_tag_vertex(), HigherOrderTest::test_tet_basic_apex_down(), HigherOrderTest::test_tet_basic_apex_over(), HigherOrderTest::test_tet_basic_apex_up(), HigherOrderTest::test_tet_basic_ideal(), HigherOrderTest::test_tet_basic_mid_convex(), HigherOrderTest::test_tet_basic_mid_spin(), HigherOrderTest::test_tri_basic_ideal(), HigherOrderTest::test_tri_basic_mid_convex(), HigherOrderTest::test_tri_basic_mid_spin(), HigherOrderTest::test_tri_basic_peak_down(), HigherOrderTest::test_tri_basic_peak_over(), HigherOrderTest::test_tri_basic_peak_up(), HigherOrderTest::test_tri_open_domain(), QualityMetricTester::test_type_is_not_supported(), TerminationCriterionTest::test_untangled_mesh(), MeshInterfaceTest::test_vertex_get_attached_elements(), QualityMetricTester::test_vertex_gradient_reflects_quality(), MeshInterfaceTest::test_vertex_is_fixed(), ArrayMeshTest::test_vertex_iterator(), ArrayMeshTest::test_vertex_iterator_one_based(), PatchSetTest::test_vertex_patches(), ArrayMeshTest::test_vertex_set_byte(), MeshInterfaceTest::test_vertices(), ArrayMeshTest::test_vertices_get_attached_elements(), ArrayMeshTest::test_vertices_get_attached_elements_mixed(), ArrayMeshTest::test_vertices_get_attached_elements_mixed_one_based(), ArrayMeshTest::test_vertices_get_attached_elements_one_based(), ArrayMeshTest::test_vertices_get_fixed_flag(), ArrayMeshTest::test_vertices_set_byte(), CylinderDomainTest::test_x_basic(), CylinderDomainTest::test_z_basic(), MeshImplTest::test_zero_length_data(), iMeshTest::testDoubleTag(), iMeshTest::testElementConnectivity(), iMeshTest::testElementTopology(), iMeshTest::testIntTag(), iMeshTest::testVertexAdjacency(), iMeshTest::testVertexByte(), iMeshTest::testVertexFlag(), and iMeshTest::testVertexFlagNone().

#define CPPUNIT_ASSERT_VECTORS_EQUAL (   E,
  V,
  T 
)
Value:
do                                                                             \
    {                                                                              \
        if( !( E ).within_tolerance_box( V, T ) )                                  \
        {                                                                          \
            std::cout << "Assertion Failed: " << #V << " == " << #E << std::endl;  \
            std::cout << "Expected: " << ( E ) << "  Got: " << ( V ) << std::endl; \
            std::cout << "  File: " << __FILE__ << std::endl;                      \
            std::cout << "  Line: " << __LINE__ << std::endl;                      \
            return 1;                                                              \
        }                                                                          \
    } while( false )

Definition at line 95 of file wedge_test.cpp.

Referenced by smooth_mesh().

#define TOL   1e-5

Definition at line 29 of file wedge_test.cpp.


Function Documentation

int main ( int  argc,
char *  [] 
)

Definition at line 123 of file wedge_test.cpp.

References MBMesquite::arrptr(), CPPUNIT_ASSERT, CPPUNIT_ASSERT_DOUBLES_EQUAL, CPPUNIT_ASSERT_EQUAL, MBMesquite::MeshImpl::elements_get_attached_vertices(), MBMesquite::MeshImpl::elements_get_topologies(), MBMesquite::MeshImpl::get_all_elements(), MBMesquite::Vector3D::length(), mesh, meshfile, metrics, NUM_ELEM, MBMesquite::PRISM, MBMesquite::MeshImpl::read_vtk(), MBMesquite::Vector3D::set(), smooth_mesh(), VERT_PER_ELEM, and MBMesquite::MeshImpl::vertices_get_coordinates().

{
    if( argc != 1 )
    {
        std::cerr << "Invalid arguments.\n";
        return 2;
    }

    std::string meshfile = TestDir + "unittest/mesquite/3D/vtk/prisms/untangled/6-wedge-prism.vtk";
    unsigned i;

    MBMesquite::MsqPrintError err( cout );
    IdealWeightMeanRatio m1;
    IdealWeightInverseMeanRatio m2( err );
    ConditionNumberQualityMetric m3;
    QualityMetric* metrics[] = { &m1, &m2, &m3, 0 };

    // Read Mesh
    MBMesquite::MeshImpl mesh;
    mesh.read_vtk( meshfile.c_str(), err );
    CPPUNIT_ASSERT( !err );
    MBMesquite::MeshImpl ideal_mesh;
    ideal_mesh.read_vtk( meshfile.c_str(), err );
    CPPUNIT_ASSERT( !err );

    // Check that the mesh read correctly, and contains what is
    // expected later.

    // Get mesh data
    // Expecting file to contain 6 wedge elements constructed
    // from 14 vertices.
    std::vector< Mesh::VertexHandle > vert_array;
    std::vector< Mesh::ElementHandle > elem_array;
    std::vector< size_t > conn_offsets;
    mesh.get_all_elements( elem_array, err );
    CPPUNIT_ASSERT( !err );
    CPPUNIT_ASSERT_EQUAL( elem_array.size(), NUM_ELEM );
    mesh.elements_get_attached_vertices( arrptr( elem_array ), elem_array.size(), vert_array, conn_offsets, err );
    CPPUNIT_ASSERT( !err );
    CPPUNIT_ASSERT_EQUAL( vert_array.size(), VERT_PER_ELEM * NUM_ELEM );
    CPPUNIT_ASSERT_EQUAL( conn_offsets.size(), NUM_ELEM + 1 );
    EntityTopology type_array[NUM_ELEM];
    mesh.elements_get_topologies( arrptr( elem_array ), type_array, NUM_ELEM, err );
    CPPUNIT_ASSERT( !err );

    // Verify element types and number of vertices
    for( i = 0; i < NUM_ELEM; ++i )
    {
        CPPUNIT_ASSERT_EQUAL( type_array[i], PRISM );
        CPPUNIT_ASSERT_EQUAL( conn_offsets[i], VERT_PER_ELEM * i );
    }

    // All wedges should share the 9th and 10th vertices
    const unsigned INDEX_8 = 1, INDEX_9 = 4;
    Mesh::VertexHandle handle8 = vert_array[INDEX_8];
    Mesh::VertexHandle handle9 = vert_array[INDEX_9];
    for( i = 1; i < NUM_ELEM; ++i )
    {
        CPPUNIT_ASSERT_EQUAL( vert_array[VERT_PER_ELEM * i + INDEX_8], handle8 );
        CPPUNIT_ASSERT_EQUAL( vert_array[VERT_PER_ELEM * i + INDEX_9], handle9 );
    }

    // The input file should be a hexagonal prism decomposed into
    // 6 wedges such that all wedges have one quad face on the
    // boundary and all wedges share a single edge which is the axis
    // of the prism.
    MsqVertex vertices[NUM_ELEM * VERT_PER_ELEM];
    mesh.vertices_get_coordinates( arrptr( vert_array ), vertices, NUM_ELEM * VERT_PER_ELEM, err );
    CPPUNIT_ASSERT( !err );
    for( i = 0; i < NUM_ELEM * VERT_PER_ELEM; ++i )
    {
        if( vert_array[i] == handle8 || vert_array[i] == handle9 )
        {
            CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, vertices[i][1], 1e-6 );
            CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, vertices[i][2], 1e-6 );
        }
        else
        {
            Vector3D xproj( vertices[i] );
            xproj[0] = 0;
            CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.0, xproj.length(), 1e-6 );
        }
    }

    // Try smoothing w/out moving the free vertices and verify that
    // the smoother didn't move the vertex
    Vector3D delta( 0, 0, 0 );
    for( i = 0; metrics[i] != NULL; ++i )
        CPPUNIT_ASSERT( !smooth_mesh( &mesh, &ideal_mesh, handle8, handle9, delta, metrics[i] ) );

    // Now try moving the vertex and see if the smoother moves it back
    // to the origin
    delta.set( 0.1, 0.0, 0.1 );
    for( i = 0; metrics[i] != NULL; ++i )
        CPPUNIT_ASSERT( !smooth_mesh( &mesh, &ideal_mesh, handle8, handle9, delta, metrics[i] ) );

    // Now try moving the vertex further and see if the smoother moves it back
    // to the origin
    delta.set( 1.0, 0.0, 1.0 );
    for( i = 0; metrics[i] != NULL; ++i )
        CPPUNIT_ASSERT( !smooth_mesh( &mesh, &ideal_mesh, handle8, handle9, delta, metrics[i] ) );

    return 0;
}
bool smooth_mesh ( MeshImpl mesh,
Mesh ref_mesh,
Mesh::VertexHandle  vertex_8,
Mesh::VertexHandle  vertex_9,
Vector3D  delta,
QualityMetric metric 
)

Definition at line 228 of file wedge_test.cpp.

References MBMesquite::TerminationCriterion::add_absolute_vertex_movement(), MBMesquite::TerminationCriterion::add_iteration_limit(), MBMesquite::InstructionQueue::add_quality_assessor(), CPPUNIT_ASSERT, CPPUNIT_ASSERT_VECTORS_EQUAL, MBMesquite::QualityMetric::get_name(), origin, MBMesquite::IQInterface::run_instructions(), MBMesquite::QualityImprover::set_inner_termination_criterion(), MBMesquite::InstructionQueue::set_master_quality_improver(), MBMesquite::QualityImprover::set_outer_termination_criterion(), TOL, MBMesquite::PatchSetUser::use_global_patch(), MBMesquite::MeshImpl::vertex_set_coordinates(), and MBMesquite::MeshImpl::vertices_get_coordinates().

{
    MBMesquite::MsqPrintError err( cout );
    const Vector3D origin( 0, 0, 0 );

    // print a little output so we know when we died
    std::cout << "**************************************************************************" << std::endl
              << "* Smoothing..." << std::endl
              << "* Metric: " << metric->get_name() << std::endl
              << "* Offset: " << delta
              << std::endl  //<<
              //"**************************************************************************"
              << std::endl;

    // Set free vertices to specified position
    Mesh::VertexHandle handles[] = { vert1, vert2 };
    MsqVertex coordinates[2];
    mesh->vertices_get_coordinates( handles, coordinates, 2, err );
    CPPUNIT_ASSERT( !err );
    Vector3D coord1 = coordinates[0] + delta;
    Vector3D coord2 = coordinates[1] + delta;
    mesh->vertex_set_coordinates( vert1, coord1, err );
    CPPUNIT_ASSERT( !err );
    mesh->vertex_set_coordinates( vert2, coord2, err );
    CPPUNIT_ASSERT( !err );

    // Create an InstructionQueue
    InstructionQueue Q;

    // Set up objective function
    LPtoPTemplate obj_func( metric, 1, err );
    CPPUNIT_ASSERT( !err );

    // Create solver
    FeasibleNewton solver( &obj_func );
    CPPUNIT_ASSERT( !err );
    solver.use_global_patch();

    // Set stoping criteria for solver
    TerminationCriterion tc_inner;
    tc_inner.add_absolute_vertex_movement( 1e-7 );
    solver.set_inner_termination_criterion( &tc_inner );

    TerminationCriterion tc_outer;
    tc_outer.add_iteration_limit( 1 );
    solver.set_outer_termination_criterion( &tc_outer );

#ifdef DO_QUALITY_ASSESSOR
    QualityAssessor qa( metric, 10 );
    Q.add_quality_assessor( &qa, err );
    CPPUNIT_ASSERT( !err );
#endif

    // Add solver to queue
    Q.set_master_quality_improver( &solver, err );
    CPPUNIT_ASSERT( !err );

#ifdef DO_QUALITY_ASSESSOR
    Q.add_quality_assessor( &qa, err );
    CPPUNIT_ASSERT( !err );
#endif

    // And smooth...
    Q.run_instructions( mesh, err );
    CPPUNIT_ASSERT( !err );

    // Verify that vertices were moved back to origin
    MsqVertex new_coords[2];
    mesh->vertices_get_coordinates( handles, new_coords, 2, err );
    CPPUNIT_ASSERT( !err );

    // print a little output so we know when we died
    std::cout  //<<
               //"**************************************************************************"
        << std::endl
        << "* Done Smoothing:" << std::endl
        << "* Metric: " << metric->get_name() << std::endl
        << "* Position1: " << new_coords[0][0] << " " << new_coords[0][1] << " " << new_coords[0][2] << std::endl
        << "* Position2: " << new_coords[1][0] << " " << new_coords[1][1] << " " << new_coords[1][2] << std::endl
        << "**************************************************************************" << std::endl;

    CPPUNIT_ASSERT_VECTORS_EQUAL( coordinates[0], new_coords[0], TOL );
    CPPUNIT_ASSERT_VECTORS_EQUAL( coordinates[1], new_coords[1], TOL );
    return false;
}

Variable Documentation

const unsigned NUM_ELEM = 6

Definition at line 119 of file wedge_test.cpp.

const unsigned NUM_VERT = 14

Definition at line 120 of file wedge_test.cpp.

const unsigned VERT_PER_ELEM = 6

Definition at line 121 of file wedge_test.cpp.

Referenced by main().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines