forked from moebiusband/NuSiF-Solver
		
	Reformat license header
This commit is contained in:
		@@ -1,13 +1,11 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 * Use of this source code is governed by a MIT-style
 | 
			
		||||
 * license that can be found in the LICENSE file.
 | 
			
		||||
 */
 | 
			
		||||
 * license that can be found in the LICENSE file.    */
 | 
			
		||||
#ifndef __ALLOCATE_H_
 | 
			
		||||
#define __ALLOCATE_H_
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
extern void* allocate (int alignment, size_t bytesize);
 | 
			
		||||
extern void* allocate(int alignment, size_t bytesize);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,9 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.ke
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 * Use of this source code is governed by a MIT-style
 | 
			
		||||
 * license that can be found in the LICENSE file.
 | 
			
		||||
 */
 | 
			
		||||
#include <float.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
 * license that can be found in the LICENSE file.    */
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
#include "likwid-marker.h"
 | 
			
		||||
#include "parameter.h"
 | 
			
		||||
@@ -44,11 +39,12 @@ int main(int argc, char** argv)
 | 
			
		||||
        variant = atoi(argv[2]);
 | 
			
		||||
    }
 | 
			
		||||
    if (argc == 4) {
 | 
			
		||||
        sscanf("%lf", argv[2], ¶ms.omg);
 | 
			
		||||
        sscanf("%lf", argv[2], ¶ms.rho);
 | 
			
		||||
        sscanf("%lf", argv[3], ¶ms.omg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    initSolver(&solver, ¶ms, 2);
 | 
			
		||||
    writeResult(&solver, "p-init.dat");
 | 
			
		||||
 | 
			
		||||
    switch (variant) {
 | 
			
		||||
    case SOR:
 | 
			
		||||
        printf("Plain SOR\n");
 | 
			
		||||
@@ -64,7 +60,7 @@ int main(int argc, char** argv)
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
    printf(" %.2fs\n", endTime - startTime);
 | 
			
		||||
    // writeResult(&solver);
 | 
			
		||||
    writeResult(&solver, "p-final.dat");
 | 
			
		||||
 | 
			
		||||
    LIKWID_MARKER_CLOSE;
 | 
			
		||||
    return EXIT_SUCCESS;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved. This file is part of nusif-solver.
 | 
			
		||||
 * Use of this source code is governed by a MIT style
 | 
			
		||||
 * license that can be found in the LICENSE file.
 | 
			
		||||
 */
 | 
			
		||||
/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 * Use of this source code is governed by a MIT-style
 | 
			
		||||
 * license that can be found in the LICENSE file.    */
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved. This file is part of nusif-solver.
 | 
			
		||||
 * Use of this source code is governed by a MIT style
 | 
			
		||||
 * license that can be found in the LICENSE file.
 | 
			
		||||
 */
 | 
			
		||||
/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 * Use of this source code is governed by a MIT-style
 | 
			
		||||
 * license that can be found in the LICENSE file.    */
 | 
			
		||||
#ifndef __PARAMETER_H_
 | 
			
		||||
#define __PARAMETER_H_
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved. This file is part of nusif-solver.
 | 
			
		||||
 * Use of this source code is governed by a MIT style
 | 
			
		||||
 * license that can be found in the LICENSE file.
 | 
			
		||||
 */
 | 
			
		||||
/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 * Use of this source code is governed by a MIT-style
 | 
			
		||||
 * license that can be found in the LICENSE file.    */
 | 
			
		||||
#include "math.h"
 | 
			
		||||
#include "stdio.h"
 | 
			
		||||
#include "stdlib.h"
 | 
			
		||||
@@ -75,6 +73,7 @@ void solve(Solver* solver)
 | 
			
		||||
    double epssq  = eps * eps;
 | 
			
		||||
    int it        = 0;
 | 
			
		||||
    double res    = 1.0;
 | 
			
		||||
    char filename[20];
 | 
			
		||||
 | 
			
		||||
    while ((res >= epssq) && (it < itermax)) {
 | 
			
		||||
        res = 0.0;
 | 
			
		||||
@@ -104,11 +103,14 @@ void solve(Solver* solver)
 | 
			
		||||
        res = res / (double)(imax * jmax);
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
        printf("%d Residuum: %e\n", it, res);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef ANIMATE
 | 
			
		||||
        sprintf(filename, "p-%d.dat", it);
 | 
			
		||||
        writeResult(solver, filename);
 | 
			
		||||
#endif
 | 
			
		||||
        it++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // printf("Solver took %d iterations to reach %f\n", it, sqrt(res));
 | 
			
		||||
    printf("%d, %f\n", it, solver->omega);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -165,6 +167,10 @@ void solveRB(Solver* solver)
 | 
			
		||||
        res = res / (double)(imax * jmax);
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
        printf("%d Residuum: %e\n", it, res);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef ANIMATE
 | 
			
		||||
        sprintf(filename, "p-%d.dat", it);
 | 
			
		||||
        writeResult(solver, filename);
 | 
			
		||||
#endif
 | 
			
		||||
        it++;
 | 
			
		||||
    }
 | 
			
		||||
@@ -230,6 +236,10 @@ void solveRBA(Solver* solver)
 | 
			
		||||
        res = res / (double)(imax * jmax);
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
        printf("%d Residuum: %e Omega: %e\n", it, res, omega);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef ANIMATE
 | 
			
		||||
        sprintf(filename, "p-%d.dat", it);
 | 
			
		||||
        writeResult(solver, filename);
 | 
			
		||||
#endif
 | 
			
		||||
        it++;
 | 
			
		||||
    }
 | 
			
		||||
@@ -239,14 +249,14 @@ void solveRBA(Solver* solver)
 | 
			
		||||
    printf("%d, %f\n", it, omega);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void writeResult(Solver* solver)
 | 
			
		||||
void writeResult(Solver* solver, char* filename)
 | 
			
		||||
{
 | 
			
		||||
    int imax  = solver->imax;
 | 
			
		||||
    int jmax  = solver->jmax;
 | 
			
		||||
    double* p = solver->p;
 | 
			
		||||
 | 
			
		||||
    FILE* fp;
 | 
			
		||||
    fp = fopen("p.dat", "w");
 | 
			
		||||
    fp = fopen(filename, "w");
 | 
			
		||||
 | 
			
		||||
    if (fp == NULL) {
 | 
			
		||||
        printf("Error!\n");
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved. This file is part of nusif-solver.
 | 
			
		||||
 * Use of this source code is governed by a MIT style
 | 
			
		||||
 * license that can be found in the LICENSE file.
 | 
			
		||||
 */
 | 
			
		||||
/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 * Use of this source code is governed by a MIT-style
 | 
			
		||||
 * license that can be found in the LICENSE file.    */
 | 
			
		||||
#ifndef __SOLVER_H_
 | 
			
		||||
#define __SOLVER_H_
 | 
			
		||||
#include "parameter.h"
 | 
			
		||||
@@ -17,7 +15,7 @@ typedef struct {
 | 
			
		||||
} Solver;
 | 
			
		||||
 | 
			
		||||
extern void initSolver(Solver*, Parameter*, int problem);
 | 
			
		||||
extern void writeResult(Solver*);
 | 
			
		||||
extern void writeResult(Solver*, char*);
 | 
			
		||||
extern void solve(Solver*);
 | 
			
		||||
extern void solveRB(Solver*);
 | 
			
		||||
extern void solveRBA(Solver*);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 * Use of this source code is governed by a MIT-style
 | 
			
		||||
 * license that can be found in the LICENSE file.
 | 
			
		||||
 */
 | 
			
		||||
 * license that can be found in the LICENSE file.    */
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
 | 
			
		||||
@@ -21,7 +19,4 @@ double getTimeResolution()
 | 
			
		||||
    return (double)ts.tv_sec + (double)ts.tv_nsec * 1.e-9;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
double getTimeStamp_()
 | 
			
		||||
{
 | 
			
		||||
    return getTimeStamp();
 | 
			
		||||
}
 | 
			
		||||
double getTimeStamp_() { return getTimeStamp(); }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,11 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 * Use of this source code is governed by a MIT-style
 | 
			
		||||
 * license that can be found in the LICENSE file.
 | 
			
		||||
 */
 | 
			
		||||
 * license that can be found in the LICENSE file.    */
 | 
			
		||||
#ifndef __TIMING_H_
 | 
			
		||||
#define __TIMING_H_
 | 
			
		||||
 | 
			
		||||
extern double getTimeStamp();
 | 
			
		||||
extern double getTimeResolution();
 | 
			
		||||
extern double getTimeStamp_();
 | 
			
		||||
 | 
			
		||||
#endif // __TIMING_H_
 | 
			
		||||
 
 | 
			
		||||
@@ -1,18 +1,17 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 * Use of this source code is governed by a MIT-style
 | 
			
		||||
 * license that can be found in the LICENSE file.
 | 
			
		||||
 */
 | 
			
		||||
 * license that can be found in the LICENSE file.    */
 | 
			
		||||
#ifndef __UTIL_H_
 | 
			
		||||
#define __UTIL_H_
 | 
			
		||||
#define HLINE "----------------------------------------------------------------------------\n"
 | 
			
		||||
#define HLINE                                                                            \
 | 
			
		||||
    "----------------------------------------------------------------------------\n"
 | 
			
		||||
 | 
			
		||||
#ifndef MIN
 | 
			
		||||
#define MIN(x,y) ((x)<(y)?(x):(y))
 | 
			
		||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef MAX
 | 
			
		||||
#define MAX(x,y) ((x)>(y)?(x):(y))
 | 
			
		||||
#define MAX(x, y) ((x) > (y) ? (x) : (y))
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef ABS
 | 
			
		||||
#define ABS(a) ((a) >= 0 ? (a) : -(a))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user