Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto committed Nov 25, 2024
1 parent ab988a0 commit b074232
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 23 deletions.
3 changes: 2 additions & 1 deletion Crystallography.Controls/Crystal/PoleFigureControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

Expand Down Expand Up @@ -286,7 +287,7 @@ public void DrawOutline(Graphics g)
private int justBeforeCrystallineNumber = -1;
private IEnumerable<(int Radial, int Sector)>[] Index;

public object lockObject = new object();
public Lock lockObject = new();

public double[][] generateDensityArrayNormal(double angleResolution)
{
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.Controls/Crystallography.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.11.25.0714</AssemblyVersion>
<FileVersion>2024.11.25.0714</FileVersion>
<AssemblyVersion>2024.11.25.0723</AssemblyVersion>
<FileVersion>2024.11.25.0723</FileVersion>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
<ApplicationVisualStyles>true</ApplicationVisualStyles>
Expand Down
3 changes: 2 additions & 1 deletion Crystallography.Controls/DataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Drawing;
using System.Linq;
using System.Numerics;
using System.Threading;

namespace Crystallography.Controls;

Expand Down Expand Up @@ -258,7 +259,7 @@ public void Replace(object srcCrystal, Crystal2 targetcrystal)
}
}

readonly object lockObj = new();
readonly Lock lockObj = new();
public DataTableCrystalDatabaseRow CreateRow(Crystal2 c)
{
DataTableCrystalDatabaseRow dr;
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.OpenGL/Crystallography.OpenGL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.11.25.0714</AssemblyVersion>
<FileVersion>2024.11.25.0714</FileVersion>
<AssemblyVersion>2024.11.25.0723</AssemblyVersion>
<FileVersion>2024.11.25.0723</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion Crystallography.OpenGL/GLObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using PT = OpenTK.Graphics.OpenGL4.PrimitiveType;
using MathNet.Numerics.Distributions;
using static System.Windows.Forms.DataFormats;
using System.Threading;
#endregion 定義

namespace Crystallography.OpenGL;
Expand Down Expand Up @@ -149,7 +150,7 @@ abstract public class GLObject
private static readonly int sizeOfUInt = sizeof(uint);
private static readonly List<(string Product, string Version)> GraphicsInfo;
private static int serialNumber = 0;
public static readonly object LockObj = new();
public static readonly Lock LockObj = new();

public static float LineWidthStatic = 1f;

Expand Down
3 changes: 2 additions & 1 deletion Crystallography/ChemicalStandard.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace Crystallography
{
Expand Down Expand Up @@ -679,7 +680,7 @@ public static double ChontinuousFluorescenceFactor(Element[] elements, int index
return c * elements[index].MolarWeight * zAve * EcA * mu_rhoAAe / mu_rhoUnkAe * gammaMinusOnePerGamma * Math.Log(1 + g * U0A) / g / U0A;
}

private static object lockObJforBetaArray = new object();
private static Lock lockObJforBetaArray = new Lock();

/// <summary>
/// betaの値を保管する一時変数.
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Crystallography.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.11.25.0714</AssemblyVersion>
<FileVersion>2024.11.25.0714</FileVersion>
<AssemblyVersion>2024.11.25.0723</AssemblyVersion>
<FileVersion>2024.11.25.0723</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion Crystallography/Detector/Ring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Crystallography;
Expand Down Expand Up @@ -144,7 +145,7 @@ public static class Ring
public enum Rotation { Clockwise, Counterclockwise }
public enum Direction { Right, Left, Top, Bottom }

private static readonly object lockObj = new();
private static readonly Lock lockObj = new();


public enum ImageTypeEnum
Expand Down
3 changes: 2 additions & 1 deletion Crystallography/Images/ImageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;

namespace Crystallography;
Expand Down Expand Up @@ -218,7 +219,7 @@ unsafe static public double[] DustAndScratches(double[] pixels, int width, doubl
return results;
}

private static readonly object lockObj = new object();
private static readonly Lock lockObj = new Lock();

/// <summary>
/// 画像中から、スポットを検出する。戻り値はList<Vector3DBase>. X, Y: スポットのピクセル上の位置, Int: 強度
Expand Down
3 changes: 2 additions & 1 deletion Crystallography/Mathematics/Statistics.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Crystallography;
Expand Down Expand Up @@ -273,7 +274,7 @@ public static double SigmaProduct(double[] values1, double[] values2)
}


public static object lockObject = new();
public static Lock lockObject = new();

/// <summary>
/// 平均mu, 標準偏差sigmaの正規分布乱数を得る。Box-Muller法による。
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Matrix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,11 @@ public static Matrix3D RotZ(double theta)

public static Matrix3D GenerateRamdomRotationMatrix(int seed) => GenerateRamdomRotationMatrix(new Random(seed));

private static readonly Lock o = new();
private static readonly Lock lockObj = new();
public static Matrix3D GenerateRamdomRotationMatrix(Random rn)
{
double rn1, rn2, rn3;
lock (o)
lock (lockObj)
{
rn1 = rn.NextDouble();
rn2 = rn.NextDouble();
Expand Down
3 changes: 2 additions & 1 deletion ReciPro/FormTrajectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using V3 = OpenTK.Vector3d;
Expand All @@ -22,7 +23,7 @@ public partial class FormTrajectory : Form

private GLControlAlpha glControlTrajectory;

private object lockObj = new();
private readonly Lock lockObj = new();

(V3 p, double e)[][] Trajectories = [];
private double EnergyThreshold = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Serialization;
Expand Down Expand Up @@ -378,7 +379,7 @@ private void graphControlFrequency_LinePositionChanged()

//private delegate SortedList<uint, int> calcFreqDelegate(int start, int end);

private object lockObj = new object();
private readonly Lock lockObj = new();

/// <summary>
/// Frequencyを計算
Expand Down
4 changes: 2 additions & 2 deletions ReciPro/ReciPro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.11.25.0714</AssemblyVersion>
<FileVersion>2024.11.25.0714</FileVersion>
<AssemblyVersion>2024.11.25.0723</AssemblyVersion>
<FileVersion>2024.11.25.0723</FileVersion>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<ApplicationIcon>App.ico</ApplicationIcon>
Expand Down
3 changes: 2 additions & 1 deletion ReciPro/SpotID/FormSpotIDV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using MQ = Crystallography.Marquardt;
Expand Down Expand Up @@ -49,7 +50,7 @@ public double PixelSize

public double FittingRange => numericBoxFittingRange.Value;

private readonly object lockObj = new object();
private readonly Lock lockObj = new();

private readonly Stopwatch sw = new Stopwatch();

Expand Down
6 changes: 3 additions & 3 deletions ReciPro/StructureViewer/FormStructureViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public partial class FormStructureViewer : Form
public List<GLObject> GLObjects = [];
private readonly ParallelQuery<GLObject> GLObjectsP;

public readonly object lockObj1 = new();
public readonly object lockObj2 = new();
public readonly object lockObj3 = new();
public readonly Lock lockObj1 = new();
public readonly Lock lockObj2 = new();
public readonly Lock lockObj3 = new();


private bool skipSetCrystal = false;
Expand Down

0 comments on commit b074232

Please sign in to comment.