Skip to content

Commit

Permalink
Daily Update
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwillow committed Jul 11, 2021
1 parent 1c6b55e commit 9ac29c4
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 40 deletions.
Binary file not shown.
1 change: 1 addition & 0 deletions Common/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ std::vector<double> StrSliceToDoubleVector(String s)
{
String word;
ss >> word;
if (word.empty()) break;
ret.emplace_back(std::stod(word));
}
return ret;
Expand Down
29 changes: 5 additions & 24 deletions Linkage Mechanism Laboratory.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Linkage Mechanism Laboratory", "Linkage Mechanism Laboratory.vcxproj", "{265569DC-34A0-49B3-9BE3-5133199DB24D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EquationsSolver", "..\..\EquationsSolver\EquationsSolver.vcxproj", "{766594B9-B7B4-4827-9C6B-A11240060D1A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -43,28 +41,11 @@ Global
{265569DC-34A0-49B3-9BE3-5133199DB24D}.TEACHER Release|Mixed Platforms.Build.0 = TEACHER Release|Win32
{265569DC-34A0-49B3-9BE3-5133199DB24D}.TEACHER Release|Win32.ActiveCfg = TEACHER Release|Win32
{265569DC-34A0-49B3-9BE3-5133199DB24D}.TEACHER Release|Win32.Build.0 = TEACHER Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Debug|Any CPU.ActiveCfg = Debug|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Debug|Win32.ActiveCfg = Debug|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Debug|Win32.Build.0 = Debug|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Release|Any CPU.ActiveCfg = Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Release|Mixed Platforms.Build.0 = Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Release|Win32.ActiveCfg = Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.Release|Win32.Build.0 = Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.STUDENT Release|Any CPU.ActiveCfg = STUDENT Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.STUDENT Release|Mixed Platforms.ActiveCfg = STUDENT Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.STUDENT Release|Mixed Platforms.Build.0 = STUDENT Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.STUDENT Release|Win32.ActiveCfg = STUDENT Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.STUDENT Release|Win32.Build.0 = STUDENT Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.TEACHER Release|Any CPU.ActiveCfg = TEACHER Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.TEACHER Release|Mixed Platforms.ActiveCfg = TEACHER Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.TEACHER Release|Mixed Platforms.Build.0 = TEACHER Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.TEACHER Release|Win32.ActiveCfg = TEACHER Release|Win32
{766594B9-B7B4-4827-9C6B-A11240060D1A}.TEACHER Release|Win32.Build.0 = TEACHER Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E78CE7E4-0ED0-4848-9042-023683557E19}
EndGlobalSection
EndGlobal
9 changes: 5 additions & 4 deletions Linkage Mechanism Laboratory.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,36 @@
<ProjectGuid>{265569DC-34A0-49B3-9BE3-5133199DB24D}</ProjectGuid>
<RootNamespace>LinkageMechanismLaboratory</RootNamespace>
<ProjectName>Linkage Mechanism Laboratory</ProjectName>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='STUDENT Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='TEACHER Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
11 changes: 9 additions & 2 deletions Solver/TEquations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include "..\Common\String.h"
#include "TEquations.h"

#include "..\Common\TTransfer.h"

TEquations::TEquations()
{
VariableTableUnsolved.bShared = true;
Expand Down Expand Up @@ -991,4 +989,13 @@ void TEquations::SolveEquations(Ostream *pOS)
VariableTableSolved.OutputValue(pOS);
*pOS << TEXT("\r\n");
}
}

double TEquations::GetValue(const String &var)
{
auto it = VariableTable.FindVariableTable(var);
if (it == VariableTable.VariableTable.end())
throw TError{ ERROR_UNDEFINED_VARIABLE, var };

return VariableTable.VariableValue[it - VariableTable.VariableTable.begin()];
}
1 change: 1 addition & 0 deletions Solver/TEquations.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class TEquations
void TEquations::Subs(Ostream *pOS,const std::vector<String> &subsVars,const std::vector<double> &subsValue);//代入
void TEquations::SubsV(Ostream *pOS, String VarStr, double Value);
void TEquations::SubsA(Ostream *pOS, String VarStr, double Value);
double TEquations::GetValue(const String &var);
void TEquations::CalcJacobianMultiplyVector(TPEquations &EquationsResult, const TJacobian &Jacobian, const TVector &Vector);

};
Expand Down
13 changes: 9 additions & 4 deletions Solver/TExpressionTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
#include "..\Common\DetectMemoryLeak.h"

#include "..\Solver\TExpressionTree.h"
#include "..\Common\TTransfer.h"
#include "..\Common\TCHAR_Function.h"


#include <string>
#include <Windows.h>
#define _USE_MATH_DEFINES
#include <math.h>


using namespace std;

TExpressionTree::TExpressionTree()
{
Expand Down Expand Up @@ -1478,6 +1475,7 @@ void TExpressionTree::Diff(TNode *now, String var)
}

case MATH_SIN:
{
TNode *multiply = new TNode;
ZeroMemory(multiply, sizeof(TNode));
multiply->eType = NODE_OPERATOR;
Expand Down Expand Up @@ -1536,6 +1534,13 @@ void TExpressionTree::Diff(TNode *now, String var)
Diff(u2, var);
return;
}
//case MATH_ARCTAN:
//{
// TNode *multiply = new TNode()
//}
default:
throw TError(ERROR_WRONG_MATH_OPERATOR, String(TEXT("未完成的运算符")) + Function2Str(now->eOperator));
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion Solver/TExpressionTree.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "..\Common\tchar_head.h"
#include <queue>
#include <stack>
#include "..\Solver\TVariableTable.h"
Expand Down
8 changes: 5 additions & 3 deletions Solver/TVariableTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include "..\Common\DetectMemoryLeak.h"
#include "..\Common\String.h"
#include "..\Solver\TVariableTable.h"
#include "..\Common\TCHAR_Function.h"
#include "..\Common\TTransfer.h"

#include <algorithm>
#include <iostream>
Expand Down Expand Up @@ -132,7 +130,11 @@ void TVariableTable::Define(Ostream *pStr, String input_str, String input_num, b
//切分str,new出每个新变量

std::vector<String> tempVar = StrSliceToVector(input_str);
std::vector<double> tempValue = StrSliceToDoubleVector(input_num);
std::vector<double> tempValue;
if (input_num.empty())
tempValue = std::vector<double>(tempVar.size());
else
tempValue = StrSliceToDoubleVector(input_num);

if (tempVar.size() != tempValue.size())
{
Expand Down
1 change: 0 additions & 1 deletion Solver/TVariableTable.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#include "..\Common\tchar_head.h"
#include <vector>
#include <map>

Expand Down
2 changes: 1 addition & 1 deletion TConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TConfiguration

POINT Org;
double dProportion = 1.0;
int iStyle = PS_SOLID;
UINT iStyle = PS_SOLID;
int iWidth = 1;
COLORREF PrevRandomColor;
std::vector<COLORREF> vecColorLib;
Expand Down

0 comments on commit 9ac29c4

Please sign in to comment.