cratepy.clustering.clusteringdata.ClusterAnalysisData

class ClusterAnalysisData(strain_formulation, problem_type, rve_dims, n_voxels_dims, base_clustering_scheme, adaptive_clustering_scheme, feature_descriptors)[source]

Bases: object

Features data required to perform the RVE cluster analysis.

_features

Set of prescribed features identifiers (int).

Type:

set[int]

_features_idxs

Global data matrix’s indexes (item, list) associated to each feature (key, str).

Type:

dict

_feature_loads_ids

List of macroscale strain loadings identifiers (item, list[int]) associated to each feature (key, str).

Type:

dict

_mac_strains

List of macroscale strain loadings required to compute the clustering features. The macroscale strain loading is the infinitesimal strain tensor (infinitesimal strains) and the deformation gradient (finite strains).

Type:

list[numpy.ndarray (2d)]

_comp_order_sym

Strain/Stress components symmetric order.

Type:

list[str]

_comp_order_nsym

Strain/Stress components nonsymmetric order.

Type:

list[str]

_global_data_matrix

Data matrix (numpy.ndarray of shape (n_voxels, n_features_dims)) containing the required clustering features’ data to perform all the prescribed RVE clusterings.

Type:

numpy.ndarray (2d)

set_prescribed_features(self)[source]

Set prescribed clustering features.

get_features(self)[source]

Get prescribed clustering features.

set_feature_global_indexes(self)[source]

Set prescribed clustering features global data matrix indexes.

set_clustering_mac_strains(self)[source]

Set macroscale strain loadings to compute clustering features.

get_clustering_mac_strains(self)[source]

Set macroscale strain loadings to compute clustering features.

set_global_data_matrix(self, rve_global_response)[source]

Compute global data matrix containing all clustering features.

get_global_data_matrix(self)[source]

Get global data matrix containing all clustering features.

Constructor.

Parameters:
  • strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.

  • problem_type (int) – Problem type: 2D plane strain (1), 2D plane stress (2), 2D axisymmetric (3) and 3D (4).

  • rve_dims (list[float]) – RVE size in each dimension.

  • n_voxels_dims (list[int]) – Number of voxels in each dimension of the regular grid (spatial discretization of the RVE).

  • base_clustering_scheme (dict) – Prescribed base clustering scheme (item, numpy.ndarray of shape (n_clusterings, 3)) for each material phase (key, str). Each row is associated with a unique clustering characterized by a clustering algorithm (col 1, int), a list of features (col 2, list[int]) and a list of the features data matrix’ indexes (col 3, list[int]).

  • adaptive_clustering_scheme (dict) – Prescribed adaptive clustering scheme (item, numpy.ndarray of shape (n_clusterings, 3)) for each material phase (key, str). Each row is associated with a unique clustering characterized by a clustering algorithm (col 1, int), a list of features (col 2, list[int]) and a list of the features data matrix’ indexes (col 3, list[int]).

  • features_descriptors (dict) – Data (tuple structured as (number of feature dimensions (int), feature computation algorithm (function), list of macroscale strain loadings (list[numpy.ndarray (2d)]), strain magnitude factor (float))) associated to each feature (key, str). The macroscale strain loading is the infinitesimal strain tensor (infinitesimal strains) or the deformation gradient (finite strains).

  • n_voxels (int) – Total number of voxels of the regular grid (spatial discretization of the RVE).

List of Public Methods

get_clustering_mac_strains

Set macroscale strain loadings to compute clustering features.

get_features

Get prescribed clustering features.

get_global_data_matrix

Get global data matrix containing all clustering features.

set_clustering_mac_strains

Set macroscale strain loadings to compute clustering features.

set_feature_global_indexes

Set prescribed clustering features global data matrix indexes.

set_global_data_matrix

Compute global data matrix containing all clustering features.

set_prescribed_features

Set prescribed clustering features.

Methods

__init__(strain_formulation, problem_type, rve_dims, n_voxels_dims, base_clustering_scheme, adaptive_clustering_scheme, feature_descriptors)[source]

