33 #ifndef RFC_WINDOW_BASE_H
34 #define RFC_WINDOW_BASE_H
43 #include "../Rocmap/include/Pane_communicator.h"
106 using MAP::Element_node_enumerator;
189 typedef std::pair<int,int>
V2b;
193 typedef std::vector<int>
B2v;
246 {
return (
Real*)
_base->attribute(i)->pointer(); }
249 {
return (
Real*)
_base->attribute(i)->pointer(); }
260 return *
reinterpret_cast<const Point_3*
>(
_base->coordinates()+3*(
id-1));
264 return *
reinterpret_cast<const Point_3*
>(
_base->coordinates()+3*
id);
290 template <
class Po
int>
295 case 1: nc = Point( 1.-nc[0]-nc[1], nc[0]);
return;
296 case 2: nc = Point( nc[1], 1.-nc[0]-nc[1]);
return;
303 case 1: nc = Point( 1-nc[1], nc[0]);
return;
304 case 2: nc = Point( 1-nc[0], 1-nc[1]);
return;
305 case 3: nc = Point( nc[1], 1-nc[0]);
return;
318 nc[0]=p[0]; nc[1]=p[1];
332 nc[0] = p[0]; nc[1]=p[1];
342 std::pair< const COM::Connectivity*, int>
get_element(
int face_id)
const {
373 using COM::Pane::attribute;
374 using COM::Pane::connectivity;
375 using COM::Pane::set_size;
376 using COM::Pane::reinit_conn;
380 void write_tec_ij( std::ostream &,
const COM::Attribute *a=0)
const;
381 void write_tec_tri( std::ostream &,
const COM::Connectivity &,
382 const COM::Attribute *a=0)
const;
384 const std::vector< const COM::Connectivity*>&,
385 const COM::Attribute *a=0)
const;
387 void write_tec_ascii( std::ostream &os,
const COM::Attribute *attr=0)
const;
394 std::vector <int> *b2v_all=NULL, COM::Pane *p=NULL);
403 void read_rocin(
const std::string &sdv_wname,
404 const std::string &parent_wname=
"",
483 template <
class _Cont,
class _Enum>
486 typedef typename _Cont::Value
Value;
504 template <
class _Cont,
class _Enum>
507 typedef typename _Cont::Value
Value;
516 Field(
const _Cont & cont,
const Real *p,
const _Enum &ids)
545 Pane_set::const_iterator pit =
_pane_set.find( pid);
551 Pane_set::iterator pit =
_pane_set.find( pid);
581 {
return _base->attribute(f); }
594 void read_sdv(
const char *prefix,
const char *format=NULL);
597 void write_sdv(
const char* prefix,
const char *format=NULL)
const;
606 static std::string
get_sdv_fname(
const char *prefix,
int pane_id,
639 template <
class _Pane>
655 const Pane &
pane(
const int pid)
const;
663 std::pair< const Pane*, int>
get_primary(
const Pane *p,
int vid)
const;
666 void panes( std::vector<Pane*> &ps);
668 void panes( std::vector<const Pane*> &ps)
const;
671 template <
class _Pane>
674 template <
class _Pane>
677 std::vector< COM::Pane*> ps;
680 for (std::vector< COM::Pane*>::const_iterator
681 it=ps.begin(); it!=ps.end(); ++it) {
683 (_pane_set[(*it)->id()] =
new Pane(*it, color()))->init();
687 template <
class _Pane>
690 Pane_set::const_iterator pit = _pane_set.find( pid);
692 return reinterpret_cast<const _Pane&
>(*pit->second);
695 template <
class _Pane>
698 Pane_set::iterator pit = _pane_set.find( pid);
700 return reinterpret_cast<_Pane&
>(*pit->second);
703 template <
class _Pane>
706 const_cast<Self*
>(
this)->panes( (std::vector<const Pane*>&)ps);
709 template <
class _Pane>
713 ps.reserve( _pane_set.size());
714 Pane_set::const_iterator it=_pane_set.begin();
715 for ( ; it != _pane_set.end(); ++it)
716 ps.push_back( reinterpret_cast<const Pane*>(it->second));
719 template <
class _Pane>
720 std::pair< _Pane*, int>
722 RFC_Pane_base::V2b_table::iterator it;
728 return std::make_pair(p, vid);
733 Pane &p2 = pane( v2b.first);
738 return std::make_pair( &p2, v2.
node_id);
741 template <
class _Pane>
742 std::pair< const _Pane*, int>
744 return const_cast<Self*
>(
this)->get_primary( const_cast<Pane*>(p), vid);
std::string name() const
The name of the window.
std::pair< int, int > Node_ID
int face_id
local face id.
Node_ID()
A dummy constructor.
bool operator<(const Edge_ID &v) const
Less-than operator.
int node_id
the local id within the pane starting from 1.
A Pane object contains a mesh, pane attribute, and field variables.
RFC_Window_derived(COM::Window *b, int c, MPI_Comm comm)
A constructor.
virtual ~RFC_Window_derived()
A destructor.
MAP::Pane_communicator _map_comm
Value_const operator[](int i) const
int size_of_border_nodes() const
bool operator<(const Node_ID &v) const
Less-than operator.
An adaptor for enumerating node IDs of an element.
const Pane & pane(const int pid) const
Get a reference to the pane with give id pid.
int face_id
the local id within the pane starting from 1.
void write_binary(std::ostream &os) const
std::pair< int, int > V2b
Pane id and local boundary id.
void build_pc_tables()
Build the pane connectivity table.
An Attribute object is a data member of a window.
Edge_ID()
A dummy constructor.
void write_tec_ascii(std::ostream &os, const COM::Attribute *attr=0) const
void comp_nat_coors()
Compute the natural coordinates.
std::map< int, V2b > V2b_table
From node id to its corresponding map.
std::vector< const COM::Connectivity * > _elem_conns
Field(const _Cont &cont, const Real *p, const _Enum &ids)
int size_of_primary_nodes() const
Get the total number of nodes contained the window.
void normalize_nat_coor(int idx, int e, Point &nc) const
Base * base()
The id of its base COM::Pane object.
Value_const operator[](int i) const
std::map< int, Pane * > Pane_set
Adpator for element-wise data container.
SURF::Point_2< float > Point_2S
const Point_3 & get_point(int id) const
Get the physical coordinates of the node with given local id.
Self & operator=(const Self &)
const Attribute * attribute(const char *f) const
Retrieve an attribute object from the base using the attribute name.
int pane_id
the id of the owner pane.
_Cont::Value_nonconst Value_nonconst
RFC_Window_derived< _Pane > Self
std::map< int, B2v > B2v_table
From pane id to its corresponding mapping.
virtual ~RFC_Pane_base()
The default destructor.
const Node_ID & get_subnode_counterpart(int i) const
const Face_ID & get_subface_counterpart(int i) const
Base * _base
Reference to its base object.
bool coincident(int i, int j) const
Report whether the two given nodes are coincident.
const RFC_Pane_base & pane(const int pid) const
Node_ID(int p, int v)
Constructor from two integers.
void write_tec_sub(std::ostream &) const
int parent_type_of_subnode(int) const
Determine the parent type of a subnode of given tyep.
int color() const
The color of the window for overlay or for data transfer (BLUE or GREEN).
Field(_Cont &cont, Real *p, const _Enum &ids)
int size_of_faces() const
The total number of faces in the pane.
std::vector< Three_tuple< int > > _subfaces
void write_tec_ascii(const char *prefix) const
Ouptut a mesh in Tecplot format.
int get_lvid(const Element_node_enumerator &ene, const int v) const
bool _quadratic
Does it contain quadratic elements?
int size_of_isolated_nodes() const
int id() const
Get the local id of the element within the pane.
bool is_master() const
Is this pane a master copy?
int size_of_subnodes() const
The total number of nodes in the subdivision of the pane.
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
static const char * _bufwin_prefix
std::vector< Edge_ID > _subnode_parents
Edge ids of parents.
Base * _base
A reference to its base COM::Window object.
void build_v2b_from_b2v(const RFC_Window_base *w)
Build pane connectivity.
int color() const
The color of the parent window (BLUE or GREEN).
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Real * pointer(int i)
Get the address of a given attribute with id i.
std::vector< int > _elem_offsets
The base implementation of RFC_Pane.
std::vector< int > _subnode_subID
Sub-node ID of nodes in the pane.
#define RFC_END_NAME_SPACE
int pane_id
the id of the owner pane.
int get_parent_node(int) const
Get the local parent node id of a given subnode.
std::pair< const COM::Connectivity *, int > get_element(int face_id) const
Get the connectivity object and the id within the connectivity object for a given element...
void write_sdv(const char *prefix, const char *format=NULL) const
Write out panes in native binary format or using Rocout.
void write_tec_tri(std::ostream &, const COM::Connectivity &, const COM::Attribute *a=0) const
void read_binary(std::istream &is, std::vector< int > *b2v_all=NULL, COM::Pane *p=NULL)
std::vector< bool > _is_isolated
Is a node isolated?
int size_of_faces() const
Get the total number of faces contained the window.
int get_parent_face(int id) const
Get the local parent face id of a given subface.
Value_const & get_value(const RFC_Pane_base *p, int i) const
Get the coordinates of a point in p with local id .
bool is_replicate() const
Is this pane not a master copy?
const Element_node_enumerator & _enum
bool operator==(const Node_ID &v) const
Equal operator.
std::vector< Point_2S > _subnode_normalized_nc
Natual coordinates in the parent face.
void get_host_element_of_subnode(int i, Element_node_enumerator &ene, Point_2 &nc) const
int size_of_nodes() const
The total number of nodes in the pane.
A window is a collection of panes.
void new_sdv_attributes(const std::string &wname) const
New attributes.
const COM::Window * base() const
Get a reference to the base COM::Window object.
Bbox_3 get_bounding_box() const
Get the bounding box of the pane.
int edge_id
edge id within the face.
#define RFC_BEGIN_NAME_SPACE
Point_3 get_point_of_subnode(int id) const
std::vector< bool > _is_border
Is a node on border?
void get_nat_coor_in_element(const int eid, const int lid, Point_2 &nc) const
Take a subface id and a local subnode id, return the natual coordinates of the subnode within the par...
const Point_3 Value_const
const Real * pointer(int i) const
Face_ID(int p, int f)
Constructor from two integers.
void write_tec_ij(std::ostream &, const COM::Attribute *a=0) const
Value_const & get_value(const Real *p, int i) const
Get the coordinates of a point in p with local id .
const Base * base() const
int size_of_subfaces() const
The total number of faces in the subdivision of the pane.
void write_tec_sub(const char *prefix) const
Ouptut a subdivision of a mesh in Tecplot format.
bool _is_master
Is the pane a master copy?
Edge_ID get_edge_id(const int face_lid, const int vertex_lid) const
Get the edge id within a given face.
std::vector< Node_ID > _subnode_counterparts
Ids of counterparts of subnodes.
std::vector< Three_tuple< Point_2S > > _subface_nat_coors
Element connectivity of the subfaces.
Face_ID()
A dummy constructor.
void register_sdv_attributes(const std::string &wname) const
std::pair< Pane *, int > get_primary(Pane *p, int vid)
Get a handle to the primary copy of a node contained in the pane p with local id vid.
int size_of_nodes() const
Get the total number of nodes contained the window.
Value_nonconst operator[](int i)
Pane_set _pane_set
The set of panes contained in the window.
bool operator<(const Face_ID &v) const
Less-than operator.
static const char * get_prefix_base(const char *prefix)
const Real * coordinates() const
_Cont::Value_nonconst Value_nonconst
Reusable implementation for derived class of RFC_Window_base.
void get_host_element_of_subface(int i, Element_node_enumerator &ene) const
bool is_border_node(int i) const
Is a give node on the boundary of the pane?
int _color
Is a node on border?
std::vector< int > _subface_parents
Face ids of the parents of the subfaces.
std::vector< int > _subface_offsets
Offsets of first subfaces contained in a face.
Self & operator=(const Self &)
An const adaptor for accessing nodal coordinates of a pane.
const Point_3 & get_point(int id, int) const
bool is_quadratic() const
Does this pane contain quadratic elements?
void read_rocin(const std::string &sdv_wname, const std::string &parent_wname="", COM::Pane *p=NULL)
Read in using Rocin.
bool is_isolated_node(int i) const
Is a give node an isolated node not belong to any element?
void export_window(RFC_Window_base *) const
int size_of_primary_nodes() const
Get total number of primary nodes contained in the pane.
Bbox_3 get_bounding_box() const
Get the bounding box of the window.
std::vector< Point_2S > _subnode_nat_coors
Natual coordinates in the parent face.
std::vector< int > B2v
From local boundary ids to node ids.
_Cont::Value_const Value_const
int size_of_panes() const
Number of local panes in the window.
void read_sdv(const char *prefix, const char *format=NULL)
Read in local panes in native binary format or using Rocin.
static std::string get_sdv_fname(const char *prefix, int pane_id, const int format=SDV_BINARY)
void write_tec_mixed(std::ostream &, const std::vector< const COM::Connectivity * > &, const COM::Attribute *a=0) const
bool operator==(const Face_ID &v) const
Equal operator.
Edge_ID(int f, int e)
Constructor from two integers.
std::vector< Face_ID > _subface_counterparts
Ids of counterparts of faces.
RFC_Pane_base & pane(const int pid)
const Pane * pane() const
_Cont::Value_const Value_const
virtual ~RFC_Window_base()
Default destructor.
bool is_primary_node(const int vid) const
Is the node with given local id a primary one?
static int get_sdv_format(const char *format)