Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BrainSimulator/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ private void MainMenu_MouseEnter(object sender, MouseEventArgs e)

if (此神经元数组 != null && !useServers) ThreadCount.Text = 此神经元数组.获取线程数().ToString();
else ThreadCount.Text = "";
if (此神经元数组 != null) Refractory.Text = 此神经元数组.GetRefractoryDelay().ToString();
if (此神经元数组 != null) Refractory.Text = 此神经元数组.GetRefractoryDelay获取耐火材料延迟().ToString();
else Refractory.Text = "";

if (currentFileName != "" &&
Expand Down
4 changes: 2 additions & 2 deletions BrainSimulator/Module/ModuleBoundary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public override void Fire()
for (int i = 0; i < source.Width; i++)
{
int index = source.GetNeuronIndexAt(i, j);
neuronValues[i, j] = MainWindow.此神经元数组.GetNeuronLastCharge(index);
neuronValues[i, j] = MainWindow.此神经元数组.GetNeuronLastCharge获取神经元上一次的脉冲(index);
neuronValuesI[i, j] = (int)neuronValues[i, j];
}

Expand Down Expand Up @@ -165,7 +165,7 @@ public override void Fire()
int index = mv.GetNeuronIndexAt(i, j);
float lastCharge = boundaryValues[i, j];
if (cornerValues[i, j] != 0) lastCharge = 0.99f;
MainWindow.此神经元数组.SetNeuronLastCharge(index, lastCharge);
MainWindow.此神经元数组.SetNeuronLastCharge设置神经元上一次的脉冲(index, lastCharge);
}
}
//if you want the dlg to update, use the following code whenever any parameter changes
Expand Down
2 changes: 1 addition & 1 deletion BrainSimulator/Module/ModuleBoundarySegments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void FindSegments()
for (int i = 0; i < naSource.Width; i++)
{
int index = naSource.GetNeuronIndexAt(i, j);
float lastCharge = MainWindow.此神经元数组.GetNeuronLastCharge(index);
float lastCharge = MainWindow.此神经元数组.GetNeuronLastCharge获取神经元上一次的脉冲(index);
if (lastCharge > 0.1f)
{
firingPoints.Add(new Point(i, j));
Expand Down
12 changes: 6 additions & 6 deletions BrainSimulator/神经元处理.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public void 设置所有神经元( 神经元 n)
else
{
int i = n.id;
SetNeuronCurrentCharge(i, n.当前更改);
SetNeuronLastCharge(i, n.最后更改);
SetNeuronCurrentCharge设置神经元当前的脉冲(i, n.当前更改);
SetNeuronLastCharge设置神经元上一次的脉冲(i, n.最后更改);
设置神经元标签(i, n.标签);
SetNeuronLeakRate(i, n.leakRate泄露速度);
SetNeuronLeakRate设置神经元释放率(i, n.leakRate泄露速度);
设置神经元模型(i, (int)n.模型字段);
SetNeuronAxonDelay(i, n.突触延迟);
}
Expand All @@ -54,11 +54,11 @@ public 神经元 获取用于绘图的神经元(int i)
{
神经元 retVal = new 神经元();
retVal.id = i;
retVal.LastCharge = GetNeuronLastCharge(i);
retVal.LastCharge = GetNeuronLastCharge获取神经元上一次的脉冲(i);
retVal.是否使用 = 获取神经元是否使用中(i);
retVal.标签 = 获取神经元标签(i);
retVal.模型字段 = (神经元.模型类型)获取神经元模型(i);
retVal.leakRate泄露速度 = GetNeuronLeakRate(i);
retVal.leakRate泄露速度 = GetNeuronLeakRate获取神经元释放率(i);
retVal.突触延迟 = GetNeuronAxonDelay(i);
return retVal;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public List<突触> 获取突触列表(int i)
}
public List<突触> 从列表中获取突触(int i)
{
return 变换为突触列表(GetSynapsesFrom(i));
return 变换为突触列表(GetSynapsesFrom获取突触源(i));
}
List<突触> 变换为突触列表(byte[] input)
{
Expand Down
10 changes: 5 additions & 5 deletions CSEngineTest/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ private void Button_Click(object sender, RoutedEventArgs e)
theNeuronArray.设置线程数量(16);
threads = theNeuronArray.获取线程数();

theNeuronArray.SetNeuronCurrentCharge(1, 1.4f);
theNeuronArray.SetNeuronCurrentCharge(2, 0.9f);
theNeuronArray.SetNeuronCurrentCharge设置神经元当前的脉冲(1, 1.4f);
theNeuronArray.SetNeuronCurrentCharge设置神经元当前的脉冲(2, 0.9f);
theNeuronArray.Fire(); //should transfer current chargest to last
float a = theNeuronArray.GetNeuronLastCharge(1);
float b = theNeuronArray.GetNeuronLastCharge(2);
float a = theNeuronArray.GetNeuronLastCharge获取神经元上一次的脉冲(1);
float b = theNeuronArray.GetNeuronLastCharge获取神经元上一次的脉冲(2);

string s0 = theNeuronArray.获取神经元标签(1);
theNeuronArray.设置神经元标签(1, "Fred");
Expand Down Expand Up @@ -83,7 +83,7 @@ private void Button_Click(object sender, RoutedEventArgs e)
}
});
for (int i = 0; i < neuronCount / 100; i++)
theNeuronArray.SetNeuronCurrentCharge(100 * i, 1);
theNeuronArray.SetNeuronCurrentCharge设置神经元当前的脉冲(100 * i, 1);
MessageBox.Show("突触和充电完成");
Stopwatch sw = new Stopwatch();
string msg = "";
Expand Down
4 changes: 2 additions & 2 deletions CSEngineTest/XmlFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ public static bool Load(ref NeuronHandler theNeuronArray, string fileName)
if (n != null)
{
int id = n.Id;
theNeuronArray.SetNeuronCurrentCharge(id, n.CurrentCharge);
theNeuronArray.SetNeuronCurrentCharge设置神经元当前的脉冲(id, n.CurrentCharge);
if (n.Label != "")
theNeuronArray.设置神经元标签(id, n.Label);
if (n.LeakRate != 0.1f)
theNeuronArray.SetNeuronLeakRate(id, n.LeakRate);
theNeuronArray.SetNeuronLeakRate设置神经元释放率(id, n.LeakRate);
if (n.Model != modelType.Std)
theNeuronArray.设置神经元模型(id, (int)n.Model);
foreach (S s in n.Synapses)
Expand Down
110 changes: 55 additions & 55 deletions NeuronEngineWrapper/神经元引擎包装器.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,120 +19,120 @@ namespace NeuronEngine
}
��Ԫ�б�Base::~��Ԫ�б�Base()
{
delete theNeuronArray;
delete theNeuronArray����Ԫ�б�;
}
void ��Ԫ�б�Base::Initialize(int neuronCount)
void ��Ԫ�б�Base::Initialize(int ��Ԫ����)
{
if (theNeuronArray != NULL)
delete theNeuronArray;
theNeuronArray = new NeuronEngine::��Ԫ�б�Base();
theNeuronArray->Initialize(neuronCount);
if (theNeuronArray����Ԫ�б� != NULL)
delete theNeuronArray����Ԫ�б�;
theNeuronArray����Ԫ�б� = new NeuronEngine::��Ԫ�б�Base();
theNeuronArray����Ԫ�б�->Initialize(��Ԫ����);
}
void ��Ԫ�б�Base::Fire()
{
theNeuronArray->Fire();
theNeuronArray����Ԫ�б�->Fire();
}
int ��Ԫ�б�Base::��ȡ�����С()
{
return theNeuronArray->��ȡ�����С();
return theNeuronArray����Ԫ�б�->��ȡ�����С();
}
long long ��Ԫ�б�Base::��ȡ�δ�()
{
return theNeuronArray->��ȡ�δ�();
return theNeuronArray����Ԫ�б�->��ȡ�δ�();
}
void ��Ԫ�б�Base::���ôδ�(long long i)
{
theNeuronArray->���ôδ�(i);
theNeuronArray����Ԫ�б�->���ôδ�(i);
}
int ��Ԫ�б�Base::��ȡ�������Ԫ����()
{
return theNeuronArray->��ȡ��������();
return theNeuronArray����Ԫ�б�->��ȡ��������();
}
void ��Ԫ�б�Base::�����߳�����(int theCount)
{
theNeuronArray->�����߳�����(theCount);
theNeuronArray����Ԫ�б�->�����߳�����(theCount);
}
int ��Ԫ�б�Base::��ȡ�߳���()
{
return theNeuronArray->��ȡ�߳�����();
return theNeuronArray����Ԫ�б�->��ȡ�߳�����();
}
void ��Ԫ�б�Base::SetRefractoryDelay(int i)
{
theNeuronArray->SetRefractoryDelay(i);
theNeuronArray����Ԫ�б�->SetRefractoryDelay(i);
}
int ��Ԫ�б�Base::GetRefractoryDelay()
int ��Ԫ�б�Base::GetRefractoryDelay��ȡ�ͻ�����ӳ�()
{
return theNeuronArray->GetRefractoryDelay();
return theNeuronArray����Ԫ�б�->GetRefractoryDelay();
}
float ��Ԫ�б�Base::GetNeuronLastCharge(int i)
float ��Ԫ�б�Base::GetNeuronLastCharge��ȡ��Ԫ��һ�ε�����(int i)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
return n->GetLastCharge();
}
void ��Ԫ�б�Base::SetNeuronLastCharge(int i, float value)
void ��Ԫ�б�Base::SetNeuronLastCharge������Ԫ��һ�ε�����(int i, float value)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
n->SetLastCharge(value);
}
void ��Ԫ�б�Base::SetNeuronCurrentCharge(int i, float value)
void ��Ԫ�б�Base::SetNeuronCurrentCharge������Ԫ��ǰ������(int i, float value)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
n->SetCurrentCharge(value);
}
void ��Ԫ�б�Base::AddToNeuronCurrentCharge(int i, float value)
void ��Ԫ�б�Base::AddToNeuronCurrentCharge������Ԫ��ǰ������(int i, float value)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
n->AddToCurrentValue(value);
}
float ��Ԫ�б�Base::GetNeuronLeakRate(int i)
float ��Ԫ�б�Base::GetNeuronLeakRate��ȡ��Ԫ�ͷ���(int i)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
return n->��ȡй¶��();
}
void ��Ԫ�б�Base::SetNeuronLeakRate(int i, float value)
void ��Ԫ�б�Base::SetNeuronLeakRate������Ԫ�ͷ���(int i, float value)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
n->������(value);
}
int ��Ԫ�б�Base::GetNeuronAxonDelay(int i)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
return n->GetAxonDelay();
}
void ��Ԫ�б�Base::SetNeuronAxonDelay(int i, int value)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
n->SetAxonDelay(value);
}
long long ��Ԫ�б�Base::GetNeuronLastFired(int i)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
return n->GetLastFired();
}
int ��Ԫ�б�Base::��ȡ��Ԫģ��(int i)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
return (int)n->��ȡģ��();
}
void ��Ԫ�б�Base::������Ԫģ��(int i, int model)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
n->����ģ��((��ԪBase::modelType) model);
}
bool ��Ԫ�б�Base::��ȡ��Ԫ�Ƿ�ʹ����(int i)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(i);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i);
return n->GetInUse();
}
void ��Ԫ�б�Base::������Ԫ��ǩ(int i, String^ newLabel)
{
const wchar_t* chars = (const wchar_t*)(Marshal::StringToHGlobalAuto(newLabel)).ToPointer();
theNeuronArray->��ȡ��Ԫ(i)->���ñ�ǩ(chars);
theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i)->���ñ�ǩ(chars);
Marshal::FreeHGlobal(IntPtr((void*)chars));
}
String^ ��Ԫ�б�Base::��ȡ��Ԫ��ǩ(int i)
{
wchar_t* labelChars = theNeuronArray->��ȡ��Ԫ(i)->��ȡ��ǩ();
wchar_t* labelChars = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(i)->��ȡ��ǩ();
if (labelChars != NULL)
{
std::wstring label(labelChars);
Expand All @@ -145,74 +145,74 @@ namespace NeuronEngine
return str;
}
}
String^ ��Ԫ�б�Base::GetRemoteFiring()
String^ ��Ԫ�б�Base::GetRemoteFiring��ȡԶ�̼���()
{
std::string remoteFiring = theNeuronArray->GetRemoteFiringString();
std::string remoteFiring = theNeuronArray����Ԫ�б�->GetRemoteFiringString();
String^ str = gcnew String(remoteFiring.c_str());
return str;
}
cli::array<byte>^ ��Ԫ�б�Base::GetRemoteFiringSynapses()
cli::array<byte>^ ��Ԫ�б�Base::GetRemoteFiringSynapses��ȡԶ�̼���ͻ��()
{
std::vector<ͻ��Base> tempVec;
ͻ��Base s1 = theNeuronArray->GetRemoteFiringSynapse();
ͻ��Base s1 = theNeuronArray����Ԫ�б�->GetRemoteFiringSynapse();
while (s1.��ȡĿ����Ԫ() != NULL)
{
tempVec.push_back(s1);
s1 = theNeuronArray->GetRemoteFiringSynapse();
s1 = theNeuronArray����Ԫ�б�->GetRemoteFiringSynapse();
}
return ReturnArray(tempVec);
}

