Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some compilation warnings and removed unused source code #94

Merged
merged 9 commits into from
May 31, 2018
3 changes: 2 additions & 1 deletion Base/FileTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ std::string getCwd()
#ifdef WIN32
_getcwd(cwd, FILENAME_MAX);
#else
getcwd(cwd, FILENAME_MAX);
char* unused __attribute__((unused));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are compilers other than GCC supporting __attribute__?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@norihiro-w Thanks. Just removed it and gcc 7.3 still keeps silent after removing.

unused = getcwd(cwd, FILENAME_MAX);
#endif

return cwd;
Expand Down
9 changes: 0 additions & 9 deletions FEM/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3477,7 +3477,6 @@ void COutput::PCONWriteDOMDataTEC()
void COutput::WriteTECNodePCONData(fstream& tec_file)
{
const size_t nName(_pcon_value_vector.size());
int nidx_dm[3];
std::vector<int> PconIndex(nName);

// m_msh = GetMSH();
Expand Down Expand Up @@ -3509,14 +3508,6 @@ void COutput::WriteTECNodePCONData(fstream& tec_file)
// XYZ
double x[3] = {m_msh->nod_vector[j]->getData()[0], m_msh->nod_vector[j]->getData()[1],
m_msh->nod_vector[j]->getData()[2]};
// x[0] = m_msh->nod_vector[j]->X();
// x[1] = m_msh->nod_vector[j]->Y();
// x[2] = m_msh->nod_vector[j]->Z();
// Amplifying DISPLACEMENTs
if (M_Process || MH_Process) // WW

for (size_t k = 0; k < max_dim + 1; k++)
x[k] += out_amplifier * m_pcs->GetNodeValue(m_msh->nod_vector[j]->GetIndex(), nidx_dm[k]);
for (size_t i = 0; i < 3; i++)
tec_file << x[i] << " ";
// NOD values
Expand Down
2 changes: 1 addition & 1 deletion FEM/fem_ele_std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6778,7 +6778,7 @@ string CFiniteElementStd::Cal_GP_Velocity_DuMux(int* i_ind, CRFProcess* m_pcs, i
{
cout << "The program is canceled because there is a phase used which is not considered yet!"
<< "\n";
system("Pause");
//system("Pause");
exit(0);
}
}
Expand Down
28 changes: 7 additions & 21 deletions FEM/fem_ele_vec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3790,7 +3790,13 @@ void CFiniteElementVec::GlobalAssembly_RHS()
----------------------
-----------------------------------------------------------------*/
ElementValue_DM::ElementValue_DM(CElem * ele, const int NGP, bool HM_Staggered)
: NodesOnPath(NULL), orientation(NULL), Strain(NULL), Strain_t_ip(NULL)
: Stress(NULL), Stress_i(NULL), Stress_j(NULL), pStrain(NULL),
y_surface(NULL), prep0(NULL), e_i(NULL), xi(NULL), MatP(NULL),
Strain_Kel(NULL), Strain_Max(NULL), Strain_pl(NULL),
Strain_t_ip(NULL), e_pl(NULL), ev_loc_nr_res(NULL),
lambda_pl(NULL), Strain(NULL), NodesOnPath(NULL),
orientation(NULL), scalar_aniso_comp(NULL),
scalar_aniso_tens(NULL)
{
int Plastic = 1;
const int LengthMat = 7; // Number of material parameter of SYS model.
Expand All @@ -3799,24 +3805,10 @@ void CFiniteElementVec::GlobalAssembly_RHS()
CSolidProperties* sdp = NULL;
int ele_dim;
//
Stress = NULL;
pStrain = NULL;
prep0 = NULL;
e_i = NULL;
xi = NULL;
MatP = NULL;
NodesOnPath = NULL;
orientation = NULL;
MshElemType::type ele_type = ele->GetElementType();
ele_dim = ele->GetDimension();
sdp = msp_vector[ele->GetPatchIndex()];
Plastic = sdp->Plastictity();
Strain_Kel = NULL;
Strain_Max = NULL;
Strain_pl = NULL;
e_pl = NULL;
lambda_pl = NULL;
ev_loc_nr_res = NULL;

if (ele_dim == 2)
LengthBS = 4;
Expand All @@ -3837,8 +3829,6 @@ void CFiniteElementVec::GlobalAssembly_RHS()
Stress = Stress_i;
if (HM_Staggered)
Stress_j = new Matrix(LengthBS, NGPoints);
else
Stress_j = NULL; // for HM coupling iteration
//
if (Plastic > 0)
{
Expand All @@ -3847,8 +3837,6 @@ void CFiniteElementVec::GlobalAssembly_RHS()
*y_surface = 0.0;
*pStrain = 0.0;
}
else
y_surface = NULL;
*Stress = 0.0;

if (Plastic == 2) // Rotational hardening model
Expand Down Expand Up @@ -3913,8 +3901,6 @@ void CFiniteElementVec::GlobalAssembly_RHS()
disp_j = 0.0;
tract_j = 0.0;
Localized = false;
scalar_aniso_comp = NULL; // WX: 11.2011 plasticity bedding
scalar_aniso_tens = NULL;
if (sdp->Plasticity_Bedding)
{
scalar_aniso_comp = new Matrix(NGPoints);
Expand Down
3 changes: 2 additions & 1 deletion FEM/files0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,8 @@ char* ReadString(void)
{
char* s = (char*)malloc(256);
// char *s = new char[256];//CC
scanf(" %s%*[^\n]%*c", s);
int unused __attribute__((unused));
unused = scanf(" %s%*[^\n]%*c", s);
// int a = (int)strlen(s);
// delete[] s;
// s = new char[a+1];//CC
Expand Down
6 changes: 3 additions & 3 deletions FEM/problem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,7 @@ inline double Problem::MultiPhaseFlow()
{
std::cout << "Error running Eclipse!"
<< "\n";
system("Pause");
//system("Pause");
exit(0);
}
}
Expand Down Expand Up @@ -2016,7 +2016,7 @@ inline double Problem::MultiPhaseFlow()
<< "\n";
std::cout << "The run is terminated now ..."
<< "\n";
system("Pause");
//system("Pause");
exit(0);
}
FluidProp = MFPGet("GAS");
Expand All @@ -2027,7 +2027,7 @@ inline double Problem::MultiPhaseFlow()
<< "\n";
std::cout << "The run is terminated now ..."
<< "\n";
system("Pause");
//system("Pause");
exit(0);
}
}
Expand Down
3 changes: 2 additions & 1 deletion FEM/rf_mfp_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,7 @@ double CFluidProperties::Density(double* variables)
std::cout << " Error - Density Model 18 not implemented, usind dummy density of 1000."
<< "\n";
density = 1000; // Achtung - dummy
break;

