1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 * MOAB, a Mesh-Oriented datABase, is a software component for creating,
 * storing and accessing finite element mesh data.
 *
 * Copyright 2007 Sandia Corporation.  Under the terms of Contract
 * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
 * retains certain rights in this software.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 */

/**\class moab::SimplexTemplateRefiner
 *
 * This is a concrete subclass of EntityRefiner that implements
 * refinement using templates applied to simplices.
 * Entities that are not simplices are divided into tetrahedra,
 * triangles, or lines before being processed.
 * Points are passed through unchanged.
 *
 * \author David Thompson
 * \author Philippe Pebay
 *
 * \date 24 December 2007
 */
#ifndef MB_SIMPLEX_TEMPLATE_REFINER_HPP
#define MB_SIMPLEX_TEMPLATE_REFINER_HPP

#include "EntityRefiner.hpp"
#include "SimplexTemplateTagAssigner.hpp"

#include "moab/Types.hpp"  // for MB_DLL_EXPORT

namespace moab
{

class RefinerTagManager;

class SimplexTemplateRefiner : public EntityRefiner
{
  public:
    SimplexTemplateRefiner();
    virtual ~SimplexTemplateRefiner();

    virtual bool refine_entity( EntityType etyp, EntityHandle entity );<--- Function in derived class<--- Function in derived class<--- Function in derived class
    virtual unsigned long get_heap_size_bound( int max_recursions ) const<--- Function in derived class<--- Function in derived class<--- Function in derived class
    {
        return 48 * 4 * ( 1 << max_recursions ) + 8;
    }

    virtual bool set_tag_assigner( SimplexTemplateTagAssigner* ta );
    SimplexTemplateTagAssigner* get_tag_assigner() const
    {
        return this->tag_assigner;
    }

    virtual bool prepare( RefinerTagManager* tmgr, EntityRefinerOutputFunctor* ofunc );<--- Function in derived class<--- Function in derived class<--- Function in derived class

  protected:
    SimplexTemplateTagAssigner* tag_assigner;
    RefinerTagManager* tag_manager;
    std::vector< double > corner_coords;
    std::vector< void* > corner_tags;
    std::vector< EntityHandle > corner_handles;
    bool input_is_output;

    static int template_index[64][2];
    static int permutations_from_index[24][14];
    static int templates[];

    void refine_0_simplex( const double* v0, const void* t0, EntityHandle h0 );
    bool refine_1_simplex( int max_depth,
                           const double* v0,
                           const void* t0,
                           EntityHandle h0,
                           const double* v1,
                           const void* t1,
                           EntityHandle h1 );
    bool refine_2_simplex( int max_depth,
                           int move,
                           const double* v0,
                           const void* t0,
                           EntityHandle h0,
                           const double* v1,
                           const void* t1,
                           EntityHandle h1,
                           const double* v2,
                           const void* t2,
                           EntityHandle h2 );
    bool refine_3_simplex( int max_depth,
                           double* v0,
                           void* t0,
                           EntityHandle h0,
                           double* v1,
                           void* t1,
                           EntityHandle h1,
                           double* v2,
                           void* t2,
                           EntityHandle h2,
                           double* v3,
                           void* t3,
                           EntityHandle h3 );

    int best_tets( int* alternates, double* [14], int, int )
    {
        return alternates[0];
    }
    void assign_parametric_coordinates( int num_nodes, const double* src, double* tgt );
    static bool compare_Hopf_cross_string_dist( const double* v00,
                                                const double* v01,
                                                const double* v10,
                                                const double* v11 );
};

}  // namespace moab

#endif  // MB_SIMPLEX_TEMPLATE_REFINER_HPP