void ��Ԫ�б�Base::����ͻ��(int src, int dest, float weight, int model, bool noBackPtr)
{
if (src < 0)return;
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(src);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(src);
if (dest < 0)
n->����ͻ��((��ԪBase*)(long long)dest, weight, (ͻ��Base::modelType) model, noBackPtr);
else
n->����ͻ��(theNeuronArray->��ȡ��Ԫ(dest), weight, (ͻ��Base::modelType)model, noBackPtr);
n->����ͻ��(theNeuronArray����Ԫ�б�->��ȡ��Ԫ(dest), weight, (ͻ��Base::modelType)model, noBackPtr);
}
void ��Ԫ�б�Base::��������ͻ��(int src, int dest, float weight, int model)
{
if (dest < 0)return;
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(dest);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(dest);
if (src < 0)
n->AddSynapseFrom((��ԪBase*)(long long)src, weight, (ͻ��Base::modelType)model);
else
n->AddSynapseFrom(theNeuronArray->��ȡ��Ԫ(src), weight, (ͻ��Base::modelType)model);
n->AddSynapseFrom(theNeuronArray����Ԫ�б�->��ȡ��Ԫ(src), weight, (ͻ��Base::modelType)model);
}
void ��Ԫ�б�Base::ɾ��ͻ��(int src, int dest)
{
if (src < 0) return;
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(src);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(src);
if (dest < 0)
n->ɾ��ͻ��((��ԪBase*)(long long)dest);
else
n->ɾ��ͻ��(theNeuronArray->��ȡ��Ԫ(dest));
n->ɾ��ͻ��(theNeuronArray����Ԫ�б�->��ȡ��Ԫ(dest));
}
void ��Ԫ�б�Base::ɾ������ͻ��(int src, int dest)
{
if (dest < 0)return;
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(dest);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(dest);
if (src < 0)
n->ɾ��ͻ��((��ԪBase*)(long long)src);
else
n->ɾ��ͻ��(theNeuronArray->��ȡ��Ԫ(src));
n->ɾ��ͻ��(theNeuronArray����Ԫ�б�->��ȡ��Ԫ(src));
}


