Commit f8e84eb6 authored by Giacomo Mulas's avatar Giacomo Mulas
Browse files

Merge branch 'trapping' into 'master'

DRAFT: Trapping

See merge request giacomo.mulas/np_tmcode!12
parents 8d3c5b4e 9f2bb199
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -62,6 +62,6 @@ The default behaviour of `np_sphere` is to take the same input files as `edfb` a

### trapping

The execution of trapping programs requires at least one of the previous programs to have produced a complete output set.
The execution of trapping programs requires at least one of the previous programs to have produced a complete output set. The working assumption is that the `frfme` program is a pre-requisite to `lffft`.

*TODO:* Define a common format for binary I/O operations on the TTMS file.
+25 −26
Original line number Diff line number Diff line
BUILDDIR=../../build/cluster
FC=gfortran
FCFLAGS=-std=legacy -O3
LFLAGS=
LFLAGS=
CXX=g++
CXXFLAGS=-O2 -ggdb -pg -coverage
CXXLFLAGS=

include ../make.inc


all: clu edfb np_cluster

clu: clu.o
	$(FC) $(FCFLAGS) -o $(BUILDDIR)/clu $(BUILDDIR)/clu.o $(LFLAGS)
	$(FC) $(FCFLAGS) -o $(BUILDDIR)/clu $(BUILDDIR)/clu.o $(LDFLAGS)

edfb: edfb.o
	$(FC) $(FCFLAGS) -o $(BUILDDIR)/edfb $(BUILDDIR)/edfb.o $(LFLAGS)
	$(FC) $(FCFLAGS) -o $(BUILDDIR)/edfb $(BUILDDIR)/edfb.o $(LDFLAGS)

np_cluster: $(BUILDDIR)/np_cluster.o $(BUILDDIR)/Commons.o $(BUILDDIR)/Configuration.o $(BUILDDIR)/file_io.o $(BUILDDIR)/Parsers.o $(BUILDDIR)/sph_subs.o $(BUILDDIR)/clu_subs.o $(BUILDDIR)/cluster.o
	$(CXX) $(CXXFLAGS) -o $(BUILDDIR)/np_cluster $(BUILDDIR)/np_cluster.o $(BUILDDIR)/Commons.o $(BUILDDIR)/Configuration.o $(BUILDDIR)/file_io.o $(BUILDDIR)/Parsers.o $(BUILDDIR)/sph_subs.o $(BUILDDIR)/clu_subs.o $(BUILDDIR)/cluster.o $(CXXLDFLAGS) 

np_cluster: $(BUILDDIR)/np_cluster.o $(BUILDDIR)/Commons.o $(BUILDDIR)/Configuration.o $(BUILDDIR)/Parsers.o $(BUILDDIR)/sphere.o $(BUILDDIR)/cluster.o
	$(CXX) $(CXXFLAGS) $(CXXLFLAGS) -o $(BUILDDIR)/np_cluster $(BUILDDIR)/np_cluster.o $(BUILDDIR)/Commons.o $(BUILDDIR)/Configuration.o $(BUILDDIR)/Parsers.o $(BUILDDIR)/sphere.o $(BUILDDIR)/cluster.o
#$(BUILDDIR)/np_cluster.o:
#	$(CXX) $(CXXFLAGS) -c np_cluster.cpp -o $(BUILDDIR)/np_cluster.o

$(BUILDDIR)/np_cluster.o:
	$(CXX) $(CXXFLAGS) -c np_cluster.cpp -o $(BUILDDIR)/np_cluster.o
#$(BUILDDIR)/Commons.o:
#	$(CXX) $(CXXFLAGS) -c ../libnptm/Commons.cpp -o $(BUILDDIR)/Commons.o

$(BUILDDIR)/Commons.o:
	$(CXX) $(CXXFLAGS) -c ../libnptm/Commons.cpp -o $(BUILDDIR)/Commons.o
#$(BUILDDIR)/Configuration.o:
#	$(CXX) $(CXXFLAGS) -c ../libnptm/Configuration.cpp -o $(BUILDDIR)/Configuration.o

$(BUILDDIR)/Configuration.o:
	$(CXX) $(CXXFLAGS) -c ../libnptm/Configuration.cpp -o $(BUILDDIR)/Configuration.o
#$(BUILDDIR)/file_io.o:
#	$(CXX) $(CXXFLAGS) -c ../libnptm/file_io.cpp -o $(BUILDDIR)/file_io.o

$(BUILDDIR)/Parsers.o:
	$(CXX) $(CXXFLAGS) -c ../libnptm/Parsers.cpp -o $(BUILDDIR)/Parsers.o
#$(BUILDDIR)/Parsers.o:
#	$(CXX) $(CXXFLAGS) -c ../libnptm/Parsers.cpp -o $(BUILDDIR)/Parsers.o

