forked from calculix/Cubit-CalculiX
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ae46ef
commit 8e3e2d8
Showing
18 changed files
with
386 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include "ccxConstraintEquationCreateCommand.hpp" | ||
#include "CubitInterface.hpp" | ||
#include "CubitMessage.hpp" | ||
#include "CalculiXCoreInterface.hpp" | ||
|
||
ccxConstraintEquationCreateCommand::ccxConstraintEquationCreateCommand() | ||
{} | ||
|
||
ccxConstraintEquationCreateCommand::~ccxConstraintEquationCreateCommand() | ||
{} | ||
|
||
std::vector<std::string> ccxConstraintEquationCreateCommand::get_syntax() | ||
{ | ||
std::vector<std::string> syntax_list; | ||
|
||
std::string syntax = "ccx "; | ||
syntax.append("create constraint equation "); | ||
syntax.append("name <string:type='unquoted', number='1', label='name', help='<name>'> " ); | ||
syntax.append("node_dof_coefficient <value:label='node_dof_coefficient',help='<node_dof_coefficient>'>..." ); | ||
syntax_list.push_back(syntax); | ||
|
||
return syntax_list; | ||
} | ||
|
||
std::vector<std::string> ccxConstraintEquationCreateCommand::get_syntax_help() | ||
{ | ||
std::vector<std::string> help(5); | ||
help[0] = "ccx create constraint equation name <name> node_dof_coefficient <node_dof_coefficient>..."; | ||
|
||
return help; | ||
} | ||
|
||
std::vector<std::string> ccxConstraintEquationCreateCommand::get_help() | ||
{ | ||
std::vector<std::string> help; | ||
return help; | ||
} | ||
|
||
bool ccxConstraintEquationCreateCommand::execute(CubitCommandData &data) | ||
{ | ||
|
||
CalculiXCoreInterface ccx_iface; | ||
|
||
std::string output; | ||
|
||
std::string name; | ||
std::vector<std::string> options; | ||
std::vector<std::vector<double>> options2; | ||
std::vector<double> node_dof_coefficient; | ||
|
||
data.get_string("name", name); | ||
data.get_values("node_dof_coefficient", node_dof_coefficient); | ||
|
||
options.push_back(name); | ||
|
||
if (node_dof_coefficient.size() % 3 != 0) | ||
{ | ||
output = "Failed! node_dof_coefficient must be 3 numbers per node!\n"; | ||
PRINT_ERROR(output.c_str()); | ||
return false; | ||
} | ||
|
||
for (size_t i = 0; i < int(node_dof_coefficient.size()/3); i++) | ||
{ | ||
options2.push_back({node_dof_coefficient[i*3+0],node_dof_coefficient[i*3+1],node_dof_coefficient[i*3+2]}); | ||
} | ||
|
||
if (!ccx_iface.create_constraint("EQUATION",options,options2)) | ||
{ | ||
output = "Failed!\n"; | ||
PRINT_ERROR(output.c_str()); | ||
} | ||
options.clear(); | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef CCXCONSTRAINTEQUATIONCREATECOMMAND_HPP | ||
#define CCXCONSTRAINTEQUATIONCREATECOMMAND_HPP | ||
|
||
#include "CubitCommandInterface.hpp" | ||
|
||
/*! | ||
* \brief The Constraint create command lets you create your desired constraints | ||
*/ | ||
class ccxConstraintEquationCreateCommand : public CubitCommand | ||
{ | ||
public: | ||
ccxConstraintEquationCreateCommand(); | ||
~ccxConstraintEquationCreateCommand(); | ||
|
||
std::vector<std::string> get_syntax(); | ||
std::vector<std::string> get_syntax_help(); | ||
std::vector<std::string> get_help(); | ||
bool execute(CubitCommandData &data); | ||
}; | ||
|
||
#endif // CCXCONSTRAINTEQUATIONCREATECOMMAND_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#include "ccxConstraintEquationModifyCommand.hpp" | ||
#include "CubitInterface.hpp" | ||
#include "CubitMessage.hpp" | ||
#include "CalculiXCoreInterface.hpp" | ||
|
||
ccxConstraintEquationModifyCommand::ccxConstraintEquationModifyCommand() | ||
{} | ||
|
||
ccxConstraintEquationModifyCommand::~ccxConstraintEquationModifyCommand() | ||
{} | ||
|
||
std::vector<std::string> ccxConstraintEquationModifyCommand::get_syntax() | ||
{ | ||
std::vector<std::string> syntax_list; | ||
|
||
std::string syntax = "ccx "; | ||
syntax.append("modify constraint equation <value:label='constraint id',help='<constraint id>'> "); | ||
syntax.append("[name <string:type='unquoted', number='1', label='name', help='<name>'>] " ); | ||
syntax.append("[node_dof_coefficient <value:label='node_dof_coefficient',help='<node_dof_coefficient>'>...]" ); | ||
syntax_list.push_back(syntax); | ||
|
||
return syntax_list; | ||
} | ||
|
||
std::vector<std::string> ccxConstraintEquationModifyCommand::get_syntax_help() | ||
{ | ||
std::vector<std::string> help(5); | ||
help[0] = "ccx modify constraint equation <constraint id> [name <name>] [node_dof_coefficient <node_dof_coefficient>...]"; | ||
|
||
return help; | ||
} | ||
|
||
std::vector<std::string> ccxConstraintEquationModifyCommand::get_help() | ||
{ | ||
std::vector<std::string> help; | ||
return help; | ||
} | ||
|
||
bool ccxConstraintEquationModifyCommand::execute(CubitCommandData &data) | ||
{ | ||
|
||
CalculiXCoreInterface ccx_iface; | ||
|
||
std::string output; | ||
|
||
std::string name; | ||
std::vector<std::string> options; | ||
std::vector<std::vector<double>> options2; | ||
std::vector<int> options_marker; | ||
std::vector<double> node_dof_coefficient; | ||
int constraint_id; | ||
|
||
data.get_value("constraint id", constraint_id); | ||
|
||
if (!data.get_string("name", name)) | ||
{ | ||
name = ""; | ||
options_marker.push_back(0); | ||
} | ||
else | ||
{ | ||
options_marker.push_back(1); | ||
} | ||
options.push_back(name); | ||
|
||
data.get_values("node_dof_coefficient", node_dof_coefficient); | ||
|
||
if (node_dof_coefficient.size() % 3 != 0) | ||
{ | ||
output = "Failed! node_dof_coefficient must be 3 numbers per node!\n"; | ||
PRINT_ERROR(output.c_str()); | ||
return false; | ||
} | ||
|
||
for (size_t i = 0; i < int(node_dof_coefficient.size()/3); i++) | ||
{ | ||
options2.push_back({node_dof_coefficient[i*3+0],node_dof_coefficient[i*3+1],node_dof_coefficient[i*3+2]}); | ||
} | ||
|
||
if (!ccx_iface.modify_constraint("EQUATION",constraint_id,options,options_marker,options2)) | ||
{ | ||
output = "Failed with ID " + std::to_string(constraint_id) + "!\n"; | ||
PRINT_ERROR(output.c_str()); | ||
return false; | ||
} | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef CCXCONSTRAINTEQUATIONMODIFYCOMMAND_HPP | ||
#define CCXCONSTRAINTEQUATIONMODIFYCOMMAND_HPP | ||
|
||
#include "CubitCommandInterface.hpp" | ||
|
||
/*! | ||
* \brief The Constraint create command lets you modify your desired constraints | ||
*/ | ||
class ccxConstraintEquationModifyCommand : public CubitCommand | ||
{ | ||
public: | ||
ccxConstraintEquationModifyCommand(); | ||
~ccxConstraintEquationModifyCommand(); | ||
|
||
std::vector<std::string> get_syntax(); | ||
std::vector<std::string> get_syntax_help(); | ||
std::vector<std::string> get_help(); | ||
bool execute(CubitCommandData &data); | ||
}; | ||
|
||
#endif // CCXCONSTRAINTEQUATIONMODIFYCOMMAND_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.