case 19: // KG44 get the density from GEMS calculations
// seems complicated, as we probably have to call GEMS.....or take values from last GEMS calculation
Expand Down Expand Up @@ -1317,7 +1318,7 @@ double CFluidProperties::GetElementValueFromNodes(long ElementIndex, int GPIndex
<< "\n";
cout << "The run is terminated now ..."
<< "\n";
system("Pause");
//system("Pause");
exit(0);
}

Expand Down
1 change: 1 addition & 0 deletions FEM/rf_mmp_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ std::ios::pos_type CMediumProperties::Read(std::ifstream* mmp_file)
// if -1, threshold is constant
in >> permeability_strain_model_value[4]; // lower limit
in >> permeability_strain_model_value[5]; // uper limit
break;
default:
cout << "Error in MMPRead: no valid permeability strain model"
<< "\n";
Expand Down
1 change: 1 addition & 0 deletions FEM/rf_msp_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8168,6 +8168,7 @@ double CSolidProperties::E_Function(int dim, const ElementValue_DM* ele_val, int
}
CalPrinStrDir(stress, prin_str, prin_dir, size);
return_value = GetCurveValue((int)E_Function_Model_Value[0], 0, prin_str[0], &valid);
break;
}
default:
return_value = 1.;
Expand Down
26 changes: 10 additions & 16 deletions FEM/rf_pcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8647,21 +8647,14 @@ void CRFProcess::CalcSecondaryVariables(bool initial)
case FiniteElement::TWO_PHASE_FLOW:
break;
case FiniteElement::RICHARDS_FLOW: // Richards flow
// WW
case FiniteElement::MULTI_PHASE_FLOW:
case FiniteElement::DEFORMATION_H2: // H2M
CalcSecondaryVariablesUnsaturatedFlow(initial);
break;
case FiniteElement::DEFORMATION || FiniteElement::DEFORMATION_FLOW || FiniteElement::DEFORMATION_DYNAMIC:
if (type == 42) // H2M //WW
CalcSecondaryVariablesUnsaturatedFlow(initial);

