Skip to content

Commit

Permalink
Fix warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-korous committed Mar 3, 2013
1 parent b7f0985 commit 91c9744
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion cmake/cxx_flag_overrides.cmake
@@ -1,6 +1,6 @@
# This overrides CXX flags for MSVC
if(MSVC)
set(MSVC_DEFINES "/DWIN32 /D_WINDOWS /Dpopen=_popen /Dpclose=_pclose /D__value=_value /Dfinite=_finite /Dhypot=_hypot /Disatty=_isatty /Dfileno=_fileno /D_CRT_SECURE_NO_WARNINGS /DYY_NO_UNISTD_H /D_USE_MATH_DEFINES /DIMPLEMENT_C99 /wd4275 /wd4251 /SAFESEH:NO")
set(MSVC_DEFINES "/DWIN32 /D_WINDOWS /Dpopen=_popen /Dpclose=_pclose /D__value=_value /Dfinite=_finite /Dhypot=_hypot /Disatty=_isatty /Dfileno=_fileno /D_CRT_SECURE_NO_WARNINGS /DYY_NO_UNISTD_H /D_USE_MATH_DEFINES /DIMPLEMENT_C99 /wd4275 /wd4251 /wd4661 /wd4018 /wd4244 /wd4273")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /Od /Ob2 /MDd /Zi /RTC1 ${MSVC_DEFINES}")
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O2 /Ob2 /MD ${MSVC_DEFINES}")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "/DNDEBUG /O2 /Ob2 /MD ${MSVC_DEFINES}")
Expand Down
2 changes: 0 additions & 2 deletions hermes2d/include/api2d.h
Expand Up @@ -21,8 +21,6 @@
*/
#ifndef __HERMES_API_2D_H_
#define __HERMES_API_2D_H_
// This is here because of an operator-related error in gcc
#pragma GCC diagnostic warning "-fpermissive"

#include "compat.h"
#include "hermes_common.h"
Expand Down
6 changes: 3 additions & 3 deletions hermes2d/include/neighbor.h
Expand Up @@ -237,10 +237,10 @@ namespace Hermes
class NeighborEdgeInfo
{
public:
NeighborEdgeInfo() : local_num_of_edge(-1), orientation(-1) {};
NeighborEdgeInfo() : local_num_of_edge(-1), orientation(false) {};

int local_num_of_edge; ///< Local number of the edge on neighbor element.
int orientation; ///< Relative orientation of the neighbor edge with respect to the active edge
bool orientation; ///< Relative orientation of the neighbor edge with respect to the active edge
///< (0 - same orientation, 1 - reverse orientation).
};

Expand Down Expand Up @@ -403,7 +403,7 @@ namespace Hermes
/// \return 1 if the orientation of the neighbor's edge is reversed w.r.t. the central el.'s edge,
/// 0 otherwise.
///
int neighbor_edge_orientation(int bounding_vert1, int bounding_vert2, int segment) const;
bool neighbor_edge_orientation(int bounding_vert1, int bounding_vert2, int segment) const;

/// Cleaning of internal structures before a new edge is set as active.
void reset_neighb_info();
Expand Down
8 changes: 4 additions & 4 deletions hermes2d/src/adapt/kelly_type_adapt.cpp
Expand Up @@ -765,15 +765,15 @@ namespace Hermes

// Initialize geometry and jacobian*weights (do not use the NeighborSearch caching mechanism).
double3* tan;
double* jwt = new double[np];
for(int i = 0; i < np; i++)
jwt[i] = pt[i][2] * tan[i][2];

Geom<double>* e = new InterfaceGeom<double>(init_geom_surf(rm, surf_pos->surf_num, surf_pos->marker, eo, tan),
nbs->neighb_el->marker,
nbs->neighb_el->id,
nbs->neighb_el->get_diameter());

double* jwt = new double[np];
for(int i = 0; i < np; i++)
jwt[i] = pt[i][2] * tan[i][2];

// Function values.
DiscontinuousFunc<Scalar>** ui = this->dp.init_ext_fns(slns, neighbor_searches, order, 0);

Expand Down
2 changes: 2 additions & 0 deletions hermes2d/src/function/solution.cpp
Expand Up @@ -1732,12 +1732,14 @@ namespace Hermes
#ifdef H2D_USE_SECOND_DERIVATIVES
this->warn("Cannot obtain second derivatives of an exact solution.");
#endif
return toReturn;
}
else if(sln_type == HERMES_UNDEF)
{
throw Hermes::Exceptions::Exception("Cannot obtain values -- uninitialized solution. The solution was either "
"not calculated yet or you used the assignment operator which destroys "
"the solution on its right-hand side.");
return NULL;
}
else // HERMES_SLN
{
Expand Down
3 changes: 1 addition & 2 deletions hermes2d/src/mesh/mesh.cpp
Expand Up @@ -293,7 +293,7 @@ namespace Hermes
{
r.set_active_element(e);

int i, o, mo = quad->get_max_order(e->get_mode());
int i, mo = quad->get_max_order(e->get_mode());

int k = e->is_triangle() ? 2 : 3;

Expand All @@ -304,7 +304,6 @@ namespace Hermes
};

double const_jacobian = 0.25 * (const_m[0][0] * const_m[1][1] - const_m[0][1] * const_m[1][0]);
double2x2 const_inv_ref_map;
if(const_jacobian <= 0.0)
throw Hermes::Exceptions::MeshLoadFailureException("Element #%d is concave or badly oriented in initial_single_check().", e->id);

Expand Down
1 change: 1 addition & 0 deletions hermes2d/src/mesh/mesh_reader_h2d_xml.cpp
Expand Up @@ -69,6 +69,7 @@ namespace Hermes
{
throw Hermes::Exceptions::MeshLoadFailureException(e.what());
}
return true;
}

