Exemplo n.º 1
0
/*!
	Enables cell balancing.

	This is a void function since mesh refinement is not implemented
	for SurfTri patches.

	\param id is the id of the cell
	\param enabled defines if enable the balancing for the specified cell
*/
bool SurfUnstructured::_enableCellBalancing(const long &id, bool enabled)
{
	BITPIT_UNUSED(id);
	BITPIT_UNUSED(enabled);

	return false;
}
Exemplo n.º 2
0
/*!
 * Locates the cell the contains the point.
 *
 * If the point is not inside the patch, the function returns the id of the
 * null element.
 *
 * NOTE: this function is not implemented yet.
 *
 * \param[in] point is the point to be checked
 * \result Returns the linear id of the cell the contains the point. If the
 * point is not inside the patch, the function returns the id of the null
 * element.
 */
long SurfUnstructured::locatePoint(const std::array<double, 3> &point)
{
	BITPIT_UNUSED(point);

	throw std::runtime_error ("The function 'locatePoint' is not implemented yet");

	return false;
}
Exemplo n.º 3
0
/*!
 * Interface method for obtaining field meta Data
 * @param[in] name name of the field to be written
 * @return VTKFieldMetaData containing the size of field and typeid of data
 */
const VTKFieldMetaData VTK::getMetaData( std::string name ){
    BITPIT_UNUSED( name ) ;

    VTKFieldMetaData   dummy(-1,typeid(int));
    return dummy ;
};
Exemplo n.º 4
0
/*!
 * Interface method for reading field data
 * @param[in] str output stream
 * @param[in] format codex to be used [VTKFormat::ASCII/VKFormat::APPENDED]
 * @param[in] name name of the field to be read
 */
void VTK::absorbData( std::fstream &str, VTKFormat format, std::string name ){
    BITPIT_UNUSED( str ) ;
    BITPIT_UNUSED( format ) ;
    BITPIT_UNUSED( name ) ;
};
Exemplo n.º 5
0
/*!
 * Read Field data from stream
 * @param[in] str input stream
 * @param[in] field field to be read
 */
