Skip to content

Commit

Permalink
Merge pull request #151 from AliHaider93/Plan_devel_k-g
Browse files Browse the repository at this point in the history
distinction between command and option: this is a way to make a distinction between a command and it's options, and eventually this is a necessary code to handle all kinds of elements in LS-DYNA
  • Loading branch information
drossberg committed Aug 24, 2024
2 parents cf73468 + 179746c commit 9d8e10c
Show file tree
Hide file tree
Showing 8 changed files with 1,108 additions and 30 deletions.
2 changes: 2 additions & 0 deletions src/conv/k-g/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(k-g_SRCF
region_list.cpp
arbs.cpp
geometry.cpp
pipe.cpp
)
BRLCAD_ADDEXEC(k-g "${k-g_SRCF}" "libwdb;librt;libbu" FOLDER Conv)

Expand All @@ -15,6 +16,7 @@ set(k-g_ignore_files
region_list.h
arbs.h
geometry.h
pipe.h
)
CMAKEFILES(${k-g_ignore_files})

Expand Down
38 changes: 27 additions & 11 deletions src/conv/k-g/geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@
#include "geometry.h"


// Local Variables:
// tab-width: 8
// mode: C++
// c-basic-offset: 4
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8



void Geometry::setBaseName
Expand All @@ -47,6 +40,7 @@ void Geometry::setBaseName

m_bot.setName(name.c_str());
m_arbs.setName(name.c_str());
m_pipe.setName(name.c_str());
}

void Geometry::setThickness
Expand Down Expand Up @@ -82,6 +76,12 @@ void Geometry::addArb
}


void Geometry::addPipePnt(pipePoint point)
{
m_pipe.addPipePnt(point);
}


const char* Geometry::getBaseName(void) const{
return name.c_str();
}
Expand All @@ -95,15 +95,31 @@ Arbs& Geometry::getArbs(void) {
return m_arbs;
}

Pipe& Geometry::getPipe(void)
{
return m_pipe;
}


std::vector<std::string> Geometry::write
(
rt_wdb* wdbp
) {
std::vector<std::string> ret = m_bot.write(wdbp);
std::vector<std::string> arbNames = m_arbs.write(wdbp);
std::vector<std::string> ret = m_bot.write(wdbp);
std::vector<std::string> arbNames = m_arbs.write(wdbp);
std::vector<std::string> pipeName = m_pipe.write(wdbp);

ret.insert(ret.end(), arbNames.begin(), arbNames.end());

ret.insert(ret.end(), pipeName.begin(), pipeName.end());
return ret;
}


// Local Variables:
// tab-width: 8
// mode: C++
// c-basic-offset: 4
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8
8 changes: 6 additions & 2 deletions src/conv/k-g/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License along with this file; see the file named COPYING for more
* information.
*/
/** @file region_list.cpp
/** @file geometry.h
*
* LS Dyna keyword file to BRL-CAD converter:
* intermediate geometry structure implementation
Expand All @@ -29,6 +29,7 @@

#include "bot.h"
#include "arbs.h"
#include "pipe.h"


class Geometry {
Expand All @@ -48,16 +49,19 @@ class Geometry {
const point_t& point6,
const point_t& point7,
const point_t& point8);
void addPipePnt(pipePoint point);

const char* getBaseName(void) const;
Bot& getBot(void);
Arbs& getArbs(void);
Pipe& getPipe(void);

std::vector<std::string> write(rt_wdb* wdbp);
private:
std::string name;
Bot m_bot;
Arbs m_arbs;
Pipe m_pipe;
};


Expand All @@ -71,4 +75,4 @@ class Geometry {
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8
// ex: shiftwidth=4 tabstop=8
35 changes: 34 additions & 1 deletion src/conv/k-g/k-g.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "k_parser.h"
#include "region_list.h"
#include "pipe.h"


static void AddArb(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8,KData& kData, std::string arbNumber, Geometry& geometry) {
Expand Down Expand Up @@ -136,7 +137,39 @@ int main
std::cout << "Missing section to part" << partName.c_str() << '\n';

for (std::set<int>::iterator itr = (it->second).elements.begin(); itr != (it->second).elements.end(); itr++) {
if (kData.elements[*itr].nodes.size() == 4) {
if ((kData.elements[*itr].nodes.size() == 3)) {
//int n3 = kData.elements[*itr].nodes[2];
if (section > 0) {
KSectionBeam beamSection = kData.sectionsBeam[section];

if (beamSection.CST == 1) {
pipePoint point1;
pipePoint point2;


int n1 = kData.elements[*itr].nodes[0];
int n2 = kData.elements[*itr].nodes[1];
//int n3 = kData.elements[*itr].nodes[2];
point1.coords[X] = kData.nodes[n1].x * factor;
point1.coords[Y] = kData.nodes[n1].y * factor;
point1.coords[Z] = kData.nodes[n1].z * factor;
point1.outerDiameter = beamSection.TS1;
point1.innerDiameter = beamSection.TT1;

point2.coords[X] = kData.nodes[n2].x * factor;
point2.coords[Y] = kData.nodes[n2].y * factor;
point2.coords[Z] = kData.nodes[n2].z * factor;
point2.outerDiameter = beamSection.TS2;
point2.innerDiameter = beamSection.TT2;

std::string beamNumber = std::to_string(*itr);

geometry.addPipePnt(point1);
geometry.addPipePnt(point2);
}
}
}
else if (kData.elements[*itr].nodes.size() == 4) {

point_t point1;
point_t point2;
Expand Down
Loading

0 comments on commit 9d8e10c

Please sign in to comment.