Skip to content

Commit 1b0b823

Browse files
committed
to ci test
1 parent 5b332df commit 1b0b823

File tree

4 files changed

+18
-28
lines changed

4 files changed

+18
-28
lines changed

src/shared/common/sphinxsys_constant.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,23 @@
3434

3535
namespace SPH
3636
{
37-
template <typename GeneratorType, typename DataType>
37+
template <typename DataType>
3838
class ConstantArray : public Entity
3939
{
4040
UniquePtrKeeper<Entity> device_only_constant_array_keeper_;
4141

4242
public:
43+
template <typename GeneratorType>
4344
ConstantArray(StdVec<GeneratorType *> generators)
44-
: Entity("ConstantArray"), generators_(generators),
45-
data_size_(generators.size()),
45+
: Entity("ConstantArray"), data_size_(generators.size()),
4646
data_(new DataType[data_size_]), delegated_(data_)
4747
{
4848
for (size_t i = 0; i != data_size_; ++i)
4949
{
50-
data_[i] = DataType(*generators_[i]);
50+
data_[i] = DataType(*generators[i]);
5151
}
5252
};
5353
~ConstantArray() { delete[] data_; };
54-
StdVec<GeneratorType *> getGenerators() { return generators_; }
5554
size_t getDataSize() { return data_size_; }
5655
DataType *Data() { return data_; };
5756
template <class ExecutionPolicy>
@@ -64,19 +63,18 @@ class ConstantArray : public Entity
6463
void setDelegateData(DataType *new_delegated) { delegated_ = new_delegated; };
6564

6665
protected:
67-
StdVec<GeneratorType *> generators_;
6866
size_t data_size_;
6967
DataType *data_;
7068
DataType *delegated_;
7169
};
7270

73-
template <typename GeneratorType, typename DataType>
71+
template <typename DataType>
7472
class DeviceOnlyConstantArray : public Entity
7573
{
7674
public:
7775
template <class PolicyType>
7876
DeviceOnlyConstantArray(const DeviceExecution<PolicyType> &ex_policy,
79-
ConstantArray<GeneratorType, DataType> *host_constant);
77+
ConstantArray<DataType> *host_constant);
8078
~DeviceOnlyConstantArray();
8179

8280
protected:

src/shared/common/sphinxsys_variable.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,9 @@ class DiscreteVariable : public Entity
135135
template <class InitializationFunction>
136136
DiscreteVariable(const std::string &name, size_t data_size,
137137
const InitializationFunction &initialization)
138-
: Entity(name), data_size_(data_size), data_field_(nullptr),
138+
: Entity(name), data_size_(data_size), data_field_(new DataType[data_size]),
139139
device_only_variable_(nullptr), device_data_field_(nullptr)
140140
{
141-
data_field_ = new DataType[data_size];
142141
for (size_t i = 0; i < data_size; ++i)
143142
{
144143
data_field_[i] = initialization(i);

src/shared/shared_ck/particle_dynamics/diffusion_reaction_dynamics/diffusion_dynamics_ck.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class DiffusionRelaxationCK<DiffusionType, BaseInteractionType>
9090
DiscreteVariableArray<Real> dv_diffusion_species_array_;
9191
DiscreteVariableArray<Real> dv_gradient_species_array_;
9292
DiscreteVariableArray<Real> dv_diffusion_dt_array_;
93-
ConstantArray<DiffusionType, InverseVolumetricCapacity> ca_inverse_volume_capacity_;
93+
ConstantArray<InverseVolumetricCapacity> ca_inverse_volume_capacity_;
9494
};
9595

9696
template <class DiffusionType, class KernelCorrectionType, class... Parameters>
@@ -122,7 +122,7 @@ class DiffusionRelaxationCK<Inner<InteractionOnly, DiffusionType, KernelCorrecti
122122

123123
protected:
124124
KernelCorrectionType kernel_correction_method_;
125-
ConstantArray<DiffusionType, InterParticleDiffusionCoeff> ca_inter_particle_diffusion_coeff_;
125+
ConstantArray<InterParticleDiffusionCoeff> ca_inter_particle_diffusion_coeff_;
126126
Real smoothing_length_sq_;
127127
};
128128

@@ -278,7 +278,7 @@ class Dirichlet<DiffusionType>
278278
Real smoothing_length_sq_;
279279
DiscreteVariableArray<Real> &dv_gradient_species_array_;
280280
DiscreteVariableArray<Real> contact_dv_gradient_species_array_;
281-
ConstantArray<DiffusionType, InterParticleDiffusionCoeff> ca_inter_particle_diffusion_coeff_;
281+
ConstantArray<InterParticleDiffusionCoeff> ca_inter_particle_diffusion_coeff_;
282282
};
283283

284284
template <class DiffusionType>

src/src_sycl/shared/common/sphinxsys_constant_sycl.hpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,33 @@
77
namespace SPH
88
{
99
//=================================================================================================//
10-
template <typename GeneratorType, typename DataType>
10+
template <typename DataType>
1111
template <class PolicyType>
12-
DataType *ConstantArray<GeneratorType, DataType>::
13-
DelegatedOnDevice(const DeviceExecution<PolicyType> &ex_policy)
12+
DataType *ConstantArray<DataType>::DelegatedOnDevice(const DeviceExecution<PolicyType> &ex_policy)
1413
{
1514
if (!isDataDelegated())
1615
{
1716
device_only_constant_array_keeper_
18-
.createPtr<DeviceOnlyConstantArray<GeneratorType, DataType>>(DeviceExecution<PolicyType>{}, this);
17+
.createPtr<DeviceOnlyConstantArray<DataType>>(DeviceExecution<PolicyType>{}, this);
1918
}
2019
return delegated_;
2120
};
2221
//=================================================================================================//
23-
template <typename GeneratorType, typename DataType>
22+
template <typename DataType>
2423
template <class PolicyType>
25-
DeviceOnlyConstantArray<GeneratorType, DataType>::
26-
DeviceOnlyConstantArray(const DeviceExecution<PolicyType> &ex_policy,
27-
ConstantArray<GeneratorType, DataType> *host_constant)
24+
DeviceOnlyConstantArray<DataType>::DeviceOnlyConstantArray(
25+
const DeviceExecution<PolicyType> &ex_policy, ConstantArray<DataType> *host_constant)
2826
: Entity(host_constant->Name()), device_only_data_(nullptr)
2927
{
30-
StdVec<GeneratorType *> generators = host_constant->getGenerators();
3128
size_t data_size = host_constant->getDataSize();
3229
DataType *host_data = host_constant->Data();
33-
for (size_t i = 0; i != data_size; ++i)
34-
{
35-
host_data[i] = DataType(ex_policy, *generators[i]);
36-
}
3730
device_only_data_ = allocateDeviceOnly<DataType>(data_size);
3831
copyToDevice(host_data, device_only_data_, data_size);
3932
host_constant->setDelegateData(device_only_data_);
4033
}
4134
//=================================================================================================//
42-
template <typename GeneratorType, typename DataType>
43-
DeviceOnlyConstantArray<GeneratorType, DataType>::~DeviceOnlyConstantArray()
35+
template <typename DataType>
36+
DeviceOnlyConstantArray<DataType>::~DeviceOnlyConstantArray()
4437
{
4538
freeDeviceData(device_only_data_);
4639
}

0 commit comments

Comments
 (0)