void VTK::readFieldData( std::fstream &str, VTKField &field ){

    BITPIT_UNUSED( str ) ;
    BITPIT_UNUSED( field ) ;
};
Exemplo n.º 6
0
// -------------------------------------------------------------------------- //
double grad2DUpdate(
    int                        nSimplex,
    std::vector<std::array<double,3>>                 &Vertex,
    std::vector<std::vector<int>>                 &Simplex,
    std::vector<std::vector<int>>                 &Adjacency,
    std::vector<double>                 &val,
    int                        T,
    double                     g,
    std::vector<bool>                 &flag
) {

// ========================================================================== //
// double grad2DUpdate(                                        //
//     int                        nSimplex,                                   //
//     dvector2D                 &Vertex,                                     //
//     std::vector<std::vector<int>>                 &Simplex,                                    //
//     std::vector<std::vector<int>>                 &Adjacency,                                  //
//     std::vector<double>                 &val,                                        //
//     int                        T,                                          //
//     double                     g,                                          //
//     std::vector<bool>                 &flag)                                       //
//                                                                            //
// Compute local solution to the 2D gradient limiting equation on a           //
// 2D volume.                                                                 //
// ========================================================================== //
// INPUT                                                                      //
// ========================================================================== //
// - nSimplex  : int, number of simplicies in the surface tasselation         //
// - Vertex    : std::vector<double>, vertex coordinate list. Vertex[i][0],             //
//               Vertex[i][1], ... are the x, y, ... coordinates of the cell  //
//               center of the i-th simplex                                   //
// - Simplex   : std::vector<std::vector<int>>, simplex-vertex connectivity. Simplex[i][0] and    //
//               Simplex[i][1] are the global indices of vertices of the i-th //
//               segment.                                                     //
// - Adjacency : std::vector<std::vector<int>>, simplex-simplex adjacencies                       //
// - val       : std::vector<double>, scalar field at each mesh vertex                  //
// - T         : int, simplex global index                                    //
// - g         : double, max slope                                            //
// - flag      : std::vector<bool> with flag for dead (flag = false), and alive       //
//               (flag = true) vertexes.                                      //
// ========================================================================== //
// OUTPUT                                                                     //
// ========================================================================== //
// - value     : solution to the 2D gradient limiting equation                //
// ========================================================================== //

BITPIT_UNUSED(nSimplex);
BITPIT_UNUSED(Simplex);

// ========================================================================== //
// VARIABLES DECLARATION                                                      //
// ========================================================================== //

// Local variables
double     value = 1.0e+18;

// Counters
int        A, j, m;

// ========================================================================== //
// COMPUTE THE LOCAL SOLUTION TO THE 2D GRADIENT LIMITING EQUATION            //
// ========================================================================== //

// Find dead neighboors ----------------------------------------------------- //
m = Adjacency[T].size();
for (j = 0; j < m; ++j) {
    A = Adjacency[T][j];
    if (!flag[A]) {
        value = std::min(value, val[A] + g * norm2(Vertex[T] - Vertex[A]));
    }
} //next j

// Solve 1D grad limiting equation ------------------------------------------ //
value = std::min(val[T], value);

return(value); }
Exemplo n.º 7
0
// -------------------------------------------------------------------------- //
double grad1DUpdate(
    int                        nSimplex,
    std::vector<std::array<double,3>>                 &Vertex,
    std::vector<std::vector<int>>                 &Simplex,
    std::vector<std::vector<std::vector<int>>>                 &Adjacency,
    std::vector<double>                 &val,
    int                        T,
    int                        i,
    double                     g,
    std::vector<bool>                 &flag
) {

// ========================================================================== //
// double grad1DUpdate(                                        //
//     int                        nSimplex,                                   //
//     dvector2D                 &Vertex,                                     //
//     std::vector<std::vector<int>>                 &Simplex,                                    //
//     std::vector<std::vector<std::vector<int>>>                 &Adjacency,                                  //
//     std::vector<double>                 &val,                                        //
//     int                        T,                                          //
//     int                        i,                                          //
//     double                     g,                                          //
//     std::vector<bool>                 &flag)                                       //
//                                                                            //
// Compute local solution to the 1D gradient limiting equation on a           //
// 1D manifold in a 2D Euclidean space.                                       //
// ========================================================================== //
// INPUT                                                                      //
// ========================================================================== //
// - nSimplex  : int, number of simplicies                                    //
// - Vertex    : std::vector<double>, vertex coordinate list. Vertex[i][0],             //
//               Vertex[i][1] are the x, y, coordinates of the i-th vertex    //
// - Simplex   : std::vector<std::vector<int>>, simplex-vertex connectivity. Simplex[i][0] and    //
//               Simplex[i][1] are the global indices of vertices of the i-th //
//               segment.                                                     //
// - Adjacency : std::vector<std::vector<std::vector<int>>>, simplex-simplex adjacency. Adjacency[i][j] stores //
//               the global indices of all simplicies adjacenct to the i-th   //
//               simplex at vertex Simplex[i][j].                             //
// - val       : std::vector<double>, scalar field at each mesh vertex                  //
// - T         : int, simplex global index                                    //
// - i         : int, vertex local index                                      //
// - g         : double, max slope                                            //
// - flag      : std::vector<bool> with flag for dead (flag = false), and alive       //
//               (flag = true) vertexes.                                      //
// ========================================================================== //
// OUTPUT                                                                     //
// ========================================================================== //
// - value     : solution to the 1D gradient limiting equation                //
// ========================================================================== //

BITPIT_UNUSED(nSimplex);

// ========================================================================== //
// VARIABLES DECLARATION                                                      //
// ========================================================================== //

// Local variables
double     value = 1.0e+18, value_0 = 1.0e+18;
std::array<double,3>    P0;
P0.fill(0.0) ;

// Counters
int        A, V, W, j, k, m;

// ========================================================================== //
// COMPUTE THE LOCAL SOLUTION TO THE 1D GRADIENT LIMITING EQUATION            //
// ========================================================================== //

// Vertex global index ------------------------------------------------------ //
V = Simplex[T][i];

// Find dead neighboors ----------------------------------------------------- //
W = Simplex[T][(i+1) % Simplex[T].size()];
if (!flag[W]) {
    value_0 = val[W];
    P0 = Vertex[W];
    value = std::min(value, value_0 + g * norm2(Vertex[V] - P0));
}
if (Adjacency[T][i][0] >= 0) {
    m = Adjacency[T][i].size();
    for (k = 0; k < m; k++) {
        A = Adjacency[T][i][k];
        j = 0;
        if (Simplex[A][0] == V) { j = 1; }
        W = Simplex[A][j];

        if (!flag[W]) {
            value_0 = val[W];
            P0 = Vertex[W];
            value = std::min(value, value_0 + g * norm2(Vertex[V] - P0));
        }
    } //next k
}

// Solve 1D grad limiting equation ------------------------------------------ //
value = std::min(val[V], value);

return(value); }
Exemplo n.º 8
0
// -------------------------------------------------------------------------- //
double grad2DUpdate(
    int                        nSimplex,
    std::vector<std::array<double,3>>                 &Vertex,
    std::vector<std::vector<int>>                 &Simplex,
    std::vector<std::vector<std::vector<int>>>                 &ring_1,
    std::vector<double>                 &val,
    int                        T,
    int                        i,
    double                     g,
    std::vector<bool>                 &flag
) {

// ========================================================================== //
// double grad2DUpdate(                                        //
//     int                        nSimplex,                                   //
//     dvector2D                 &Vertex,                                     //
//     std::vector<std::vector<int>>                 &Simplex,                                    //
//     std::vector<std::vector<std::vector<int>>>                 &ring_1,                                     //
//     std::vector<double>                 &val,                                        //
//     int                        T,                                          //
//     int                        i,                                          //
//     double                     g,                                          //
//     std::vector<bool>                 &flag)                                       //
//                                                                            //
// Compute local solution to the 2D gradient limiting equation on a           //
// 2D manifold in a 3D Euclidean space.                                       //
// ========================================================================== //
// INPUT                                                                      //
// ========================================================================== //
// - nSimplex  : int, number of simplicies in the surface tasselation         //
// - Vertex    : std::vector<double>, vertex coordinate list. Vertex[i][0],             //
//               Vertex[i][1], ... are the x, y, ... coordinates of the i-th  //
//               vertex                                                       //
// - Simplex   : std::vector<std::vector<int>>, simplex-vertex connectivity. Simplex[i][0] and    //
//               Simplex[i][1] are the global indices of vertices of the i-th //
//               segment.                                                     //
// - ring_1    : std::vector<std::vector<std::vector<int>>>, 1-ring of simplcies for each vertex.              //
// - val       : std::vector<double>, scalar field at each mesh vertex                  //
// - T         : int, simplex global index                                    //
// - i         : int, vertex local index                                      //
// - g         : double, max slope                                            //
// - flag      : std::vector<bool> with flag for dead (flag = false), and alive       //
//               (flag = true) vertexes.                                      //
// ========================================================================== //
// OUTPUT                                                                     //
// ========================================================================== //
// - value     : solution to the 1D gradient limiting equation                //
// ========================================================================== //

BITPIT_UNUSED(nSimplex);

// ========================================================================== //
// VARIABLES DECLARATION                                                      //
// ========================================================================== //

// Local variables
double     value = 1.0e+18;

// Counters
size_t     j;
int        A, V, W, k, m;

// ========================================================================== //
// COMPUTE THE LOCAL SOLUTION TO THE 1D GRADIENT LIMITING EQUATION            //
// ========================================================================== //

// Vertex global index ------------------------------------------------------ //
V = Simplex[T][i];

// Find dead neighboors ----------------------------------------------------- //
for (j = 0; j < ring_1[V].size(); ++j) {
    A = ring_1[V][j][0];
    k = ring_1[V][j][1];
    m = (k - 1 + Simplex[A].size()) % Simplex[A].size();
    W = Simplex[A][m];
    if (!flag[W]) {
        value = std::min(value, val[W] + g * norm2(Vertex[V] - Vertex[W]));
    }
    m = (k + 1) % Simplex[A].size();
    W = Simplex[A][m];
    if (!flag[W]) {
        value = std::min(value, val[W] + g * norm2(Vertex[V] - Vertex[W]));
    }
} //next j

// Solve 1D grad limiting equation ------------------------------------------ //
value = std::min(val[V], value);

return(value); }
Exemplo n.º 9
0
/*!
 * Checks which mechanism is used to read/write data
 * @return  true if flushData is used, false if internal pointer to data is used
 */
void VTKField::absorbData( std::fstream &str )const{ 
    BITPIT_UNUSED( str);

    return  ;
};
Exemplo n.º 10
0
/*!
	Marks a cell for refinement.

	This is a void function since mesh refinement is not implemented
	for SurfTri patches.

	\param id is the id of the cell that needs to be refined
*/
bool SurfUnstructured::_markCellForRefinement(const long &id)
{
	BITPIT_UNUSED(id);

	return false;
}
Exemplo n.º 11
0
/*!
	Marks a cell for coarsening.

	This is a void function since mesh refinement is not implemented
	for SurfTri patches.

	\param id the cell to be refined
*/
bool SurfUnstructured::_markCellForCoarsening(const long &id)
{
	BITPIT_UNUSED(id);

	return false;
}