bool MeshReaderH2DXML::save(const char *filename, Mesh *mesh)
Expand Down
12 changes: 6 additions & 6 deletions hermes2d/src/neighbor.cpp
Expand Up @@ -181,7 +181,7 @@ namespace Hermes
// Query the orientation of the neighbor edge relative to the central el.
int p1 = central_el->vn[active_edge]->id;
int p2 = central_el->vn[(active_edge + 1) % central_el->get_nvert()]->id;
local_edge_info.orientation = neighbor_edge_orientation(p1, p2, 0);
local_edge_info.orientation = neighbor_edge_orientation(p1, p2, false);

neighbor_edges.push_back(local_edge_info);

Expand Down Expand Up @@ -698,7 +698,7 @@ namespace Hermes
local_edge_info.local_num_of_edge = neighbor_edge.local_num_of_edge;

// Query the orientation of the neighbor edge relative to the central el.
local_edge_info.orientation = neighbor_edge_orientation(id_of_par_orient_1, id_of_par_orient_2, 0);
local_edge_info.orientation = neighbor_edge_orientation(id_of_par_orient_1, id_of_par_orient_2, false);

neighbor_edges.push_back(local_edge_info);

Expand Down Expand Up @@ -796,21 +796,21 @@ namespace Hermes
}

template<typename Scalar>
int NeighborSearch<Scalar>::neighbor_edge_orientation(int bounding_vert1, int bounding_vert2, int segment) const
bool NeighborSearch<Scalar>::neighbor_edge_orientation(int bounding_vert1, int bounding_vert2, int segment) const
{
if(segment == 0)
{
// neighbor edge goes from parent1 to middle vertex
if(neighb_el->vn[neighbor_edge.local_num_of_edge]->id != bounding_vert1)
return 1; // orientation reversed
return true; // orientation reversed
}
else
{
// neighbor edge goes from middle vertex to parent2
if(neighb_el->vn[neighbor_edge.local_num_of_edge]->id == bounding_vert2)
return 1; // orientation reversed
return true; // orientation reversed
}
return 0;
return false;
}

template<typename Scalar>
Expand Down
2 changes: 1 addition & 1 deletion hermes2d/src/projections/localprojection.cpp
Expand Up @@ -101,7 +101,7 @@ namespace Hermes
int ndof = space->get_num_dofs();
Scalar* coeff_vec = new Scalar[ndof];
project_local(space, source_sln, coeff_vec, proj_norm);
Solution<Scalar>::vector_to_solution(coeff_vec, space, target_sln, proj_norm);
Solution<Scalar>::vector_to_solution(coeff_vec, space, target_sln);
delete [] coeff_vec;
}

Expand Down
2 changes: 1 addition & 1 deletion hermes2d/src/space/space.cpp
Expand Up @@ -1287,7 +1287,7 @@ namespace Hermes
}

space->essential_bcs = essential_bcs;
space->mesh_seq == space->mesh->get_seq();
space->mesh_seq = space->mesh->get_seq();

// L2 space does not have any (strong) essential BCs.
if(essential_bcs != NULL && parsed_xml_space->spaceType().get().c_str() != "l2")
Expand Down
8 changes: 4 additions & 4 deletions hermes2d/test_examples/05-hcurl-adapt/bessel.cpp
Expand Up @@ -2398,9 +2398,9 @@ double jv(double n, double x)
x = -x;
}
if( n == 0.0 )
return( j0(x) );
return( _j0(x) );
if( n == 1.0 )
return( sign * j1(x) );
return( sign * _j1(x) );
}

if( (x < 0.0) && (y != an) )
Expand Down Expand Up @@ -2434,12 +2434,12 @@ double jv(double n, double x)
q = recur( &n, x, &k, 1 );
if( k == 0.0 )
{
y = j0(x)/q;
y = _j0(x)/q;
goto done;
}
if( k == 1.0 )
{
y = j1(x)/q;
y = _j1(x)/q;
goto done;
}
}
Expand Down
2 changes: 1 addition & 1 deletion hermes2d/test_examples/11-FCT/hp_adapt.cpp
Expand Up @@ -28,7 +28,7 @@ bool HPAdapt::adapt_smooth(int* smooth_elem, int max_p)
throw Hermes::Exceptions::Exception("adapt_smooth: Only for one space .");
bool changed = false;
Space<double>* space = this->spaces[0];
int order, v_ord, h_ord,ref;
int order, v_ord, h_ord;
int n_dof = space->get_num_dofs();
Element* e;
// Just set the verbose output to true so that the next calls to this->info() produce output.
Expand Down
2 changes: 0 additions & 2 deletions hermes2d/test_examples/12-transient-adapt/main.cpp
Expand Up @@ -148,7 +148,6 @@ int main(int argc, char* argv[])
H1ProjBasedSelector<double> selector(CAND_LIST, CONV_EXP, H2DRS_DEFAULT_ORDER);

// Visualize initial condition.
char title[100];
ScalarView view("Initial condition", new WinGeom(0, 0, 440, 350));
OrderView ordview("Initial mesh", new WinGeom(445, 0, 410, 350));
if(HERMES_VISUALIZATION)
Expand Down Expand Up @@ -187,7 +186,6 @@ int main(int argc, char* argv[])
// Spatial adaptivity loop. Note: sln_time_prev must not be changed
// during spatial adaptivity.
bool done = false; int as = 1;
double err_est;
do {
Hermes::Mixins::Loggable::Static::info("Time step %d, adaptivity step %d:", ts, as);

Expand Down

0 comments on commit 91c9744

Please sign in to comment.