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
1 change: 0 additions & 1 deletion Base/FileTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,5 @@ std::string getCwd()
#else
getcwd(cwd, FILENAME_MAX);
#endif

return cwd;
}
182 changes: 0 additions & 182 deletions Base/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,90 +67,8 @@ static Memory_Table* memtab = NULL;
static long memory_list_size = 0;
static long memory_alloced = 0;
static long memory_max_alloced = 0;
extern long MemoryTestInTimeSum(void);
#endif

/* Definitionen */

/**************************************************************************
ROCKFLOW - Funktion: InitMemoryTest

Aufgabe:
Oeffnet Protokolldatei "memtest.log".

Formalparameter: (E: Eingabe; R: Rueckgabe; X: Beides)
- void -

Ergebnis:
0 bei Fehler, sonst 1

Programmaenderungen:
12/1994 MSR Erste Version
5/1997 C.Thorenz Erste Version des "in-time" Speichertests

**************************************************************************/
int InitMemoryTest(void)
{
#ifdef MEMORY_TEST_IN_TIME
/* Sicherstellen, dass auch beim ersten Aufruf schon Speicher zur
Verfuegung steht */
memtab = (Memory_Table*)malloc(sizeof(Memory_Table));
memory_list_size = 0;
memory_alloced = 0;
memory_max_alloced = 0;
#endif

return 1;
}

/**************************************************************************
ROCKFLOW - Funktion: StopMemoryTest

Aufgabe:
Schliesst Protokolldatei "memtest.log".

Formalparameter: (E: Eingabe; R: Rueckgabe; X: Beides)
- void -

Ergebnis:
- void -

Programmaenderungen:
12/1994 MSR Erste Version
5/1997 C.Thorenz Erste Version des "in-time" Speichertests

**************************************************************************/
void StopMemoryTest(void)
{
#ifdef MEMORY_TEST_IN_TIME
#ifdef MEMORY_STR
long i;
#endif

if (memtab)
{
printf("\n");
#ifdef MEMORY_STR
/* Fehler in der Speicherfreigabe anzeigen */
i = 0;
while (i < memory_list_size)
{
if (memtab[i].address > 0)
printf("Nicht freigegeben wurde: %s Zeile %d\n", memtab[i].file, memtab[i].line);
i = i + 1;
}
#endif
/* Speicher wieder freigeben */
free(memtab);
memtab = NULL;

printf("\nSpeicherbilanz:\n");
printf("Nicht freigegeben wurden %ld Bytes.\n", memory_alloced);
printf("Maximal allokiert waren %ld Bytes.\n\n", memory_max_alloced);
}
#endif
}

/**************************************************************************
ROCKFLOW - Funktion: Malloc (MAlloc)

Expand Down Expand Up @@ -464,103 +382,3 @@ void* REalloc(void* block, long bytes, char* datei, int zeile)

return address;
}

#ifdef MEMORY_TEST_IN_TIME
/**************************************************************************/
/* ROCKFLOW - Funktion: MEMORY_TEST_IN_TIME_SUM
*/
/* Aufgabe:
Ermittelt bei gesetztem MEMORY_TEST_IN_TIME
die Summe des per Malloc/Free/Realloc belegten Speichers.
*/
/* Formalparameter: (E: Eingabe; R: Rueckgabe; X: Beides)
E void : */
/* Ergebnis:
long summe: Belegter Speicher auf dem Heap
*/
/* Programmaenderungen:
5/1997 C.Thorenz Erste Version des "in-time" Speichertest
*/
/**************************************************************************/
long MemoryTestInTimeSum(void)
{
long i, summe;

i = 0;
summe = 0;
if (memtab)

while (i < memory_list_size)
{
summe = summe + memtab[i].size;
i = i + 1;
}
return summe;
}
#endif
#ifdef MEMORY_TEST_IN_TIME
/**************************************************************************/
/* ROCKFLOW - Funktion: MEMORY_TEST_IN_TIME_MEMORY
*/
/* Aufgabe:
Ermittelt bei gesetztem MEMORY_TEST_IN_TIME
die Groesse des durch den Memorytest belegten Speichers.
*/
/* Formalparameter: (E: Eingabe; R: Rueckgabe; X: Beides)
E void : */
/* Ergebnis:
long summe: Belegter Speicher auf dem Heap
*/
/* Programmaenderungen:
5/1997 C.Thorenz Erste Version des "in-time" Speichertest
*/
/**************************************************************************/
long MemoryTestInTimeMemory(void)
{
long summe;

summe = memory_list_size * sizeof(Memory_Table);

return summe;
}
#endif

