[TEST]UPSTREAM: Pick some source changes from 48080d0a97

* Sync new folder structure
This commit is contained in:
2026-04-23 20:55:40 +08:00
parent c185f99ee3
commit 17109fde9b
211 changed files with 189504 additions and 189280 deletions

View File

@@ -0,0 +1,109 @@
#ifndef MYLIST_H
#define MYLIST_H
// Note: There is never an implementation file (*.C) for a template class
template <class T>
class MyList
{
public:
MyList *next;
T *data;
public:
MyList();
MyList(T *p);
~MyList();
void insert(T *p);
void clearList();
void destroyList();
void catList(MyList<T> *p);
void CloneList(MyList<T> *p);
};
template <class T>
MyList<T>::MyList()
{
data = 0;
next = 0;
}
template <class T>
MyList<T>::MyList(T *p)
{
data = p;
next = 0;
}
template <class T>
MyList<T>::~MyList()
{
}
template <class T>
void MyList<T>::insert(T *p)
{
MyList *ct = this;
if (data == 0)
{
data = p;
}
else
{
while (ct->next)
{
ct = ct->next;
}
ct->next = new MyList(p);
ct = ct->next;
ct->next = 0;
}
}
template <class T>
void MyList<T>::clearList()
{
MyList *ct = this, *n;
while (ct)
{
n = ct->next;
delete ct;
ct = n;
}
}
template <class T>
void MyList<T>::destroyList()
{
MyList *ct = this, *n;
while (ct)
{
n = ct->next;
delete ct->data;
delete ct;
ct = n;
}
}
template <class T>
void MyList<T>::catList(MyList<T> *p)
{
MyList *ct = this;
while (ct->next)
{
ct = ct->next;
}
ct->next = p;
}
template <class T>
void MyList<T>::CloneList(MyList<T> *p)
{
MyList *ct = this;
p = 0;
while (ct)
{
if (!p)
p = new MyList<T>(ct->data);
else
p->insert(ct->data);
ct = ct->next;
}
}
#endif /* MyList_H */

View File

@@ -0,0 +1,35 @@
#ifndef PARAMETERS_H
#define PARAMETERS_H
#ifdef newc
#include <algorithm>
#include <functional>
#include <vector>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <map.h>
#endif
#include <mpi.h>
namespace parameters
{
extern map<string,int> int_par;
extern map<string,double> dou_par;
extern map<string,string> str_par;
}
#endif /* PARAMETERS_H */

View File

@@ -0,0 +1,38 @@
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
using namespace std;
#include <time.h>
#include <mpi.h>
#include "var.h"
var::var(const char *namei, int sgfni,
const double SYM1, const double SYM2, const double SYM3) : sgfn(sgfni)
{
const char *p = namei;
int i = 0;
while (*(p++))
i++;
if (i > 20)
cout << "too long name for var: " << namei << endl;
sprintf(name, namei);
SoA[0] = SYM1;
SoA[1] = SYM2;
SoA[2] = SYM3;
propspeed = 1;
}
var::~var() {}
void var::setpropspeed(const double vl)
{
propspeed = vl;
}

View File

@@ -0,0 +1,26 @@
#ifndef VAR_H
#define VAR_H
class var
{
public:
char name[20];
int sgfn;
double SoA[3];
double propspeed;
public:
var(const char *namei, int sgfni,
const double SYM1, const double SYM2, const double SYM3);
// original interface:
// var(char *namei, int sgfni,
// const double SYM1, const double SYM2, const double SYM3);
~var();
void setpropspeed(const double vl);
};
#endif /* VAR_H */