Constructor.

Parameters:
  • strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.

  • problem_type (int) – Problem type: 2D plane strain (1), 2D plane stress (2), 2D axisymmetric (3) and 3D (4).

  • rve_dims (list[float]) – RVE size in each dimension.

  • n_voxels_dims (list[int]) – Number of voxels in each dimension of the regular grid (spatial discretization of the RVE).

  • base_clustering_scheme (dict) – Prescribed base clustering scheme (item, numpy.ndarray of shape (n_clusterings, 3)) for each material phase (key, str). Each row is associated with a unique clustering characterized by a clustering algorithm (col 1, int), a list of features (col 2, list[int]) and a list of the features data matrix’ indexes (col 3, list[int]).

  • adaptive_clustering_scheme (dict) – Prescribed adaptive clustering scheme (item, numpy.ndarray of shape (n_clusterings, 3)) for each material phase (key, str). Each row is associated with a unique clustering characterized by a clustering algorithm (col 1, int), a list of features (col 2, list[int]) and a list of the features data matrix’ indexes (col 3, list[int]).

  • features_descriptors (dict) – Data (tuple structured as (number of feature dimensions (int), feature computation algorithm (function), list of macroscale strain loadings (list[numpy.ndarray (2d)]), strain magnitude factor (float))) associated to each feature (key, str). The macroscale strain loading is the infinitesimal strain tensor (infinitesimal strains) or the deformation gradient (finite strains).

  • n_voxels (int) – Total number of voxels of the regular grid (spatial discretization of the RVE).

get_clustering_mac_strains()[source]

Set macroscale strain loadings to compute clustering features.

Returns:

mac_strains – List of macroscale strain loadings required to compute the clustering features. The macroscale strain loading is the infinitesimal strain tensor (infinitesimal strains) and the deformation gradient (finite strains).

Return type:

list[numpy.ndarray (2d)]

get_features()[source]

Get prescribed clustering features.

Returns:

features – Set of prescribed features identifiers (int).

Return type:

set[int]

get_global_data_matrix()[source]

Get global data matrix containing all clustering features.

Returns:

global_data_matrix – Data matrix (numpy.ndarray of shape (n_voxels, n_features_dims)) containing the required clustering features data to perform all the prescribed RVE clusterings.

Return type:

numpy.ndarray (2d)

set_clustering_mac_strains()[source]

Set macroscale strain loadings to compute clustering features.

List the required macroscale strain loadings to compute all the prescribed clustering features. The macroscale strain loading is the infinitesimal strain tensor (infinitesimal strains) or the deformation gradient (finite strains). In addition, assign the macroscale strain loadings identifiers (index in the previous list) associated to each clustering feature.

set_feature_global_indexes()[source]

Set prescribed clustering features global data matrix indexes.

Assign a list of global data matrix indexes to each clustering feature according to the corresponding dimensionality. This list is essentialy a unitary-step slice, i.e., described by initial and ending delimitary indexes. The clustering scheme is also updated by assigning the global data matrix’ indexes associated to each prescribed RVE clustering.

Returns:

features_idxs – Global data matrix indexes (item, list[range]) associated to each feature (key, str).

Return type:

dict

set_global_data_matrix(rve_global_response)[source]

Compute global data matrix containing all clustering features.

Compute the data matrix required to perform all the RVE clusterings prescribed in the clustering scheme. This involves the computation of each clustering feature’s data matrix (based on a RVE response database) and post assembly to the clustering global data matrix.


Parameters:

rve_global_response (numpy.ndarray (2d)) – RVE local elastic strain response for a given set of macroscale loadings, where each macroscale loading is associated with a set of independent strain components (numpy.ndarray of shape (n_voxels, n_mac_strains*n_strain_comps)). Each column is associated with a independent strain component of the infinitesimal strain tensor (infinitesimal strains) or material logarithmic strain tensor (finite strains).

set_prescribed_features()[source]

Set prescribed clustering features.