#ifdef MEMORY_TEST_IN_TIME
/**************************************************************************/
/* ROCKFLOW - Funktion: MEMORY_TEST_IN_TIME_AREA
*/
/* Aufgabe:
Ermittelt bei gesetztem MEMORY_TEST_IN_TIME
die Groesse des durch (Groesste Adresse) - (Kleinste Adresse)
angegebenen Bereichs */
/* Formalparameter: (E: Eingabe; R: Rueckgabe; X: Beides)
E void : */
/* Ergebnis:
long summe: Belegter Speicher auf dem Heap
*/
/* Programmaenderungen:
5/1997 C.Thorenz Erste Version des "in-time" Speichertest
*/
/**************************************************************************/
long MemoryTestInTimeArea(void)
{
long i, min_address = 0, max_address = 0;

i = 0;
if (memtab)
{
min_address = memtab[i].address;
max_address = memtab[i].address + memtab[i].size;

while (i < memory_list_size)
{
if (min_address > memtab[i].address)
min_address = memtab[i].address;
if (max_address < (memtab[i].address + memtab[i].size))
max_address = memtab[i].address + memtab[i].size;
i = i + 1;
}
}
return max_address - min_address;
}
#endif
13 changes: 0 additions & 13 deletions Base/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,6 @@

/* Andere oeffentlich benutzte Module */

/* Deklarationen */

extern int InitMemoryTest(void);
/* Startet Memory-Test, 0 bei Fehler */
extern void StopMemoryTest(void);
/* Beendet Memory-Test */
extern long MemoryTestInTimeSum(void);
/* Gibt Summe des aktuell allokierten Speichers zurueck */
extern long MemoryTestInTimeMemory(void);
/* Gibt Summe des Speichers fuer den Eigenbedarf zurueck */
extern long MemoryTestInTimeArea(void);
/* Gibt Groesse des aktuell durch Addressen eingegrenzten Bereichs zurueck */

#ifndef MEMORY_STR
extern void* Malloc(long bytes);
/* Ersetzt malloc */
Expand Down
20 changes: 0 additions & 20 deletions FEM/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1460,17 +1460,6 @@ void COutput::WriteELEValuesTECData(fstream& tec_file)
tec_file << m_pcs_2->GetElementValue(i, ele_value_index_vector[j]) << " ";
}
}
/*
int j;
int eidx;
char ele_value_char[20];
int no_ele_values = (int)ele_value_vector.size();
for(j=0;j<no_ele_values;j++){
sprintf(ele_value_char,"%s",ele_value_vector[j].data());
eidx = PCSGetELEValueIndex(ele_value_char);
tec_file << ElGetElementVal(i,eidx) << " ";
}
*/
tec_file << "\n";
}

Expand Down Expand Up @@ -3477,7 +3466,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 +3497,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
30 changes: 1 addition & 29 deletions FEM/files0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static bool checkFormatOfInputFiles(const std::string& basename)
last modified: OK 16.10.2002
*/
/**************************************************************************/
int ReadData(char* dateiname, GEOLIB::GEOObjects& geo_obj, std::string& unique_name)
int ReadData(const char* dateiname, GEOLIB::GEOObjects& geo_obj, std::string& unique_name)
{
#if defined(USE_MPI) // WW
if (myrank == 0)
Expand Down Expand Up @@ -698,34 +698,6 @@ int StrReadDouble(double* x, char* s, FILE* f, int* pos)
}
}

/**************************************************************************/
/* ROCKFLOW - Funktion: ReadString
*/
/* Aufgabe:
Liest Zeichenkette von Standardeingabe
*/
/* Formalparameter: (E: Eingabe; R: Rueckgabe; X: Beides)
- void -
*/
/* Ergebnis:
gelesene Zeichenkette
*/
/* Programmaenderungen:
03/1994 MSR Erste Version
*/
/**************************************************************************/
char* ReadString(void)
{
char* s = (char*)malloc(256);
// char *s = new char[256];//CC
scanf(" %s%*[^\n]%*c", s);
// int a = (int)strlen(s);
// delete[] s;
// s = new char[a+1];//CC
s = (char*)realloc(s, ((int)strlen(s) + 1));
return s;
}

/**************************************************************************
STRLib-Method: SubKeyword
Task:
Expand Down
1 change: 0 additions & 1 deletion FEM/files0.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ extern int StringReadStr(char** x, char* s, int* pos);
// extern int TFDoubleNew (char *s, FILE *f );
extern int TFString(char* x, FILE* f);

extern char* ReadString(void);
/* Liest Zeichenkette von Standardeingabe */
extern char* StrUp(const char* s);
/* wandelt s in Grossbuchstaben um */
Expand Down
Loading