1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 2 // Copyright (c) Lawrence Livermore National Security, LLC and other Ascent 3 // Project developers. See top-level LICENSE AND COPYRIGHT files for dates and 4 // other details. No copyright assignment is required to contribute to Ascent. 5 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// 6 7 //----------------------------------------------------------------------------- 8 /// 9 /// file: ascent_derived_jit.hpp 10 /// 11 //----------------------------------------------------------------------------- 12 13 #ifndef ASCENT_JIT_TOPOLOGY_HPP 14 #define ASCENT_JIT_TOPOLOGY_HPP 15 16 #include "ascent_insertion_ordered_set.hpp" 17 #include "ascent_jit_math.hpp" 18 #include "ascent_jit_array.hpp" 19 20 //----------------------------------------------------------------------------- 21 // -- begin ascent:: -- 22 //----------------------------------------------------------------------------- 23 namespace ascent 24 { 25 26 //----------------------------------------------------------------------------- 27 // -- begin ascent::runtime -- 28 //----------------------------------------------------------------------------- 29 namespace runtime 30 { 31 32 //----------------------------------------------------------------------------- 33 // -- begin ascent::runtime::expressions-- 34 //----------------------------------------------------------------------------- 35 namespace expressions 36 { 37 38 class TopologyCode 39 { 40 public: 41 TopologyCode(const std::string &topo_name, 42 const conduit::Node &domain, 43 const ArrayCode &array_code); 44 45 void pack(conduit::Node &args) const; 46 47 void vertex_xyz(InsertionOrderedSet<std::string> &code) const; 48 void element_xyz(InsertionOrderedSet<std::string> &code) const; 49 void volume(InsertionOrderedSet<std::string> &code) const; 50 void area(InsertionOrderedSet<std::string> &code) const; 51 52 // helper functions 53 void vertex_idx(InsertionOrderedSet<std::string> &code) const; 54 55 void element_idx(InsertionOrderedSet<std::string> &code) const; 56 57 void dxdydz(InsertionOrderedSet<std::string> &code) const; 58 59 void structured_vertices(InsertionOrderedSet<std::string> &code) const; 60 61 void structured_vertex_locs(InsertionOrderedSet<std::string> &code) const; 62 63 void unstructured_vertices(InsertionOrderedSet<std::string> &code, 64 const std::string &index_name = "item") const; 65 66 void unstructured_vertex_locs(InsertionOrderedSet<std::string> &code, 67 const std::string &index_name = "item") const; 68 69 void vertex_coord(InsertionOrderedSet<std::string> &code, 70 const std::string &coord, 71 const std::string &index_name, 72 const std::string &res_name, 73 const bool declare = true) const; 74 75 void element_coord(InsertionOrderedSet<std::string> &code, 76 const std::string &coord, 77 const std::string &index_name, 78 const std::string &res_name, 79 const bool declare = true) const; 80 81 void vertex_xyz(InsertionOrderedSet<std::string> &code, 82 const std::string &index_name, 83 const bool index_array, 84 const std::string &res_name, 85 const bool declare = true) const; 86 87 void hexahedral_volume(InsertionOrderedSet<std::string> &code, 88 const std::string &vertex_locs, 89 const std::string &res_name) const; 90 91 void tetrahedral_volume(InsertionOrderedSet<std::string> &code, 92 const std::string &vertex_locs, 93 const std::string &res_name) const; 94 95 void quadrilateral_area(InsertionOrderedSet<std::string> &code, 96 const std::string &p0, 97 const std::string &p1, 98 const std::string &p2, 99 const std::string &p3, 100 const std::string &res_name) const; 101 102 void quadrilateral_area(InsertionOrderedSet<std::string> &code, 103 const std::string &vertex_locs, 104 const std::string &res_name) const; 105 106 void triangle_area(InsertionOrderedSet<std::string> &code, 107 const std::string &p0, 108 const std::string &p1, 109 const std::string &p2, 110 const std::string &res_name) const; 111 112 void triangle_area(InsertionOrderedSet<std::string> &code, 113 const std::string &vertex_locs, 114 const std::string &res_name) const; 115 116 void polygon_area_vec(InsertionOrderedSet<std::string> &code, 117 const std::string &vertex_locs, 118 const std::string &res_name) const; 119 120 void polygon_area(InsertionOrderedSet<std::string> &code, 121 const std::string &vertex_locs, 122 const std::string &res_name) const; 123 124 void polyhedron_volume(InsertionOrderedSet<std::string> &code, 125 const std::string &vertex_locs, 126 const std::string &res_name) const; 127 128 void hexahedral_surface_area(InsertionOrderedSet<std::string> &code, 129 const std::string &vertex_locs, 130 const std::string &res_name) const; 131 132 void tetrahedral_surface_area(InsertionOrderedSet<std::string> &code, 133 const std::string &vertex_locs, 134 const std::string &res_name) const; 135 136 void surface_area(InsertionOrderedSet<std::string> &code) const; 137 138 const std::string topo_name; 139 const conduit::Node &domain; 140 std::string topo_type; 141 int num_dims; 142 std::string shape; 143 int shape_size; 144 145 const ArrayCode &array_code; 146 147 const MathCode math_code; 148 }; 149 150 }; 151 //----------------------------------------------------------------------------- 152 // -- end ascent::runtime::expressions-- 153 //----------------------------------------------------------------------------- 154 155 //----------------------------------------------------------------------------- 156 }; 157 //----------------------------------------------------------------------------- 158 // -- end ascent::runtime -- 159 //----------------------------------------------------------------------------- 160 161 //----------------------------------------------------------------------------- 162 }; 163 //----------------------------------------------------------------------------- 164 // -- end ascent:: -- 165 //----------------------------------------------------------------------------- 166 167 #endif 168 //----------------------------------------------------------------------------- 169 // -- end header ifdef guard 170 //----------------------------------------------------------------------------- 171