Files
LBPM/analysis/Minkowski.h

143 lines
4.2 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
*
*/
2018-06-06 22:38:46 -04:00
class Minkowski{
//...........................................................................
int kstart,kfinish;
double isovalue;
double Volume;
// CSV / text file where time history of averages is saved
2018-06-07 10:35:32 -04:00
FILE *LOGFILE;
2018-06-06 22:38:46 -04:00
public:
//...........................................................................
std::shared_ptr <Domain> Dm;
Array <char> id;
Array <int> label;
2019-03-19 08:36:08 -04:00
Array <double> distance;
2018-06-06 22:38:46 -04:00
//...........................................................................
// Averaging variables
//...........................................................................
// local averages (to each MPI process)
2018-09-10 21:30:04 -04:00
double Ai,Ji,Xi,Vi;
2018-06-06 22:38:46 -04:00
// Global averages (all processes)
2018-09-10 23:46:58 -04:00
double Ai_global,Ji_global,Xi_global,Vi_global;
int n_connected_components;
2018-06-06 22:38:46 -04:00
//...........................................................................
2018-06-07 10:35:32 -04:00
int Nx,Ny,Nz;
2021-09-18 16:33:26 -04:00
double V(){
return Vi;
}
double A(){
return Ai;
}
double H(){
return Ji;
}
double X(){
return Xi;
}
2019-03-19 08:36:08 -04:00
2018-09-28 16:36:42 -04:00
//..........................................................................
2021-09-18 16:33:26 -04:00
/**
* \brief Null constructor
*/
2018-09-28 16:36:42 -04:00
Minkowski(){};//NULL CONSTRUCTOR
2021-09-18 16:33:26 -04:00
/**
* \brief Constructor based on an existing Domain
* @param Dm - Domain structure
*/
2018-06-06 22:38:46 -04:00
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();
2021-09-18 16:33:26 -04:00
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();
2021-09-18 16:33:26 -04:00
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
*/
2018-06-06 22:54:38 -04:00
void PrintAll();
2018-06-06 22:38:46 -04:00
};
#endif