Skip to content

Commit 81cf8fa

Browse files
authored
Format src code (#28)
1 parent 8dbc37c commit 81cf8fa

21 files changed

+847
-839
lines changed

README.md

100755100644
File mode changed.

src/ADT.h

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//
1717
// You should have received a copy of the GNU Lesser General Public
1818
// License along with this library; if not, write to the Free Software
19-
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020

2121
#ifndef ADT_H
2222
#define ADT_H
@@ -25,45 +25,53 @@
2525
#include <memory>
2626

2727
// forward declaration for instantiation
28-
class MeshBlock;
28+
class MeshBlock;
2929

3030
/**
3131
* Generic Alternating Digital Tree For Search Operations
3232
*/
33-
class ADT
34-
{
35-
private :
36-
37-
int ndim; /** < number of dimensions (usually 3 but can be more) */
38-
int nelem; /** < number of elements */
39-
int *adtIntegers; /** < integers that define the architecture of the tree */
40-
double *adtReals; /** < real numbers that provide the extents of each box */
33+
class ADT {
34+
private:
35+
int ndim; /** < number of dimensions (usually 3 but can be more) */
36+
int nelem; /** < number of elements */
37+
int *adtIntegers; /** < integers that define the architecture of the tree */
38+
double *adtReals; /** < real numbers that provide the extents of each box */
4139
double *adtExtents; /** < global extents */
42-
double *coord; /** < bounding box of each element */
40+
double *coord; /** < bounding box of each element */
4341

44-
public :
45-
ADT() {ndim=6;nelem=0;adtIntegers=NULL;adtReals=NULL;adtExtents=NULL;coord=NULL;};
46-
~ADT()
47-
{
48-
if (adtIntegers) free(adtIntegers);
49-
if (adtReals) free(adtReals);
50-
if (adtExtents) free(adtExtents);
51-
adtIntegers=NULL;
52-
adtReals=NULL;
53-
adtExtents=NULL;
54-
};
55-
void clearData(void)
56-
{
57-
if (adtIntegers) free(adtIntegers);
58-
if (adtReals) free(adtReals);
59-
if (adtExtents) free(adtExtents);
60-
adtIntegers=NULL;
61-
adtReals=NULL;
62-
adtExtents=NULL;
63-
};
64-
void buildADT(int d,int nelements,double *elementBbox);
65-
void searchADT(MeshBlock *mb,int *cellindx,double *xsearch);
42+
public:
43+
ADT() {
44+
ndim = 6;
45+
nelem = 0;
46+
adtIntegers = NULL;
47+
adtReals = NULL;
48+
adtExtents = NULL;
49+
coord = NULL;
50+
};
51+
~ADT() {
52+
if (adtIntegers)
53+
free(adtIntegers);
54+
if (adtReals)
55+
free(adtReals);
56+
if (adtExtents)
57+
free(adtExtents);
58+
adtIntegers = NULL;
59+
adtReals = NULL;
60+
adtExtents = NULL;
61+
};
62+
void clearData(void) {
63+
if (adtIntegers)
64+
free(adtIntegers);
65+
if (adtReals)
66+
free(adtReals);
67+
if (adtExtents)
68+
free(adtExtents);
69+
adtIntegers = NULL;
70+
adtReals = NULL;
71+
adtExtents = NULL;
72+
};
73+
void buildADT(int d, int nelements, double *elementBbox);
74+
void searchADT(MeshBlock *mb, int *cellindx, double *xsearch);
6675
};
6776

68-
6977
#endif /* ADT_H */

src/CartBlock.h

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
//
1717
// You should have received a copy of the GNU Lesser General Public
1818
// License along with this library; if not, write to the Free Software
19-
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020

2121
#ifndef CARTBLOCK_H
2222
#define CARTBLOCK_H
2323

24+
#include "codetypes.h"
2425
#include <cassert>
2526
#include <cstdlib>
26-
#include "codetypes.h"
2727

2828
struct INTERPLIST2;
2929
struct DONORLIST;
@@ -34,63 +34,76 @@ struct AMRMeshInfo;
3434
}
3535

3636
class CartGrid;
37-
class CartBlock
38-
{
39-
private:
37+
class CartBlock {
38+
private:
4039
int local_id;
4140
int global_id;
42-
int dims[3],nf,ncell,ncell_nf,nnode,nnode_nf;
43-
int nvar_cell,nvar_node;
41+
int dims[3], nf, ncell, ncell_nf, nnode, nnode_nf;
42+
int nvar_cell, nvar_node;
4443
int myid;
45-
int *ibl_cell, *ibl_node;;
44+
int *ibl_cell, *ibl_node;
45+
;
4646
double *qcell, *qnode;
47-
double xlo[3];
47+
double xlo[3];
4848
double dx[3];
4949
int ndonors;
5050
int interpListSize;
51-
INTERPLIST2 *interpList,*listptr;
51+
INTERPLIST2 *interpList, *listptr;
5252
DONORLIST **donorList;
53-
void (*donor_frac) (int *,double *,int *,double *);
54-
public:
55-
CartBlock() { global_id=0;dims[0]=dims[1]=dims[2]=0;ibl_cell=NULL;ibl_node=NULL;qcell=NULL;qnode=NULL;interpListSize=0;donorList=NULL;interpList=NULL;
56-
donor_frac=nullptr;nvar_cell=0;nvar_node=0;};
57-
~CartBlock() { clearLists();};
53+
void (*donor_frac)(int *, double *, int *, double *);
5854

59-
void registerData(int lid, TIOGA::AMRMeshInfo* minfo);
60-
void registerSolution(int lid, TIOGA::AMRMeshInfo* minfo);
55+
public:
56+
CartBlock() {
57+
global_id = 0;
58+
dims[0] = dims[1] = dims[2] = 0;
59+
ibl_cell = NULL;
60+
ibl_node = NULL;
61+
qcell = NULL;
62+
qnode = NULL;
63+
interpListSize = 0;
64+
donorList = NULL;
65+
interpList = NULL;
66+
donor_frac = nullptr;
67+
nvar_cell = 0;
68+
nvar_node = 0;
69+
};
70+
~CartBlock() { clearLists(); };
6171

62-
void registerData(int local_id_in,int global_id_in,int *iblankin,int *iblanknin)
63-
{
64-
local_id=local_id_in;
65-
global_id=global_id_in;
66-
ibl_cell=iblankin;
67-
ibl_node=iblanknin;
72+
void registerData(int lid, TIOGA::AMRMeshInfo *minfo);
73+
void registerSolution(int lid, TIOGA::AMRMeshInfo *minfo);
74+
75+
void registerData(int local_id_in, int global_id_in, int *iblankin,
76+
int *iblanknin) {
77+
local_id = local_id_in;
78+
global_id = global_id_in;
79+
ibl_cell = iblankin;
80+
ibl_node = iblanknin;
6881
};
69-
void registerSolution(double *qin,int nq_cell,int nq_node) {
70-
assert ((nq_cell+nq_node > 0)
71-
&& !((nq_cell > 0) && (nq_node > 0)));
82+
void registerSolution(double *qin, int nq_cell, int nq_node) {
83+
assert((nq_cell + nq_node > 0) && !((nq_cell > 0) && (nq_node > 0)));
7284
if (nq_node > 0) {
7385
nvar_node = nq_node;
7486
qnode = qin;
75-
}
76-
else if (nq_cell > 0){
87+
} else if (nq_cell > 0) {
7788
nvar_cell = nq_cell;
7889
qcell = qin;
7990
}
8091
};
8192
int num_cell_var() const { return nvar_cell; }
8293
int num_node_var() const { return nvar_node; }
8394
void preprocess(CartGrid *cg);
84-
void getInterpolatedData(int *nints,int *nreals,int **intData,
85-
double **realData);
86-
void update(double *qval,int index);
95+
void getInterpolatedData(int *nints, int *nreals, int **intData,
96+
double **realData);
97+
void update(double *qval, int index);
8798
void getCancellationData(int *cancelledData, int *ncancel);
8899
void processDonors(HOLEMAP *holemap, int nmesh);
89100
void processDonors(ADAPTIVE_HOLEMAP *holemap, int nmesh);
90101
void processIblank(HOLEMAP *holemap, int nmesh, bool isNodal);
91102
void processIblank(ADAPTIVE_HOLEMAP *holemap, int nmesh, bool isNodal);
92-
void insertInDonorList(int senderid,int index,int meshtagdonor,int remoteid,int remoteblockid,double cellRes);
93-
void insertInInterpList(int procid,int remoteid,int remoteblockid,double *xtmp);
103+
void insertInDonorList(int senderid, int index, int meshtagdonor,
104+
int remoteid, int remoteblockid, double cellRes);
105+
void insertInInterpList(int procid, int remoteid, int remoteblockid,
106+
double *xtmp);
94107
void writeCellFile(int bid);
95108
void clearLists(void);
96109
void initializeLists(void);

src/CartGrid.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,19 @@
1616
//
1717
// You should have received a copy of the GNU Lesser General Public
1818
// License along with this library; if not, write to the Free Software
19-
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020

2121
#ifndef CARTGRID_H
2222
#define CARTGRID_H
2323

2424
#include <cstdlib>
2525

26-
namespace TIOGA
27-
{
26+
namespace TIOGA {
2827
struct AMRMeshInfo;
2928
}
3029

31-
class CartGrid
32-
{
33-
private:
30+
class CartGrid {
31+
private:
3432
double xlosup[3];
3533
double *dxlvl{nullptr};
3634
int *lcount{nullptr};
@@ -39,9 +37,9 @@ class CartGrid
3937
bool own_data_ptrs{true};
4038
bool own_amr_mesh_info{false};
4139

42-
public :
43-
TIOGA::AMRMeshInfo* m_info{nullptr};
44-
TIOGA::AMRMeshInfo* m_info_device{nullptr};
40+
public:
41+
TIOGA::AMRMeshInfo *m_info{nullptr};
42+
TIOGA::AMRMeshInfo *m_info_device{nullptr};
4543

4644
int *global_id{nullptr};
4745
int *level_num{nullptr};
@@ -55,17 +53,18 @@ class CartGrid
5553
double *xlo{nullptr};
5654
double *dx{nullptr};
5755
int ngrids{0};
58-
void (*donor_frac) (int *,double *,int *,double *) = nullptr;
56+
void (*donor_frac)(int *, double *, int *, double *) = nullptr;
5957

6058
CartGrid() = default;
6159
~CartGrid();
6260

63-
void registerData(TIOGA::AMRMeshInfo* m_info);
64-
void registerData(int nf,int *idata,double *rdata,int ngridsin);
65-
void preprocess(void);
66-
void search(double *x,int *donorid,int nsearch);
67-
void setcallback(void (*f1)(int *,double *,int *,double *))
68-
{ donor_frac=f1; }
61+
void registerData(TIOGA::AMRMeshInfo *m_info);
62+
void registerData(int nf, int *idata, double *rdata, int ngridsin);
63+
void preprocess(void);
64+
void search(double *x, int *donorid, int nsearch);
65+
void setcallback(void (*f1)(int *, double *, int *, double *)) {
66+
donor_frac = f1;
67+
}
6968

7069
void create_mesh_info();
7170
};

0 commit comments

Comments
 (0)