$(BUILDDIR)/cluster.o:
	$(CXX) $(CXXFLAGS) -c cluster.cpp -o $(BUILDDIR)/cluster.o
#$(BUILDDIR)/cluster.o:
#	$(CXX) $(CXXFLAGS) -c cluster.cpp -o $(BUILDDIR)/cluster.o

$(BUILDDIR)/sphere.o:
	$(CXX) $(CXXFLAGS) -c ../sphere/sphere.cpp -o $(BUILDDIR)/sphere.o
#$(BUILDDIR)/clu_subs.o:
#	$(CXX) $(CXXFLAGS) -c ../libnptm/clu_subs.cpp -o $(BUILDDIR)/clu_subs.o

#$(BUILDDIR)/sph_subs.o:
#	$(CXX) $(CXXFLAGS) -c ../libnptm/sph_subs.cpp -o $(BUILDDIR)/sph_subs.o

clean:
	rm -f $(BUILDDIR)/*.o
@@ -42,6 +44,3 @@ clean:
wipe:
	rm -f $(BUILDDIR)/clu $(BUILDDIR)/edfb $(BUILDDIR)/*.o
%.o : %.f
	$(FC) $(FCFLAGS) -c -o $(BUILDDIR)/$@ $<
+16 −15
Original line number Diff line number Diff line
/*! \file cluster.cpp
 */
#include <cstdio>
#include <complex>
#include <exception>
#include <fstream>
#include <string>
#include <complex>

#ifndef INCLUDE_CONFIGURATION_H_
#include "../include/Configuration.h"
#endif

#ifndef INCLUDE_COMMONS_H_
#include "../include/Commons.h"
#endif

#ifndef INCLUDE_SPH_SUBS_H_
#include "../include/sph_subs.h"
#endif

#ifndef INCLUDE_CLU_SUBS_H_
#include "../include/clu_subs.h"
#endif

using namespace std;

/*
 * >>> WARNING: works only for IDFC >= 0, as the original code <<<
 *
 */

/*! \brief C++ implementation of CLU
 *
 *  \param config_file: `string` Name of the configuration file.
@@ -34,6 +42,7 @@ void cluster(string config_file, string data_file, string output_path) {
  }
  sconf->write_formatted(output_path + "/c_OEDFB");
  sconf->write_binary(output_path + "/c_TEDF");
  sconf->write_binary(output_path + "/c_TEDF.hd5", "HDF5");
  GeometryConfiguration *gconf = NULL;
  try {
    gconf = GeometryConfiguration::from_legacy(data_file);
@@ -107,7 +116,7 @@ void cluster(string config_file, string data_file, string output_path) {
    }
    C2 *c2 = new C2(nsph, max_ici, npnt, npntts);
    complex<double> **am = new complex<double>*[mxndm];
    for (int ai = 0; ai < mxndm; ai++) am[ai] = new complex<double>[mxndm];
    for (int ai = 0; ai < mxndm; ai++) am[ai] = new complex<double>[mxndm]();
    const int ndi = c4->nsph * c4->nlim;
    C9 *c9 = new C9(ndi, c4->nlem, 2 * ndi, 2 * c4->nlem);
    double *gaps = new double[nsph]();
@@ -313,17 +322,9 @@ void cluster(string config_file, string data_file, string output_path) {
	  }
	  if (jer != 0) break;
	} // i132 loop
	//printf("INFO: initializing matrix...");
	cms(am, c1, c1ao, c4, c6);
	//printf(" done.\n");
	//ccsam = summat(am, 960, 960);
	//printf("DEBUG: after CMS CCSAM = (%lE,%lE)\n", ccsam.real(), ccsam.imag());
	int ndit = 2 * nsph * c4->nlim;
	//printf("INFO: inverting matrix...");
	lucin(am, mxndm, ndit, jer);
	//printf(" done.\n");
	//ccsam = summat(am, 960, 960);
	//printf("DEBUG: after LUCIN CCSAM = (%lE,%lE)\n", ccsam.real(), ccsam.imag());
	if (jer != 0) break; // jxi488 loop: goes to memory clean
	ztm(am, c1, c1ao, c4, c6, c9);
	if (sconf->idfc >= 0) {
+2 −0
Original line number Diff line number Diff line
@@ -2,7 +2,9 @@
 */

#include <cstdio>
#include <complex>
#include <string>

#ifndef INCLUDE_CONFIGURATION_H_
#include "../include/Configuration.h"
#endif
+2 −4
Original line number Diff line number Diff line
@@ -14,10 +14,8 @@
 *
 */

#ifndef INCLUDE_COMMONS_
#define INCLUDE_COMMONS_

#include <complex>
#ifndef INCLUDE_COMMONS_H_
#define INCLUDE_COMMONS_H_

/*! \brief Representation of the FORTRAN C1 common blocks.
 *
Loading