Skip to content

Commit

Permalink
removed typename template and upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
gitpeterwind committed Jul 26, 2024
1 parent 9b24281 commit f734374
Show file tree
Hide file tree
Showing 11 changed files with 1,980 additions and 403 deletions.
2 changes: 1 addition & 1 deletion api/mrcpp_declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ template <int D, typename T = double> class NodeAllocator;

template <int D, typename T = double> class MWNode;
template <int D, typename T = double> class FunctionNode;
template <int D = 3, typename T = double> class CompFunction;
template <int D = 3> class CompFunction;
class ComplexFunction;
class OperatorNode;

Expand Down
153 changes: 85 additions & 68 deletions src/treebuilders/apply.cpp

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/treebuilders/apply.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ template <int D> class DerivativeOperator;
template <int D> class ConvolutionOperator;

template <int D, typename T> void apply(double prec, FunctionTree<D, T> &out, ConvolutionOperator<D> &oper, FunctionTree<D, T> &inp, int maxIter = -1, bool absPrec = false);
template <int D, typename T> void apply(double prec, CompFunction<D, T> &out, ConvolutionOperator<D> &oper, CompFunction<D, T> &inp, T **metric, int maxIter = -1, bool absPrec = false);
template <int D> void apply(double prec, CompFunction<D> &out, ConvolutionOperator<D> &oper, CompFunction<D> &inp, ComplexDouble **metric, int maxIter = -1, bool absPrec = false);
template <int D, typename T> void apply(double prec, FunctionTree<D, T> &out, ConvolutionOperator<D> &oper, FunctionTree<D, T> &inp, FunctionTreeVector<D, T> &precTrees, int maxIter = -1, bool absPrec = false);
template <int D, typename T> void apply(double prec, CompFunction<D, T> &out, ConvolutionOperator<D> &oper, CompFunction<D, T> &inp, FunctionTreeVector<D, T> *precTrees, T **metric, int maxIter = -1, bool absPrec = false);
template <int D, typename T> void apply(double prec, CompFunction<D> &out, ConvolutionOperator<D> &oper, CompFunction<D> &inp, FunctionTreeVector<D, T> *precTrees, ComplexDouble **metric, int maxIter = -1, bool absPrec = false);
template <int D, typename T> void apply_far_field(double prec, FunctionTree<D, T> &out, ConvolutionOperator<D> &oper, FunctionTree<D, T> &inp, int maxIter = -1, bool absPrec = false);
template <int D, typename T> void apply_far_field(double prec, CompFunction<D, T> &out, ConvolutionOperator<D> &oper, CompFunction<D, T> &inp, T **metric, int maxIter = -1, bool absPrec = false);
template <int D> void apply_far_field(double prec, CompFunction<D> &out, ConvolutionOperator<D> &oper, CompFunction<D> &inp, ComplexDouble **metric, int maxIter = -1, bool absPrec = false);
template <int D, typename T> void apply_near_field(double prec, FunctionTree<D, T> &out, ConvolutionOperator<D> &oper, FunctionTree<D, T> &inp, int maxIter = -1, bool absPrec = false);
template <int D, typename T> void apply_near_field(double prec, CompFunction<D, T> &out, ConvolutionOperator<D> &oper, CompFunction<D, T> &inp, T **metric, int maxIter = -1, bool absPrec = false);
template <int D> void apply_near_field(double prec, CompFunction<D> &out, ConvolutionOperator<D> &oper, CompFunction<D> &inp, ComplexDouble **metric, int maxIter = -1, bool absPrec = false);
template <int D, typename T> void apply(FunctionTree<D, T> &out, DerivativeOperator<D> &oper, FunctionTree<D, T> &inp, int dir = -1);
template <int D, typename T> void apply(CompFunction<D, T> &out, DerivativeOperator<D> &oper, CompFunction<D, T> &inp, T **metric, int dir = -1);
template <int D> void apply(CompFunction<D> &out, DerivativeOperator<D> &oper, CompFunction<D> &inp, ComplexDouble **metric, int dir = -1);
template <int D, typename T> void divergence(FunctionTree<D, T> &out, DerivativeOperator<D> &oper, FunctionTreeVector<D, T> &inp);
template <int D, typename T> void divergence(CompFunction<D, T> &out, DerivativeOperator<D> &oper, FunctionTreeVector<D, T> *inp, T **metric);
template <int D, typename T> void divergence(CompFunction<D> &out, DerivativeOperator<D> &oper, FunctionTreeVector<D, T> *inp, ComplexDouble **metric);
template <int D, typename T> void divergence(FunctionTree<D, T> &out, DerivativeOperator<D> &oper, std::vector<FunctionTree<D, T> *> &inp);
template <int D, typename T> void divergence(CompFunction<D, T> &out, DerivativeOperator<D> &oper, std::vector<FunctionTree<D, T> *> *inp, T **metric);
template <int D, typename T> void divergence(CompFunction<D> &out, DerivativeOperator<D> &oper, std::vector<FunctionTree<D, T> *> *inp, ComplexDouble **metric);
template <int D, typename T> FunctionTreeVector<D, T> gradient(DerivativeOperator<D> &oper, FunctionTree<D, T> &inp);
template <int D, typename T> CompFunctionVector<D, T> gradient(DerivativeOperator<D> &oper, CompFunction<D, T> &inp, T **metric);
template <int D> CompFunctionVector<D> gradient(DerivativeOperator<D> &oper, CompFunction<D> &inp, ComplexDouble **metric);
// clang-format on

} // namespace mrcpp
18 changes: 9 additions & 9 deletions src/utils/Bank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ void Bank::open() {
}
send_function(*deposits[ix].orb, status.MPI_SOURCE, 1, comm_bank);
if (message == GET_FUNCTION_AND_DELETE) {
currentsize[account] -= deposits[ix].orb->getSizeNodes(NUMBER::Total);
totcurrentsize -= deposits[ix].orb->getSizeNodes(NUMBER::Total);
deposits[ix].orb->free(NUMBER::Total);
currentsize[account] -= deposits[ix].orb->getSizeNodes();
totcurrentsize -= deposits[ix].orb->getSizeNodes();
deposits[ix].orb->free();
id2ix[id] = 0;
}
}
Expand Down Expand Up @@ -370,7 +370,7 @@ void Bank::open() {
} else {
ix = deposits.size(); // NB: ix is now index of last element + 1
deposits.resize(ix + 1);
if (message == SAVE_FUNCTION) deposits[ix].orb = new ComplexFunction(0);
if (message == SAVE_FUNCTION) deposits[ix].orb = new CompFunction<3>(0);
if (message == SAVE_DATA) {
datasize = messages[3];
deposits[ix].data = mem[account]->get_mem(datasize);//new double[datasize];
Expand All @@ -386,8 +386,8 @@ void Bank::open() {
if (message == SAVE_FUNCTION) {
recv_function(*deposits[ix].orb, deposits[ix].source, 1, comm_bank);
if (exist_flag == 0) {
currentsize[account] += deposits[ix].orb->getSizeNodes(NUMBER::Total);
totcurrentsize += deposits[ix].orb->getSizeNodes(NUMBER::Total);
currentsize[account] += deposits[ix].orb->getSizeNodes();
totcurrentsize += deposits[ix].orb->getSizeNodes();
this->maxsize = std::max(totcurrentsize, this->maxsize);
}
}
Expand Down Expand Up @@ -641,7 +641,7 @@ std::vector<int> Bank::get_totalsize() {
// get orbital with identity id.
// If wait=0, return immediately with value zero if not available (default)
// else, wait until available
int BankAccount::get_func(int id, ComplexFunction &func, int wait) {
int BankAccount::get_func(int id, CompFunction<3> &func, int wait) {
#ifdef MRCPP_HAS_MPI
MPI_Status status;
int messages[message_size];
Expand Down Expand Up @@ -669,7 +669,7 @@ int BankAccount::get_func(int id, ComplexFunction &func, int wait) {

// get orbital with identity id, and delete from bank.
// return immediately with value zero if not available
int BankAccount::get_func_del(int id, ComplexFunction &orb) {
int BankAccount::get_func_del(int id, CompFunction<3> &orb) {
#ifdef MRCPP_HAS_MPI
MPI_Status status;
int messages[message_size];
Expand All @@ -690,7 +690,7 @@ int BankAccount::get_func_del(int id, ComplexFunction &orb) {
}

// save function in Bank with identity id
int BankAccount::put_func(int id, ComplexFunction &func) {
int BankAccount::put_func(int id, CompFunction<3> &func) {
#ifdef MRCPP_HAS_MPI
// for now we distribute according to id
int messages[message_size];
Expand Down
10 changes: 5 additions & 5 deletions src/utils/Bank.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "ComplexFunction.h"
#include "CompFunction.h"
#include "parallel.h"
#include "trees/NodeIndex.h"

Expand All @@ -9,7 +9,7 @@ namespace mrcpp {
using namespace mpi;

struct deposit {
ComplexFunction *orb;
CompFunction<3> *orb;
double *data; // for pure data arrays
bool hasdata;
int datasize;
Expand Down Expand Up @@ -96,9 +96,9 @@ class BankAccount {
void clear(int i = wrk_rank, MPI_Comm comm = comm_wrk);
// int put_orb(int id, ComplexFunction &orb);
// int get_orb(int id, ComplexFunction &orb, int wait = 0);
int get_func_del(int id, ComplexFunction &orb);
int put_func(int id, ComplexFunction &func);
int get_func(int id, ComplexFunction &func, int wait = 0);
int get_func_del(int id, CompFunction<3> &orb);
int put_func(int id, CompFunction<3> &func);
int get_func(int id, CompFunction<3> &func, int wait = 0);
int put_data(int id, int size, double *data);
int put_data(int id, int size, ComplexDouble *data);
int get_data(int id, int size, double *data);
Expand Down
Loading

0 comments on commit f734374

Please sign in to comment.