cli::array<byte>^ ��Ԫ�б�Base::��ȡͻ������(int src)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(src);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(src);
n->GetLock();
std::vector<ͻ��Base> tempVec = n->��ȡͻ������();
n->ClearLock();
return ReturnArray(tempVec);

}
cli::array<byte>^ ��Ԫ�б�Base::GetSynapsesFrom(int src)
cli::array<byte>^ ��Ԫ�б�Base::GetSynapsesFrom��ȡͻ��Դ(int src)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(src);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(src);
n->GetLock();
std::vector<ͻ��Base> tempVec = n->GetSynapsesFrom();
n->ClearLock();
Expand Down Expand Up @@ -257,7 +257,7 @@ namespace NeuronEngine
};
cli::array<byte>^ ��Ԫ�б�Base::��ȡ��Ԫ(int src)
{
��ԪBase* n = theNeuronArray->��ȡ��Ԫ(src);
��ԪBase* n = theNeuronArray����Ԫ�б�->��ȡ��Ԫ(src);
const int byteCount = sizeof(Neuron);
cli::array<byte>^ tempArr = gcnew cli::array<byte>(byteCount);
Neuron n1;
Expand All @@ -279,11 +279,11 @@ namespace NeuronEngine
}
long long ��Ԫ�б�Base::��ȡ��ͻ����()
{
return theNeuronArray->GetTotalSynapseCount();
return theNeuronArray����Ԫ�б�->GetTotalSynapseCount();
}
long ��Ԫ�б�Base::��ȡʹ���е���Ԫ����()
{
return theNeuronArray->��ȡʹ������Ԫ����();
return theNeuronArray����Ԫ�б�->��ȡʹ������Ԫ����();
}
}
}
Loading