break;
case FiniteElement::PS_GLOBAL:
CalcSecondaryVariablesPSGLOBAL(); // WW
break;
default:
if (type == 1212)
// WW
CalcSecondaryVariablesUnsaturatedFlow(initial);
break;
}
}
Expand Down Expand Up @@ -11834,7 +11827,7 @@ void CRFProcess::CalcELEFluxes(const GEOLIB::Polyline* const ply, double* result
for (int k = 0; k < int(vec_nodes_edge.size()); k++)
{
Point_on_Geo = false;
for (int l = 0; l < int(nod_vector_at_geo.size()); l++)
for (std::size_t l = 0; l < nod_vector_at_geo.size(); l++)
{
if (vec_nodes_edge[k]->GetIndex() == nod_vector_at_geo[l])
{
Expand Down Expand Up @@ -12123,7 +12116,7 @@ void CRFProcess::CalcELEMassFluxes(const GEOLIB::Polyline* const ply, std::strin
for (int k = 0; k < int(vec_nodes_edge.size()); k++)
{
Point_on_Geo = false;
for (int l = 0; l < int(nod_vector_at_geo.size()); l++)
for (std::size_t l = 0; l < nod_vector_at_geo.size(); l++)
{
if (vec_nodes_edge[k]->GetIndex() == nod_vector_at_geo[l])
{
Expand Down Expand Up @@ -12615,10 +12608,11 @@ void CRFProcess::AssembleParabolicEquationRHSVector(CNode* m_nod)
*/
}
}
if (m_edg->GetMark())
break;
//----------------------------------------------------------------
// ToDo
//if (m_edg->GetMark())
// break;
break;
default:
cout << "Warning in CRFProcess::AssembleParabolicEquationRHSVector - not implemented for this element "
"type"
Expand Down Expand Up @@ -15276,7 +15270,7 @@ void CRFProcess::CalculateFluidDensitiesAndViscositiesAtNodes(CRFProcess* m_pcs)
{
cout << "Density calculation of water was not possible"
<< "\n";
system("Pause");
//system("Pause");
exit(0);
}
// calculate new moles of H2O
Expand Down Expand Up @@ -15359,7 +15353,7 @@ void CRFProcess::CalculateFluidDensitiesAndViscositiesAtNodes(CRFProcess* m_pcs)
{
cout << "Density calculation of gas was not possible"
<< "\n";
system("Pause");
//system("Pause");
exit(0);
}
// set new density to nodes
Expand Down Expand Up @@ -15701,7 +15695,7 @@ void CRFProcess::Phase_Transition_CO2(CRFProcess* m_pcs, int Step)
cout << "The volume is not equal before and after the calculation of CO2 phase transition! "
<< "\n";
cout << "Before: " << Volume_eff << " After: " << gas.volume + liquid.volume << "\n";
system("Pause");
//system("Pause");
exit(0);
}

Expand Down
1 change: 0 additions & 1 deletion FEM/rf_random_walk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6133,7 +6133,6 @@ void DATWriteParticleControlPlaneFile(int current_time_step, string control_plan
if (pos==0)
vtk_file << "id, starting_time, arrival_time_step_time, arrival-time-cp , start_coor_x, start_coor_y, start_coor_z, control_plane_x, control_plane_y, control_plane_z, time_correction_factor, x_back_shift " << endl;

int id = 0;
double starting_time = 0.0;
double time_correction = 0.0;
double arrival_time_step_time = 0.0;
Expand Down
4 changes: 2 additions & 2 deletions FEM/rf_react.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,12 @@ void REACT::ExecutePQCString(void)
ii = 0;
int idx, idy;
bool firstinput;
char string[4]; //, string1[4], string2[4];
// char string[4]; //, string1[4], string2[4];
for (std::size_t j = 0; j < rankrankliststore[myrank].size(); j++)
{
firstinput = true;
idy = rankrankliststore[myrank][j];
sprintf(string, "%li", static_cast<long>(idy));
//sprintf(string, "%li", static_cast<long>(idy));
for (std::size_t i = 0; i < ranknodeliststore[idy].size(); i++)
{
idx = ranknodeliststore[idy][i];
Expand Down
2 changes: 2 additions & 0 deletions FEM/rfmat_cp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,7 @@ int CompProperties::GetNumberDiffusionValuesCompProperties(int diffusion_model)
break; /* Keine Diffusion */
case 0: /* curve */
n = 1;
break;
case 1:
n = 1;
break; /* Konstanter Diffusionswert */
Expand Down Expand Up @@ -1379,6 +1380,7 @@ int CompProperties::GetNumberIsothermValuesCompProperties(int isotherm)
{
case -1:
n = 0; /* no isotherm */
break;
case 0:
n = 1;
break; /* get KD from curve derivative */
Expand Down
Loading