30 #ifndef CORE_DATATYPES_PRISMVOLMESH_H
31 #define CORE_DATATYPES_PRISMVOLMESH_H 1
60 #include <boost/thread.hpp>
88 #if (SCIRUN_PRISMVOL_SUPPORT > 0)
91 #if (SCIRUN_QUADRATIC_SUPPORT > 0)
94 #if (SCIRUN_CUBIC_SUPPORT > 0)
101 #define PRISM_DUMMY_NODE_INDEX (typename Node::index_type) 999999999
106 template <
class Basis>
107 class PrismVolMesh :
public Mesh
175 if (basis_type::polynomial_order() > 1)
177 mesh_.get_edges_from_cell(edges_, index_);
184 return mesh_.cells_[index_ * 6];
188 return mesh_.cells_[index_ * 6 + 1];
192 return mesh_.cells_[index_ * 6 + 2];
196 return mesh_.cells_[index_ * 6 + 3];
200 return mesh_.cells_[index_ * 6 + 4];
204 return mesh_.cells_[index_ * 6 + 5];
285 mesh_(mesh), sync_(sync) {}
294 mesh_->synchronize_lock_.lock();
296 sync_ &= ~(mesh_->synchronized_);
298 sync_ &= ~(mesh_->synchronizing_);
301 mesh_->synchronizing_ |= sync_;
303 mesh_->synchronize_lock_.unlock();
311 mesh_->synchronize_cond_.wait(lock);
325 while(!(mesh_->synchronized_&Mesh::BOUNDING_BOX_E))
326 mesh_->synchronize_cond_.wait(lock);
332 mesh_->synchronize_lock_.lock();
334 mesh_->synchronized_ |= sync_;
336 mesh_->synchronizing_ &= ~(sync_);
338 mesh_->synchronize_cond_.conditionBroadcast();
339 mesh_->synchronize_lock_.unlock();
367 return boost::shared_ptr<Core::Datatypes::MeshFacade<VMesh>>();
447 { array.
resize(1); array[0]= idx; }
460 {
ASSERTFAIL(
"PrismVolMesh: get_edges has not been implemented for nodes"); }
463 { array.resize(1); array[0]= idx; }
473 {
ASSERTFAIL(
"PrismVolMesh: get_faces has not been implemented for nodes"); }
476 {
ASSERTFAIL(
"PrismVolMesh: get_faces has not been implemented for edges"); }
480 { array.resize(1); array[0]= idx; }
496 { array.resize(1); array[0]= idx; }
509 { array.resize(1); array[0]= idx; }
513 {
ASSERTFAIL(
"PrismVolMesh: get_faces has not been implemented for nodes"); }
516 {
ASSERTFAIL(
"PrismVolMesh: get_faces has not been implemented for edges"); }
519 { array.resize(1); array[0]= idx; }
526 template<
class VECTOR,
class INDEX>
529 unsigned int which_edge,
530 unsigned int div_per_unit)
const
532 basis_.approx_edge(which_edge, div_per_unit, coords);
537 template<
class VECTOR,
class INDEX>
540 unsigned int which_face,
541 unsigned int div_per_unit)
const
543 basis_.approx_face(which_face, div_per_unit, coords);
567 return ((p1 - p0).length());
579 return (
Cross(p0-p1,p2-p0)).length()*0.5;
583 return ((
Cross(p0-p1,p2-p0)).length()+(
Cross(p0-p3,p2-p0)).length())*0.5;
590 return (
basis_.get_volume(ed));
635 std::vector<double>& coords,
643 {
ASSERTFAIL(
"PrismVolMesh::get_weights for edges isn't supported"); }
645 {
ASSERTFAIL(
"PrismVolMesh::get_weights for faces isn't supported"); }
657 {
ASSERTFAIL(
"This mesh type does not have node normals."); }
660 template<
class VECTOR,
class INDEX1,
class INDEX2>
662 INDEX1 eidx, INDEX2 fidx)
const
672 const double un0 =
basis_.unit_face_normals[fidx][0];
673 const double un1 =
basis_.unit_face_normals[fidx][1];
674 const double un2 =
basis_.unit_face_normals[fidx][2];
677 result.
x(Ji[0]*un0+Ji[1]*un1+Ji[2]*un2);
678 result.
y(Ji[3]*un0+Ji[4]*un1+Ji[5]*un2);
679 result.
z(Ji[6]*un0+Ji[7]*un1+Ji[8]*un2);
691 template<
class ARRAY>
694 ASSERTMSG(a.size() == 6,
"Tried to add non-prism element.");
696 return add_prism( static_cast<typename Node::index_type>(a[0]),
697 static_cast<typename Node::index_type>(a[1]),
698 static_cast<typename Node::index_type>(a[2]),
699 static_cast<typename Node::index_type>(a[3]),
700 static_cast<typename Node::index_type>(a[4]),
701 static_cast<typename Node::index_type>(a[5]) );
714 template<
class VECTOR,
class INDEX>
718 return basis_.get_coords(coords, p, ed);
723 template<
class VECTOR,
class INDEX>
727 pt =
basis_.interpolate(coords, ed);
733 template<
class VECTOR1,
class INDEX,
class VECTOR2>
734 void derivate(
const VECTOR1 &coords, INDEX idx, VECTOR2 &J)
const
737 basis_.derivate(coords, ed, J);
742 template<
class VECTOR,
class INDEX>
747 basis_.derivate(coords,ed,Jv);
754 template<
class VECTOR,
class INDEX>
755 void jacobian(
const VECTOR& coords, INDEX idx,
double* J)
const
759 basis_.derivate(coords,ed,Jv);
774 template<
class VECTOR,
class INDEX>
779 basis_.derivate(coords,ed,Jv);
783 template<
class INDEX>
794 size_t num_vertices =
basis_.number_of_vertices();
795 for (
size_t j=0;j < num_vertices;j++)
799 if(temp < min_jacobian) min_jacobian = temp;
802 return (min_jacobian);
805 template<
class INDEX>
816 size_t num_vertices =
basis_.number_of_vertices();
817 for (
size_t j=0;j < num_vertices;j++)
821 if(temp < min_jacobian) min_jacobian = temp;
824 return (min_jacobian);
827 template <
class INDEX>
834 template <
class INDEX>
837 double maxdist)
const
839 if (maxdist < 0.0) maxdist = DBL_MAX;
else maxdist = maxdist*maxdist;
843 if (sz == 0)
return (
false);
845 if (node >= 0 && node < sz)
848 double dist = (point-p).length2();
859 "PrismVolMesh::find_closest_node requires synchronize(NODE_LOCATE_E).")
871 if (bi > ni) bi = ni;
if (bi < 0) bi = 0;
872 if (bj > nj) bj = nj;
if (bj < 0) bj = 0;
873 if (bk > nk) bk = nk;
if (bk < 0) bk = 0;
875 ei = bi; ej = bj; ek = bk;
877 double dmin = maxdist;
879 bool found_one =
false;
889 if (i < 0 || i > ni)
continue;
892 if (j < 0 || j > nj)
continue;
895 if (k < 0 || k > nk)
continue;
896 if (i == bi || i == ei || j == bj || j == ej || k == bk || k == ek)
898 if (
node_grid_->min_distance_squared(p, i, j, k) < dmin)
907 const double dist = (p-
point).length2();
935 if (!found_one)
return (
false);
941 template <
class ARRAY>
947 "PrismVolMesh::find_closest_node requires synchronize(NODE_LOCATE_E).")
964 if (bi > ni) bi = ni;
if (bi < 0) bi = 0;
965 if (bj > nj) bj = nj;
if (bj < 0) bj = 0;
966 if (bk > nk) bk = nk;
if (bk < 0) bk = 0;
968 if (ei > ni) ei = ni;
if (ei < 0) ei = 0;
969 if (ej > nj) ej = nj;
if (ej < 0) ej = 0;
970 if (ek > nk) ek = nk;
if (ek < 0) ek = 0;
972 double maxdist2 = maxdist*maxdist;
980 if (
node_grid_->min_distance_squared(p, i, j, k) < maxdist2)
988 const double dist = (p-
point).length2();
992 nodes.push_back(*it);
1001 return(nodes.size() > 0);
1005 template <
class ARRAY1,
class ARRAY2>
1011 "PrismVolMesh::find_closest_node requires synchronize(NODE_LOCATE_E).")
1028 if (bi > ni) bi = ni;
if (bi < 0) bi = 0;
1029 if (bj > nj) bj = nj;
if (bj < 0) bj = 0;
1030 if (bk > nk) bk = nk;
if (bk < 0) bk = 0;
1032 if (ei > ni) ei = ni;
if (ei < 0) ei = 0;
1033 if (ej > nj) ej = nj;
if (ej < 0) ej = 0;
1034 if (ek > nk) ek = nk;
if (ek < 0) ek = 0;
1036 double maxdist2 = maxdist*maxdist;
1044 if (
node_grid_->min_distance_squared(p, i, j, k) < maxdist2)
1052 const double dist = (p-
point).length2();
1054 if (dist < maxdist2)
1056 nodes.push_back(*it);
1057 distances.push_back(dist);
1066 return(nodes.size() > 0);
1071 template <
class INDEX,
class ARRAY>
1082 template <
class INDEX,
class ARRAY>
1088 double maxdist)
const
1090 if (maxdist < 0.0) maxdist = DBL_MAX;
else maxdist = maxdist*maxdist;
1094 if (sz == 0)
return (
false);
1097 if ((elem > 0)&&(elem < sz))
1102 basis_.get_coords(coords, p, ed);
1110 "PrismVolMesh: need to synchronize ELEM_LOCATE_E first");
1112 "PrismVolMesh: need to synchronize FACES_E first");
1124 elem =
static_cast<INDEX
>(*it);
1126 basis_.get_coords(coords, p, ed);
1144 if (bi > ni) bi = ni;
if (bi < 0) bi = 0;
1145 if (bj > nj) bj = nj;
if (bj < 0) bj = 0;
1146 if (bk > nk) bk = nk;
if (bk < 0) bk = 0;
1148 ei = bi; ej = bj; ek = bk;
1150 double dmin = maxdist;
1152 bool found_one =
false;
1161 if (i < 0 || i > ni)
continue;
1164 if (j < 0 || j > nj)
continue;
1167 if (k < 0 || k > nk)
continue;
1168 if (i == bi || i == ei || j == bj || j == ej || k == bk || k == ek)
1170 if (
elem_grid_->min_distance_squared(p, i, j, k) < dmin)
1191 const double dtmp = (p - r).length2();
1202 basis_.get_coords(coords,result,ed);
1204 result =
basis_.interpolate(coords,ed);
1205 double dmin = (result-p).length2();
1217 const double dtmp = (p - r).length2();
1228 basis_.get_coords(coords,result,ed);
1230 result =
basis_.interpolate(coords,ed);
1231 double dmin = (result-p).length2();
1244 const double dtmp = (p - r).length2();
1255 basis_.get_coords(coords,result,ed);
1257 result =
basis_.interpolate(coords,ed);
1258 double dmin = (result-p).length2();
1271 const double dtmp = (p - r).length2();
1282 basis_.get_coords(coords,result,ed);
1284 result =
basis_.interpolate(coords,ed);
1285 double dmin = (result-p).length2();
1298 const double dtmp = (p - r).length2();
1309 basis_.get_coords(coords,result,ed);
1311 result =
basis_.interpolate(coords,ed);
1312 double dmin = (result-p).length2();
1333 if (!found_one)
return (
false);
1336 basis_.get_coords(coords,result,ed);
1338 result =
basis_.interpolate(coords,ed);
1339 dmin = (result-p).length2();
1344 template <
class INDEX>
1353 template<
class ARRAY>
1357 ASSERTFAIL(
"PrismVolMesh: Find closest element has not yet been implemented.");
1371 static const std::string
type_name(
int n = -1);
1400 template <
class Iter,
class Functor>
1402 template <
class Iter,
class Functor>
1408 double err = 1.0e-3);
1437 template<
class ARRAY,
class INDEX>
1441 "PrismVolMesh: Must call synchronize EDGES_E first");
1444 { array.clear();
return; }
1449 array[0] =
static_cast<typename ARRAY::value_type
>(e.
nodes_[0]);
1450 array[1] =
static_cast<typename ARRAY::value_type
>(e.
nodes_[1]);
1454 template <
class ARRAY,
class INDEX>
1458 "PrismVolMesh: Must call synchronize FACES_E first");
1462 if( static_cast<typename ARRAY::value_type>(f.
nodes_[3]) ==
1468 array[0] =
static_cast<typename ARRAY::value_type
>(f.
nodes_[0]);
1469 array[1] =
static_cast<typename ARRAY::value_type
>(f.
nodes_[1]);
1470 array[2] =
static_cast<typename ARRAY::value_type
>(f.
nodes_[2]);
1472 if( static_cast<typename ARRAY::value_type>(f.
nodes_[3]) !=
1474 array[3] = static_cast<typename ARRAY::value_type>(f.
nodes_[3]);
1477 template <
class ARRAY,
class INDEX>
1481 const auto off = idx * 6;
1482 array[0] =
static_cast<typename ARRAY::value_type
>(
cells_[off ]);
1483 array[1] =
static_cast<typename ARRAY::value_type
>(
cells_[off + 1]);
1484 array[2] =
static_cast<typename ARRAY::value_type
>(
cells_[off + 2]);
1485 array[3] =
static_cast<typename ARRAY::value_type
>(
cells_[off + 3]);
1486 array[4] =
static_cast<typename ARRAY::value_type
>(
cells_[off + 4]);
1487 array[5] =
static_cast<typename ARRAY::value_type
>(
cells_[off + 5]);
1490 template <
class ARRAY,
class INDEX>
1496 template <
class ARRAY,
class INDEX>
1500 "PrismVolMesh: Must call synchronize EDGES_E first");
1502 "PrismVolMesh: Must call synchronize FACES_E first");
1511 array.push_back(static_cast<typename ARRAY::value_type>(
1517 array.push_back(static_cast<typename ARRAY::value_type>(
1521 if( static_cast<typename ARRAY::value_type>(f.
nodes_[3]) ==
1527 array.push_back(static_cast<typename ARRAY::value_type>(
1536 array.push_back(static_cast<typename ARRAY::value_type>(
1542 array.push_back(static_cast<typename ARRAY::value_type>(
1548 template <
class ARRAY,
class INDEX>
1552 "PrismVolMesh: Must call synchronize EDGES_E first");
1558 typedef typename ARRAY::value_type T;
1564 array[i++] = (
static_cast<T
>((*(
edge_table_.find(e))).second));
1570 array[i++] = (
static_cast<T
>((*(
edge_table_.find(e))).second));
1576 array[i++] = (
static_cast<T
>((*(
edge_table_.find(e))).second));
1583 array[i++] = (
static_cast<T
>((*(
edge_table_.find(e))).second));
1589 array[i++] = (
static_cast<T
>((*(
edge_table_.find(e))).second));
1595 array[i++] = (
static_cast<T
>((*(
edge_table_.find(e))).second));
1602 array[i++] = (
static_cast<T
>((*(
edge_table_.find(e))).second));
1608 array[i++] = (
static_cast<T
>((*(
edge_table_.find(e))).second));
1614 array[i++] = (
static_cast<T
>((*(
edge_table_.find(e))).second));
1618 template <
class ARRAY,
class INDEX>
1624 template <
class ARRAY,
class INDEX>
1628 "PrismVolMesh: Must call synchronize FACES_E first");
1643 PFace f(n1,n2,n3,n4);
1644 array.push_back(static_cast<typename ARRAY::value_type>(
1651 PFace f(n1,n2,n3,n4);
1652 array.push_back(static_cast<typename ARRAY::value_type>(
1659 PFace f(n1,n2,n3,n4);
1660 array.push_back(static_cast<typename ARRAY::value_type>(
1667 PFace f(n1,n2,n3,n4);
1668 array.push_back(static_cast<typename ARRAY::value_type>(
1675 PFace f(n1,n2,n3,n4);
1676 array.push_back(static_cast<typename ARRAY::value_type>(
1681 template <
class ARRAY,
class INDEX>
1685 "PrismVolMesh: Must call synchronize NODE_NEIGHBORS_E first");
1687 "PrismVolMesh: Must call synchronize EDGES_E first");
1689 std::vector<typename Node::index_type> neighbors;
1690 std::set<typename ARRAY::value_type> unique_cells;
1694 for (
size_t n = 0;
n < neighbors.size();
n++)
1697 typename edge_ht::const_iterator iter =
1699 static_cast<typename Node::index_type>(idx),neighbors[
n]));
1701 "Edge not found in PrismVolMesh::edge_table_");
1704 for (
size_t c = 0; c < (iter->first).
cells_.size(); c++)
1705 unique_cells.insert(static_cast<typename ARRAY::value_type>(
1706 (iter->first).cells_[c]));
1710 array.resize(unique_cells.size());
1711 copy(unique_cells.begin(), unique_cells.end(), array.begin());
1714 template <
class ARRAY,
class INDEX>
1718 "PrismVolMesh: Must call synchronize EDGES_E first");
1719 for (
size_t i=0; i<
edges_[idx].cells_.size();i++)
1720 array[i] = static_cast<typename ARRAY::value_type>(
edges_[idx].
cells_[i]);
1723 template <
class ARRAY,
class INDEX>
1727 "PrismVolMesh: Must call synchronize FACES_E first");
1731 array[0] =
static_cast<typename ARRAY::value_type
>((
faces_[idx].cells_[0])>>3);
1736 array[0] =
static_cast<typename ARRAY::value_type
>((
faces_[idx].cells_[0])>>3);
1737 array[1] =
static_cast<typename ARRAY::value_type
>((
faces_[idx].cells_[1])>>3);
1741 template <
class ARRAY,
class INDEX>
1745 cells_[idx * 6 +
n] = static_cast<index_type>(array[
n]);
1748 template <
class INDEX1,
class INDEX2>
1752 "Must call synchronize FACES_E on PrismVolMesh first");
1756 if (static_cast<typename Cell::index_type>(elem) == (f.
cells_[0]>>3))
1758 neighbor =
static_cast<INDEX1
>((f.
cells_[1]>>3));
1762 neighbor =
static_cast<INDEX1
>((f.
cells_[0]>>3));
1768 template <
class ARRAY,
class INDEX1,
class INDEX2>
1772 "Must call synchronize FACES_E on PrismVolMesh first");
1776 if (elem == static_cast<INDEX1>(f.
cells_[0]))
1779 array[0] =
static_cast<typename ARRAY::value_type
>((f.
cells_[1]>>3));
1784 array[0] =
static_cast<typename ARRAY::value_type
>((f.
cells_[0]>>3));
1794 template <
class ARRAY,
class INDEX>
1801 typename Face::array_type::iterator iter = faces.begin();
1802 while(iter != faces.end())
1804 typename ARRAY::value_type nbor;
1807 array.push_back(nbor);
1814 template <
class ARRAY,
class INDEX>
1818 "Must call synchronize NODE_NEIGHBORS_E on PrismVolMesh first.");
1821 for (
size_t i=0; i< sz; i++)
1823 array[i] =
static_cast<typename ARRAY::value_type
>(
node_neighbors_[node][i]);
1827 template <
class INDEX>
1833 if (sz == 0)
return (
false);
1836 if (node >= 0 && node < sz)
1842 "PrismVolMesh::locate_node requires synchronize(NODE_LOCATE_E).")
1854 if (bi > ni) bi =ni;
if (bi < 0) bi = 0;
1855 if (bj > nj) bj =nj;
if (bj < 0) bj = 0;
1856 if (bk > nk) bk =nk;
if (bk < 0) bk = 0;
1862 double dmin = DBL_MAX;
1872 if (i < 0 || i > ni)
continue;
1875 if (j < 0 || j > nj)
continue;
1878 if (k < 0 || k > nk)
continue;
1879 if (i == bi || i == ei || j == bj || j == ej || k == bk || k == ek)
1881 if (
node_grid_->min_distance_squared(p, i, j, k) < dmin)
1890 const double dist = (p-
point).length2();
1910 while ((!found)||(dmin == DBL_MAX)) ;
1916 template <
class INDEX>
1920 "Must call synchronize EDGES_E on PrismVolMesh first");
1928 double mindist = 0.0;
1934 if (!found || dist < mindist)
1936 edge =
static_cast<INDEX
>(*bi);
1946 template <
class INDEX>
1950 "Must call synchronize FACES_E on PrismVolMesh first");
1953 double mindist = DBL_MAX;
1960 const double dist = (p - c).length2();
1961 if (!found || dist < mindist)
1964 face =
static_cast<INDEX
>(*bi);
1972 template <
class INDEX>
1982 if (sz == 0)
return (
false);
1985 if ((elem > 0)&&(elem < sz))
1987 if (
inside(elem,p))
return (
true);
1991 "PrismVolMesh: need to synchronize ELEM_LOCATE_E first");
2000 elem =
static_cast<INDEX
>(*it);
2009 template <
class ARRAY>
2014 "PrismVolMesh::locate_elems requires synchronize(ELEM_LOCATE_E).")
2030 for (;p<array.size();p++)
if (array[p] ==
typename ARRAY::value_type(*it))
break;
2031 if (p == array.size()) array.push_back(
typename ARRAY::value_type(*it));
2036 return (array.size() > 0);
2040 template <
class INDEX,
class ARRAY>
2050 if (sz == 0)
return (
false);
2053 if ((elem > 0)&&(elem < sz))
2058 basis_.get_coords(coords, p, ed);
2064 "PrismVolMesh: need to synchronize ELEM_LOCATE_E first");
2073 elem =
static_cast<INDEX
>(*it);
2075 basis_.get_coords(coords, p, ed);
2084 template <
class INDEX>
2090 template <
class INDEX>
2101 template <
class INDEX>
2108 ASSERT(nodes.size() == 3 || nodes.size() == 4);
2109 typename Node::array_type::iterator nai = nodes.begin();
2113 while (nai != nodes.end())
2123 template <
class INDEX>
2130 ASSERT(nodes.size() == 6);
2131 typename Node::array_type::iterator nai = nodes.begin();
2135 while (nai != nodes.end())
2163 template<
class INDEX>
2191 if(
basis_.get_coords(coords, p, ed))
return (
true);
2356 std::vector<typename Cell::index_type>
cells_;
2474 #ifdef HAVE_HASH_MAP
2477 typedef stdext::hash_map<PFace, typename Face::index_type, FaceHash>
face_ht;
2478 typedef stdext::hash_map<PEdge, typename Edge::index_type, EdgeHash>
edge_ht;
2481 typedef hash_map<PFace, typename Face::index_type, FaceHash>
face_ht;
2482 typedef hash_map<PEdge, typename Edge::index_type, EdgeHash>
edge_ht;
2485 typedef std::map<PFace, typename Face::index_type, FaceHash>
face_ht;
2486 typedef std::map<PEdge, typename Edge::index_type, EdgeHash>
edge_ht;
2507 template <
class INDEX>
2515 if ((n1 == n3)||(n2==n4))
return (
false);
2520 if ((n1 < n2)&&(n1 < n3)&&(n1 < n4))
2523 else if ((n2 < n3)&&(n2 < n4))
2527 t = n1; n1 = n2; n2 = n3; n3 = n4; n4 = t;
2533 t = n1; n1 = n3; n3 = t; t = n2; n2 = n4; n4 = t;
2539 t = n4; n4 = n3; n3 = n2; n2 = n1; n1 = t;
2544 if (n3==n4)
return (
false);
2549 if (n1==n4)
return (
false);
2573 std::vector<std::vector<typename Node::index_type> > &
nbor_vec_;
2608 template <
class Basis>
2618 template <
class Basis>
2626 synchronize_lock_(
"PrismVolMesh Lock"),
2627 synchronize_cond_(
"PrismVolMesh condition variable"),
2628 synchronized_(
Mesh::NODES_E |
Mesh::CELLS_E),
2640 template <
class Basis>
2649 synchronize_lock_(
"PrismVolMesh Lock"),
2650 synchronize_cond_(
"PrismVolMesh condition variable"),
2651 synchronized_(
Mesh::NODES_E |
Mesh::CELLS_E),
2662 copy.synchronize_lock_.lock();
2674 copy.synchronize_lock_.unlock();
2682 template <
class Basis>
2688 template <
class Basis>
2689 template <
class Iter,
class Functor>
2693 synchronize_lock_.lock();
2695 points_.resize(end - begin);
2696 std::vector<Core::Geometry::Point>::iterator piter = points_.begin();
2699 *piter = fill_ftor(*iter);
2702 synchronize_lock_.unlock();
2705 template <
class Basis>
2706 template <
class Iter,
class Functor>
2710 synchronize_lock_.lock();
2712 cells_.resize((end - begin) * 6);
2713 std::vector<under_type>::iterator citer = cells_.begin();
2716 int *nodes = fill_ftor(*iter);
2718 for(
int i=0; i<6; i++ )
2726 synchronize_lock_.unlock();
2729 template <
class Basis>
2734 template <
class Basis>
2738 ASSERT((n >= -1) && n <= 1);
2746 static const std::string nm(
"PrismVolMesh");
2758 template <
class Basis>
2775 const double w = rng() * (a0 + a1 + a2);
2791 const double tmp =
v;
2795 else if (t + u + v > 1.0)
2797 const double tmp =
v;
2798 v = t + u + v - 1.0;
2803 const double a = 1.0 - t - u -
v;
2819 template <
class Basis>
2829 result.
extend(points_[*ni]);
2835 template <
class Basis>
2845 template <
class Basis>
2849 synchronize_lock_.lock();
2851 std::vector<Core::Geometry::Point>::iterator itr = points_.begin();
2852 std::vector<Core::Geometry::Point>::iterator eitr = points_.end();
2869 bbox_.extend(point(*ni));
2874 epsilon_ = bbox_.diagonal().length()*1e-8;
2875 epsilon2_ = epsilon_*epsilon_;
2876 epsilon3_ = epsilon_*epsilon_*epsilon_;
2881 if (node_grid_) { node_grid_->transform(t); }
2882 if (elem_grid_) { elem_grid_->transform(t); }
2883 synchronize_lock_.unlock();
2886 template <
class Basis>
2900 if (!(order_face_nodes(n1,n2,n3,n4)))
return;
2901 PFace f(n1, n2, n3, n4);
2903 typename face_ht::iterator iter = table.find(f);
2904 if (iter == table.end())
2906 f.
cells_[0] = combined_index;
2911 PFace f = (*iter).first;
2914 std::cerr <<
"PrismVolMesh - This Mesh has problems: Cells #"
2915 << (f.
cells_[0]>>3) <<
", #" << (f.
cells_[1]>>3) <<
", and #" << (combined_index >> 3)
2916 <<
" are illegally adjacent." << std::endl;
2918 else if ((f.
cells_[0]>>3) == (combined_index>>3))
2920 std::cerr <<
"PrismVolMesh - This Mesh has problems: Cells #"
2921 << (f.
cells_[0]>>3) <<
" and #" << (combined_index>>3)
2922 <<
" are the same." << std::endl;
2926 f.
cells_[1] = combined_index;
2933 template <
class Basis>
2937 face_table_.clear();
2940 begin(ci); end(cie);
2944 get_nodes(arr, *ci);
2949 hash_face(arr[1], arr[4], arr[5], arr[2], cell_index + 2, face_table_);
2950 hash_face(arr[2], arr[5], arr[3], arr[0], cell_index + 3, face_table_);
2951 hash_face(arr[0], arr[3], arr[4], arr[1], cell_index + 4, face_table_);
2957 faces_.resize(face_table_.size());
2958 typename std::vector<PFace>::iterator f_iter = faces_.begin();
2959 typename face_ht::iterator ht_iter = face_table_.begin();
2961 boundary_faces_.resize(cells_.size() /6);
2964 while (ht_iter != face_table_.end())
2966 *f_iter = (*ht_iter).first;
2967 (*ht_iter).second = i;
2969 if ((*f_iter).cells_[1] == -1)
2971 index_type cell = ((*f_iter).cells_[0]) >> 3;
2972 index_type face = ((*f_iter).cells_[0]) & 0x7;
2973 boundary_faces_[cell] |= 1 << face;
2975 ++f_iter; ++ht_iter; i++;
2978 synchronize_lock_.lock();
2980 synchronize_lock_.unlock();
2983 template <
class Basis>
2990 if (n1 == n2)
return;
2992 typename edge_ht::iterator iter = table.find(e);
2993 if (iter == table.end())
3000 PEdge e = (*iter).first;
3007 template <
class Basis>
3012 begin(ci); end(cie);
3016 get_nodes(arr, *ci);
3017 hash_edge(arr[0], arr[1], *ci, edge_table_);
3018 hash_edge(arr[1], arr[2], *ci, edge_table_);
3019 hash_edge(arr[2], arr[0], *ci, edge_table_);
3021 hash_edge(arr[3], arr[4], *ci, edge_table_);
3022 hash_edge(arr[4], arr[5], *ci, edge_table_);
3023 hash_edge(arr[5], arr[3], *ci, edge_table_);
3025 hash_edge(arr[0], arr[3], *ci, edge_table_);
3026 hash_edge(arr[4], arr[1], *ci, edge_table_);
3027 hash_edge(arr[2], arr[5], *ci, edge_table_);
3033 edges_.resize(edge_table_.size());
3035 typename std::vector<PEdge>::iterator e_iter = edges_.begin();
3036 typename edge_ht::iterator ht_iter = edge_table_.begin();
3037 while (ht_iter != edge_table_.end()) {
3038 *e_iter = (*ht_iter).first;
3040 e_iter - edges_.begin());
3041 ++e_iter; ++ht_iter;
3044 synchronize_lock_.lock();
3046 synchronize_lock_.unlock();
3049 template <
class Basis>
3074 sync &= (~synchronized_);
3079 synchronize_lock_.unlock();
3081 synchronize_lock_.lock();
3087 boost::thread syncthread(syncclass);
3093 synchronize_lock_.unlock();
3095 synchronize_lock_.lock();
3101 boost::thread syncthread(syncclass);
3104 if (sync == Mesh::NODE_NEIGHBORS_E)
3107 synchronize_lock_.unlock();
3109 synchronize_lock_.lock();
3111 else if (sync & Mesh::NODE_NEIGHBORS_E)
3115 boost::thread syncthread(syncclass);
3121 synchronize_lock_.unlock();
3123 synchronize_lock_.lock();
3129 boost::thread syncthread(syncclass);
3135 synchronize_lock_.unlock();
3137 synchronize_lock_.lock();
3143 boost::thread syncthread(syncclass);
3149 synchronize_lock_.unlock();
3151 synchronize_lock_.lock();
3157 boost::thread syncthread(syncclass);
3161 while ((synchronized_ & sync) != sync)
3163 synchronize_cond_.wait(lock);
3169 template <
class Basis>
3176 template <
class Basis>
3180 synchronize_lock_.lock();
3186 node_neighbors_.clear();
3188 edge_table_.clear();
3190 face_table_.clear();
3191 boundary_faces_.clear();
3196 synchronize_lock_.unlock();
3202 template <
class Basis>
3207 "Must call synchronize NODES_E on PrismVolMesh first");
3211 template <
class Basis>
3216 "Must call synchronize NODES_E on PrismVolMesh first");
3220 template <
class Basis>
3225 "Must call synchronize NODES_E on PrismVolMesh first");
3229 template <
class Basis>
3234 "Must call synchronize EDGES_E on PrismVolMesh first");
3238 template <
class Basis>
3243 "Must call synchronize EDGES_E on PrismVolMesh first");
3247 template <
class Basis>
3252 "Must call synchronize EDGES_E on PrismVolMesh first");
3256 template <
class Basis>
3261 "Must call synchronize FACES_E on PrismVolMesh first");
3265 template <
class Basis>
3270 "Must call synchronize FACES_E on PrismVolMesh first");
3274 template <
class Basis>
3279 "Must call synchronize FACES_E on PrismVolMesh first");
3283 template <
class Basis>
3288 "Must call synchronize CELLS_E on PrismVolMesh first");
3292 template <
class Basis>
3297 "Must call synchronize CELLS_E on PrismVolMesh first");
3301 template <
class Basis>
3306 "Must call synchronize CELLS_E on PrismVolMesh first");
3310 template <
class Basis>
3319 "Must call synchronize FACES_E on PrismVolMesh first");
3320 if(!(order_face_nodes(n1,n2,n3,n4)))
return (
false);
3321 PFace f(n1, n2, n3, n4);
3322 typename face_ht::const_iterator fiter = face_table_.find(f);
3323 if (fiter == face_table_.end()) {
3326 face = (*fiter).second;
3330 template <
class Basis>
3334 node_neighbors_.clear();
3335 node_neighbors_.resize(points_.size());
3337 begin(ei); end(eie);
3340 synchronize_lock_.lock();
3342 synchronize_lock_.unlock();
3345 template <
class Basis>
3351 if (locate_elem(idx, p))
3354 std::vector<double> coords(3);
3355 if (get_coords(coords, p, idx))
3357 basis_.get_weights(coords, w);
3358 return basis_.dofs();
3364 template <
class Basis>
3370 if (locate_elem(idx, p))
3380 template <
class Basis>
3389 box.
extend(points_[cells_[idx]]);
3390 box.
extend(points_[cells_[idx+1]]);
3391 box.
extend(points_[cells_[idx+2]]);
3392 box.
extend(points_[cells_[idx+3]]);
3393 box.
extend(points_[cells_[idx+4]]);
3394 box.
extend(points_[cells_[idx+5]]);
3396 elem_grid_->insert(ci, box);
3399 template <
class Basis>
3405 box.
extend(points_[cells_[idx]]);
3406 box.
extend(points_[cells_[idx+1]]);
3407 box.
extend(points_[cells_[idx+2]]);
3408 box.
extend(points_[cells_[idx+3]]);
3409 box.
extend(points_[cells_[idx+4]]);
3410 box.
extend(points_[cells_[idx+5]]);
3412 elem_grid_->remove(ci, box);
3415 template <
class Basis>
3421 node_grid_->insert(ni,points_[ni]);
3424 template <
class Basis>
3428 node_grid_->remove(ni,points_[ni]);
3431 template <
class Basis>
3442 3*
static_cast<size_type>((ceil(pow(static_cast<double>(esz) , (1.0/3.0))))/2.0 + 1.0);
3445 double trace = (diag.
x()+diag.
y()+diag.
z());
3454 begin(ci); end(cie);
3457 insert_elem_into_grid(*ci);
3462 synchronize_lock_.lock();
3464 synchronize_lock_.unlock();
3467 template <
class Basis>
3471 ASSERTMSG(bbox_.valid(),
"PrismVolMesh BBox not valid");
3479 ((ceil(pow(static_cast<double>(esz) , (1.0/3.0))))/2.0 + 1.0);
3482 double trace = (diag.
x()+diag.
y()+diag.
z());
3491 begin(ni); end(nie);
3494 insert_node_into_grid(*ni);
3499 synchronize_lock_.lock();
3501 synchronize_lock_.unlock();
3504 template <
class Basis>
3516 bbox_.extend(point(*ni));
3521 epsilon_ = bbox_.diagonal().length()*1e-8;
3522 epsilon2_ = epsilon_*epsilon_;
3523 epsilon3_ = epsilon_*epsilon_*epsilon_;
3525 synchronize_lock_.lock();
3527 synchronize_lock_.unlock();
3530 template <
class Basis>
3535 if (locate(i, p) && (points_[i] - p).length2() < err)
3541 points_.push_back(p);
3546 template <
class Basis>
3556 cells_.push_back(a);
3557 cells_.push_back(b);
3558 cells_.push_back(c);
3559 cells_.push_back(d);
3560 cells_.push_back(e);
3561 cells_.push_back(f);
3565 template <
class Basis>
3569 points_.push_back(p);
3573 template <
class Basis>
3579 return add_prism(add_find_point(p0), add_find_point(p1),
3580 add_find_point(p2), add_find_point(p3),
3581 add_find_point(p4), add_find_point(p5));
3584 #define PRISM_VOL_MESH_VERSION 3
3586 template <
class Basis>
3590 const int version = stream.
begin_class(type_name(-1),
3598 std::vector<int> neighbors;
3611 synchronized_ = NODES_E | CELLS_E;
3617 template <
class Basis>
3627 std::string(__FILE__),
3634 template <
class Basis>
3635 const TypeDescription*
3641 template <
class Basis>
3651 std::string(__FILE__),
3658 template <
class Basis>
3668 std::string(__FILE__),
3675 template <
class Basis>
3685 std::string(__FILE__),
3692 template <
class Basis>
3702 std::string(__FILE__),
CellIndex< under_type > index_type
Definition: PrismVolMesh.h:147
void get_node_neighbors(ARRAY &array, INDEX node) const
We should optimize this function more.
Definition: PrismVolMesh.h:1815
bool locate(typename Edge::index_type &edge, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:627
bool find_closest_node(double &pdist, Core::Geometry::Point &result, INDEX &node, const Core::Geometry::Point &p, double maxdist) const
Definition: PrismVolMesh.h:835
void get_neighbors(std::vector< typename Node::index_type > &array, typename Node::index_type node) const
These are more general implementations.
Definition: PrismVolMesh.h:613
void get_nodes(typename Node::array_type &array, typename Node::index_type idx) const
Get the child topology elements of the given topology.
Definition: PrismVolMesh.h:445
Interface to statically allocated std::vector class.
Definition: VUnstructuredMesh.h:41
bool get_coords(VECTOR &coords, const Core::Geometry::Point &p, INDEX idx) const
Definition: PrismVolMesh.h:715
bool reading() const
Definition: Persistent.h:164
double get_length(typename Edge::index_type idx) const
More specific names for get_size.
Definition: PrismVolMesh.h:594
Distinct type for node FieldIterator.
Definition: FieldIterator.h:89
void get_center(Core::Geometry::Point &result, typename Face::index_type idx) const
Definition: PrismVolMesh.h:551
bool locate(typename Elem::index_type &elem, std::vector< double > &coords, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:634
const Core::Geometry::Point & node1() const
Definition: PrismVolMesh.h:250
Definition: PrismVolMesh.h:165
Node::index_type add_point(const Core::Geometry::Point &p)
Add a new node to the mesh.
Definition: PrismVolMesh.h:3567
Definition: FieldRNG.h:37
double get_size(typename Face::index_type idx) const
Definition: PrismVolMesh.h:570
std::string get_name(const std::string &type_sep_start="<", const std::string &type_sep_end="> ") const
Definition: TypeDescription.cc:135
Distinct type for face Iterator.
Definition: FieldIterator.h:121
Face DElem
Definition: PrismVolMesh.h:157
void jacobian(const VECTOR &coords, INDEX idx, double *J) const
Definition: PrismVolMesh.h:755
Definition: ConditionVariable.h:45
index_type node5_index() const
Definition: PrismVolMesh.h:203
std::vector< index_type > array_type
Definition: PrismVolMesh.h:136
double get_volume(typename Cell::index_type idx) const
Definition: PrismVolMesh.h:598
void get_faces(typename Face::array_type &array, typename Cell::index_type idx) const
Definition: PrismVolMesh.h:481
void get_node_center(Core::Geometry::Point &p, INDEX idx) const
Definition: PrismVolMesh.h:2085
void get_delems(typename DElem::array_type &array, typename Cell::index_type idx) const
Definition: PrismVolMesh.h:520
Point max() const
Definition: BBox.h:195
index_type edge2_index() const
Definition: PrismVolMesh.h:217
bool operator()(const PFace &f1, const PFace &f2) const
This should return less than rather than equal to.
Definition: PrismVolMesh.h:2434
void set_point(const Core::Geometry::Point &point, typename Node::index_type index)
Definition: PrismVolMesh.h:651
std::vector< index_type > array_type
Definition: PrismVolMesh.h:150
boost::shared_ptr< SearchGridT< index_type > > elem_grid_
Definition: PrismVolMesh.h:2587
index_type edge7_index() const
Definition: PrismVolMesh.h:237
bool find_closest_nodes(ARRAY &nodes, const Core::Geometry::Point &p, double maxdist) const
Definition: PrismVolMesh.h:942
#define ASSERTMSG(condition, message)
Definition: Exception.h:113
void get_nodes(typename Node::array_type &array, typename Edge::index_type idx) const
Definition: PrismVolMesh.h:448
void get_normal(Core::Geometry::Vector &result, VECTOR &coords, INDEX1 eidx, INDEX2 fidx) const
Get the normals at the outside of the element.
Definition: PrismVolMesh.h:661
void get_center(Core::Geometry::Point &result, typename Edge::index_type idx) const
Definition: PrismVolMesh.h:549
bool get_neighbors(std::vector< typename Elem::index_type > &array, typename Elem::index_type elem, typename DElem::index_type delem) const
Definition: PrismVolMesh.h:616
static const int up4_mask
Definition: PrismVolMesh.h:2412
const PrismVolMesh & mesh_
Definition: PrismVolMesh.h:2574
static const int sz_quarter_int
These are for our own use (making the hash function.
Definition: PrismVolMesh.h:2410
void get_cells(typename Cell::array_type &array, typename Edge::index_type idx) const
Definition: PrismVolMesh.h:488
void get_delems(typename DElem::array_type &, typename Node::index_type) const
Definition: PrismVolMesh.h:511
static MeshHandle mesh_maker()
This function returns a handle for the virtual interface.
Definition: PrismVolMesh.h:1387
Definition: Persistent.h:89
static const int up_mask
Definition: PrismVolMesh.h:2454
static const int low_mask
Definition: PrismVolMesh.h:2455
std::vector< std::vector< typename Node::index_type > > node_neighbors_
Definition: PrismVolMesh.h:2583
void get_normal(Core::Geometry::Vector &, typename Node::index_type) const
Function for getting node normals.
Definition: PrismVolMesh.h:656
void get_elems(typename Elem::array_type &array, typename Node::index_type idx) const
Definition: PrismVolMesh.h:498
Cell Elem
Definition: PrismVolMesh.h:156
virtual bool unsynchronize(mask_type mask)
Definition: PrismVolMesh.h:3171
std::vector< Core::Geometry::Point > & get_points()
must detach, if altering points!
Definition: PrismVolMesh.h:1420
static PersistentTypeID prismvol_typeid
This ID is created as soon as this class will be instantiated.
Definition: PrismVolMesh.h:1368
bool inside(INDEX idx, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:2164
virtual void io(Piostream &)
Export this class using the old Pio system.
Definition: PrismVolMesh.h:3588
index_type edge3_index() const
Definition: PrismVolMesh.h:221
Core::Thread::ConditionVariable synchronize_cond_
Definition: PrismVolMesh.h:2591
void get_faces(typename Face::array_type &, typename Edge::index_type) const
Definition: PrismVolMesh.h:474
int compute_checksum(T *data, std::size_t length)
Definition: CheckSum.h:38
void run()
Definition: PrismVolMesh.h:292
static const size_t min_buckets
Definition: PrismVolMesh.h:2407
double InverseMatrix3P(const PointVector &p, double *q)
Inline templated inverse matrix.
Definition: Locate.h:72
SCIRun::mask_type mask_type
Definition: PrismVolMesh.h:119
virtual PrismVolMesh * clone() const
Definition: PrismVolMesh.h:357
PrismVolMesh< Basis >::index_type index_type
Definition: PrismVolMesh.h:168
Definition: Persistent.h:187
useful functors
Definition: PrismVolMesh.h:2560
static const int top4_mask
Definition: PrismVolMesh.h:2411
static const TypeDescription * edge_type_description()
Definition: PrismVolMesh.h:3660
BBox & extend(const Point &p)
Expand the bounding box to include point p.
Definition: BBox.h:98
face_ht face_table_
Definition: PrismVolMesh.h:2492
EdgeIndex< under_type > size_type
Definition: PrismVolMesh.h:135
Definition: PrismVolMesh.h:75
void get_edges_from_face(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1497
void end(typename Node::iterator &) const
Definition: PrismVolMesh.h:3213
Definition: TypeDescription.h:50
Basis basis_type
Definition: PrismVolMesh.h:122
double epsilon_
Definition: PrismVolMesh.h:2600
Definition: TypeDescription.h:45
virtual Core::Geometry::BBox get_bounding_box() const
Get the bounding box of the field.
Definition: PrismVolMesh.h:2821
#define SCISHARE
Definition: share.h:39
void to_index(typename Edge::index_type &index, index_type i) const
Definition: PrismVolMesh.h:437
std::vector< const TypeDescription * > td_vec
Definition: TypeDescription.h:56
void get_face_center(Core::Geometry::Point &p, INDEX idx) const
Definition: PrismVolMesh.h:2102
index_type edge5_index() const
Definition: PrismVolMesh.h:229
Elem::index_type add_elem(ARRAY a)
Add a new element to the mesh.
Definition: PrismVolMesh.h:692
void to_index(typename Cell::index_type &index, index_type i) const
Definition: PrismVolMesh.h:441
double get_size(typename Edge::index_type idx) const
Definition: PrismVolMesh.h:560
double get_epsilon() const
Definition: PrismVolMesh.h:402
double tetrahedra_volume(const Point &p0, const Point &p1, const Point &p2, const Point &p3)
Definition: CompGeom.cc:389
bool operator()(const PEdge &e1, const PEdge &e2) const
This should return less than rather than equal to.
Definition: PrismVolMesh.h:2465
bool locate_elem(INDEX &elem, ARRAY &coords, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:2041
void to_index(typename Face::index_type &index, index_type i) const
Definition: PrismVolMesh.h:439
VMesh * CreateVPrismVolMesh(MESH *)
Definition: PrismVolMesh.h:81
void insert_node_into_grid(typename Node::index_type ci)
Definition: PrismVolMesh.h:3417
double scaled_jacobian_metric(INDEX idx) const
Definition: PrismVolMesh.h:784
boost::shared_ptr< Mesh > MeshHandle
Definition: DatatypeFwd.h:67
bool find_closest_elem(double &pdist, Core::Geometry::Point &result, INDEX &elem, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:1345
#define MESH_NO_NEIGHBOR
Definition: MeshTraits.h:67
friend class VPrismVolMesh
Make sure the virtual interface has access.
Definition: PrismVolMesh.h:110
Distinct type for cell Iterator.
Definition: FieldIterator.h:134
bool operator<(const PFace &f) const
Definition: PrismVolMesh.h:2248
unsigned int mask_type
Definition: Types.h:45
SCIRun::index_type index_type
Definition: PrismVolMesh.h:117
void get_elem_neighbors(ARRAY &array, INDEX elem) const
Definition: PrismVolMesh.h:1795
static const size_t bucket_size
These are needed by the hash_map particularly.
Definition: PrismVolMesh.h:2406
void to_index(typename Node::index_type &index, index_type i) const
Definition: PrismVolMesh.h:435
SCIRun::size_type size_type
Definition: PrismVolMesh.h:118
Face information.
Definition: PrismVolMesh.h:2203
mask_type synchronizing_
Definition: PrismVolMesh.h:2596
boost::shared_ptr< SearchGridT< index_type > > node_grid_
Definition: PrismVolMesh.h:2586
#define ASSERT(condition)
Definition: Assert.h:110
SCIRun::index_type under_type
Definition: PrismVolMesh.h:116
void resize_nodes(size_type s)
Definition: PrismVolMesh.h:708
std::vector< PFace > faces_
Definition: PrismVolMesh.h:2491
void get_cells(typename Cell::array_type &array, typename Node::index_type idx) const
Definition: PrismVolMesh.h:485
void get_edges(typename Edge::array_type &array, typename Edge::index_type idx) const
Definition: PrismVolMesh.h:461
index_type node3_index() const
Definition: PrismVolMesh.h:195
Node::index_type nodes_[4]
Definition: PrismVolMesh.h:2204
double get_area(typename Face::index_type idx) const
Definition: PrismVolMesh.h:596
static const int mid4_mask
Definition: PrismVolMesh.h:2413
virtual int begin_class(const std::string &name, int current_version)
Definition: Persistent.cc:143
virtual bool is_editable() const
Check whether mesh can be altered by adding nodes or elements.
Definition: PrismVolMesh.h:394
ElemData(const PrismVolMesh< Basis > &msh, const index_type ind)
Definition: PrismVolMesh.h:170
void get_edges(typename Edge::array_type &array, typename Cell::index_type idx) const
Definition: PrismVolMesh.h:467
const Core::Geometry::Point & node0() const
Definition: PrismVolMesh.h:246
boost::unique_lock< boost::mutex > UniqueLock
Definition: ConditionVariable.h:43
double jacobian_metric(INDEX idx) const
Definition: PrismVolMesh.h:806
double DetMatrix3P(const VectorOfPoints &p)
Inline templated determinant of matrix.
Definition: Locate.h:120
Definition: PrismVolMesh.h:2400
const string find_type_name(float *)
Definition: TypeName.cc:63
Elem::index_type add_prism(typename Node::index_type a, typename Node::index_type b, typename Node::index_type c, typename Node::index_type d, typename Node::index_type e, typename Node::index_type f)
Definition: PrismVolMesh.h:3548
bool locate_edge(INDEX &edge, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:1917
void get_cells_from_node(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1682
CellIndex< under_type > size_type
Definition: PrismVolMesh.h:149
const Core::Geometry::Point & node5() const
Definition: PrismVolMesh.h:266
bool get_elem_neighbor(INDEX1 &neighbor, INDEX1 elem, INDEX2 delem) const
Definition: PrismVolMesh.h:1749
EdgeIterator< under_type > iterator
Definition: PrismVolMesh.h:134
void get_faces(typename Face::array_type &, typename Node::index_type) const
Definition: PrismVolMesh.h:471
const Core::Geometry::Point & point(typename Node::index_type i)
Definition: PrismVolMesh.h:2161
void get_center(Core::Geometry::Point &result, typename Cell::index_type idx) const
Definition: PrismVolMesh.h:553
double epsilon3_
Definition: PrismVolMesh.h:2602
Basis basis_
Definition: PrismVolMesh.h:2598
const Core::Geometry::Point & node2() const
Definition: PrismVolMesh.h:254
std::vector< Core::Geometry::Point > points_
all the nodes.
Definition: PrismVolMesh.h:2198
int get_weights(const Core::Geometry::Point &, typename Face::array_type &, double *) const
Definition: PrismVolMesh.h:644
bool find_closest_nodes(ARRAY1 &distances, ARRAY2 &nodes, const Core::Geometry::Point &p, double maxdist) const
Definition: PrismVolMesh.h:1006
void get_nodes(typename Node::array_type &array, typename Cell::index_type idx) const
Definition: PrismVolMesh.h:454
virtual bool has_normals() const
Has this mesh normals.
Definition: PrismVolMesh.h:397
void get_center(Core::Geometry::Point &result, typename Node::index_type idx) const
get the center point (in object space) of an element
Definition: PrismVolMesh.h:547
Definition: VMeshShared.h:40
void compute_node_neighbors()
Definition: PrismVolMesh.h:3332
Definition: ParallelLinearAlgebraTests.cc:358
bool operator<(const PEdge &e) const
Definition: PrismVolMesh.h:2388
bool get_neighbor(typename Elem::index_type &neighbor, typename Elem::index_type elem, typename DElem::index_type delem) const
Get neighbors of an element or a node.
Definition: PrismVolMesh.h:607
std::vector< index_type > array_type
Definition: PrismVolMesh.h:143
bool shared() const
Definition: PrismVolMesh.h:2378
Definition: SearchGridT.h:47
bool locate(typename Node::index_type &node, const Core::Geometry::Point &p) const
return false if point is out of range.
Definition: PrismVolMesh.h:625
index_type node2_index() const
Definition: PrismVolMesh.h:191
const char * name[]
Definition: BoostGraphExampleTests.cc:87
static const TypeDescription * cell_type_description()
Definition: PrismVolMesh.h:3694
void get_cells_from_edge(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1715
static const std::string type_name(int n=-1)
Core functionality for getting the name of a templated mesh class.
Definition: PrismVolMesh.h:2736
void get_delems(typename DElem::array_type &, typename Edge::index_type) const
Definition: PrismVolMesh.h:514
size_t operator()(const PEdge &e) const
This is the hash function.
Definition: PrismVolMesh.h:2458
void est_closest_point_on_quad(Point &result, const Point &orig, const Point &p0, const Point &p1, const Point &p2, const Point &p3, const double epsilon)
Definition: CompGeom.cc:226
FillNodeNeighbors(std::vector< std::vector< typename Node::index_type > > &n, const PrismVolMesh &m)
Definition: PrismVolMesh.h:2561
void Pio_index(Piostream &stream, index_type *data, size_type size)
Definition: Persistent.cc:606
long long size_type
Definition: Types.h:40
static const size_t bucket_size
These are needed by the hash_map particularly.
Definition: PrismVolMesh.h:2448
static const int sz_int
Definition: PrismVolMesh.h:2399
void compute_faces()
Definition: PrismVolMesh.h:2935
Vector Cross(const Vector &v1, const Vector &v2)
Definition: Vector.h:378
static const TypeDescription * node_type_description()
Definition: PrismVolMesh.h:3643
virtual int dimensionality() const
Topological dimension.
Definition: PrismVolMesh.h:375
double ScaledDetMatrix3P(const VectorOfPoints &p)
Inline templated determinant of matrix.
Definition: Locate.h:132
void get_elems(typename Elem::array_type &array, typename Edge::index_type idx) const
Definition: PrismVolMesh.h:501
NodeIndex< under_type > size_type
Definition: PrismVolMesh.h:128
bool operator==(const PFace &f) const
true if both have the same nodes (order does not matter)
Definition: PrismVolMesh.h:2231
NodeIndex< under_type > index_type
Definition: PrismVolMesh.h:126
Definition: PrismVolMesh.h:132
void derivate(const VECTOR1 &coords, INDEX idx, VECTOR2 &J) const
Definition: PrismVolMesh.h:734
Vector diagonal() const
Definition: BBox.h:198
boost::shared_ptr< PrismVolMesh< Basis > > handle_type
Definition: PrismVolMesh.h:121
void get_edges_from_elem(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1619
Persistent i/o for STL containers.
std::vector< INDEX >::iterator iterator
Definition: SearchGridT.h:53
void get_cell_center(Core::Geometry::Point &p, INDEX idx) const
Definition: PrismVolMesh.h:2124
std::string type
Definition: Persistent.h:72
void fill_points(Iter begin, Iter end, Functor fill_ftor)
Definition: PrismVolMesh.h:2691
bool get_face(typename Face::index_type &array, typename Node::index_type n1, typename Node::index_type n2, typename Node::index_type n3, typename Node::index_type n4=PRISM_DUMMY_NODE_INDEX) const
Trying figure out which face is made out of 3/4 nodes (?)
Definition: PrismVolMesh.h:3312
void get_edges(typename Edge::array_type &array, typename Face::index_type idx) const
Definition: PrismVolMesh.h:464
void get_neighbors(typename Elem::array_type &array, typename Elem::index_type elem) const
Definition: PrismVolMesh.h:620
Point min() const
Definition: BBox.h:192
Distinct type for face index.
Definition: FieldIndex.h:90
void get_point(Core::Geometry::Point &result, typename Node::index_type index) const
Access the nodes of the mesh.
Definition: PrismVolMesh.h:649
Node::index_type add_node(const Core::Geometry::Point &p)
Definition: PrismVolMesh.h:687
bool order_face_nodes(INDEX &n1, INDEX &n2, INDEX &n3, INDEX &n4) const
Definition: PrismVolMesh.h:2508
const Core::Geometry::Point & node4() const
Definition: PrismVolMesh.h:262
void get_edges_from_cell(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1549
double get_size(typename Node::index_type) const
Get the size of an elemnt (length, area, volume)
Definition: PrismVolMesh.h:557
index_type edge1_index() const
Definition: PrismVolMesh.h:213
void get_cells(typename Cell::array_type &array, typename Cell::index_type idx) const
Definition: PrismVolMesh.h:494
Index and Iterator types required for Mesh Concept.
Definition: PrismVolMesh.h:125
void x(double)
Definition: Vector.h:175
std::vector< under_type > cells_
each 6 indecies make up a Prism
Definition: PrismVolMesh.h:2200
index_type edge0_index() const
the following designed to coordinate with ::get_edges
Definition: PrismVolMesh.h:209
void closest_point_on_tri(Point &result, const Point &orig, const Point &p0, const Point &p1, const Point &p2, const double epsilon)
Definition: CompGeom.cc:136
virtual int topology_geometry() const
Definition: PrismVolMesh.h:380
std::vector< unsigned char > boundary_faces_
Definition: PrismVolMesh.h:2585
int get_weights(const Core::Geometry::Point &, typename Edge::array_type &, double *) const
Definition: PrismVolMesh.h:642
bool operator==(const PEdge &e) const
true if both have the same nodes (order does not matter)
Definition: PrismVolMesh.h:2381
bool locate_elems(ARRAY &array, const Core::Geometry::BBox &b) const
Definition: PrismVolMesh.h:2010
void get_delems(typename DElem::array_type &array, typename Face::index_type idx) const
Definition: PrismVolMesh.h:517
void get_nodes_from_cell(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1478
static const std::string make_template_id(const std::string &templateName, const std::string &templateParam)
Definition: TypeName.h:62
static const size_t min_buckets
Definition: PrismVolMesh.h:2449
void get_elems(typename Elem::array_type &array, typename Face::index_type idx) const
Definition: PrismVolMesh.h:504
bool inside(const Point &p) const
Definition: BBox.h:205
bool get_elem_neighbors(ARRAY &array, INDEX1 elem, INDEX2 delem) const
Definition: PrismVolMesh.h:1769
v
Definition: readAllFields.py:42
Edge information.
Definition: PrismVolMesh.h:2352
void get_faces_from_cell(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1625
Definition: PrismVolMesh.h:281
double normalize()
Definition: Vector.h:437
virtual ~PrismVolMesh()
Destructor.
Definition: PrismVolMesh.h:2683
virtual const TypeDescription * get_type_description() const
Definition: PrismVolMesh.h:3636
static const TypeDescription * elem_type_description()
Definition: PrismVolMesh.h:1381
void begin(typename Node::iterator &) const
begin/end iterators
Definition: PrismVolMesh.h:3204
PFace(typename Node::index_type n1, typename Node::index_type n2, typename Node::index_type n3, typename Node::index_type n4)
Definition: PrismVolMesh.h:2217
Definition: PrismVolMesh.h:146
void get_random_point(Core::Geometry::Point &p, typename Elem::index_type i, FieldRNG &r) const
Definition: PrismVolMesh.h:2760
void y(double)
Definition: Vector.h:185
const Core::Geometry::Point & node3() const
Definition: PrismVolMesh.h:258
double distance_to_line2(const Point &p, const Point &a, const Point &b, const double epsilon)
Definition: CompGeom.cc:53
Distinct type for edge Iterator.
Definition: FieldIterator.h:105
void remove_node_from_grid(typename Node::index_type ci)
Definition: PrismVolMesh.h:3426
bool find_closest_elems(double &, Core::Geometry::Point &, ARRAY &, const Core::Geometry::Point &) const
Find the closest elements to a point.
Definition: PrismVolMesh.h:1354
#define ASSERTFAIL(string)
Definition: Assert.h:52
double epsilon2_
Definition: PrismVolMesh.h:2601
virtual bool synchronize(mask_type mask)
Definition: PrismVolMesh.h:3051
static const int low4_mask
Definition: PrismVolMesh.h:2414
Basis & get_basis()
Get the basis class.
Definition: PrismVolMesh.h:411
void Pio(Piostream &stream, Array1< T > &array)
Definition: Array1.h:65
void hash_face(typename Node::index_type n1, typename Node::index_type n2, typename Node::index_type n3, typename Node::index_type n4, index_type combined_index, face_ht &table) const
Definition: PrismVolMesh.h:2888
Synchronize(PrismVolMesh< Basis > *mesh, mask_type sync)
Definition: PrismVolMesh.h:284
Some convenient simple iterators for fields.
void operator()()
Definition: PrismVolMesh.h:287
void get_elems(typename Elem::array_type &array, typename Cell::index_type idx) const
Definition: PrismVolMesh.h:507
index_type node1_index() const
Definition: PrismVolMesh.h:187
void pwl_approx_face(std::vector< std::vector< VECTOR > > &coords, INDEX ci, unsigned int which_face, unsigned int div_per_unit) const
Definition: PrismVolMesh.h:538
Definition: PrismVolMesh.h:139
std::map< PEdge, typename Edge::index_type, EdgeHash > edge_ht
Definition: PrismVolMesh.h:2486
void compute_edges()
Definition: PrismVolMesh.h:3009
void get_nodes_from_edge(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1438
static const int sz_half_int
Definition: PrismVolMesh.h:2453
index_type node4_index() const
Definition: PrismVolMesh.h:199
bool find_closest_elem(double &pdist, Core::Geometry::Point &result, ARRAY &coords, INDEX &elem, const Core::Geometry::Point &p) const
Find the closest element to a point.
Definition: PrismVolMesh.h:1072
void resize_elems(size_type s)
Definition: PrismVolMesh.h:709
size_t operator()(const PFace &f) const
This is the hash function.
Definition: PrismVolMesh.h:2417
index_type node0_index() const
Definition: PrismVolMesh.h:183
virtual void end_class()
Definition: Persistent.cc:178
Cell::index_type cells_[2]
4 nodes makes a face.
Definition: PrismVolMesh.h:2205
void compute_bounding_box()
Definition: PrismVolMesh.h:3506
Node::index_type nodes_[2]
Definition: PrismVolMesh.h:2354
virtual VMesh * vmesh()
Access point to virtual interface.
Definition: PrismVolMesh.h:363
bool locate_node(INDEX &node, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:1828
double get_size(typename Cell::index_type idx) const
Definition: PrismVolMesh.h:587
PFace()
2 cells may have this face is in common.
Definition: PrismVolMesh.h:2207
long long index_type
Definition: Types.h:39
PrismVolMesh()
Construct a new mesh.
Definition: PrismVolMesh.h:2619
StackVector< index_type, 6 > array_type
Definition: PrismVolMesh.h:129
void resize(size_t size, const value_type &val=value_type())
Definition: StackVector.h:61
Definition: PrismVolMesh.h:2443
NodeIterator< under_type > iterator
Definition: PrismVolMesh.h:127
Core::Geometry::BBox bbox_
Definition: PrismVolMesh.h:2599
Node::index_type add_find_point(const Core::Geometry::Point &p, double err=1.0e-3)
Definition: PrismVolMesh.h:3532
Node::array_type nodes_
Definition: PrismVolMesh.h:2575
virtual void get_canonical_transform(Core::Geometry::Transform &t) const
Definition: PrismVolMesh.h:2837
edge_ht edge_table_
Definition: PrismVolMesh.h:2496
virtual bool has_face_normals() const
Has this mesh face normals.
Definition: PrismVolMesh.h:400
int compute_checksum()
Definition: PrismVolMesh.h:2610
virtual void transform(const Core::Geometry::Transform &t)
Core::Geometry::Transform a field (transform all nodes using this transformation matrix) ...
Definition: PrismVolMesh.h:2847
bool locate(typename Face::index_type &face, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:629
virtual std::string dynamic_type_name() const
Definition: PrismVolMesh.h:1372
void reset()
Definition: BBox.h:95
bool locate(typename Cell::index_type &cell, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:631
Definition: Persistent.h:64
void insert_elem_into_grid(typename Elem::index_type ci)
Definition: PrismVolMesh.h:3382
index_type edge8_index() const
Definition: PrismVolMesh.h:241
virtual int basis_order()
Definition: PrismVolMesh.h:372
std::vector< PEdge > edges_
Definition: PrismVolMesh.h:2495
PEdge()
Definition: PrismVolMesh.h:2358
Distinct type for edge index.
Definition: FieldIndex.h:81
void fill_cells(Iter begin, Iter end, Functor fill_ftor)
Definition: PrismVolMesh.h:2708
EdgeIndex< under_type > index_type
Definition: PrismVolMesh.h:133
int n
Definition: eab.py:9
void operator()(typename Edge::index_type e)
Definition: PrismVolMesh.h:2567
Core::Thread::Mutex synchronize_lock_
Definition: PrismVolMesh.h:2590
void get_nodes_from_face(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1455
CellIterator< under_type > iterator
Definition: PrismVolMesh.h:148
std::map< PFace, typename Face::index_type, FaceHash > face_ht
Definition: PrismVolMesh.h:2485
bool find_closest_node(double &pdist, Core::Geometry::Point &result, INDEX &node, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:828
void remove_elem_from_grid(typename Elem::index_type ci)
Definition: PrismVolMesh.h:3401
FaceIterator< under_type > iterator
Definition: PrismVolMesh.h:141
#define DEBUG_CONSTRUCTOR(type)
Definition: Debug.h:64
void io(Piostream &stream)
Persistent I/O.
Definition: Mesh.cc:387
#define PRISM_DUMMY_NODE_INDEX
Definition: PrismVolMesh.h:101
void get_nodes(typename Node::array_type &array, typename Face::index_type idx) const
Definition: PrismVolMesh.h:451
std::vector< std::vector< typename Node::index_type > > & nbor_vec_
Definition: PrismVolMesh.h:2573
double inverse_jacobian(const VECTOR &coords, INDEX idx, double *Ji) const
Definition: PrismVolMesh.h:775
std::vector< typename Cell::index_type > cells_
list of all the cells this edge is in.
Definition: PrismVolMesh.h:2356
void hash_edge(typename Node::index_type n1, typename Node::index_type n2, typename Cell::index_type ci, edge_ht &table) const
Definition: PrismVolMesh.h:2985
void get_faces(typename Face::array_type &array, typename Face::index_type idx) const
Definition: PrismVolMesh.h:478
void compute_elem_grid()
Definition: PrismVolMesh.h:3433
mask_type synchronized_
Definition: PrismVolMesh.h:2594
void z(double)
Definition: Vector.h:195
FaceIndex< under_type > index_type
Definition: PrismVolMesh.h:140
boost::shared_ptr< MeshFacade< VMesh > > MeshFacadeHandle
Definition: MeshTraits.h:61
PEdge(typename Node::index_type n1, typename Node::index_type n2)
Definition: PrismVolMesh.h:2363
void get_nodes_from_elem(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1491
#define PRISM_VOL_MESH_VERSION
Definition: PrismVolMesh.h:3584
boost::shared_ptr< VMesh > vmesh_
Pointer to virtual interface.
Definition: PrismVolMesh.h:2605
static const TypeDescription * face_type_description()
Definition: PrismVolMesh.h:3677
MeshFacadeHandle getFacade() const
Definition: PrismVolMesh.h:365
bool find_closest_elem(double &pdist, Core::Geometry::Point &result, ARRAY &coords, INDEX &elem, const Core::Geometry::Point &p, double maxdist) const
Find the closest element to a point.
Definition: PrismVolMesh.h:1083
bool shared() const
Definition: PrismVolMesh.h:2227
void size(typename Node::size_type &) const
Get the iteration sizes.
Definition: PrismVolMesh.h:3222
void get_cells_from_face(ARRAY &array, INDEX idx) const
Definition: PrismVolMesh.h:1724
void get_edge_center(Core::Geometry::Point &p, INDEX idx) const
Definition: PrismVolMesh.h:2091
static Persistent * maker()
This function returns a maker for Pio.
Definition: PrismVolMesh.h:1385
void get_cells(typename Cell::array_type &array, typename Face::index_type idx) const
Definition: PrismVolMesh.h:491
int size
Definition: eabLatVolData.py:2
void get_edges(typename Edge::array_type &, typename Node::index_type) const
Definition: PrismVolMesh.h:458
void node_reserve(size_type s)
Definition: PrismVolMesh.h:706
int get_weights(const Core::Geometry::Point &p, typename Node::array_type &l, double *w) const
Definition: PrismVolMesh.h:3347
index_type edge4_index() const
Definition: PrismVolMesh.h:225
void pwl_approx_edge(std::vector< VECTOR > &coords, INDEX ci, unsigned int which_edge, unsigned int div_per_unit) const
Definition: PrismVolMesh.h:527
#define DEBUG_DESTRUCTOR(type)
Definition: Debug.h:65
void elem_reserve(size_type s)
Definition: PrismVolMesh.h:707
const TypeDescription * get_type_description(Core::Basis::ConstantBasis< T > *)
Definition: Constant.h:209
bool locate_elem(INDEX &elem, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:1973
double det_jacobian(const VECTOR &coords, INDEX idx) const
Definition: PrismVolMesh.h:743
bool locate_face(INDEX &face, const Core::Geometry::Point &p) const
Definition: PrismVolMesh.h:1947
FaceIndex< under_type > size_type
Definition: PrismVolMesh.h:142
void set_nodes_by_elem(ARRAY &array, INDEX idx)
Definition: PrismVolMesh.h:1742
static const int sz_int
These are for our own use (making the hash function.
Definition: PrismVolMesh.h:2452
index_type edge6_index() const
Definition: PrismVolMesh.h:233
bool clear_synchronization()
Definition: PrismVolMesh.h:3178
void compute_node_grid()
Definition: PrismVolMesh.h:3469
void interpolate(Core::Geometry::Point &pt, const VECTOR &coords, INDEX idx) const
Definition: PrismVolMesh.h:724
bool elem_locate(INDEX &elem, MESH &msh, const Core::Geometry::Point &p)
General case locate, search each elem.
Definition: Mesh.h:188