34template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
36 PtrList<GeometricField<Type, PatchField, GeoMesh >> & snapshots):
54 flt = autoPtr<Filter>(Filter::New(word(
convDict().lookup(
"Filter")),
64template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
68 M_Assert(((Nx != 1 &&
mesh.solutionD()[0] != -1 ) || (Nx == 1 &&
69 mesh.solutionD()[0] == -1)),
70 "The mesh has valid components only along the y and z directions, set Nx = 1");
71 M_Assert(((Ny != 1 &&
mesh.solutionD()[1] != -1 ) || (Ny == 1 &&
72 mesh.solutionD()[1] == -1)),
73 "The mesh has valid components only along the x and z directions, set Ny = 1");
74 M_Assert(((Nz != 1 &&
mesh.solutionD()[2] != -1 ) || (Nz == 1 &&
75 mesh.solutionD()[2] == -1)),
76 "The mesh has valid components only along the x and y directions, set Nz = 1");
78 for (label
i = 0;
i <
ds.size();
i++)
86 ds[
i] = domainSize[
i] / 2;
90 convPoints = List<point>(Nx * Ny * Nz);
93 for (label
i = 0;
i < Nx;
i++)
95 for (label j = 0; j < Ny; j++)
97 for (label k = 0; k < Nz; k++)
99 if (
i == 0 && Nx == 1)
104 if (j == 0 && Ny == 1)
109 if (k == 0 && Nz == 1)
114 convPoints[index] =
mesh.bounds().min() + cmptMultiply((ds *
i), vector(1, 0,
115 0)) + cmptMultiply((ds * j), vector(0, 1, 0)) + cmptMultiply((ds * k), vector(0,
122 isDomainDivisionSet =
true;
125template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
137 cellSet a(
mesh,
"set", 0);
140 treeBoundBox boxi(mini, maxi);
141 List<treeBoundBox> l;
143 boxToCell finding(
mesh, l);
145 finding.verbose(
false);
147 finding.applyToSet(topoSetSource::ADD, a);
169 "You need to set domainDivision and filterSize before calling the filter funtion.");
173 torch::Tensor output = torch::zeros({
_snapshots.size(), 1, Nx, Ny, Nz});
174 auto foo_a = output.accessor<float, 5>();
180 for (label j = 0; j < Nx; j++)
182 for (label k = 0; k < Ny; k++)
184 for (label l = 0; l < Nz; l++)
207 "You need to set domainDivision and filterSize before calling the filter funtion.");
211 torch::Tensor output = torch::zeros({
_snapshots.size(), 3, Nx, Ny, Nz});
212 auto foo_a = output.accessor<float, 5>();
218 for (label j = 0; j < Nx; j++)
220 for (label k = 0; k < Ny; k++)
222 for (label l = 0; l < Nz; l++)
Header file of the ConvLayer class.
#define M_Assert(Expr, Msg)
Vector< label > domainDivision
Vector< scalar > filterSize
ConvLayer(PtrList< GeometricField< Type, PatchField, GeoMesh > > &snapshots)
Construct using Time as functionObject.
void setDomainDivision(label Nx, label Ny, label Nz)
List< scalarList > weights
void setFilterSize(double dx, double dy, double dz)
autoPtr< IOdictionary > convDict
Vector< scalar > domainSize
PtrList< GeometricField< Type, PatchField, GeoMesh > > & _snapshots
List< labelList > cellsInBoxes