Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F73085932
block.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 18, 10:14
Size
3 KB
Mime Type
text/x-c++
Expires
Sat, Jul 20, 10:14 (2 d)
Engine
blob
Format
Raw Data
Handle
19139959
Attached To
rCADDMESH CADD_mesher
block.hh
View Options
/**
* @file block.hh
* @author Till Junge <junge@lsmspc42.epfl.ch>
* @date Wed Apr 4 15:28:40 2012
*
* @brief Block geometry class
*
* @section LICENSE
*
* <insert lisence here>
*
*/
/* -------------------------------------------------------------------------- */
#ifndef __cadd_mesh_BLOCK_HH__
#define __cadd_mesh_BLOCK_HH__
#include "common.hh"
#include "geometry.hh"
/*! \brief implementation of the Geometry interface for blocks aligned with
coordinate axes*/
template
<
Uint
DIM
>
class
Block
:
public
Geometry
<
DIM
>
{
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public
:
Block
(
const
std
::
vector
<
Real
>
&
min_max
,
std
::
string
name
=
""
);
Block
(
const
Real
*
min_max
,
std
::
string
_name
=
""
);
Block
(
const
Block
&
other
);
virtual
~
Block
(){};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public
:
virtual
Geometry
<
DIM
>
*
resolveType
()
const
{
return
newGeom
<
DIM
>
(
*
this
);
}
/// function to print the contain of the class
virtual
void
printself
(
std
::
ostream
&
stream
,
int
indent
=
0
)
const
;
virtual
void
shift
(
const
PointRef
<
DIM
>
&
offset
);
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
public
:
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
/* Returns the minimum value of all constraint violations (negative return
value means point is inside and return value from the nearest boundary) */
virtual
bool
is_inside
(
const
Real
*
point
)
const
{
return
this
->
from_border
(
point
)
<=
0
;}
virtual
Real
from_border
(
const
Real
*
point
)
const
;
// for instance x_min of a geom in latticespacings
virtual
Real
min_in_direction
(
const
Real
*
dir
,
const
Real
&
unit
=
1
)
const
;
// idem
virtual
Real
max_in_direction
(
const
Real
*
dir
,
const
Real
&
unit
=
1
)
const
;
// idem
virtual
Real
size_in_direction
(
const
Real
*
dir
,
const
Real
&
unit
=
1
)
const
;
virtual
void
generate_surface_points
(
const
Mesh
<
DIM
>
&
auxiliary
,
const
std
::
vector
<
Real
>
&
refinement
,
const
Real
&
step_size
,
PointContainer
<
DIM
>
&
points
)
const
;
std
::
vector
<
Real
>
bounds
()
{
std
::
vector
<
Real
>
bounds
;
for
(
Uint
i
=
0
;
i
<
DIM
*
2
;
++
i
)
{
bounds
.
push_back
(
this
->
min_max
[
i
]);
}
return
bounds
;
}
private
:
Real
min_max
[
2
*
DIM
];
};
/* -------------------------------------------------------------------------- */
/* inline functions */
/* -------------------------------------------------------------------------- */
/// standard output stream operator
template
<
Uint
DIM
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
stream
,
const
Block
<
DIM
>
&
_this
)
{
_this
.
printself
(
stream
);
return
stream
;
}
#endif
/* __cadd_mesh_BLOCK_HH__ */
Event Timeline
Log In to Comment