Files
LBPM/analysis/Minkowski.h

132 lines
4.3 KiB
C
Raw Normal View History

2018-06-11 15:19:05 -04:00
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
2020-10-12 06:08:29 -04:00
Copyright Equnior ASA
2018-06-11 15:19:05 -04:00
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
2018-06-06 22:38:46 -04:00
// Header file for two-phase averaging class
#ifndef Minkowski_INC
#define Minkowski_INC
2019-03-18 09:42:44 -04:00
#include <memory>
2018-06-06 22:38:46 -04:00
#include <vector>
2018-09-15 13:39:01 -04:00
#include "analysis/dcel.h"
2018-06-06 22:38:46 -04:00
#include "common/Domain.h"
#include "common/Communication.h"
#include "analysis/analysis.h"
#include "analysis/distance.h"
2020-07-22 13:14:07 -04:00
#include "analysis/filters.h"
2018-06-06 22:38:46 -04:00
#include "common/Utilities.h"
2021-01-04 22:16:58 -05:00
#include "common/MPI.h"
2018-06-06 22:38:46 -04:00
#include "IO/MeshDatabase.h"
#include "IO/Reader.h"
#include "IO/Writer.h"
2021-09-18 16:33:26 -04:00
/**
* \class Minkowski
*
* @brief
* The Minkowski class is constructed to analyze the geometric properties of structures based on the Minkowski functionals
*
*/
class Minkowski {
//...........................................................................
int kstart, kfinish;
2018-06-06 22:38:46 -04:00
double isovalue;
double Volume;
2018-06-06 22:38:46 -04:00
// CSV / text file where time history of averages is saved
FILE *LOGFILE;
2018-06-06 22:38:46 -04:00
public:
//...........................................................................
std::shared_ptr<Domain> Dm;
Array<char> id;
Array<int> label;
Array<double> distance;
//...........................................................................
// Averaging variables
//...........................................................................
// local averages (to each MPI process)
double Ai, Ji, Xi, Vi;
// Global averages (all processes)
double Ai_global, Ji_global, Xi_global, Vi_global;
int n_connected_components;
//...........................................................................
int Nx, Ny, Nz;
double V() { return Vi; }
double A() { return Ai; }
double H() { return Ji; }
double X() { return Xi; }
//..........................................................................
2021-09-18 16:33:26 -04:00
/**
* \brief Null constructor
*/
Minkowski(){}; //NULL CONSTRUCTOR
2021-09-18 16:33:26 -04:00
/**
* \brief Constructor based on an existing Domain
* @param Dm - Domain structure
*/
Minkowski(std::shared_ptr<Domain> Dm);
~Minkowski();
2021-09-18 16:33:26 -04:00
/**
* \brief Compute scalar minkowski functionals
* step 1. compute the distance to an object
* step 2. construct dcel to represent the isosurface
* step 3. compute the scalar Minkowski functionals
* THIS ALGORITHM ASSUMES THAT id() is populated with phase id to distinguish objects
* 0 - labels the object
* 1 - labels everything else
*/
void MeasureObject();
void MeasureObject(double factor, const DoubleArray &Phi);
2021-09-18 16:33:26 -04:00
/**
* \details Compute scalar minkowski functionals for connected part of a structure
* step 1. compute connected components and extract largest region by volume
* step 2. compute the distance to the connected part of the structure
* step 3. construct dcel to represent the isosurface
* step 4. compute the scalar Minkowski functionals
* THIS ALGORITHM ASSUMES THAT id() is populated with phase id to distinguish objects
* 0 - labels the object
* 1 - labels everything else
*/
int MeasureConnectedPathway();
int MeasureConnectedPathway(double factor, const DoubleArray &Phi);
2021-09-18 16:33:26 -04:00
/**
* \brief Compute scalar minkowski functionals
* \details Construct an isosurface and return the geometric invariants based on the triangulated list
* @param isovalue - threshold value to use to determine iso-surface
* @param Field - DoubleArray containing the field to threshold
*/
void ComputeScalar(const DoubleArray &Field, const double isovalue);
2019-03-19 08:36:08 -04:00
2021-09-18 16:33:26 -04:00
/**
* \brief print the scalar invariants
*/
void PrintAll();
2018-06-06 22:38:46 -04:00
};
#endif