Skip to content

Commit

Permalink
Format src code (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf authored Apr 26, 2024
1 parent 8dbc37c commit 81cf8fa
Show file tree
Hide file tree
Showing 21 changed files with 847 additions and 839 deletions.
Empty file modified README.md
100755 → 100644
Empty file.
76 changes: 42 additions & 34 deletions src/ADT.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

#ifndef ADT_H
#define ADT_H
Expand All @@ -25,45 +25,53 @@
#include <memory>

// forward declaration for instantiation
class MeshBlock;
class MeshBlock;

/**
* Generic Alternating Digital Tree For Search Operations
*/
class ADT
{
private :

int ndim; /** < number of dimensions (usually 3 but can be more) */
int nelem; /** < number of elements */
int *adtIntegers; /** < integers that define the architecture of the tree */
double *adtReals; /** < real numbers that provide the extents of each box */
class ADT {
private:
int ndim; /** < number of dimensions (usually 3 but can be more) */
int nelem; /** < number of elements */
int *adtIntegers; /** < integers that define the architecture of the tree */
double *adtReals; /** < real numbers that provide the extents of each box */
double *adtExtents; /** < global extents */
double *coord; /** < bounding box of each element */
double *coord; /** < bounding box of each element */

public :
ADT() {ndim=6;nelem=0;adtIntegers=NULL;adtReals=NULL;adtExtents=NULL;coord=NULL;};
~ADT()
{
if (adtIntegers) free(adtIntegers);
if (adtReals) free(adtReals);
if (adtExtents) free(adtExtents);
adtIntegers=NULL;
adtReals=NULL;
adtExtents=NULL;
};
void clearData(void)
{
if (adtIntegers) free(adtIntegers);
if (adtReals) free(adtReals);
if (adtExtents) free(adtExtents);
adtIntegers=NULL;
adtReals=NULL;
adtExtents=NULL;
};
void buildADT(int d,int nelements,double *elementBbox);
void searchADT(MeshBlock *mb,int *cellindx,double *xsearch);
public:
ADT() {
ndim = 6;
nelem = 0;
adtIntegers = NULL;
adtReals = NULL;
adtExtents = NULL;
coord = NULL;
};
~ADT() {
if (adtIntegers)
free(adtIntegers);
if (adtReals)
free(adtReals);
if (adtExtents)
free(adtExtents);
adtIntegers = NULL;
adtReals = NULL;
adtExtents = NULL;
};
void clearData(void) {
if (adtIntegers)
free(adtIntegers);
if (adtReals)
free(adtReals);
if (adtExtents)
free(adtExtents);
adtIntegers = NULL;
adtReals = NULL;
adtExtents = NULL;
};
void buildADT(int d, int nelements, double *elementBbox);
void searchADT(MeshBlock *mb, int *cellindx, double *xsearch);
};


#endif /* ADT_H */
79 changes: 46 additions & 33 deletions src/CartBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

#ifndef CARTBLOCK_H
#define CARTBLOCK_H

#include "codetypes.h"
#include <cassert>
#include <cstdlib>
#include "codetypes.h"

struct INTERPLIST2;
struct DONORLIST;
Expand All @@ -34,63 +34,76 @@ struct AMRMeshInfo;
}

class CartGrid;
class CartBlock
{
private:
class CartBlock {
private:
int local_id;
int global_id;
int dims[3],nf,ncell,ncell_nf,nnode,nnode_nf;
int nvar_cell,nvar_node;
int dims[3], nf, ncell, ncell_nf, nnode, nnode_nf;
int nvar_cell, nvar_node;
int myid;
int *ibl_cell, *ibl_node;;
int *ibl_cell, *ibl_node;
;
double *qcell, *qnode;
double xlo[3];
double xlo[3];
double dx[3];
int ndonors;
int interpListSize;
INTERPLIST2 *interpList,*listptr;
INTERPLIST2 *interpList, *listptr;
DONORLIST **donorList;
void (*donor_frac) (int *,double *,int *,double *);
public:
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;
donor_frac=nullptr;nvar_cell=0;nvar_node=0;};
~CartBlock() { clearLists();};
void (*donor_frac)(int *, double *, int *, double *);

void registerData(int lid, TIOGA::AMRMeshInfo* minfo);
void registerSolution(int lid, TIOGA::AMRMeshInfo* minfo);
public:
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;
donor_frac = nullptr;
nvar_cell = 0;
nvar_node = 0;
};
~CartBlock() { clearLists(); };

void registerData(int local_id_in,int global_id_in,int *iblankin,int *iblanknin)
{
local_id=local_id_in;
global_id=global_id_in;
ibl_cell=iblankin;
ibl_node=iblanknin;
void registerData(int lid, TIOGA::AMRMeshInfo *minfo);
void registerSolution(int lid, TIOGA::AMRMeshInfo *minfo);

void registerData(int local_id_in, int global_id_in, int *iblankin,
int *iblanknin) {
local_id = local_id_in;
global_id = global_id_in;
ibl_cell = iblankin;
ibl_node = iblanknin;
};
void registerSolution(double *qin,int nq_cell,int nq_node) {
assert ((nq_cell+nq_node > 0)
&& !((nq_cell > 0) && (nq_node > 0)));
void registerSolution(double *qin, int nq_cell, int nq_node) {
assert((nq_cell + nq_node > 0) && !((nq_cell > 0) && (nq_node > 0)));
if (nq_node > 0) {
nvar_node = nq_node;
qnode = qin;
}
else if (nq_cell > 0){
} else if (nq_cell > 0) {
nvar_cell = nq_cell;
qcell = qin;
}
};
int num_cell_var() const { return nvar_cell; }
int num_node_var() const { return nvar_node; }
void preprocess(CartGrid *cg);
void getInterpolatedData(int *nints,int *nreals,int **intData,
double **realData);
void update(double *qval,int index);
void getInterpolatedData(int *nints, int *nreals, int **intData,
double **realData);
void update(double *qval, int index);
void getCancellationData(int *cancelledData, int *ncancel);
void processDonors(HOLEMAP *holemap, int nmesh);
void processDonors(ADAPTIVE_HOLEMAP *holemap, int nmesh);
void processIblank(HOLEMAP *holemap, int nmesh, bool isNodal);
void processIblank(ADAPTIVE_HOLEMAP *holemap, int nmesh, bool isNodal);
void insertInDonorList(int senderid,int index,int meshtagdonor,int remoteid,int remoteblockid,double cellRes);
void insertInInterpList(int procid,int remoteid,int remoteblockid,double *xtmp);
void insertInDonorList(int senderid, int index, int meshtagdonor,
int remoteid, int remoteblockid, double cellRes);
void insertInInterpList(int procid, int remoteid, int remoteblockid,
double *xtmp);
void writeCellFile(int bid);
void clearLists(void);
void initializeLists(void);
Expand Down
31 changes: 15 additions & 16 deletions src/CartGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

#ifndef CARTGRID_H
#define CARTGRID_H

#include <cstdlib>

namespace TIOGA
{
namespace TIOGA {
struct AMRMeshInfo;
}

class CartGrid
{
private:
class CartGrid {
private:
double xlosup[3];
double *dxlvl{nullptr};
int *lcount{nullptr};
Expand All @@ -39,9 +37,9 @@ class CartGrid
bool own_data_ptrs{true};
bool own_amr_mesh_info{false};

public :
TIOGA::AMRMeshInfo* m_info{nullptr};
TIOGA::AMRMeshInfo* m_info_device{nullptr};
public:
TIOGA::AMRMeshInfo *m_info{nullptr};
TIOGA::AMRMeshInfo *m_info_device{nullptr};

int *global_id{nullptr};
int *level_num{nullptr};
Expand All @@ -55,17 +53,18 @@ class CartGrid
double *xlo{nullptr};
double *dx{nullptr};
int ngrids{0};
void (*donor_frac) (int *,double *,int *,double *) = nullptr;
void (*donor_frac)(int *, double *, int *, double *) = nullptr;

CartGrid() = default;
~CartGrid();

void registerData(TIOGA::AMRMeshInfo* m_info);
void registerData(int nf,int *idata,double *rdata,int ngridsin);
void preprocess(void);
void search(double *x,int *donorid,int nsearch);
void setcallback(void (*f1)(int *,double *,int *,double *))
{ donor_frac=f1; }
void registerData(TIOGA::AMRMeshInfo *m_info);
void registerData(int nf, int *idata, double *rdata, int ngridsin);
void preprocess(void);
void search(double *x, int *donorid, int nsearch);
void setcallback(void (*f1)(int *, double *, int *, double *)) {
donor_frac = f1;
}

void create_mesh_info();
};
Expand Down
Loading

0 comments on commit 81cf8fa

Please sign in to comment.