You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simulacion-permeabilidad/fftma_module/gen/lib_src/cardsin.c

42 lines
973 B
C

#include "genlib.h"
#include "log.h"
#include <math.h>
#include <stdio.h>
#include <time.h>
/*cardsin covariance function*/
double cardsin(double h) {
clock_t t = clock();
log_info("RESULT = in progress, h = %f", h);
float delta = 20.371;
double z;
if (h != 0) {
z = (double)(h * delta);
z = sin(z) / z;
} else {
z = 1.;
}
t = clock() - t;
double time_taken = ((double)t)/CLOCKS_PER_SEC; // calculate the elapsed time
double* total_ram = malloc(sizeof(double));
getTotalVirtualMem(total_ram);
double* used_ram = malloc(sizeof(double));
getVirtualMemUsed(used_ram);
log_info("TOTAL VIRTUAL MEM = %5.1f MB, USED VIRTUAL MEM = %5.1f MB, USED VIRTUAL MEM BY CURRENT PROCESS = %d MB",
*total_ram, *used_ram, getVirtualMemUsedByCurrentProcess());
free(total_ram);
free(used_ram);
log_info("RESULT = success, z = %f, ELAPSED = %f seconds", z, time_taken);
return z;
}